StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEStructTrackCuts.cxx
1 /**********************************************************************
2  *
3  * $Id: StEStructTrackCuts.cxx,v 1.6 2012/11/16 21:19:08 prindle Exp $
4  *
5  * Author: Jeff Porter
6  *
7  **********************************************************************
8  *
9  * Description: Cut class for track level quantities
10  *
11  *
12  ***********************************************************************/
13 #include "StEStructTrackCuts.h"
14 #include <math.h>
15 #include <stdlib.h>
16 
17 ClassImp(StEStructTrackCuts)
18 
20 StEStructTrackCuts::StEStructTrackCuts(const char* cutfileName): StEStructCuts(cutfileName) { init(); };
21 
22 StEStructTrackCuts::~StEStructTrackCuts() {};
23 
24 void StEStructTrackCuts::init(){
25 
26  strcpy(mcutTypeName,"Track");
27  initCuts();
28  initNames();
29  if(isLoaded())loadCuts();
30 
31 }
32 
33 void StEStructTrackCuts::initCuts(){
34 
35  mflag[0]=mflag[1]=0;
36  mcharge[0]=mcharge[1]=0;
37  mnfitpoints[0]=mnfitpoints[1]=0;
38  mnfitnmax[0]=mnfitnmax[1]=0;
39  mglobalDCA[0]=mglobalDCA[1]=0;
40  mchi2[0]=mchi2[1]=0;
41  mdPtByPt[0]=mdPtByPt[1]=0;
42  mpt[0]=mpt[1]=0;
43  myt[0]=myt[1]=0;
44  mxt[0]=mxt[1]=0;
45  mphi[0]=mphi[1]=0;
46  meta[0]=meta[1]=0;
47  mTOFEMass[0]=mTOFEMass[1]=0;
48  mnsigmaE[0]=mnsigmaE[1]=0;
49  mnsigmaPi[0]=mnsigmaPi[1]=0;
50  mnsigmaK[0]=mnsigmaK[1]=0;
51  mnsigmaP[0]=mnsigmaP[1]=0;
52  mhijingFragment[0]=mhijingFragment[1]=0;
53  mNFragTypes = 0;
54  mnJets = 0;
55 
56 }
57 
58 void StEStructTrackCuts::initNames(){
59 
60  strcpy(mflagName.name,"Flag");
61  strcpy(mchargeName.name,"Charge");
62  strcpy(mnfitpointsName.name,"NFitPoints");
63  strcpy(mnfitnmaxName.name,"NFitPerNMax");
64  strcpy(mglobalDCAName.name,"GlobalDCA");
65  strcpy(mchi2Name.name,"Chi2");
66  strcpy(mdPtByPtName.name,"dPtByPt");
67  strcpy(mptName.name,"Pt");
68  strcpy(mytName.name,"Yt");
69  strcpy(mxtName.name,"Xt") ;
70  strcpy(mphiName.name,"Phi");
71  strcpy(metaName.name,"Eta");
72  strcpy(mTOFEMassName.name,"TOFEMass");
73  strcpy(mnsigmaEName.name,"NSigmaElectron");
74  strcpy(mnsigmaPiName.name,"NSigmaPion");
75  strcpy(mnsigmaKName.name,"NSigmaKaon");
76  strcpy(mnsigmaPName.name,"NSigmaProton");
77  strcpy(mhijingFragmentName.name,"hijingFragment");
78 
79 }
80 
81 bool StEStructTrackCuts::loadBaseCuts(const char* name, const char** vals, int nvals){
82 
83  if(!strcmp(name,mflagName.name)){
84  mflag[0]=atoi(vals[0]); mflag[1]=atoi(vals[1]);
85  mflagName.idx = createCutHists(name,mflag);
86  return true;
87  }
88 
89  if(!strcmp(name,mchargeName.name)){
90  mcharge[0]=atoi(vals[0]); mcharge[1]=atoi(vals[1]);
91  mchargeName.idx = createCutHists(name,mcharge);
92  return true;
93  }
94 
95  if(!strcmp(name,mnfitpointsName.name)){
96  mnfitpoints[0]=atoi(vals[0]); mnfitpoints[1]=atoi(vals[1]);
97  mnfitpointsName.idx = createCutHists(name,mnfitpoints);
98  setRange(mnfitpointsName.name,mnfitpoints[0],mnfitpoints[1]);
99  return true;
100  }
101 
102  if(!strcmp(name,mnfitnmaxName.name)){
103  mnfitnmax[0]=atof(vals[0]); mnfitnmax[1]=atof(vals[1]);
104  mnfitnmaxName.idx = createCutHists(name,mnfitnmax);
105  return true;
106  }
107 
108  if(!strcmp(name,mglobalDCAName.name)){
109  mglobalDCA[0]=atof(vals[0]); mglobalDCA[1]=atof(vals[1]);
110  mglobalDCAName.idx = createCutHists(name,mglobalDCA);
111  return true;
112  }
113 
114  if(!strcmp(name,mchi2Name.name)){
115  mchi2[0]=atof(vals[0]); mchi2[1]=atof(vals[1]);
116  mchi2Name.idx = createCutHists(name,mchi2);
117  return true;
118  }
119 
120  if(!strcmp(name,mdPtByPtName.name)){
121  mdPtByPt[0]=atof(vals[0]); mdPtByPt[1]=atof(vals[1]);
122  mdPtByPtName.idx = createCutHists(name,mdPtByPt);
123  return true;
124  }
125 
126  if(!strcmp(name,mptName.name)){
127  mpt[0]=atof(vals[0]); mpt[1]=atof(vals[1]);
128  mptName.idx = createCutHists(name,mpt);
129  setRange(mptName.name,mpt[0],mpt[1]);
130  return true;
131  }
132 
133  if(!strcmp(name,mytName.name)){
134  myt[0]=atof(vals[0]); myt[1]=atof(vals[1]);
135  mytName.idx = createCutHists(name,myt);
136  setRange(mytName.name,myt[0],myt[1]);
137  return true;
138  }
139 
140  if(!strcmp(name,mxtName.name)){
141  mxt[0]=atof(vals[0]); mxt[1]=atof(vals[1]);
142  mxtName.idx = createCutHists(name,mxt);
143  setRange(mxtName.name,mxt[0],mxt[1]);
144  return true;
145  }
146 
147  if(!strcmp(name,mphiName.name)){
148  mphi[0]=(float)(M_PI*atof(vals[0])); mphi[1]=(float)(M_PI*atof(vals[1]));
149  mphiName.idx = createCutHists(name,mphi);
150  setRange(mphiName.name,mphi[0],mphi[1]);
151  return true;
152  }
153 
154  if(!strcmp(name,metaName.name)){
155  meta[0]=atof(vals[0]); meta[1]=atof(vals[1]);
156  metaName.idx = createCutHists(name,meta);
157  setRange(metaName.name,meta[0],meta[1]);
158  return true;
159  }
160 
161  if(!strcmp(name,mTOFEMassName.name)){
162  mTOFEMass[0]=atof(vals[0]); mTOFEMass[1]=atof(vals[1]);
163  mTOFEMassName.idx = createCutHists(name,mTOFEMass);
164  return true;
165  }
166 
167  if(!strcmp(name,mnsigmaEName.name)){
168  mnsigmaE[0]=atof(vals[0]); mnsigmaE[1]=atof(vals[1]);
169  mnsigmaEName.idx = createCutHists(name,mnsigmaE);
170  return true;
171  }
172 
173  if(!strcmp(name,mnsigmaPiName.name)){
174  mnsigmaPi[0]=atof(vals[0]); mnsigmaPi[1]=atof(vals[1]);
175  mnsigmaPiName.idx = createCutHists(name,mnsigmaPi);
176  return true;
177  }
178 
179  if(!strcmp(name,mnsigmaKName.name)){
180  mnsigmaK[0]=atof(vals[0]); mnsigmaK[1]=atof(vals[1]);
181  mnsigmaKName.idx = createCutHists(name,mnsigmaK);
182  return true;
183  }
184 
185  if(!strcmp(name,mnsigmaPName.name)){
186  mnsigmaP[0]=atof(vals[0]); mnsigmaP[1]=atof(vals[1]);
187  mnsigmaPName.idx = createCutHists(name,mnsigmaP);
188  return true;
189  }
190 
191  if(!strcmp(name,mhijingFragmentName.name)){
192  // I am setting this up so if mNFragTypes is non-zero we only accept
193  // particles that are in the list mFragTypes.
194  // I am not sure how to do accounting so one can look at log files
195  // to see a sensible thing has been done (but at least we have the Cuts
196  // file to see what we were trying to do).
197  sscanf(vals[0],"%s\t",mFragmentType);
198  if (!strcmp(mFragmentType,"projectileString")) {
199  mFragTypes[mNFragTypes] = 3;
200  mNFragTypes++;
201  } else if (!strcmp(mFragmentType,"targetString")) {
202  mFragTypes[mNFragTypes] = 13;
203  mNFragTypes++;
204  } else if (!strcmp(mFragmentType,"hardScatter")) {
205  mFragTypes[mNFragTypes] = 20;
206  mNFragTypes++;
207  } else if (!strcmp(mFragmentType,"softSea")) {
208  mFragTypes[mNFragTypes] = 30;
209  mNFragTypes++;
210  }
211  if (mhijingFragment[1]==0) {
212  mhijingFragment[0]=0; mhijingFragment[1]=50;
213  mhijingFragmentName.idx = createCutHists(name,mhijingFragment);
214  }
215  return true;
216  }
217 
218 
219  return false;
220 
221 }
222 
223 bool StEStructTrackCuts::goodFragment(int ifragtype){
224  mvalues[mhijingFragmentName.idx] = ifragtype;
225  if (mNFragTypes == 0) {
226  return true;
227  }
228  for (int it=0;it<mNFragTypes;it++) {
229  if (mFragTypes[it] == ifragtype) {
230  if (ifragtype == 20) {
231  mnJets++;
232  }
233  return true;
234  }
235  }
236  return false;
237 };
238 
239 
240 void StEStructTrackCuts::printCutStats(ostream& ofs){
241 
242  // ofs<<"# ******************************************** "<<endl;
243  // ofs<<"# *************** Track Cuts ***************** "<<endl;
244  // ofs<<"# *** format = variable,minvalue,maxvalue *** "<<endl;
245  // ofs<<"# ******************************************** "<<endl;
246  ofs<<endl;
247  ofs<<mflagName.name<<","<<mflag[0]<<","<<mflag[1]<<"\t\t\t"<<" # track flag cut"<<endl;
248  ofs<<mchargeName.name<<","<<mcharge[0]<<","<<mcharge[1]<<"\t\t\t"<<" # charge cut"<<endl;
249  ofs<<mnfitpointsName.name<<","<<mnfitpoints[0]<<","<<mnfitpoints[1]<<"\t\t"<<" # fit points cut"<<endl;
250  ofs<<mnfitnmaxName.name<<","<<mnfitnmax[0]<<","<<mnfitnmax[1]<<"\t\t"<<" # fitpoints per possible cut"<<endl;
251  ofs<<mglobalDCAName.name<<","<<mglobalDCA[0]<<","<<mglobalDCA[1]<<"\t\t\t"<<" # global DCA cut"<<endl;
252  ofs<<mchi2Name.name<<","<<mchi2[0]<<","<<mchi2[1]<<"\t\t\t"<<" # chi square cut"<<endl;
253  ofs<<mdPtByPtName.name<<","<<mdPtByPt[0]<<","<<mdPtByPt[1]<<"\t\t\t"<<" # sigma for determination of sign of charge"<<endl;
254  ofs<<mptName.name<<","<<mpt[0]<<","<<mpt[1]<<"\t\t\t"<<" # pt cut"<<endl;
255  ofs<<mytName.name<<","<<myt[0]<<","<<myt[1]<<"\t\t\t"<<" # yt cut"<<endl;
256  ofs<<mphiName.name<<","<<mphi[0]/M_PI<<","<<mphi[1]/M_PI<<"\t\t\t"<<" # phi cut in factor of pi"<<endl;
257  ofs<<metaName.name<<","<<meta[0]<<","<<meta[1]<<"\t\t\t"<<" # eta cut"<<endl;
258  ofs<<mTOFEMassName.name<<","<<mTOFEMass[0]<<","<<mTOFEMass[1]<<"\t\t"<<" # num TOF electron Mass cut"<<endl;
259  ofs<<mnsigmaEName.name<<","<<mnsigmaE[0]<<","<<mnsigmaE[1]<<"\t\t"<<" # num sigma electron cut"<<endl;
260  ofs<<mnsigmaPiName.name<<","<<mnsigmaPi[0]<<","<<mnsigmaPi[1]<<"\t\t\t"<<" # num sigma Pion cut"<<endl;
261  ofs<<mnsigmaKName.name<<","<<mnsigmaK[0]<<","<<mnsigmaK[1]<<"\t\t\t"<<" # num sigma Kaon cut"<<endl;
262  ofs<<mnsigmaPName.name<<","<<mnsigmaP[0]<<","<<mnsigmaP[1]<<"\t\t"<<" # num sigma proton cut"<<endl;
263  // ofs<<"# ******************************************** "<<endl<<endl;
264 
265 }
266 
267 
268 /***********************************************************************
269  *
270  * $Log: StEStructTrackCuts.cxx,v $
271  * Revision 1.6 2012/11/16 21:19:08 prindle
272  * Moved EventCuts, TrackCuts to EventReader. Affects most readers.
273  * Added support to write and read EStructEvents.
274  * Cuts: 3D histo support, switch to control filling of histogram for reading EStructEvents
275  * EventCuts: A few new cuts
276  * MuDstReader: Add 2D to some histograms, treat ToFCut, PrimaryCuts, VertexRadius histograms like other cut histograms.
277  * QAHists: Add refMult
278  * TrackCuts: Add some hijing cuts.
279  *
280  * Revision 1.5 2011/08/02 20:31:26 prindle
281  * Change string handling
282  * Added event cuts for VPD, good fraction of global tracks are primary, vertex
283  * found only from tracks on single side of TPC, good fraction of primary tracks have TOF hits..
284  * Added methods to check if cuts imposed
285  * Added 2010 200GeV and 62 GeV, 2011 19 GeV AuAu datasets, 200 GeV pp2pp 2009 dataset.
286  * Added TOF vs. dEdx vs. p_t histograms
287  * Fix participant histograms in QAHists.
288  * Added TOFEMass cut in TrackCuts although I think we want to supersede this.
289  *
290  * Revision 1.4 2008/12/02 23:35:35 prindle
291  * Added code for pileup rejection in EventCuts and MuDstReader.
292  * Modified trigger selections for some data sets in EventCuts.
293  *
294  * Revision 1.3 2006/04/04 22:05:07 porter
295  * a handful of changes:
296  * - changed the StEStructAnalysisMaker to contain 1 reader not a list of readers
297  * - added StEStructQAHists object to contain histograms that did exist in macros or elsewhere
298  * - made centrality event cut taken from StEStructCentrality singleton
299  * - put in ability to get any max,min val from the cut class - one must call setRange in class
300  *
301  * Revision 1.2 2005/09/14 17:08:36 msd
302  * Fixed compiler warnings, a few tweaks and upgrades
303  *
304  * Revision 1.1 2003/10/15 18:20:32 porter
305  * initial check in of Estruct Analysis maker codes.
306  *
307  *
308  *********************************************************************/
309 
310 
311 
312