35 #ifndef STETOFMATCHMAKER_H
36 #define STETOFMATCHMAKER_H
43 #include "StThreeVectorD.hh"
44 #include "StPhysicalHelixD.hh"
60 ETofTrack():mom(-999.),pt(-999.),eta(-999.),phi(-999.),nFtPts(0),nDedxPts(0),flag(0),nHitsPoss(999),dEdx(-999.),nSigmaPion(-999.){};
108 typedef std::vector< StructETofHit > eTofHitVec;
109 typedef std::vector< StructETofHit >::iterator eTofHitVecIter;
116 Int_t InitRun( Int_t );
117 Int_t FinishRun( Int_t );
125 void setFileNameAlignParam(
const char* fileName );
127 void setOuterGeometry(
const bool outerGeom );
128 void setUseHelixSwimmer(
const bool useSwimmer );
129 void setUseOnlyBTofHeaderStartTime(
const bool useBTofT0 );
131 void setT0corr(
const double t0corr );
132 void setNupdatesT0(
const int nUpdatesT0 );
134 void setIsSim(
const bool isSim );
135 void setDoQA(
const bool doQA );
136 void setDebug(
const bool debug );
138 void setMatchDistXYT(
const double x,
const double y,
const double t );
140 void setYmax(
const double ymax );
148 void readETofDetectorHits( eTofHitVec& detectorHitVec );
149 void findTrackIntersections( eTofHitVec& intersectionVec,
int& nPrimaryWithIntersection );
151 void fillIndexToPrimaryMap();
152 void cleanUpTraits();
154 bool validTrack(
const StTrack* );
158 void extrapolateTrackToETof( eTofHitVec& intersectionVec,
const StPhysicalHelixD& theHelix,
const int& iNode,
int& nCrossings,
bool isPrimary );
160 void matchETofHits( eTofHitVec& detectorHitVec, eTofHitVec& intersectionVec, eTofHitVec& matchCandVec );
161 void sortSingleMultipleHits( eTofHitVec& matchCandVec, eTofHitVec& singleTrackMatchVec, std::vector< eTofHitVec >& multiTrackMatchVec );
162 void finalizeMatching( eTofHitVec& singleTrackMatchVec, eTofHitVec& finalMatchVec );
164 void fillPidTraits( eTofHitVec& finalMatchVec );
165 void calculatePidVariables( eTofHitVec& finalMatchVec,
int& nPrimaryWithPid );
167 void sortandcluster(eTofHitVec& matchCandVec , eTofHitVec& detectorHitVec , eTofHitVec& intersectionVec , eTofHitVec& finalMatchVec);
168 void sortMatchCases( eTofHitVec inputVec , std::map< Int_t, eTofHitVec >& outputMap );
170 double startTimeBTof();
171 double startTimeETof(
const eTofHitVec& finalMatchVec,
unsigned int& nCand_etofT0 );
173 double moduloDist(
const double& dist,
const double& mod );
174 double startTime(
const eTofHitVec& finalMatchVec );
176 double timeOfFlight(
const double& startTime,
const double& stopTime );
177 double expectedTimeOfFlight(
const double& pathLength,
const double& momentum,
const double& mass );
179 void checkClockJumps();
180 void fillQaHistograms( eTofHitVec& finalMatchVec );
181 void fillSlewHistograms( eTofHitVec& finalMatchVec );
182 void bookHistograms();
183 void setHistFileName();
184 void writeHistograms();
186 int rotateHit(
const int& sector,
const int& rot );
197 std::string mFileNameMatchParam;
198 std::string mFileNameAlignParam;
203 Bool_t mOuterTrackGeometry;
204 Bool_t mUseHelixSwimmer;
205 Bool_t mUseOnlyBTofHeaderStartTime;
211 Double_t mMatchDistX;
212 Double_t mMatchDistY;
213 Double_t mMatchDistT;
215 std::vector< Double_t > mT0corrVec;
220 std::map< Int_t, Int_t > mIndex2Primary;
222 Double_t mMatchRadius;
224 std::vector< Double_t > mTrackCuts;
226 std::map< Int_t, Int_t > mClockJumpCand;
227 std::map< Int_t, Int_t > mClockJumpDirection;
229 std::string mHistFileName;
231 std::map< std::string, TH1* > mHistograms;
232 std::map< std::string, TH2* > mHistograms2d;
241 virtual const Char_t *GetCVS()
const {
static const char cvs[]=
"Tag $Name: $Id: built " __DATE__
" " __TIME__ ;
return cvs; }
248 inline void StETofMatchMaker::setFileNameAlignParam(
const char* fileName ) { mFileNameAlignParam = fileName; }
249 inline void StETofMatchMaker::setOuterGeometry(
const bool outerGeom ) { mOuterTrackGeometry = outerGeom; }
250 inline void StETofMatchMaker::setUseHelixSwimmer(
const bool useSwimmer ) { mUseHelixSwimmer = useSwimmer; }
251 inline void StETofMatchMaker::setUseOnlyBTofHeaderStartTime(
const bool useBTofT0 ) { mUseOnlyBTofHeaderStartTime = useBTofT0; }
253 inline void StETofMatchMaker::setT0corr(
const double t0corr ) { mT0corr = t0corr; }
254 inline void StETofMatchMaker::setNupdatesT0(
const int nUpdatesT0 ) { mNupdatesT0 = nUpdatesT0; }
256 inline void StETofMatchMaker::setIsSim(
const bool isSim ) { mIsSim = isSim; }
257 inline void StETofMatchMaker::setDoQA(
const bool doQA ) { mDoQA = doQA; }
258 inline void StETofMatchMaker::setDebug(
const bool debug ) { mDebug = debug; }
259 inline void StETofMatchMaker::setYmax(
const double ymax ) { mLocalYmax = ymax; }
261 inline StETofGeometry* StETofMatchMaker::etofGeometry()
const {
return mETofGeom; }
void setFileNameMatchParam(const char *fileName)
read matching parameters from file