StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEStructCutBin.h
1 /**********************************************************************
2  *
3  * $Id: StEStructCutBin.h,v 1.16 2013/02/08 19:32:43 prindle Exp $
4  *
5  * Author: Jeff Porter
6  *
7  **********************************************************************
8  *
9  * Description: Cut-bins for building histograms based on kinematic selections
10  * Singleton class with several implementations based on
11  * a mode ID
12  *
13  ***********************************************************************/
14 #ifndef __STESTRUCTCUTBIN__H
15 #define __STESTRUCTCUTBIN__H
16 
17 #include "Stiostream.h"
18 #include "TObject.h"
19 #include "TH1D.h"
20 #include "StEStructPairCuts.h"
21 
22 class StEStructTrack;
23 
24 class StEStructCutBin : public TObject {
25 
26  protected:
27 
28  int mcutMode;
29  int mnumBins;
30  int mnumParentBins;
31  char* mcutModeName;
32  int mcutBinHistMode;
33  double mMaxDEta;
34 
35  TH1D** mHCutBinHists[8];
36 
37  static StEStructCutBin* mInstance;
38  StEStructCutBin(): mcutMode(0), mnumBins(1), mcutModeName(0), mcutBinHistMode(0), mMaxDEta(2) { setMode(0); };
39  // StEStructCutBin(int mode){ setMode(mode); };
40 
41  int getCutBinMode1(StEStructPairCuts *pc);
42  int getCutBinMode2(StEStructPairCuts *pc);
43  int getCutBinMode3(StEStructPairCuts *pc);
44  int getCutBinMode4(StEStructPairCuts *pc);
45  int getCutBinMode5(StEStructPairCuts *pc, int pairCase);
46  int getCutBinMode6(StEStructPairCuts *pc, int zbin);
47  int getCutBinMode7(StEStructPairCuts *pc, int zbin);
48  int getCutBinMode8(StEStructPairCuts *pc);
49  int getCutBinMode9(StEStructPairCuts *pc);
50  int getCutBinMode10(StEStructPairCuts *pc);
51  int ignorePair5(StEStructPairCuts *pc);
52  int symmetrizeXX3(StEStructPairCuts *pc);
53  int symmetrizeXX5(StEStructPairCuts *pc);
54  int symmetrizeXX8(StEStructPairCuts *pc);
55  int symmetrizeXX9(StEStructPairCuts *pc);
56  int switchXX3(StEStructPairCuts *pc);
57  int switchXX5(StEStructPairCuts *pc);
58  int switchXX8(StEStructPairCuts *pc);
59  int switchXX9(StEStructPairCuts *pc);
60  int notSymmetrizedXX3(int cutBin, int pairCharge);
61  int notSymmetrizedXX5(int cutBin, int pairCharge);
62  int notSymmetrizedXX8(int cutBin, int pairCharge);
63  int notSymmetrizedXX9(int cutBin, int pairCharge);
64 
65  void initCutBinHists5();
66  void writeCutBinHists5();
67 
68  public:
69 
70  static StEStructCutBin* Instance();
71  // static StEStructCutBin* Instance(int mode);
72 
73  virtual ~StEStructCutBin();
74 
75  void setMode(int mode);
76  int getMode();
77  // Save histograms (mHCutBinHists) to currently opened file.
78  void setCutBinHistMode(int mode); // Non-zero means fill histograms.
79  void setMaxDEta(double deta);
80  int getCutBinHistMode();
81  void initCutBinHists();
82  void writeCutBinHists();
83  int getNumBins();
84  int getNumPairDensityBins();
85  int getNumParentBins();
86  int getParentBin(StEStructPairCuts *p, StEStructTrack* trkPtr);
87  int getNumQABins();
88  int getCutBin(StEStructPairCuts *p, int pairCase=0);
89  int getPairDensityBin(int ibin);
90  int ignorePair(StEStructPairCuts *pc);
91  int symmetrizeXX(StEStructPairCuts *pc);
92  int switchXX(StEStructPairCuts *pc);
93  int notSymmetrizedXX(int cutBin, int pairCharge);
94  char* printCutBinName();
95 
96  ClassDef(StEStructCutBin,1)
97 
98 };
99 
100 inline char* StEStructCutBin::printCutBinName(){ return mcutModeName; }
101 
102 inline void StEStructCutBin::setMaxDEta(double deta){ mMaxDEta = deta; }
103 
104 inline int StEStructCutBin::getNumBins(){ return mnumBins; }
105 inline int StEStructCutBin::getNumPairDensityBins() {
106  if (3 == mcutMode) {
107  return 4;
108  } else {
109  return mnumBins;
110  }
111 }
112 inline int StEStructCutBin::getNumParentBins(){ return mnumParentBins; }
113 inline int StEStructCutBin::getNumQABins() { return mnumParentBins; }
114 
115 inline int StEStructCutBin::getCutBin(StEStructPairCuts *pc, int pairCase){
116  int retVal=0;
117 
118  switch (mcutMode){
119  case 0:
120  {
121  retVal=0;
122  break;
123  }
124  case 1:
125  {
126  retVal=getCutBinMode1(pc);
127  break;
128  }
129  case 2:
130  {
131  retVal=getCutBinMode2(pc);
132  break;
133  }
134  case 3:
135  {
136  retVal=getCutBinMode3(pc);
137  break;
138  }
139  case 4:
140  {
141  retVal=getCutBinMode4(pc);
142  break;
143  }
144  case 5:
145  {
146  retVal=getCutBinMode5(pc,pairCase);
147  break;
148  }
149  case 6:
150  {
151  retVal=getCutBinMode6(pc,pairCase);
152  break;
153  }
154  case 7:
155  {
156  retVal=getCutBinMode7(pc,pairCase);
157  break;
158  }
159  case 8:
160  {
161  retVal=getCutBinMode8(pc);
162  break;
163  }
164  case 9:
165  {
166  retVal=getCutBinMode9(pc);
167  break;
168  }
169  case 10:
170  {
171  retVal=getCutBinMode10(pc);
172  break;
173  }
174  }
175  return retVal;
176 }
177 inline int StEStructCutBin::getPairDensityBin(int ibin){
178  if (3 == mcutMode) {
179  if (2 != ibin && 6 != ibin && 10 != ibin && 14 != ibin) {
180  return -1;
181  } else {
182  return (ibin-2)/4;
183  }
184  } else {
185  return ibin;
186  }
187 }
188 inline int StEStructCutBin::getParentBin(StEStructPairCuts *pc, StEStructTrack* trkPtr) {
189  // This is for calculating mean pt of parent population.
190  if (3 == mcutMode) {
191  float yt = trkPtr->Yt();
192  // These numbers are also used in StEStructCutBin::getCutBinMode3 (change both)
193  if (yt<1.99) { // soft
194  return 0;
195  } else if ((1.99<yt) && (yt<2.383)) { // neck
196  return 1;
197  } else { // hard
198  return 2;
199  }
200  } else if (5 == mcutMode) {
201  return trkPtr->PID();
202  } else if (8 == mcutMode) {
203  float yt = trkPtr->Yt();
204  // These numbers are also used in StEStructCutBin::getCutBinMode3 (change both)
205  if (yt<1.8) { // soft
206  return 0;
207  } else if ((1.8<yt) && (yt<2.2)) { // neck
208  return 1;
209  } else { // hard
210  return 2;
211  }
212  } else if (9 == mcutMode) {
213  float pt = trkPtr->Pt();
214  // These numbers are also used in StEStructCutBin::getCutBinMode9 (change both)
215  if (pt<0.5) {
216  return 0;
217  } else if (pt<1.0) {
218  return 1;
219  } else if (pt<2.0) {
220  return 2;
221  } else if (pt<3.0) {
222  return 3;
223  } else if (pt<4.0) {
224  return 4;
225  } else {
226  return 5;
227  }
228  } else {
229  return 0;
230  }
231 }
232 inline void StEStructCutBin::initCutBinHists() {
233  switch (mcutMode) {
234  case 5: {
235  initCutBinHists5();
236  break;
237  }
238  default: {
239  break;
240  }
241  }
242  return;
243 }
244 inline void StEStructCutBin::writeCutBinHists() {
245  switch (mcutMode) {
246  case 5: {
247  writeCutBinHists5();
248  break;
249  }
250  default: {
251  break;
252  }
253  }
254  return;
255 }
256 inline int StEStructCutBin::ignorePair(StEStructPairCuts *pc) {
257  if (mcutMode != 5) {
258  if ( (-1 == pc->Track1()->Charge()) &&
259  (+1 == pc->Track2()->Charge()) ) {
260  return 1;
261  } else {
262  return 0;
263  }
264  }
265  return ignorePair5(pc);
266 }
267 // Normally we want to enter pair at (x1,x2) _and_ (x2,x1) for phi-phi, eta-eta etc. histograms.
268 // When Particles are distinguishable in some way we can postpone the symmetrization and
269 // perhaps get some useful information. Maybe this will work for ytyt, but eta and phi
270 // seem to be dominated by detector artifacts.
271 inline int StEStructCutBin::symmetrizeXX(StEStructPairCuts *pc) {
272  switch (mcutMode) {
273  case 3: {
274  return symmetrizeXX3(pc);
275  }
276  case 5: {
277  return symmetrizeXX5(pc);
278  }
279  case 8: {
280  return symmetrizeXX8(pc);
281  }
282  case 9: {
283  return symmetrizeXX9(pc);
284  }
285  default: {
286  return 1;
287  }
288  }
289 }
290 // When we are not symmetrizing we want to order the pair. For example we may want the lower pt
291 // track to be the first of the pair.
292 inline int StEStructCutBin::switchXX(StEStructPairCuts *pc) {
293  switch (mcutMode) {
294  case 3: {
295  return switchXX3(pc);
296  }
297  case 5: {
298  return switchXX5(pc);
299  }
300  case 8: {
301  return switchXX8(pc);
302  }
303  case 9: {
304  return switchXX9(pc);
305  }
306  default: {
307  return 0;
308  }
309  }
310  return 0;
311 }
312 // When adding cut bins together some of them may have been symmetrized during analysis.
313 // If one hasn't it needs to be symmetrized before the addition.
314 // This method is called from StEStructHAdd in Support.
315 inline int StEStructCutBin::notSymmetrizedXX(int cutBin, int pairCharge) {
316  switch (mcutMode) {
317  case 3: {
318  return notSymmetrizedXX3(cutBin,pairCharge);
319  }
320  case 5: {
321  return notSymmetrizedXX5(cutBin,pairCharge);
322  }
323  case 8: {
324  return notSymmetrizedXX8(cutBin,pairCharge);
325  }
326  case 9: {
327  return notSymmetrizedXX9(cutBin,pairCharge);
328  }
329  default: {
330  return 0;
331  }
332  }
333  return 0;
334 }
335 
336 
337 
338 #endif
339 
340 
341 /***********************************************************************
342  *
343  * $Log: StEStructCutBin.h,v $
344  * Revision 1.16 2013/02/08 19:32:43 prindle
345  * Added "Triggered" histograms in StEStruct2ptCorrelations.
346  * Protected against using tracks cuts in StEStruct2ptCorrelations when reading EStruct format events.
347  * Added comment in EventMaker/StEStructTrack.cxx pointing out need to set BField correctly
348  * when reading EStruct format events. (This should be read from file somehow, but...)
349  *
350  * Revision 1.15 2012/11/16 21:22:27 prindle
351  * 2ptCorrelations: SS, AS histograms. Get eta limits from cuts. Fit PtAll histogram. Add histograms to keep track of eta, phi limits. A few more histograms
352  * Binning: Add quality cut.
353  * CutBin: modify mode9
354  * PairCuts: modify goodDeltaZ for case of one track leaving via endcap.
355  *
356  * Revision 1.14 2012/10/30 00:16:50 dkettler
357  * Cut bins for marginal pt bins added
358  *
359  * Revision 1.13 2011/08/02 20:34:02 prindle
360  * More detailed histograms for event mixing.
361  * Buffer: increased mixed events to 4 (from 2)
362  * CutBin: added mode 9 for exploration of p_t space, fixed place in mode 5 where
363  * histogram was written before checking it existed.
364  * OneBuffer: added ZDC coincidence rate to event sorting space.
365  *
366  * Revision 1.12 2010/09/02 21:24:08 prindle
367  * 2ptCorrelations: Fill histograms for event mixing information
368  * Option for common mixing buffer
369  * Switch to selectively fill QInv histograms (which take a long time)
370  * CutBin: Moved PID code to Track class from Pair class. Needed to update this code.
371  * PairCuts: Moved PID code from here to Track class.
372  * Removed unnecessary creation of StThreeVector which seem to take a long time
373  * Add ToF momentum cuts, modify dEdx momentum cuts. (Now allow dEdx to be
374  * be identified up to 15GeV/c, ToF up to 10GeV/c.)
375  *
376  * Revision 1.11 2008/12/02 23:45:06 prindle
377  * Changed switchYt to switchXX (etc.) to better reflect function.
378  * Change minYt to 1.0 in Binning so YtYt histogram doesn't have empty lower bin (pt = 0.164 for yt = 1.0)
379  * In CutBin: remove initPtBin
380  * add mode 8
381  * add notSymmetrized (used in Support)
382  * Added LUT (Look Up Table) for pair cuts. Experimental for now.
383  * Modified cutMerging2 (to look at track separation at a few radii)
384  * and cutCrossing2 so it doesn't accidentally reject almost back to back tracks.
385  *
386  * Revision 1.10 2008/03/19 22:06:01 prindle
387  * Added doInvariantMass flag.
388  * Added some plots in pairDensityHistograms.
389  * SetZOffset used to only be done when doPairDensity was true.
390  * Moved creating/copying pairDensity histograms to same place as other histograms.
391  * Added cutBinHistMode
392  * mode3 neck was defined as yt1<2.2 && yt2<2.2 (and not soft)
393  * now is 1.8<yt1<2.2 && 1.8<yt2<2.2
394  * Added gooddzdxy, Merging2 and Crossing2 to pair cuts.
395  *
396  * Revision 1.9 2007/11/26 19:55:25 prindle
397  * In 2ptCorrelations: Support for keeping all z-bins of selected centralities
398  * Change way \hat{p_t} is calculated for parent distributions in pid case.
399  * Binning Added parent binning (for \hat{p_t}
400  * CutBin: Mode 5 extensively modified.
401  * Added invariant mass cuts (probably a bad idea in general.)
402  *
403  * Revision 1.8 2007/05/27 22:45:02 msd
404  * Added new cut bin modes 2 (soft/hard SS/AS), 6 (z-vertex binning), and 7 (modes 2*6).
405  * Fixed bug in merging cut.
406  * Added a few histograms to 2pt corr.
407  *
408  * Revision 1.7 2007/01/26 17:17:10 msd
409  * Implemented new binning scheme: dEta stored in array with bin centered at zero, dPhi array has bins centered at zero and pi. Final DEtaDPhi has 25x25 bins with dPhi bin width of pi/12 so all major angles are centered in bins.
410  *
411  * Revision 1.6 2006/10/02 22:21:01 prindle
412  * Store only quadrant of eta_Delta - phi_Delta array/histogram.
413  * Store half of eta_Sigma - phi_Delta array/histogram.
414  * This required modifications in Binning.
415  * I had a bug in the pair loop (which left +- not fully symmetrized)
416  * and had to make changes in cut bins for mode 5 (and 3 I think)
417  * when I fixed this.
418  * Also change crossing cut to use only two parameters, the sign of
419  * the magnetic field being taken from the MuDst.
420  *
421  * Revision 1.5 2006/04/06 01:01:20 prindle
422  *
423  * New mode in CutBin, 5, to do pid correlations. There is still an issue
424  * of how to set the pt ranges allowed for the different particle types.
425  * For data we probably want to restrict p to below 1GeV for pi and K, but
426  * for Hijing and Pythia we can have perfect pid. Currently cuts are type
427  * into the code (so you have to re-compile to change them.)
428  *
429  * In the Correlations code I split -+ from +- and am keeping track of
430  * pt for each cut bin. These required changes in the Support code.
431  *
432  * Revision 1.4 2006/04/04 22:10:12 porter
433  * a handful of changes (specific to correlations)
434  * - added StEStructQAHists so that if NOT input frm Maker, each analysis has its own
435  * - used ability to get any max,min val from the cut class - or z-vertex binning
436  * - put z-vertex binning into 1 place
437  * - switched back 1st line of pair cut method to keep pair if good, not to reject if bad.
438  * - Pair cut object is now pointer in correlations
439  * - some diagnostic printouts available from macro
440  * - Duncan's delta-phi binning change
441  *
442  * Revision 1.3 2006/02/22 22:05:18 prindle
443  * Removed all references to multRef (?)
444  * Added cut mode 5 for particle identified correlations.
445  * Other cut modes should be same as before
446  *
447  * Revision 1.2 2005/03/03 01:30:44 porter
448  * updated StEStruct2ptCorrelations to include pt-correlations and removed
449  * old version of pt-correlations from chunhuih (StEStruct2ptPtNbar)
450  *
451  * Revision 1.1 2004/06/25 03:11:49 porter
452  * New cut-binning implementation and modified pair-cuts for chunhui to review
453  *
454  *
455  *********************************************************************/