StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEStructEventCuts.h
1 /**********************************************************************
2  *
3  * $Id: StEStructEventCuts.h,v 1.16 2011/08/02 20:31:25 prindle Exp $
4  *
5  * Author: Jeff Porter
6  *
7  **********************************************************************
8  *
9  * Description: Cut class for event level quantities
10  *
11  *
12  ***********************************************************************/
13 #ifndef __STEBYEEVENTCUTS__H
14 #define __STEBYEEVENTCUTS__H
15 
16 
17 #include "StMuDSTMaker/COMMON/StMuDst.h"
18 #include "StMuDSTMaker/COMMON/StMuEvent.h"
19 #include "StMuDSTMaker/COMMON/StMuPrimaryVertex.h"
20 #include "StMuDSTMaker/COMMON/StMuL3EventSummary.h"
21 #include "StEStructCuts.h"
22 #include "Stiostream.h"
23 #include "TH1F.h"
24 #include "TH2F.h"
25 
27 
28 protected:
29 
30  CutName mtWordName;
31  CutName mpVertexZName;
32  CutName mpVPDVertexName;
33  CutName mpVertexRadiusName;
34  CutName mcentralityName;
35  CutName mgoodtoffractionName;
36  CutName mgoodprimaryfractionName;
37  CutName mZVertSepName;
38  CutName mZVertMatchName;
39 
40 
41  char mRunPeriod[1024];
42  bool mtrgByRunPeriod;
43  unsigned int mtWord[2];
44  float mpVertexZ[2];
45  float mpVPDVertex[2];
46  float mpVertexRadius[2];
47  float mcentrality[2];
48  float mgoodtoffraction[2];
49  float mgoodprimaryfraction[2];
50  float mZVertSep[2];
51  float mZVertMatch[2];
52  int badTrigger;
53 
54  void init();
55  void initCuts();
56  void initNames();
57 
58 public:
59 
61  StEStructEventCuts(const char* cutFileName);
62  virtual ~StEStructEventCuts();
63 
64  virtual bool loadBaseCuts(const char* name, const char** vals, int nvals);
65  virtual void loadUserCuts(const char* name, const char** vals, int nvals);
66  virtual void printCutStats(ostream& ofs);
67 
68 
69  bool goodTrigger(StMuDst* muDst);
70  bool goodVertexTopology(StMuDst* muDst);
71  bool goodPrimaryVertexZ( float z );
72  bool goodVPDVertex( float dz );
73  bool goodPrimaryVertexRadius( float r );
74  bool hasPrimaryVertexRadiusCut();
75  bool goodCentrality( float n);
76  bool goodToFFraction(int ndEdx, int nToF);
77  bool hasToFFractionCut();
78  bool goodPrimaryFraction(int ndPrimary, int nGlobal);
79  bool hasPrimaryFractionCut();
80  bool goodZVertSep(float dz);
81  bool hasZVertSepCut();
82  bool goodZVertMatch(float dz);
83  bool hasZVertMatchCut();
84 
85  char* triggerWordName(){ return (char*)mtWordName.name; };
86  char* primaryVertexZName() { return (char*) mpVertexZName.name; };
87  char* primaryVPDVertexName() { return (char*) mpVPDVertexName.name; };
88  char* primaryVertexRadiusName() { return (char*) mpVertexRadiusName.name; };
89  char* centralityName() { return (char*) mcentralityName.name; };
90  char* goodtoffractionName() { return (char*) mgoodtoffractionName.name; };
91  char* goodprimaryfractionName() { return (char*) mgoodprimaryfractionName.name; };
92  char* zVertSepName() { return (char*) mZVertSepName.name; };
93  char* zVertMatchName() { return (char*) mZVertMatchName.name; };
94 
95 
96  ClassDef(StEStructEventCuts,1)
97 
98 };
99 
100 inline void StEStructEventCuts::loadUserCuts(const char* name, const char** vals, int nvals){}
101 
102 inline bool StEStructEventCuts::goodPrimaryVertexZ(float z) {
103  mvalues[mpVertexZName.idx] = z;
104  if (mpVertexZ[0]==mpVertexZ[1] && mpVertexZ[0]==0) {
105  return true;
106  }
107  return (z>=mpVertexZ[0] && z<=mpVertexZ[1]);
108 }
109 
110 inline bool StEStructEventCuts::goodVPDVertex(float dz) {
111  mvalues[mpVPDVertexName.idx] = dz;
112  if (mpVPDVertex[0]==mpVPDVertex[1] && mpVPDVertex[0]==0) {
113  return true;
114  }
115  return (dz>=mpVPDVertex[0] && dz<=mpVPDVertex[1]);
116 }
117 
118 inline bool StEStructEventCuts::goodPrimaryVertexRadius(float r) {
119  mvalues[mpVertexRadiusName.idx] = r;
120  if (mpVertexRadius[0]==mpVertexRadius[1] && mpVertexRadius[0]==0) {
121  return true;
122  }
123  return (r>=mpVertexRadius[0] && r<=mpVertexRadius[1]);
124 }
125 inline bool StEStructEventCuts::hasPrimaryVertexRadiusCut() {
126  return (mpVertexRadius[1]!=0);
127 }
128 
129 inline bool StEStructEventCuts::goodCentrality(float c){
130  mvalues[mcentralityName.idx] = c;
131  return ( (mcentrality[0]==mcentrality[1] && mcentrality[0]==0) ||
132  (c>=mcentrality[0] && c<=mcentrality[1]) );
133 }
134 
135 inline bool StEStructEventCuts::goodToFFraction(int ndEdx, int nToF) {
136  if (mgoodtoffraction[0]==mgoodtoffraction[1] && mgoodtoffraction[0]==0) {
137  return true;
138  }
139  // Need to check this cut at 2 is reasonable. May cause problem at low multiplicity
140  if (nToF < 2) {
141  return false;
142  }
143  float sToF = nToF - ndEdx * mgoodtoffraction[0];
144  if ((fabs(sToF) < mgoodtoffraction[1]) &&
145  (sToF > -0.5*ndEdx)) {
146  return true;
147  }
148  return false;
149 }
150 inline bool StEStructEventCuts::hasToFFractionCut() {
151  return (mgoodtoffraction[0]!=mgoodtoffraction[1]);
152 }
153 
154 inline bool StEStructEventCuts::goodPrimaryFraction(int nPrimary, int nGlobal) {
155  if (mgoodprimaryfraction[0]==mgoodprimaryfraction[1] && mgoodprimaryfraction[0]==0) {
156  return true;
157  }
158  float dPrim = nGlobal/mgoodprimaryfraction[0] - nPrimary;
159  if (dPrim < mgoodprimaryfraction[1]) {
160  return true;
161  }
162  return false;
163 }
164 inline bool StEStructEventCuts::hasPrimaryFractionCut() {
165  return (mgoodprimaryfraction[0]!=mgoodprimaryfraction[1]);
166 }
167 
168 inline bool StEStructEventCuts::goodZVertSep(float dz){
169  mvalues[mZVertSepName.idx] = dz;
170  return ( (mZVertSep[0]==mZVertSep[1] && mZVertSep[0]==0) ||
171  (dz<mZVertSep[0] || mZVertSep[1]<dz) );
172 }
173 inline bool StEStructEventCuts::hasZVertSepCut() {
174  return (mZVertSep[0]!=mZVertSep[1]);
175 }
176 
177 inline bool StEStructEventCuts::goodZVertMatch(float dz){
178  // If dz is between cuts we want to reject vertex
179  mvalues[mZVertMatchName.idx] = dz;
180  return ( (mZVertMatch[0]==mZVertMatch[1] && mZVertMatch[0]==0) ||
181  (dz<mZVertMatch[0] || mZVertMatch[1]<dz) );
182 }
183 inline bool StEStructEventCuts::hasZVertMatchCut() {
184  return (mZVertMatch[0]!=mZVertMatch[1]);
185 }
186 
187 #endif
188 
189 /***********************************************************************
190  *
191  * $Log: StEStructEventCuts.h,v $
192  * Revision 1.16 2011/08/02 20:31:25 prindle
193  * Change string handling
194  * Added event cuts for VPD, good fraction of global tracks are primary, vertex
195  * found only from tracks on single side of TPC, good fraction of primary tracks have TOF hits..
196  * Added methods to check if cuts imposed
197  * Added 2010 200GeV and 62 GeV, 2011 19 GeV AuAu datasets, 200 GeV pp2pp 2009 dataset.
198  * Added TOF vs. dEdx vs. p_t histograms
199  * Fix participant histograms in QAHists.
200  * Added TOFEMass cut in TrackCuts although I think we want to supersede this.
201  *
202  * Revision 1.15 2010/09/02 21:20:09 prindle
203  * Cuts: Add flag to not fill histograms. Important when scanning files for sorting.
204  * EventCuts: Add radius cut on vertex, ToF fraction cut. Merge 2004 AuAu 200 GeV datasets.
205  * Add 7, 11 and 39 GeV dataset selections
206  * MuDstReader: Add 2D histograms for vertex radius and ToF fraction cuts.
207  * Modify countGoodTracks to return number of dEdx and ToF pid identified tracks.
208  * Include code to set track pid information from Dst.
209  * QAHists: New ToF QA hists. Modify dEdx to include signed momentum.
210  *
211  * Revision 1.14 2010/03/02 21:43:38 prindle
212  * Use outerHelix() for global tracks
213  * Add sensible triggerId histograms
214  * Starting to add support to sort events (available for Hijing)
215  *
216  * Revision 1.13 2008/12/02 23:35:34 prindle
217  * Added code for pileup rejection in EventCuts and MuDstReader.
218  * Modified trigger selections for some data sets in EventCuts.
219  *
220  * Revision 1.12 2008/03/19 22:01:59 prindle
221  * Updated some dataset definitions.
222  *
223  * Revision 1.11 2007/11/27 23:00:02 prindle
224  * Added cucu22 GeV data set as possible input
225  *
226  * Revision 1.10 2007/11/26 19:52:24 prindle
227  * Add cucu62, cucu200 2007ib production datasets.
228  * Included vertex cuts for case of ranked vertices. (Pass muDst pointer to EventCuts)
229  * Add n^(1/4) histograms to QAHists
230  *
231  * Revision 1.9 2006/04/27 22:20:07 prindle
232  * Some changes in trigger names for run periods.
233  * Changed a couple of the Hijing QA histograms.
234  *
235  * Revision 1.8 2006/04/25 21:02:51 msd
236  * Added AuAu200GeVCentral2001 and dAu200GeVMinBias2003
237  *
238  * Revision 1.7 2006/04/10 23:40:40 porter
239  * Fixed the minbias trigger definition for the CuCu 200 2005 run
240  *
241  * Revision 1.6 2006/04/04 22:05:05 porter
242  * a handful of changes:
243  * - changed the StEStructAnalysisMaker to contain 1 reader not a list of readers
244  * - added StEStructQAHists object to contain histograms that did exist in macros or elsewhere
245  * - made centrality event cut taken from StEStructCentrality singleton
246  * - put in ability to get any max,min val from the cut class - one must call setRange in class
247  *
248  * Revision 1.5 2006/02/22 22:03:18 prindle
249  * Removed all references to multRef
250  *
251  * Revision 1.4 2005/09/14 17:08:34 msd
252  * Fixed compiler warnings, a few tweaks and upgrades
253  *
254  * Revision 1.3 2005/09/07 20:18:40 prindle
255  * AnalysisMaker: Keep track of currentAnalysis (for use in doEStruct macro)
256  * EventCuts.h: Added trigger cuts including cucu and year 4.
257  * MuDstReader: Added dE/dx histograms. Re-arranged code to count tracks
258  * before making centrality cut.
259  * TrackCuts: Random changes. Moved some variables from private to public.o
260  *
261  * Revision 1.2 2004/09/24 01:41:42 prindle
262  * Allow for cuts to be defined by character strings. I use this to select trigger
263  * cuts appropriate for run periods
264  *
265  * Revision 1.1 2003/10/15 18:20:32 porter
266  * initial check in of Estruct Analysis maker codes.
267  *
268  *
269  *********************************************************************/
270 
271 
272 
273 
274 
275 
276 
277