StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMtdQAMaker.h
1 #ifndef STMTDQAMAKER_HH
2 #define STMTDQAMAKER_HH
3 
4 /***************************************************************************
5  *
6  * StMtdQAMaker - class to make MTD related QA plots
7  * Author: Rongrong Ma
8  *--------------------------------------------------------------------------
9  *
10  ***************************************************************************/
11 
12 #include "StMaker.h"
13 #include <vector>
14 #ifndef ST_NO_NAMESPACES
15 using std::vector;
16 #endif
17 
18 class TH1F;
19 class TH2F;
20 class TProfile;
21 
22 class StEvent;
23 class StVertex;
24 class StTrack;
25 
26 class StMuDst;
27 class StMuTrack;
28 class StMtdTrigUtil;
29 
30 class StPicoDst;
31 class StPicoTrack;
32 class StPicoMtdHit;
33 
34 #if !defined(ST_NO_TEMPLATE_DEF_ARGS) || defined(__CINT__)
35 typedef vector<Int_t> IntVec;
36 #else
37 typedef vector<Int_t, allocator<Int_t>> IntVec;
38 #endif
39 
40 class StMtdQAMaker : public StMaker {
41  public:
42  StMtdQAMaker(const Char_t *name = "MtdQAMaker");
43  ~StMtdQAMaker();
44 
45  Int_t Init();
46  Int_t Make();
47 
48  void setMtdTrigUtil(StMtdTrigUtil* trig);
49  void setVertexMode(const Int_t mode);
50  void setMaxVtxZ(const Double_t max);
51  void setMaxVtxR(const Double_t max);
52  void setApplyMaxVtxDzCut(const Bool_t cut);
53  void setMaxVtxDz(const Double_t max);
54  void setTrackPtLimits(const Double_t min, const Double_t max);
55  void setTrackPhiLimits(const Double_t min, const Double_t max);
56  void setTrackEtaLimits(const Double_t min, const Double_t max);
57  void setMinNHitsFit(const Int_t min);
58  void setMinNHitsDedx(const Int_t min);
59  void setMinFitHitsFraction(const Double_t min);
60  void setMaxDca(const Double_t max);
61 
62  void setMinMuonPt(const Double_t min);
63  void setNsigmaPiCut(const Double_t min, const Double_t max);
64  void setMuonDeltaZ(const Double_t min, const Double_t max);
65  void setMuonDeltaY(const Double_t min, const Double_t max);
66  void setMuonDeltaTof(const Double_t min, const Double_t max);
67  void setMtdHitTrigger(const Bool_t trig);
68 
69  void setPrintMemory(const Bool_t pMem = kTRUE);
70  void setPrintCpu(const Bool_t pCpu = kTRUE);
71  void setPrintConfig(const Bool_t print = kTRUE);
72  void setTriggerIDs(const IntVec id);
73 
74  protected:
75  void bookHistos();
76  void printConfig();
77  Int_t processStEvent();
78  Int_t processMuDst();
79  Int_t processPicoDst();
80 
81  Int_t getMtdHitTHUB(const Int_t backleg) const; // Return the THUB index for a particular backleg
82  Int_t getMtdHitIndex(const StPicoTrack *track);
83  Int_t getMtdPidTraitsIndex(const StPicoMtdHit *hit);
84  Double_t rotatePhi(Double_t phi) const;
85  void addCutToHisto(TH1 *h, const Int_t bin, const char *label, const Float_t value = -9999999);
86 
87  Bool_t isValidTrack(StTrack *t, StVertex *vtx) const ; // Check if a StTrack satisfies all the quality cuts
88  Bool_t isValidTrack(const StMuTrack *t) const ; // Check if a StMuTrack satisfies all the quality cuts
89  Bool_t isValidTrack(const StPicoTrack *t) const ; // Check if a StPicoTrack satisfies all the quality cuts
90 
91  Bool_t isMuonCandidate(const StMuTrack *track);
92  Bool_t isMuonCandidate(const StPicoTrack *track);
93  Bool_t isMuonCandidate(const Double_t pt, const Double_t nSigmaPi, const Double_t dz, const Double_t dy, const Double_t dtof, const Bool_t isTrig);
94  static const Int_t kNQTboard = 8;
95 
96  private:
97  StEvent *mStEvent; // Pointer to StEvent
98  StMuDst *mMuDst; // Pointer to MuDst event
99  StPicoDst *mPicoDst; // Pointer to PicoDst event
100  StMtdTrigUtil *mTrigUtil; // Pointer to MTD trigger utility
101  Int_t mRunId; // Run number
102  Int_t mRunYear; // Run year
103  TString mCollisionSystem; // collision system
104  Int_t mVertexMode; // 0 - default; 1 - closest to VPD with positive ranking
105  Bool_t mPrintMemory; // Flag to print out memory usage
106  Bool_t mPrintCpu; // Flag to print out CPU usage
107  Bool_t mPrintConfig; // Flag to print out task configuration
108  IntVec mTriggerIDs; // Valid trigger id collection that will be tested
109 
110  // track quality cuts
111  Double_t mMaxVtxZ; // Maximum vertex z
112  Double_t mMaxVtxR; // Maximum vertex r
113  Bool_t mApplyVtxDzCut; // switch for applying dz cut
114  Double_t mMaxVtxDz; // Maximum dz between VPD and TPC
115  Double_t mMinTrkPt; // Minimum track pt
116  Double_t mMaxTrkPt; // Maximum track pt
117  Double_t mMinTrkPhi; // Minimum track phi
118  Double_t mMaxTrkPhi; // Maximum track phi
119  Double_t mMinTrkEta; // Minimum track eta
120  Double_t mMaxTrkEta; // Maximum track eta
121  Int_t mMinNHitsFit; // Minimum number of hits used for track fit
122  Int_t mMinNHitsDedx; // Minimum number of hits used for de/dx
123  Double_t mMinFitHitsFraction; // Minimum fraction of # of hits used for fit out of # of possible hits
124  Double_t mMaxDca; // Maximum track dca
125 
126  // muon pid cuts
127  Double_t mMinMuonPt;
128  Double_t mMinNsigmaPi; // Minimum nsigma for pion assumption
129  Double_t mMaxNsigmaPi; // Maximum nsigma for pion assumption
130  Double_t mMinMuonDeltaZ;
131  Double_t mMaxMuonDeltaZ;
132  Double_t mMinMuonDeltaY;
133  Double_t mMaxMuonDeltaY;
134  Double_t mMinMuonDeltaTof;
135  Double_t mMaxMuonDeltaTof;
136  Bool_t mMtdHitTrigger;
137 
138 
139  // global properties
140  TH1F *mhEventStat; // Event statistics
141  TH1F *mhEventCuts; // Analysis cuts used
142  TH1F *mhRunId; // Run indices
143  TH1F *mhZdcRate; // ZDC coincidence rate
144  TH1F *mhBbcRate; // BBC coincidence rate
145 
146  // vertex
147  TH2F *mhVtxZvsVpdVzDefault; // TpcVz vs. VpdVz (default)
148  TH1F *mhVtxZDiffDefault; // TpcVz - VpdVz(default)
149  TH2F *mhVtxZvsVpdVzClosest; // TpcVz vs. VpdVz (closest)
150  TH1F *mhVtxZDiffClosest; // TpcVz - VpdVz (closest)
151  TH1F *mhVtxClosestIndex; // Index of postively ranked vertex that is closest to VPD vz
152  TH2F *mhVertexXY; // Correlation between vertex x and y
153  TH2F *mhVertexXZ; // Correlation between vertex x and z
154  TH2F *mhVertexYZ; // Correlation between vertex y and z
155  TH1F *mhVertexZ; // Distribution of vertex z
156  TH2F *mhVtxZDiffVsTpcVz; // TpcVz - VpdVz vs. TpcVz
157  TH1F *mhVpdVz; // Distribution of VpdVz
158  TH1F *mhVtxZDiff; // TpcVz - VpdVz
159 
161  TH1F *mhRefMult; // RefMult distribution
162  TH1F *mhgRefMult; // gRefMult distribution
163  TH2F *mhgRefMultVsRefMult;
164  TH2F *mhTpcVzVsRefMult;
165  TH2F *mhDiffVzVsRefMult;
166  TH2F *mhZdcRateVsRefMult;
167  TH2F *mhBbcRateVsRefMult;
168  TH2F *mhTofMultVsRefMult;
169 
170  // Primary tracks
171  TH1F *mhNTrk; // # of good tracks per event
172  TH1F *mhTrkPt; // pt distribution of all good tracks
173  TH2F *mhTrkDcaVsPt; // Track dca distribution
174  TH2F *mhTrkPhiVsPt; // Track phi distribution
175  TH2F *mhTrkEtaVsPt; // Track eta distribution
176  TH2F *mhTrkPhiEta; // Track phi vs eta with p_T > 1 GeV/c
177  TH2F *mhTrkNHitsFitVsPt; // Track NHitsFit distribution
178  TH2F *mhTrkNHitsPossVsPt; // Track NHitsPoss distribution
179  TH2F *mhTrkNHitsDedxVsPt; // Track NHitsDedx distribtion
180  TH2F *mhTrkDedxVsMom; // Track Dedx distribution
181  TH2F *mhTrkDedxVsPhi; // Track Dedx vs. Phi (p_T > 1 GeV/c)
182  TH2F *mhTrkNsigmaPiVsMom; // Track NsigmaPi vs. momentum
183 
184  // TOF PID
185  TH2F *mhTrkBetaVsMom; // 1/beta vs. momentum
186  TH2F *mhTrkM2VsMom; // m2 vs. momentum
187  TH2F *mhTofMthTrkLocaly; // Projected y in TOF local coordinate for tracks matched to TOF hits
188  TH2F *mhTofMthTrkLocalz; // Projected z in TOF local coordinate for tracks matched to TOF hits
189 
190  // MTD trigger electronics
191  TH2F *mhMtdQTAdcAll; // Distribution of ADC per MTD QT channel
192  TH2F *mhMtdQTTacAll; // Distribution of TAC per MTD QT channel
193  TH2F *mhMtdQTAdcVsTacAll; // Correlation between ADC and TAC in MTD QT
194  TH2F *mhMtdQTJ2J3Diff; // Distribution of TAC difference between J3-J2 per MTD QT position
195  TH2F *mhMixMtdTacSumvsMxqMtdTacSum[kNQTboard][2];// Correlation between MT001 vs MT101
196  TH2F *mhMtdVpdTacDiffMT001; // Distribution of earliest 2 TAC of MTD-VPD for MT001
197  TH2F *mhMtdVpdTacDiffMT001Mth; // Distribution of earliest 2 TAC of MTD-VPD with matched tracks for MT001
198  TH2F *mhMtdVpdTacDiffMT001Muon; // Distribution of earliest 2 TAC of MTD-VPD with muon candidates for MT001
199  TH2F *mhMtdVpdTacDiffMT101; // Distribution of earliest 2 TAC of MTD-VPD for MT101
200  TH2F *mhMtdVpdTacDiffMT101Mth; // Distribution of earliest 2 TAC of MTD-VPD with matched tracks for MT101
201  TH2F *mhMtdVpdTacDiffMT101Muon; // Distribution of earliest 2 TAC of MTD-VPD with muon candidates for MT101
202  TH1F *mhNQtSignal; // Number of good QT signals
203  TH1F *mhNMT101Signal; // Number of good MT101 signals
204  TH1F *mhNTF201Signal; // Number of good TF201 signals
205 
206  // MTD hits
207  TH1F *mhMtdTriggerTime[2]; // Distribution of MTD trigger time from THUB
208  TH1F *mhMtdNRawHits; // Number of MTD raw hits per event
209  TH2F *mhMtdRawHitMap; // Hit map of MTD raw hits
210  TH2F *mhMtdRawHitLeTime; // Leading time distribution of MTD raw hits
211  TH2F *mhMtdRawHitTrTime; // Trailing time distribution of MTD raw hits
212  TH1F *mhMtdRawHitLeNEast; // Number of MTD raw hits with leading-edge on east
213  TH1F *mhMtdRawHitLeNWest; // Number of MTD raw hits with leading-edge on west
214  TH1F *mhMtdRawHitTrNEast; // Number of MTD raw hits with trailing-edge on east
215  TH1F *mhMtdRawHitTrNWest; // Number of MTD raw hits with trailing-edge on west
216  TH2F *mhMtdRawHitLeNDiff; // Difference of the number of MTD raw hits with leading-edge on east and west
217  TH2F *mhMtdRawHitTrNDiff; // Difference of the number of MTD raw hits with trailing-edge on east and west
218 
219  TH1F *mhMtdNHits; // Number of MTD hits per event
220  TH2F *mhMtdHitMap; // Hit map of MTD hits
221  TH2F *mhMtdHitLeTimeDiff; // Difference between leading time of MTD hits on east and west
222  TH2F *mhMtdHitTotWest; // Time-Over-Threshold distribution of MTD hits on west
223  TH2F *mhMtdHitTotEast; // Time-Over-Threshold distribution of MTD hits on east
224  TH2F *mhMtdHitTrigTime; // Difference between the MTD hit time, i.e. (west+east)/2, and trigger time from THUB
225  TH2F *mhMtdHitTrigTimeTrkMth; // MTD hit time with matched track
226 
227  TH1F *mhMtdTrigNHits; // Number of triggering MTD hits
228  TH2F *mhMtdTrigHitMap; // Hit map of trigger MTD hits
229  TH1F *mhMtdTrigMthNHits; // Number of triggering MTD hits with matched tracks
230  TH2F *mhMtdTrigMthHitMap; // Hit map of MTD hits with matched tracks
231 
232  // hit-track match
233  TH1F *mhMtdNMatchHits; // Number of MTD hits with matched tracks per event
234  TH2F *mhMtdMatchHitMap; // Hit map of MTD hits with matched tracks
235  TH1F *mhMtdMatchTrkPt; // pt distribution of matched tracks to MTD hits
236  TH2F *mhMtdMatchTrkPhiEta; // phi vs eta of matched tracks at primary vertex
237  TH2F *mhMtdMatchTrkPhiPt; // phi vs pt of matched tracks at primary vertex
238  TH2F *mhMtdMatchDzVsChan; // dz vs global channel id
239  TH2F *mhMtdMatchDzVsPtPos; // dz vs track pt (positive)
240  TH2F *mhMtdMatchDzVsPtNeg; // dz vs track pt (negative)
241  TH2F *mhMtdMatchDyVsChan; // dy vs global channel id
242  TH2F *mhMtdMatchDyVsPtPos; // dy vs track pt (positive)
243  TH2F *mhMtdMatchDyVsPtNeg; // dy vs track pt (negative)
244  TH2F *mhMtdMatchDtofVsPt; // dTof vs track pt
245  TH2F *mhMtdMatchMtdTofVsChan; // MTD time vs global channel id
246  TH2F *mhMtdMatchExpTofVsChan; // TPC time vs global channel id
247  TH2F *mhMtdMatchDtofVsChan; // dTof vs global channel id
248  TH2F *mhMtdMatchLocalyVsChan; // Projected y of matched tracks in local coordinates vs global channel id
249  TH2F *mhMtdMatchLocalzVsChan; // Projected z of matched tracks in local coordinates vs global channel id
250 
251  // Muon analysis
252  TH1F *mhNMuonPos;
253  TH1F *mhNMuonNeg;
254  TH1F *mhMuonPt;
255  TH2F *mhMuonPhiVsEta;
256  TH2F *mhMuonMap;
257  TH1F *mhNULpair;
258  TH1F *mhNLSpairPos;
259  TH1F *mhNLSpairNeg;
260  TH2F *mhInvMvsPtUL;
261  TH2F *mhInvMvsPtLSpos;
262  TH2F *mhInvMvsPtLSneg;
263  TH1F *mhInvMUL;
264  TH1F *mhInvMLSpos;
265  TH1F *mhInvMLSneg;
266 
267  // Run Dependence
268  TProfile *mhBBCrateVsRun;
269  TProfile *mhZDCrateVsRun;
270  TProfile *mhRefMultVsRun;
271  TProfile *mhgRefMultVsRun;
272  TProfile *mhTpcVxVsRun;
273  TProfile *mhTpcVyVsRun;
274  TProfile *mhTpcVzVsRun;
275  TProfile *mhVpdVzVsRun;
276  TProfile *mhDiffVzVsRun;
277  TProfile *mhpTrkPtVsRun;
278  TProfile *mhpTrkEtaVsRun;
279  TProfile *mhpTrkPhiVsRun;
280  TProfile *mhpTrkDcaVsRun;
281  TProfile *mhNHitsFitVsRun;
282  TProfile *mhNHitsPossVsRun;
283  TProfile *mhNHitsDedxVsRun;
284  TProfile *mhDedxVsRun;
285  TProfile *mhNsigmaPiVsRun;
286  TProfile *mhNsigmaEVsRun;
287  TProfile *mhNsigmaKVsRun;
288  TProfile *mhNsigmaPVsRun;
289  TProfile *mhBetaVsRun;
290  TProfile *mhNMtdHitsVsRun;
291  TProfile *mhNMtdTrigHitsVsRun;
292  TProfile *mhNMtdMthHitsVsRun;
293  TProfile *mhNMuonPosVsRun;
294  TProfile *mhNMuonNegVsRun;
295  TProfile *mhNMuonPairULVsRun;
296  TProfile *mhNMuonPairLSPosVsRun;
297  TProfile *mhNMuonPairLSNegVsRun;
298 
299  virtual const char *GetCVS() const {
300  static const char cvs[]="Tag $Name: $Id: built " __DATE__ " " __TIME__ ;
301  return cvs;
302  }
303 
304  ClassDef(StMtdQAMaker, 3)
305 };
306 inline void StMtdQAMaker::setMtdTrigUtil(StMtdTrigUtil* trig) { mTrigUtil = trig; }
307 inline void StMtdQAMaker::setPrintMemory(const Bool_t pMem) { mPrintMemory = pMem; }
308 inline void StMtdQAMaker::setPrintCpu(const Bool_t pCpu) { mPrintCpu = pCpu; }
309 inline void StMtdQAMaker::setPrintConfig(const Bool_t print) { mPrintConfig = print; }
310 inline void StMtdQAMaker::setVertexMode(const Int_t mode) { mVertexMode = mode; }
311 inline void StMtdQAMaker::setApplyMaxVtxDzCut(const Bool_t cut) { mApplyVtxDzCut = cut; }
312 inline void StMtdQAMaker::setMaxVtxZ(const Double_t max) { mMaxVtxZ = max; }
313 inline void StMtdQAMaker::setMaxVtxR(const Double_t max) { mMaxVtxR = max; }
314 inline void StMtdQAMaker::setMaxVtxDz(const Double_t max) { mMaxVtxDz = max; }
315 inline void StMtdQAMaker::setMinNHitsFit(const Int_t min) { mMinNHitsFit = min; }
316 inline void StMtdQAMaker::setMinNHitsDedx(const Int_t min) { mMinNHitsDedx = min; }
317 inline void StMtdQAMaker::setMinFitHitsFraction(const Double_t min){ mMinFitHitsFraction = min;}
318 inline void StMtdQAMaker::setMaxDca(const Double_t max) { mMaxDca = max; }
319 inline void StMtdQAMaker::setTriggerIDs(const IntVec id) { mTriggerIDs = id; }
320 inline void StMtdQAMaker::setTrackPtLimits(const Double_t min, const Double_t max)
321 { mMinTrkPt = min; mMaxTrkPt = max; }
322 
323 inline void StMtdQAMaker::setTrackPhiLimits(const Double_t min, const Double_t max)
324 { mMinTrkPhi = min; mMaxTrkPhi = max; }
325 
326 inline void StMtdQAMaker::setTrackEtaLimits(const Double_t min, const Double_t max)
327 { mMinTrkEta = min; mMaxTrkPhi = max;}
328 
329 inline void StMtdQAMaker::setMinMuonPt(const Double_t min)
330 { mMinMuonPt = min; }
331 
332 inline void StMtdQAMaker::setNsigmaPiCut(const Double_t min, const Double_t max)
333 { mMinNsigmaPi = min; mMaxNsigmaPi = max; }
334 
335 inline void StMtdQAMaker::setMuonDeltaZ(const Double_t min, const Double_t max)
336 { mMinMuonDeltaZ = min; mMaxMuonDeltaZ = max; }
337 
338 inline void StMtdQAMaker::setMuonDeltaY(const Double_t min, const Double_t max)
339 { mMinMuonDeltaY = min; mMaxMuonDeltaY = max; }
340 
341 inline void StMtdQAMaker::setMuonDeltaTof(const Double_t min, const Double_t max)
342 { mMinMuonDeltaTof = min; mMaxMuonDeltaTof = max; }
343 
344 inline void StMtdQAMaker::setMtdHitTrigger(const Bool_t trig)
345 { mMtdHitTrigger = trig; }
346 
347 
348 #endif
Holds information about track parameters.
Definition: StPicoTrack.h:35
Main class that keeps TClonesArrays with main classes.
Definition: StPicoDst.h:40
Holds information about the hit from MTD.
Definition: StPicoMtdHit.h:18