StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEmbeddingQAUtilities.h
1 //----------------------------------------------------------------------------------------------------
2 // Class StEmbeddingQAUtilities
3 // - Provide category id, such as 'MC' track in the minimc tree
4 //----------------------------------------------------------------------------------------------------
5 /****************************************************************************************************
6  * $Id: StEmbeddingQAUtilities.h,v 1.13 2019/07/10 05:46:53 zhux Exp $
7  * $Log: StEmbeddingQAUtilities.h,v $
8  * Revision 1.13 2019/07/10 05:46:53 zhux
9  * added option for btof pid for primary real tracks
10  *
11  * Revision 1.12 2012/03/05 10:32:50 cpowell
12  * Functions added to cut on refMult
13  *
14  * Revision 1.11 2011/04/26 20:27:22 hmasui
15  * Add isGamma function
16  *
17  * Revision 1.10 2011/04/05 23:12:35 hmasui
18  * Added getGeantId() function
19  *
20  * Revision 1.9 2011/04/01 05:02:48 hmasui
21  * Implement track selections (moved from StEmbeddingQATrack)
22  *
23  * Revision 1.8 2010/08/13 21:54:35 hmasui
24  * Separate charge for pi/K/p
25  *
26  * Revision 1.7 2010/07/12 21:27:29 hmasui
27  * Added StParticleTable & StParticleDefinition utilities
28  *
29  * Revision 1.6 2010/01/26 17:45:06 hmasui
30  * Add runid functions
31  *
32  * Revision 1.5 2009/12/22 21:37:55 hmasui
33  * Add comments for functions and members
34  *
35  ****************************************************************************************************/
36 
37 #ifndef __StEmbeddingQAUtilities_h__
38 #define __StEmbeddingQAUtilities_h__
39 
41 class TH1 ;
42 #include <map>
43 #include <vector>
44 #include "TString.h"
46 
47 //____________________________________________________________________________________________________
48 namespace StEmbeddingQAConst
49 {
50  //----------------------------------------------------------------------------------------------------
51  // id node description
52  //----------------------------------------------------------------------------------------------------
53  // 0 MC MC tracks (embedding)
54  // 1 MATCHED Matched pairs (embedding)
55  // 2 GHOST Ghost pairs (embedding)
56  // 3 CONTAM Contaminated pairs (embedding)
57  // 4 MATGLOB Matched global pairs (embedding)
58  //----------------------------------------------------------------------------------------------------
59  // 5 PRIMARY Primary tracks (real)
60  // 6 GLOBAL Global tracks (real)
61  //----------------------------------------------------------------------------------------------------
62  enum {
63  mNEmbedding = 5,
64  mNReal = 2,
65  mNCategory = mNEmbedding + mNReal
66  };
67 }
68 
69 //____________________________________________________________________________________________________
71  public:
74 
76  virtual ~StEmbeddingQAUtilities();
77 
78  // Track category for minimc nodes
79  Category getCategory(const UInt_t id) const ;
80  TString getCategoryName(const UInt_t id) const ;
81  TString getCategoryTitle(const UInt_t id) const ;
82  Int_t getCategoryId(const TString name) const ;
83 
84  // Input string is case insensitive
85  // - For example, MC, mc, mC and Mc are ok for isMc()
86  Bool_t isMc(const TString name) const ;
87  Bool_t isMatched(const TString name) const ;
88  Bool_t isGhost(const TString name) const ;
89  Bool_t isContaminated(const TString name) const ;
90  Bool_t isMatchedGlobal(const TString name) const ;
91  Bool_t isPrimary(const TString name) const ;
92  Bool_t isGlobal(const TString name) const ;
93  Bool_t isEmbedding(const TString name) const ;
94  Bool_t isReal(const TString name) const ;
95 
96  // Check geantid
97  Bool_t isElectron(const Int_t geantid) const ;
98  Bool_t isPositron(const Int_t geantid) const ;
99  Bool_t isPiPlus(const Int_t geantid) const ;
100  Bool_t isPiMinus(const Int_t geantid) const ;
101  Bool_t isKPlus(const Int_t geantid) const ;
102  Bool_t isKMinus(const Int_t geantid) const ;
103  Bool_t isProton(const Int_t geantid) const ;
104  Bool_t isPBar(const Int_t geantid) const ;
105  Bool_t isElectrons(const Int_t geantid) const ;
106  Bool_t isPions(const Int_t geantid) const ;
107  Bool_t isKaons(const Int_t geantid) const ;
108  Bool_t isProtons(const Int_t geantid) const ;
109  Bool_t isEPiKP(const Int_t geantid) const ;
110  Bool_t isGamma(const Int_t geantid) const ;
111 
112  // Histogram style
113  void setStyle() const ;
114  void setStyle(TH1* h) const ;
115 
116  // Run id
117  Int_t getRunId(const Int_t runnumber, const Int_t year) const ;
118  Int_t getRunNumber(const Int_t runid, const Int_t year) const ;
119 
121  StParticleDefinition* getParticleDefinition(const UInt_t geantid) const ;
122 
124  Bool_t isGeantIdOk(const UInt_t geantid) const ;
125 
127  Int_t getGeantId(const UInt_t geantid) const ;
128 
130  Float_t getPtMinCut() const ;
131  Float_t getPtMaxCut() const ;
132  Float_t getEtaCut() const ;
133  Short_t getNHitCut() const ;
134  Float_t getNHitToNPossCut() const ;
135  Float_t getDcaCut() const ;
136  Double_t getNSigmaCut() const ;
137  Bool_t getBTofPid() const ;
138  Float_t getRapidityCut() const ;
139  Float_t getZVertexCut() const ;
140  Int_t getRefMultMinCut() const ;
141  Int_t getRefMultMaxCut() const ;
142  std::vector<UInt_t> getTriggerIdCut() const ;
143 
145  Float_t setPtMinCut(const Float_t val) ;
146  Float_t setPtMaxCut(const Float_t val) ;
147  Float_t setEtaCut(const Float_t val) ;
148  Short_t setNHitCut(const Short_t val) ;
149  Float_t setNHitToNPossCut(const Float_t val) ;
150  Float_t setDcaCut(const Float_t val) ;
151  Double_t setNSigmaCut(const Double_t val) ;
152  Bool_t setBTofPid(const Bool_t val) ;
153  Float_t setRapidityCut(const Float_t val) ;
154  Float_t setZVertexCut(const Float_t val) ;
155  Int_t setRefMultMinCut(const Int_t val) ;
156  Int_t setRefMultMaxCut(const Int_t val) ;
157  void addTriggerIdCut(const UInt_t val) ;
158 
160  Bool_t isPtOk(const Float_t pt) const ;
161  Bool_t isEtaOk(const Float_t eta) const ;
162  Bool_t isNHitsFitOk(const Float_t nHitsFit) const ;
163  Bool_t isNHitToNPossOk(const Float_t ratio) const ;
164  Bool_t isDcaOk(const Float_t dca) const ;
165  Bool_t isNSigmaOk(const Float_t nsigma) const ;
166  Bool_t isRapidityOk(const Float_t y) const ;
167  Bool_t isZVertexOk(const Float_t vz) const ;
168  Bool_t isRefMultOk(const Int_t refMult) const ;
169  Bool_t isTriggerOk(const UInt_t trigger) const ;
170 
172  void PrintCuts() const ;
173 
174  private:
177 
179  static StEmbeddingQAUtilities* mInstance ;
180 
182  Bool_t CompareString(const TString s0, const TString s1, const Bool_t isExact=kFALSE) const ;
183 
184  // Data members
185  Category mCategory[StEmbeddingQAConst::mNEmbedding] ;
186  TString mCategoryName[StEmbeddingQAConst::mNCategory] ;
187  TString mCategoryTitle[StEmbeddingQAConst::mNCategory] ;
188  std::map<const TString, const UInt_t> mCategoryId ;
189 
190  // Moved track selections from StEmbeddingQATrack
191  // To change the track selections, use Set...() function, for example
192  // StEmbeddingQAUtilities::Instance()->SetPtMinCut(0.2);
193  // The cut values will be displayed in the pdf file
194  Float_t mPtMinCut ;
195  Float_t mPtMaxCut ;
196  Float_t mEtaCut ;
197  Short_t mNHitCut ;
198  Float_t mNHitToNPossCut ;
199  Float_t mDcaCut ;
200  Double_t mNSigmaCut ;
201  Bool_t mBTofPid ;
202  Float_t mRapidityCut ;
203  Float_t mZVertexCut ;
204  Int_t mRefMultMinCut ;
205  Int_t mRefMultMaxCut ;
206  std::vector<UInt_t> mTriggerIdCut ;
207 
208 
209  // Run id
210  Int_t getYearNumber(const Int_t year) const ; // (year - 2000 + 1) * 10^6
211 
213  // See details in the source code
214  UInt_t convertGeantId(const UInt_t geantid) const ;
215 
216  ClassDef(StEmbeddingQAUtilities, 1)
217 };
218 
219 //____________________________________________________________________________________________________
220 inline Int_t StEmbeddingQAUtilities::getYearNumber(const Int_t year) const { return (year - 1999) * 1000000 ; }
221 
222 //____________________________________________________________________________________________________
223 inline Int_t StEmbeddingQAUtilities::getRunId(const Int_t runnumber, const Int_t year) const
224 {
225  return runnumber + getYearNumber(year) ;
226 }
227 
228 //____________________________________________________________________________________________________
229 inline Int_t StEmbeddingQAUtilities::getRunNumber(const Int_t runid, const Int_t year) const
230 {
231  return runid - getYearNumber(year) ;
232 }
233 
234 #endif
235 
236 
Bool_t isMatchedGlobal(const TString name) const
Check whether the track is Contaminated pair or not.
Bool_t isElectrons(const Int_t geantid) const
Check the input geantid is pbar.
void PrintCuts() const
Print all track selections.
Bool_t isKPlus(const Int_t geantid) const
Check the input geantid is pi-.
Bool_t isGlobal(const TString name) const
Check whether the track is primary track or not.
Bool_t isEPiKP(const Int_t geantid) const
Check the input geantid is protons.
Bool_t isGhost(const TString name) const
Check whether the track is Matched pair or not.
Bool_t isReal(const TString name) const
Check whether the track is embedding pair or not.
Bool_t isPrimary(const TString name) const
Check whether the track is Contaminated pair or not.
Bool_t isEmbedding(const TString name) const
Check whether the track is global track or not.
Float_t setPtMinCut(const Float_t val)
Set track and event selections, return new value.
Category getCategory(const UInt_t id) const
Bool_t isElectron(const Int_t geantid) const
Check whether the track is real track or not.
Bool_t isGamma(const Int_t geantid) const
Check the input geantid is e/pi/K/p.
Bool_t isPBar(const Int_t geantid) const
Check the input geantid is p.
Top level class for the MiniMcTree, containing event-wise information and the McTrack, and all TrackPair collections.
TString getCategoryName(const UInt_t id) const
Category from category id.
void setStyle() const
Check the input geantid is gamma.
Bool_t isContaminated(const TString name) const
Check whether the track is Ghost pair or not.
StParticleDefinition * getParticleDefinition(const UInt_t geantid) const
runnumber = runid - (year - 2000 + 1) * 10^6
Bool_t isPiMinus(const Int_t geantid) const
Check the input geantid is pi+.
Bool_t isProton(const Int_t geantid) const
Check the input geantid is K-.
Int_t getGeantId(const UInt_t geantid) const
Return geant id.
Bool_t isPositron(const Int_t geantid) const
Check the input geantid is e-.
Int_t getRunNumber(const Int_t runid, const Int_t year) const
get runid from runnumber
Bool_t isProtons(const Int_t geantid) const
Check the input geantid is kaons.
Float_t getPtMinCut() const
Get track and event selections.
Int_t getRunId(const Int_t runnumber, const Int_t year) const
Set font, title and label styles.
Bool_t isGeantIdOk(const UInt_t geantid) const
Check geant id is defined in StParticleTable or not.
static StEmbeddingQAUtilities * instance()
Get instance.
Bool_t isPions(const Int_t geantid) const
Check the input geantid is electrons.
Bool_t isKMinus(const Int_t geantid) const
Check the input geantid is K+.
virtual ~StEmbeddingQAUtilities()
Destructor.
TString getCategoryTitle(const UInt_t id) const
Category name from category id.
Bool_t isKaons(const Int_t geantid) const
Check the input geantid is pions.
Bool_t isMatched(const TString name) const
Check whether the track is MC track or not.
Int_t getCategoryId(const TString name) const
Category title from category id.
Bool_t isPtOk(const Float_t pt) const
Track and event cuts.
Bool_t isMc(const TString name) const
Category id from category name.
Bool_t isPiPlus(const Int_t geantid) const
Check the input geantid is e+.