00001
00009
00010 #include <cassert>
00011 #include <cmath>
00012
00013 #include "MessageService/MsgService.h"
00014 #include "RecoBase/CandStripHandle.h"
00015 #include "RecoBase/CandTrackHandle.h"
00016 #include "UgliGeometry/UgliScintPlnHandle.h"
00017 #include "UgliGeometry/UgliSteelPlnHandle.h"
00018
00019 #include "CandFitTrackSA/ConstFT.h"
00020 #include "CandFitTrackSA/GeometryHelper.h"
00021 #include "CandFitTrackSA/TrackContext.h"
00022 #include "CandFitTrackSA/TracerSA.h"
00023
00024 CVSID("$Id: GeometryHelper.cxx,v 1.4 2007/02/06 16:32:29 avva Exp $");
00025
00026 using namespace ConstFT;
00027
00031 GeometryHelper::GeometryHelper(const VldContext& vldc) :
00032 fVldc(vldc), fUgh(vldc)
00033 {
00034 TracerSA trace("GeometryHelper::GeometryHelper(const VldContext& vldc)");
00035 }
00036
00040 GeometryHelper::GeometryHelper(const TrackContext& tc) :
00041 fVldc(tc.GetVldContext()), fUgh(tc.GetVldContext())
00042 {
00043 TracerSA trace("GeometryHelper::GeometryHelper(const VldContext& vldc)");
00044 }
00045
00046
00050 Double_t GeometryHelper::GetZ(PlexPlaneId id)
00051 {
00052
00053
00054 if ( id.IsValid() ) {
00055 UgliScintPlnHandle usph = fUgh.GetScintPlnHandle(id);
00056 return usph.GetZ0();
00057 }
00058
00059
00060 id.SetIsSteel(kTRUE);
00061 if ( id.IsValid() ) {
00062 UgliSteelPlnHandle usph = fUgh.GetSteelPlnHandle(id);
00063 return usph.GetZ0();
00064 }
00065
00066
00067 assert(!"Neither scint, not steel are valid here");
00068 return 0.;
00069 }
00070
00077 Double_t GeometryHelper::GetZVtx(PlexPlaneId begin, Int_t idir)
00078 {
00079
00080
00081 PlexPlaneId prevSteel = begin.GetAdjoinSteel(-idir);
00082 if ( prevSteel.IsValid() ) {
00083
00084 UgliSteelPlnHandle usph = fUgh.GetSteelPlnHandle(prevSteel);
00085 return usph.GetZ0();
00086 } else {
00087
00088 return GetZ(begin) - idir*0.03;
00089 }
00090 }
00091
00095 Double_t GeometryHelper::GetX0(PlexPlaneId id)
00096 {
00097
00098 Double_t x0=0.;
00099
00100 if ( id.IsValid() ) {
00101 UgliScintPlnHandle uscph = fUgh.GetScintPlnHandle(id);
00102 x0 += 2.*uscph.GetHalfThickness()/X0_Scint;
00103 }
00104
00105 id.SetIsSteel(kTRUE);
00106 if ( id.IsValid() ) {
00107 UgliSteelPlnHandle ustph = fUgh.GetSteelPlnHandle(id);
00108 x0 += 2.*ustph.GetHalfThickness()/X0_Steel;
00109 }
00110 return x0;
00111 }
00112
00116 Double_t GeometryHelper::GetdZSteel(PlexPlaneId id)
00117 {
00118
00119 Double_t dZSteel=0.;
00120
00121
00122 id.SetIsSteel(kTRUE);
00123 if ( id.IsValid() ) {
00124 UgliSteelPlnHandle ustph = fUgh.GetSteelPlnHandle(id);
00125 dZSteel += 2.*ustph.GetHalfThickness();
00126 }
00127
00128 return dZSteel;
00129 }
00130
00134 Float_t GeometryHelper::GetRotationCorrectedTPos(const CandStripHandle* csh,
00135 const CandTrackHandle* cth)
00136 {
00137 Int_t plane = csh->GetPlane();
00138 Float_t lpos(0.);
00139
00140 if ( csh->GetPlaneView() == PlaneView::kU ) {
00141 lpos = cth->GetV(plane);
00142 } else if ( csh->GetPlaneView() == PlaneView::kV ) {
00143 lpos = cth->GetU(plane);
00144 }
00145
00146
00147 if ( fabs(lpos) > 5 ) {
00148 MSG("FitTrackSA", Msg::kDebug) << "lpos = " << lpos
00149 << " is either bad fit or hasn't been calculated, setting it to 0."
00150 << endl;
00151 lpos = 0.;
00152 }
00153
00154 UgliStripHandle ush = fUgh.GetStripHandle(csh->GetStripEndId());
00155 return ush.GetTPos(lpos);
00156 }
00157
00161 Float_t GeometryHelper::GetRotationCorrectedTPos(const Reco::Strip_t strip,
00162 const CandTrackHandle* cth)
00163 {
00164 Int_t plane = strip->GetPlane();
00165 Float_t lpos(0.);
00166
00167 if ( strip->GetPlaneView() == PlaneView::kU ) {
00168 lpos = cth->GetV(plane);
00169 } else if ( strip->GetPlaneView() == PlaneView::kV ) {
00170 lpos = cth->GetU(plane);
00171 }
00172
00173
00174 if ( fabs(lpos) > 5 ) {
00175 MSG("FitTrackSA", Msg::kDebug) << "lpos = " << lpos
00176 << " is either bad fit or hasn't been calculated, setting it to 0."
00177 << endl;
00178 lpos = 0.;
00179 }
00180
00181 UgliStripHandle ush = fUgh.GetStripHandle(strip->GetStripEndId());
00182 return ush.GetTPos(lpos);
00183 }
00184