StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StBTofMatchMaker.h
1 
11 /*****************************************************************
12  *
13  * $Log: StBTofMatchMaker.h,v $
14  * Revision 1.13 2017/10/20 17:50:33 smirnovd
15  * Squashed commit of the following:
16  *
17  * StBTof: Remove outdated ClassImp macro
18  *
19  * Prefer explicit namespace for std:: names in header files
20  *
21  * Removed unnecessary specification of default std::allocator
22  *
23  * Frank signed-off
24  *
25  * Revision 1.12 2014/08/06 11:42:53 jeromel
26  * Suffix on literals need to be space (later gcc compiler makes it an error) - first wave of fixes
27  *
28  * Revision 1.11 2012/05/07 14:11:16 fisyak
29  * Keep btofGeometry in const area for future use
30  *
31  * Revision 1.10 2011/07/27 16:13:58 geurts
32  * Alignment calibration modifications [Patrick Huck]:
33  * - modified to open the local Z window cut to determine the z offset
34  * - variables mZLocalCut, mCalculateAlign and mAlignFileName added
35  * - functions setCalculateAlign and setAlignFileName added
36  *
37  * Revision 1.9 2010/08/09 19:18:45 geurts
38  * Include local theta calculation in CellHit structure. Pass LocalTheta info on to TOF PID traits. [Masa]
39  *
40  * Revision 1.8 2010/07/14 20:35:21 geurts
41  * introduce switch to enable ideal MC geometry, without alignment updates. Default: disabled
42  *
43  * Revision 1.7 2010/03/19 22:25:39 dongx
44  * - Added getBTofGeom() function for outside use
45  * - Remove AddConst(btofGeometry) to avoid crash due to duplication
46  * - TOT selection window opened to 40 ns
47  * - Added CPU timer printouts for processStEvent() funciton
48  *
49  * Revision 1.6 2009/09/15 00:30:45 dongx
50  * 1) Added the functionality to perform the matching with MuDst directly.
51  * 2) Several updates on the track cuts used for matching
52  * - flag<1000 was added
53  * - nHits>15 cut was removed
54  * 3) Created a new StBTofPidTraits for any primary track
55  * 4) Local Z window cut set to symmetric (fabs(localz)<3.05)
56  * 5) Some small changes in the LOGGER output.
57  *
58  * Revision 1.5 2009/08/26 20:33:56 dongx
59  * Geometry init moved to Init() function, also allow reading in from others
60  *
61  * Revision 1.4 2009/08/25 15:46:44 fine
62  * fix the compilation issues under SL5_64_bits gcc 4.3.2
63  *
64  * Revision 1.3 2009/07/24 18:52:53 dongx
65  * - Local Z window restricted in the projection
66  * - ToT selection is used firstly when more than one hits associated with a track
67  * - matchFlag updated
68  * 0: no matching
69  * 1: 1-1 matching
70  * 2: 1-2 matching, pick up the one with higher ToT value (<25ns)
71  * 3: 1-2 matching, pick up the one with closest projection posision along y
72  *
73  * Revision 1.2 2009/06/23 21:15:09 geurts
74  * first set of doxygen tags
75  *
76  * Revision 1.1 2009/06/23 13:15:03 geurts
77  * *** empty log message ***
78  *
79  *
80  *******************************************************************/
81 #ifndef STBTOFMATCHMAKER_HH
82 #define STBTOFMATCHMAKER_HH
83 #include "StMaker.h"
84 #include "StThreeVectorD.hh"
85 #include <string>
86 #include <vector>
87 
88 class StEvent;
89 class StTrack;
90 class StGlobalTrack;
91 class StHelix;
92 #include "StThreeVectorF.hh"
93 class StTrackGeometry;
94 class StDcaGeometry;
95 class StBTofGeometry;
96 class StBTofCollection;
99 class StSPtrVecBTofRawHit;
100 class StSPtrVecBTofHit;
101 class TH1D;
102 class TH2D;
103 class TTree;
104 
105 class StMuDst;
106 class StMuEvent;
107 class StMuTrack;
108 
109 typedef std::vector<Int_t> IntVec;
110 typedef std::vector<UInt_t> UIntVec;
111 typedef std::vector<Double_t> DoubleVec;
112 
113 class StBTofMatchMaker : public StMaker {
114 public:
116  StBTofMatchMaker(const Char_t *name="btofMatch");
117  ~StBTofMatchMaker();
118 
119  // void Clear(Option_t *option="");
121  Int_t Init();
123  Int_t InitRun(Int_t);
124  Int_t FinishRun(Int_t);
126  Int_t Make();
128  Int_t Finish();
129 
131  void setCreateHistoFlag(Bool_t histos=kTRUE);
133  void setCreateTreeFlag(Bool_t tree=kTRUE);
135  void setOuterTrackGeometry();
136  void setStandardTrackGeometry();
138  void setMinHitsPerTrack(Int_t);
140  void setMinFitPointsPerTrack(Int_t);
142  void setMinFitPointsOverMax(Float_t);
144  void setMaxDCA(Float_t);
146  void setHistoFileName(const Char_t*);
148  void setNtupleFileName(const Char_t*);
150  void setSaveGeometry(const Bool_t geomSave=kFALSE);
152  void setIdealGeometry(const Bool_t useIdealGeometry=kTRUE);
154  void setCalculateAlign(const Bool_t calcAlign=kTRUE);
156  void setAlignFileName(const Char_t* infile="");
157 
159  void setMuDstIn(Bool_t muDstIn=kTRUE);
162 
163 private:
164  StTrackGeometry* trackGeometry(StTrack*);
165 
167  void bookHistograms();
169  void writeHistogramsToFile();
170 
172  void processStEvent();
174  void processMuDst();
175 
177  Bool_t validTrack(StTrack*);
178 
180  Bool_t validTrack(StMuTrack*);
181 
182 public:
183  Bool_t doPrintMemoryInfo;
184  Bool_t doPrintCpuInfo;
185 
186 private:
187  static const Int_t mDAQOVERFLOW = 255;
188 
190  static const Int_t mNTray = 120;
192  static const Int_t mNTOF = 192;
194  static const Int_t mNModule = 32;
196  static const Int_t mNCell = 6;
198  static const Int_t mNVPD = 19;
199 
201  static const Int_t mEastVpdTrayId = 122;
203  static const Int_t mWestVpdTrayId = 121;
204 
206  Float_t mWidthPad;
207  Float_t mZLocalCut;
208 
209  StEvent *mEvent;
210  StBTofGeometry *mBTofGeom;
211 
212  Bool_t mHisto;
213  Bool_t mSaveTree;
214  Bool_t mUseIdealGeometry;
215  Bool_t mCalculateAlign;
216 
217  Bool_t mOuterTrackGeometry;
218  Bool_t mGeometrySave;
219  Bool_t mInitFromOther;
220 
221  string mHistoFileName;
222  string mAlignFileName;
223 
224  StMuDst* mMuDst;
225  Bool_t mMuDstIn;
226 
228  Int_t mEventCounter;
229  Int_t mAcceptedEventCounter;
230  Int_t mTofEventCounter;
231  Int_t mAcceptAndBeam;
232 
234  unsigned int mMinHitsPerTrack;
235  unsigned int mMinFitPointsPerTrack;
236  Float_t mMinFitPointsOverMax;
237  Float_t mMaxDCA;
238 
239  //
240 
242  TH2D* mADCTDCCorelation;
243 
244  TH1D* mEventCounterHisto;
245  TH1D* mCellsMultInEvent;
246  TH1D* mHitsMultInEvent;
247  TH1D* mHitsPrimaryInEvent; // ! primary tracks
248  TH1D* mHitsMultPerTrack;
249  TH1D* mDaqOccupancy[mNTray];
250  TH1D* mDaqOccupancyProj[mNTray];
251  TH2D* mHitsPosition;
252 
253  TH2D* mHitCorr[mNTray];
254  TH2D* mHitCorrModule[mNTray];
255 
256  TH2D* mDeltaHitFinal[mNTray];
257 
258  TH2D* mTrackPtEta;
259  TH2D* mTrackPtPhi;
260  TH1D* mTrackNFitPts;
261  TH2D* mTrackdEdxvsp;
262  TH2D* mNSigmaPivsPt;
263 
264  TTree* mTrackTree;
265 
266  TH1D* mCellsPerEventMatch1;
267  TH1D* mHitsPerEventMatch1;
268  TH1D* mCellsPerTrackMatch1;
269  TH1D* mTracksPerCellMatch1;
270  TH1D* mDaqOccupancyMatch1;
271  TH2D* mDeltaHitMatch1;
272 
273  TH1D* mCellsPerEventMatch2;
274  TH1D* mHitsPerEventMatch2;
275  TH1D* mCellsPerTrackMatch2;
276  TH1D* mTracksPerCellMatch2;
277  TH1D* mDaqOccupancyMatch2;
278  TH2D* mDeltaHitMatch2;
279 
280  TH1D* mCellsPerEventMatch3;
281  TH1D* mHitsPerEventMatch3;
282  TH1D* mCellsPerTrackMatch3;
283  TH1D* mTracksPerCellMatch3;
284  TH1D* mDaqOccupancyMatch3;
285  TH2D* mDeltaHitMatch3;
286 
287  TH1D* mCellsPrimaryPerEventMatch3;
288 
289  typedef std::vector<Int_t> idVector;
290  typedef idVector::iterator idVectorIter;
291 
292  struct StructCellHit{
293  Int_t tray;
294  Int_t module;
295  Int_t cell;
296  StThreeVectorF hitPosition;
297  idVector trackIdVec;
298  Int_t matchFlag;
299  Float_t zhit;
300  Float_t yhit;
301  Double_t tot;
302  Int_t index2BTofHit;
303  Double_t theta;
304  };
305 
306  struct TRACKTREE{
307  Float_t pt;
308  Float_t eta;
309  Float_t phi;
310  Int_t nfitpts;
311  Float_t dEdx;
312  Int_t ndEdxpts;
313  Int_t charge;
314  Int_t projTrayId;
315  Int_t projCellChan;
316  Float_t projY;
317  Float_t projZ;
318  };
319  TRACKTREE trackTree;
320 
321  typedef std::vector<StructCellHit> tofCellHitVector;
322  typedef std::vector<StructCellHit>::iterator tofCellHitVectorIter;
323 
324 
325  virtual const char *GetCVS() const
326  {static const char cvs[]="Tag $Name: $ $Id: StBTofMatchMaker.h,v 1.13 2017/10/20 17:50:33 smirnovd Exp $ built " __DATE__ " " __TIME__ ; return cvs;}
327 
328  ClassDef(StBTofMatchMaker,1)
329 };
330 
331 
332 inline void StBTofMatchMaker::setOuterTrackGeometry(){mOuterTrackGeometry=true;}
333 
334 inline void StBTofMatchMaker::setStandardTrackGeometry(){mOuterTrackGeometry=false;}
335 
336 inline void StBTofMatchMaker::setMinHitsPerTrack(Int_t nhits){mMinHitsPerTrack=nhits;}
337 
338 inline void StBTofMatchMaker::setMinFitPointsPerTrack(Int_t nfitpnts){mMinFitPointsPerTrack=nfitpnts;}
339 
340 inline void StBTofMatchMaker::setMinFitPointsOverMax(Float_t ratio) {mMinFitPointsOverMax=ratio;}
341 
342 inline void StBTofMatchMaker::setMaxDCA(Float_t maxdca){mMaxDCA=maxdca;}
343 
344 inline void StBTofMatchMaker::setHistoFileName(const Char_t* filename){mHistoFileName=filename;}
345 
346 inline void StBTofMatchMaker::setCreateHistoFlag(const Bool_t histos){mHisto = histos;}
347 
348 inline void StBTofMatchMaker::setCreateTreeFlag(const Bool_t tree){mSaveTree = tree;}
349 
350 inline void StBTofMatchMaker::setSaveGeometry(const Bool_t geomSave){mGeometrySave = geomSave; }
351 
352 inline void StBTofMatchMaker::setIdealGeometry(const Bool_t useIdealGeometry){mUseIdealGeometry = useIdealGeometry;}
353 
354 inline void StBTofMatchMaker::setCalculateAlign(const Bool_t calcAlign){mCalculateAlign = calcAlign;}
355 
356 inline void StBTofMatchMaker::setAlignFileName(const Char_t* infile) {mAlignFileName = infile;}
357 
358 inline void StBTofMatchMaker::setMuDstIn(const Bool_t val) { mMuDstIn = val; }
359 
360 inline StBTofGeometry* StBTofMatchMaker::getBTofGeom() { return mBTofGeom; }
361 #endif
void setMaxDCA(Float_t)
set maximum distance of closest approach
void setAlignFileName(const Char_t *infile="")
input file for alignment parameters
Int_t Make()
Main match algorithm.
void setMinHitsPerTrack(Int_t)
set minimum hits per track
void setMinFitPointsPerTrack(Int_t)
set minimum fit points per track
Int_t Finish()
Print run summary, and write QA histograms.
StBTofGeometry * getBTofGeom()
method to retrieve the BTofGeom
Int_t Init()
process start-up options
void setCreateTreeFlag(Bool_t tree=kTRUE)
enable track-tree filling
void setMuDstIn(Bool_t muDstIn=kTRUE)
switch to read in StEvent/MuDst
Barrel TOF Match Maker.
Int_t InitRun(Int_t)
initialize DaqMap, Geometry, and INL
void setOuterTrackGeometry()
selection of inner or outer geometry. By default - outerGeometry
void setHistoFileName(const Char_t *)
set histogram output file name
void setSaveGeometry(const Bool_t geomSave=kFALSE)
save geometry if it will be used by following makers in the chain
void setMinFitPointsOverMax(Float_t)
set minimum fit-points/max-points ratio
void setIdealGeometry(const Bool_t useIdealGeometry=kTRUE)
switch between standard and ideal MC geometry
StBTofMatchMaker(const Char_t *name="btofMatch")
Default constructor.
void setCreateHistoFlag(Bool_t histos=kTRUE)
enable QA histogram filling
void setCalculateAlign(const Bool_t calcAlign=kTRUE)
switch for alignment calculation
void setNtupleFileName(const Char_t *)
set ntuple output file name