00001
00181 #ifndef StMiniMcMaker_H
00182 #define StMiniMcMaker_H
00183
00184 #include "StMaker.h"
00185
00186 #include <vector>
00187 #include <utility>
00188 #include <algorithm>
00189 #include <map>
00190
00191 #include "TString.h"
00192
00193 #include "StAssociationMaker/StAssociationMaker.h"
00194 #include "StAssociationMaker/StTrackPairInfo.hh"
00195
00196 #include "StMiniMcEvent/StMiniMcEvent.h"
00197 #include "StMiniMcEvent/StMiniMcPair.h"
00198 #include "StMiniMcEvent/StContamPair.h"
00199
00200 class TFile;
00201 class TTree;
00202 class StEvent;
00203 class StMcEvent;
00204 class StMcTrack;
00205 class StTrack;
00206 class StPrimaryTrack;
00207 class StIOInterFace;
00208 #include "StThreeVectorF.hh"
00209 class StTpcDedxPidAlgorithm;
00210 class StuProbabilityPidAlgorithm;
00211 class StTpcHit;
00212 class StDedxPidTraits;
00213 class StEmcRawHit;
00214 class StEmcPoint;
00215
00216
00217 #ifndef __CINT__
00218
00219 typedef map<UInt_t,Int_t> RCFOUNDMAP;
00220 typedef map<long,Int_t> MCFOUNDMAP;
00221 typedef map<Long_t,const StMcTrack*> MCMAP;
00222 typedef vector<StTrackPairInfo*> PAIRVEC;
00223 typedef pair<const StTpcHit*,const StTpcHit*> PAIRHIT;
00224 inline bool pairCmp(StTrackPairInfo* p1, StTrackPairInfo* p2){
00225 return p1->commonTpcHits() < p2->commonTpcHits();
00226 }
00227 inline bool sortCmp(StTrackPairInfo* p1, StTrackPairInfo* p2){
00228 return p1->commonTpcHits() > p2->commonTpcHits();
00229 }
00230
00231 #endif
00232
00233
00234
00235
00236
00237
00238
00239 class StMiniMcMaker : public StMaker{
00240 public:
00241 StMiniMcMaker(const Char_t* name="StMiniMcMaker",
00242 const Char_t* title="event/StMiniMcMaker");
00243 virtual ~StMiniMcMaker();
00244
00245 void Clear(Option_t *option="");
00246 Int_t Init();
00247 Int_t InitRun(int runnumber);
00248 Int_t Make();
00249 Int_t Finish();
00250 virtual const char *GetCVS() const
00251 {static const char cvs[]="Tag $Name: $ $Id: StMiniMcMaker.h,v 1.19 2012/03/15 23:37:36 perev Exp $ built "__DATE__" "__TIME__ ; return cvs;}
00252
00253
00254
00255 void setGhost(Bool_t doit=kTRUE) { mGhost = doit; }
00256 void setOutDir(const char* dir= "./") { mOutDir = dir; }
00257 void setPtCut(Float_t minPt=0, Float_t maxPt=9999)
00258 { mMinPt=minPt; mMaxPt=maxPt; }
00259 void setFileName(TString& val) { mInFileName = val; }
00260 void setFilePrefix(TString& val) { mInFilePrefix = val; }
00261
00262 private:
00263
00264
00265
00266
00267 Bool_t initAssociation();
00268 Bool_t initVertex();
00269 Bool_t acceptRaw(const StMcTrack*);
00270 Bool_t accept(const StMcTrack*);
00271 Bool_t accept(const StTrack*);
00272 Bool_t acceptGood20(const StTrack*);
00273 Bool_t acceptGood20(const StMcTrack*);
00274 Bool_t acceptCentrality(const StTrack*);
00275 Bool_t acceptUncorrected(const StTrack*);
00276 Bool_t acceptGlobals(const StTrack* track);
00277 Bool_t acceptFTPC(const StTrack*);
00278 Bool_t ok(const StTrack*);
00279 Bool_t isSameSign(const StTrack*,const StMcTrack*);
00280 Bool_t acceptPt(const StTrack*);
00281 Bool_t acceptPt(const StMcTrack*);
00282 Bool_t acceptDebug(const StMcTrack*);
00283
00284 StTrackPairInfo* findBestMatchedGlobal(const StMcTrack*);
00285 PAIRVEC findMatchedRc(const StMcTrack*);
00286 PAIRHIT findFirstLastHit(const StTrack*);
00287 PAIRHIT findFirstLastFitHit(const StTrack*);
00288
00289 Float_t computeXY(const StThreeVectorF*, const StTrack*);
00290 StDedxPidTraits* findDedxPidTraits(const StTrack*);
00291
00292 Float_t computeZDca(const StThreeVectorF*,const StTrack*);
00293
00294 const StPrimaryTrack* isPrimaryTrack(const StTrack*);
00295 Bool_t isPrimaryTrack(const StMcTrack*);
00296 Int_t openFile();
00297 Int_t closeFile();
00298 void trackLoop();
00299 void trackLoopIdT();
00300 void buildEmcIndexArray();
00301 void fillEventInfo(Int_t nGoodTrack, Int_t nRcGlobal, Int_t nRcGoodGlobal20,
00302
00303 Int_t nMcGlobal, Int_t nMcGoodGlobal20,
00304 Int_t nMcNch, Int_t nMcHminus,
00305 Int_t nMcFtpcENch, Int_t nMcFtpcWNch,
00306 Int_t nFtpcEUncorrected, Int_t nFtpcWUncorrected,
00307 Int_t nUncorrectedGlobals);
00308 void fillTrackPairInfo(StMiniMcPair*,
00309 const StMcTrack*,
00310 const StTrack* prTrack,
00311 const StTrack* glTrack,
00312 Int_t commonHits, Int_t nAssMc,
00313 Int_t nAssGl, Int_t nAssPr,
00314 Bool_t isBestContam=kFALSE);
00315
00316 void fillRcTrackInfo(StTinyRcTrack*,
00317 const StTrack* prTrack,
00318 const StTrack* glTrack,
00319 Int_t nAssMc);
00320
00321 void fillMcTrackInfo(StTinyMcTrack*,
00322 const StMcTrack*,
00323 Int_t nAssGl, Int_t nAssPr);
00324
00325 void checkMerged(const StMcTrack* merged, Int_t mergedCommonHits,
00326 const StTrack* prTrack);
00327 void checkSplit (const StMcTrack*,const StTrack*,Int_t);
00328 void checkContam(const StMcTrack*,const StGlobalTrack*,Int_t);
00329
00330 size_t getIndex(size_t mult);
00331
00332 void AppendMCDaughterTrack();
00333 static void dominatTkInfo(const StTrack* recTrack,int &dominatrackKey ,int& dominatrackHits,float& avgQuality);
00334
00335 StMiniMcEvent* mMiniMcEvent;
00336 StIOInterFace* mIOMaker;
00337 TTree* mMiniMcTree;
00338 TFile* mMiniMcDST;
00339 TString mInFileName;
00340 TString mInFilePrefix;
00341 TString mOutFileName;
00342 TString mOutDir;
00343 TString mParameterFileName;
00344
00345 StEvent* mRcEvent;
00346 StMcEvent* mMcEvent;
00347 rcTpcHitMapType* mRcHitMap;
00348 rcTrackMapType* mRcTrackMap;
00349 mcTrackMapType* mMcTrackMap;
00350 const StThreeVectorF* mRcVertexPos;
00351 const StThreeVectorF* mMcVertexPos;
00352 StTpcDedxPidAlgorithm* mTpcDedxAlgo;
00353 StuProbabilityPidAlgorithm* mPidAlgo;
00354 vector<StEmcRawHit*> mEmcIndex;
00355 Bool_t mGhost;
00356
00357 Float_t mMinPt;
00358 Float_t mMaxPt;
00359
00360 Int_t mNSplit;
00361 Int_t mNRc;
00362 Int_t mNGhost;
00363 Int_t mNContam;
00364 Int_t mNMatched;
00365 Int_t mNMatGlob;
00366 int mMainVtx;
00367 ClassDef(StMiniMcMaker,0)
00368 };
00369
00370
00371
00372
00373 #endif
00374
00375
00376