00001 // -*- C++ -*- 00002 // 00003 // Package: MdcFastTrkAlg 00004 // Module: FTFinder 00005 // 00006 // Description: fast track finder class for MdcFastTrkAlg 00007 // 00008 // 00009 00010 #ifndef FTFinder_FLAG_ 00011 #define FTFinder_FLAG_ 00012 00013 00014 #include <iostream> 00015 00016 #include "MdcFastTrkAlg/FTList.h" 00017 #include "MdcFastTrkAlg/FTTrack.h" 00018 #include "MdcFastTrkAlg/FTWire.h" 00019 #include "MdcFastTrkAlg/FTLayer.h" 00020 #include "MdcFastTrkAlg/FTSuperLayer.h" 00021 #include "MdcFastTrkAlg/MdcParameter.h" 00022 #include "MdcFastTrkAlg/MdcFastTrkAlg.h" 00023 #include "HepPDT/ParticleDataTable.hh" 00024 #include "CLHEP/Vector/ThreeVector.h" 00025 #include "RawDataProviderSvc/IRawDataProviderSvc.h" 00026 #include "MagneticField/IMagneticFieldSvc.h" 00027 #include "MagneticField/MagneticFieldSvc.h" 00028 00029 #ifndef ENABLE_BACKWARDS_COMPATIBILITY 00030 typedef HepGeom::Point3D<double> HepPoint3D; 00031 #endif 00032 00033 using namespace CLHEP; 00034 00035 class CLHEP::Hep3Vector; 00036 //class MdcParameter; 00037 class FTSegment; 00038 class BesEvent; 00039 class StatusCode; 00040 00041 class FTFinder{ 00042 00043 public: 00045 //static FTFinder * GetPointer(void); 00046 00047 void setAlgorithmPointer(Algorithm*); 00048 public: 00050 FTFinder(); 00051 00053 void init(); 00054 00056 void term(); 00057 00059 void begin_run(); 00060 00062 void event(); 00063 00064 public: // Selectors 00065 00067 FTSuperLayer * superLayer(int id) const; 00068 00070 FTList<FTTrack *> & tracks(void) const; 00071 00073 CLHEP::Hep3Vector vertex(void) const; 00074 00076 int getWireId(FTWire *) const; 00077 00079 float t2x(const FTLayer& l, const float t) const; 00080 00082 float x2t(const FTLayer& l, const float x) const; 00083 00085 void setBunchtime(double bunchtime){_bunchtime=bunchtime;}; 00087 void setT0cal(double t0cal) {_t0cal=t0cal;}; 00088 00089 private: // private member functions 00090 Algorithm * m_algorithm; 00091 00093 void clear(void); 00094 00096 int updateMdc(void); 00097 00099 int getTestime(void); 00100 00102 void mkTrackList(void); 00103 00105 void mkTrack3D(void); 00106 00108 int VertexFit(int z_flag); 00109 00111 int VertexFit2D(); 00112 00114 int findBestVertex(void); 00115 00117 int CorrectEvtTiming(void); 00118 00120 FTTrack * linkAxialSegments(FTSegment ** inner, FTSegment ** outer); 00121 00122 // link 2,3,4 axial segments 00123 void linkAxialSuperLayer234(FTList<FTSegment *> & inner_segments); 00124 00125 // link 9,10 axial segments 00126 void linkAxialSuperLayer910(FTList<FTSegment *> & outer_segments); 00127 00128 void linkAxialSegments_step(FTList<FTSegment *>& InnerSegments, 00129 FTList<FTSegment *>& OuterSegments, 00130 FTList<FTSegment *>& Connected, 00131 float maxDphi, float maxChi2); 00132 00133 #ifndef OnlineMode 00135 void makeMdst(void); 00136 #endif 00137 00139 // by wangdy 00140 StatusCode makeTds(void); 00141 00142 //register T0 into TDS by max 00143 StatusCode registT0(void); 00144 00145 public: // public data menbers 00146 /* int findEventVertex; 00147 int evtTimeCorr; 00148 double minPt; 00149 double minDr; 00150 float tOffSet; 00151 float xtCoEff; 00152 int doIt; 00153 #ifndef OnlineMode 00154 bool mkMdst; 00155 #endif 00156 bool mkTds; 00157 */ 00158 int eventNo; 00159 int runNo; 00160 int expflag; 00161 float t0Estime; 00162 float tOffSet; 00163 float evtTiming; 00164 const HepPoint3D pivot; 00165 float Testime; 00166 int i_rPhiFit; 00167 int tEstFlag; 00168 FTList<float> tEstime[10]; 00169 00170 private: // private data members 00171 //static FTFinder * _tFinder; 00172 FTWire * _wire; 00173 FTLayer * _layer; 00174 FTSuperLayer * _superLayer; 00175 FTList<FTTrack *> & _tracks; 00176 FTList<FTSegment *> * _linkedSegments; 00177 FTList<FTSegment *> _axialSegCollect; 00178 double _vx; 00179 double _vy; 00180 double _vz; 00181 int _ExpNo; 00182 int _RunNo; 00183 double _bunchtime; 00184 double _t0cal; 00185 int m_total_trk; 00186 HepPDT::ParticleDataTable* m_particleTable; 00187 IRawDataProviderSvc* m_rawDataProviderSvc; 00188 IMagneticFieldSvc* m_pmgnIMF; 00189 00190 static MdcParameter* param; 00191 int _widbase[43]; 00192 }; 00193 00194 inline 00195 FTSuperLayer * 00196 FTFinder::superLayer(int id) const{ 00197 return _superLayer + id; 00198 } 00199 00200 inline 00201 FTList<FTTrack *> & 00202 FTFinder::tracks(void) const{ 00203 return _tracks; 00204 } 00205 00206 inline 00207 int 00208 FTFinder::getWireId(FTWire * w) const { 00209 return ((long)w - (long)_wire)/sizeof(FTWire); 00210 } 00211 00212 inline 00213 float 00214 FTFinder::x2t(const FTLayer & l, const float x) const 00215 { 00216 return (x*x) / (param->_xtCoEff * param->_xtCoEff *l.csize()); 00217 } 00218 00219 inline 00220 float 00221 FTFinder::t2x(const FTLayer & l, const float t) const 00222 { 00223 float x = (t>0.0f) ?((param->_xtCoEff))*sqrt(t*l.csize()) : 0.0f; 00224 if ( x > 0.47f*l.csize() ){ 00225 x = 0.0004f*t + 0.47f*l.csize()*(1.0f-0.0004f*0.47f/((param->_xtCoEff)*(param->_xtCoEff))); 00226 } 00227 00228 return x; 00229 } 00230 00231 inline 00232 void 00233 FTFinder::setAlgorithmPointer(Algorithm* alg){ 00234 m_algorithm = alg; 00235 } 00236 #endif /* FTFinder_FLAG_ */