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 );
169 void sortOutOlDoubles( eTofHitVec& finalMatchVec);
171 double startTimeBTof();
172 double startTimeETof(
const eTofHitVec& finalMatchVec,
unsigned int& nCand_etofT0 );
174 double moduloDist(
const double& dist,
const double& mod );
175 double startTime(
const eTofHitVec& finalMatchVec );
177 double timeOfFlight(
const double& startTime,
const double& stopTime );
178 double expectedTimeOfFlight(
const double& pathLength,
const double& momentum,
const double& mass );
180 void checkClockJumps();
181 void fillQaHistograms( eTofHitVec& finalMatchVec );
182 void fillSlewHistograms( eTofHitVec& finalMatchVec );
183 void bookHistograms();
184 void setHistFileName();
185 void writeHistograms();
187 int rotateHit(
const int& sector,
const int& rot );
198 std::string mFileNameMatchParam;
199 std::string mFileNameAlignParam;
204 Bool_t mOuterTrackGeometry;
205 Bool_t mUseHelixSwimmer;
206 Bool_t mUseOnlyBTofHeaderStartTime;
212 Double_t mMatchDistX;
213 Double_t mMatchDistY;
214 Double_t mMatchDistT;
216 std::vector< Double_t > mT0corrVec;
221 std::map< Int_t, Int_t > mIndex2Primary;
223 Double_t mMatchRadius;
225 std::vector< Double_t > mTrackCuts;
227 std::map< Int_t, Int_t > mClockJumpCand;
228 std::map< Int_t, Int_t > mClockJumpDirection;
230 std::string mHistFileName;
232 std::map< std::string, TH1* > mHistograms;
233 std::map< std::string, TH2* > mHistograms2d;
242 virtual const Char_t *GetCVS()
const {
static const char cvs[]=
"Tag $Name: $Id: built " __DATE__
" " __TIME__ ;
return cvs; }
249 inline void StETofMatchMaker::setFileNameAlignParam(
const char* fileName ) { mFileNameAlignParam = fileName; }
250 inline void StETofMatchMaker::setOuterGeometry(
const bool outerGeom ) { mOuterTrackGeometry = outerGeom; }
251 inline void StETofMatchMaker::setUseHelixSwimmer(
const bool useSwimmer ) { mUseHelixSwimmer = useSwimmer; }
252 inline void StETofMatchMaker::setUseOnlyBTofHeaderStartTime(
const bool useBTofT0 ) { mUseOnlyBTofHeaderStartTime = useBTofT0; }
254 inline void StETofMatchMaker::setT0corr(
const double t0corr ) { mT0corr = t0corr; }
255 inline void StETofMatchMaker::setNupdatesT0(
const int nUpdatesT0 ) { mNupdatesT0 = nUpdatesT0; }
257 inline void StETofMatchMaker::setIsSim(
const bool isSim ) { mIsSim = isSim; }
258 inline void StETofMatchMaker::setDoQA(
const bool doQA ) { mDoQA = doQA; }
259 inline void StETofMatchMaker::setDebug(
const bool debug ) { mDebug = debug; }
260 inline void StETofMatchMaker::setYmax(
const double ymax ) { mLocalYmax = ymax; }
262 inline StETofGeometry* StETofMatchMaker::etofGeometry()
const {
return mETofGeom; }
void setFileNameMatchParam(const char *fileName)
read matching parameters from file