StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEStructBinning.cxx
1 /**********************************************************************
2  *
3  * $Id: StEStructBinning.cxx,v 1.15 2012/11/16 21:22:27 prindle Exp $
4  *
5  * Author: Jeff Porter
6  *
7  **********************************************************************
8  *
9  * Description: Binning defs as c-structs for 2pt-analysis
10  *
11  *
12  ***********************************************************************/
13 #include "StEStructBinning.h"
14 #include <math.h>
15 
16 ClassImp(StEStructBinning)
17 
18 StEStructBinning* StEStructBinning::mInstance = 0;
19 
21 
22  //--> Q ranges <--
23  minQ=0.;
24  maxQ=1.1;
25  nQ = ESTRUCT_Q_BINS-1;
26  dQ = (maxQ-minQ)/(float)nQ;
27 
28  //--> phi ranges <--
29 
30  minPhi=-M_PI;
31  maxPhi=M_PI;
32  nPhi = ESTRUCT_PHI_BINS-1;
33  dPhi = (maxPhi-minPhi)/(float)nPhi;
34 
35  // NOTE: We store delta_phi from 0 to pi in an array, but when we
36  // copy to histogram this is unfolded and "shifted" so histogram
37  // is from -pi/2 to 3pi/2. If you want to do something else
38  // you will need to change some of the routines.
39  nDPhi = ESTRUCT_DPHI_BINS-1;
40  dDPhi = M_PI/((float)nDPhi-1.0);
41 
42  maxSPhi=2*maxPhi;
43  minSPhi=2*minPhi;
44  nSPhi = ESTRUCT_SPHI_BINS-1;
45  dSPhi=(maxSPhi-minSPhi)/(float)nSPhi;
46 
47  //--> eta ranges <--
48  nEta = ESTRUCT_ETA_BINS-1;
49  nDEta = ESTRUCT_DETA_BINS-1;
50  nSEta = ESTRUCT_SETA_BINS-1;
51  setEtaRange(-1,1);
52 
53  //--> yt ranges <--
54  // With ptMin = 0.15 find YtMin = 0.933. Close to 1.0
55 
56  minYt=1.0; //0.9; //0.15;
57  maxYt=4.5; //5.0;//4.5; // 0.925;
58  nYt = ESTRUCT_YT_BINS-1;
59  dYt = (maxYt-minYt)/(float)nYt;
60 
61  maxDYt=4.;//maxYt;
62  minDYt=0.;//-maxYt;// 0; //-maxYt;
63  nDYt= ESTRUCT_DYT_BINS-1;
64  dDYt=(maxDYt-minDYt)/(float)nDYt;
65 
66  maxSYt=10.; //2 * maxYt + 1.0;
67  minSYt=0.9; //2 * minYt;
68  nSYt = ESTRUCT_SYT_BINS-1;
69  dSYt=(maxSYt-minSYt)/(float)nSYt;
70 
71 
72  //--> xt ranges <--
73 
74  minXt= 1 - exp(-(sqrt(0.15*0.15+0.139*0.139)-0.139)/0.4); // from Aya's code
75  maxXt=0.99; // from Aya's code
76  nXt = ESTRUCT_XT_BINS-1;
77  dXt = (maxXt-minXt)/(float)nXt;
78 
79  //--> pt ranges <--
80 
81  minMeanPt= 0.0;
82  maxMeanPt=10.0;
83  nmeanPt = ESTRUCT_MEANPT_BINS-1;
84  dmeanPt = (maxMeanPt-minMeanPt)/(float)nmeanPt;
85 
86  minPt=0.15; //0.15;
87  maxPt=6.0;//4.5; // 0.925;
88  nPt = ESTRUCT_PT_BINS-1;
89  dPt = (maxPt-minPt)/(float)nPt;
90 
91  maxDPt=0.2;//maxPt;
92  minDPt=-0.2;//-maxPt;// 0; //-maxPt;
93  nDPt= ESTRUCT_DPT_BINS-1;
94  dDPt=(maxDPt-minDPt)/(float)nDPt;
95 
96  maxSPt=12.; //2 * maxPt + 1.0;
97  minSPt=0.3; //2 * minPt;
98  nSPt = ESTRUCT_SPT_BINS-1;
99  dSPt=(maxSPt-minSPt)/(float)nSPt;
100 
101  //--> TPC Separation ranges <--
102  maxTPCSep = 25; //cm
103  minTPCSep = 0;
104  nTPCSep = ESTRUCT_TPCSEP_BINS - 1;
105  dTPCSep = (maxTPCSep-minTPCSep)/(float)nTPCSep;
106 
107  maxTPCSepPhi = 1.0; //radians (~57 degrees)
108  minTPCSepPhi = -1.0;
109  nTPCSepPhi = ESTRUCT_TPCSEPPHI_BINS - 1;
110  dTPCSepPhi = (maxTPCSepPhi-minTPCSepPhi)/(float)nTPCSepPhi;
111 
112  maxTPCQuality = 1;
113  minTPCQuality = -1;
114  nTPCQuality = ESTRUCT_TPCQUALITY_BINS - 1;
115  dTPCQuality = (maxTPCQuality-minTPCQuality)/(float)nTPCQuality;
116 
117  //--> dEdx ranges <--
118  maxdEdx = 15.0e-6; //ionization units?
119  mindEdx = 0;
120  ndEdx = ESTRUCT_DEDX_BINS - 1;
121  ddEdx = (maxdEdx-mindEdx)/(float)ndEdx;
122 
123  //--> ptot ranges (for use with dEdx) <--
124  maxPtot = 1.5; //GeV/c
125  minPtot = 0;
126  nPtot = ESTRUCT_PTOT_BINS - 1;
127  dPtot = (maxPtot-minPtot)/(float)nPtot;
128 
129  //--> QAEta ranges <--
130  maxQAEta = +2.0;
131  minQAEta = -2.0;
132  nQAEta = ESTRUCT_QAETA_BINS - 1;
133  dQAEta = (maxQAEta-minQAEta)/(float)nQAEta;
134 
135  //--> QAPhi ranges <--
136  maxQAPhi = +M_PI;
137  minQAPhi = -M_PI;
138  nQAPhi = ESTRUCT_QAPHI_BINS - 1;
139  dQAPhi = (maxQAPhi-minQAPhi)/(float)nQAPhi;
140 
141  //--> QAPt ranges <--
142  maxQAPt = +6.0;
143  minQAPt = 0.0;
144  nQAPt = ESTRUCT_QAPT_BINS - 1;
145  dQAPt = (maxQAPt-minQAPt)/(float)nQAPt;
146 
147 };
148 
149 //-----------------------------------------------------------
150 void StEStructBinning::setEtaRange(float xmin, float xmax){
151 
152  //--> eta ranges <--
153 
154  minEta = xmin;
155  maxEta = xmax;
156  dEta = (maxEta-minEta)/(float)nEta;
157 
158  maxDEta = (maxEta-minEta);//2*maxEta;
159  minDEta = 0.;//0; //2*minEta;
160  dDEta = (maxDEta-minDEta)/((float)nDEta-0.5);
161 
162  calculateDEtaWeights(); // --> MUST do whenever setEtaRange is called!!!!
163 
164  maxSEta = 2*maxEta;
165  minSEta = 2*minEta;
166  dSEta = (maxSEta-minSEta)/(float)nSEta;
167 
168 }
169 
170 
171 //------------------------------------------------------------
172 void StEStructBinning::calculateDEtaWeights() {
173 
174  // init to 0
175  for(int i=0;i<=nDEta;i++) {
176  mdetaWeights.x.deta[i]=0.;
177  }
178 
179  // Assume first bin will be centered on 0.
180  // (Depends on ideta(), detaVal() and minDEta.)
181 
182  // calculate weight at cent of bin unless it is a center bin
183  // then use 1/4 shift ...
184  double fdeta0 = dDEta/4.0;
185  mdetaWeights.x.deta[0] = 1.0/(1.0 - (fdeta0/maxDEta));
186  for(int i=1;i<nDEta;i++){
187  fdeta0 = fabs(detaVal(i));
188  mdetaWeights.x.deta[i] = 1.0/(1.0 - (fdeta0/maxDEta));
189  }
190 }
191 
192 
193 /***********************************************************************
194  *
195  * $Log: StEStructBinning.cxx,v $
196  * Revision 1.15 2012/11/16 21:22:27 prindle
197  * 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
198  * Binning: Add quality cut.
199  * CutBin: modify mode9
200  * PairCuts: modify goodDeltaZ for case of one track leaving via endcap.
201  *
202  * Revision 1.14 2010/03/02 21:45:27 prindle
203  * Had a problem with pair cuts when one track exited via endplate
204  * Calculate maxDEta properly
205  * Warning if you try turning histograms for pair cuts on
206  *
207  * Revision 1.13 2009/05/08 00:09:54 prindle
208  * In 2ptCorrelations we added switches to select blocks of histograms to fill.
209  * (See constructor in StEStruct2ptCorrelations.cxx)
210  * Use a brute force method for checking crossing cuts. I had too many corner
211  * cases with my clever check.
212  * In Binning, change Yt limit and add methods for accessing number of histogram bins
213  * to use (used in Support)
214  *
215  * Revision 1.12 2008/12/02 23:45:05 prindle
216  * Changed switchYt to switchXX (etc.) to better reflect function.
217  * Change minYt to 1.0 in Binning so YtYt histogram doesn't have empty lower bin (pt = 0.164 for yt = 1.0)
218  * In CutBin: remove initPtBin
219  * add mode 8
220  * add notSymmetrized (used in Support)
221  * Added LUT (Look Up Table) for pair cuts. Experimental for now.
222  * Modified cutMerging2 (to look at track separation at a few radii)
223  * and cutCrossing2 so it doesn't accidentally reject almost back to back tracks.
224  *
225  * Revision 1.11 2008/03/19 22:06:00 prindle
226  * Added doInvariantMass flag.
227  * Added some plots in pairDensityHistograms.
228  * SetZOffset used to only be done when doPairDensity was true.
229  * Moved creating/copying pairDensity histograms to same place as other histograms.
230  * Added cutBinHistMode
231  * mode3 neck was defined as yt1<2.2 && yt2<2.2 (and not soft)
232  * now is 1.8<yt1<2.2 && 1.8<yt2<2.2
233  * Added gooddzdxy, Merging2 and Crossing2 to pair cuts.
234  *
235  * Revision 1.10 2007/11/26 19:55:23 prindle
236  * In 2ptCorrelations: Support for keeping all z-bins of selected centralities
237  * Change way \hat{p_t} is calculated for parent distributions in pid case.
238  * Binning Added parent binning (for \hat{p_t}
239  * CutBin: Mode 5 extensively modified.
240  * Added invariant mass cuts (probably a bad idea in general.)
241  *
242  * Revision 1.9 2007/01/26 17:17:07 msd
243  * 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.
244  *
245  * Revision 1.8 2006/10/02 22:20:57 prindle
246  * Store only quadrant of eta_Delta - phi_Delta array/histogram.
247  * Store half of eta_Sigma - phi_Delta array/histogram.
248  * This required modifications in Binning.
249  * I had a bug in the pair loop (which left +- not fully symmetrized)
250  * and had to make changes in cut bins for mode 5 (and 3 I think)
251  * when I fixed this.
252  * Also change crossing cut to use only two parameters, the sign of
253  * the magnetic field being taken from the MuDst.
254  *
255  * Revision 1.7 2006/04/10 23:42:32 porter
256  * Added sameSide() & awaySide() methods to PairCut (so only defined in 1 place)
257  * and added the eta_delta weighting as a binned correctin defined by the eta-limits in
258  * the StEStructBinning object
259  *
260  * Revision 1.6 2006/04/04 22:10:10 porter
261  * a handful of changes (specific to correlations)
262  * - added StEStructQAHists so that if NOT input frm Maker, each analysis has its own
263  * - used ability to get any max,min val from the cut class - or z-vertex binning
264  * - put z-vertex binning into 1 place
265  * - switched back 1st line of pair cut method to keep pair if good, not to reject if bad.
266  * - Pair cut object is now pointer in correlations
267  * - some diagnostic printouts available from macro
268  * - Duncan's delta-phi binning change
269  *
270  * Revision 1.5 2006/02/22 22:05:14 prindle
271  * Removed all references to multRef (?)
272  * Added cut mode 5 for particle identified correlations.
273  * Other cut modes should be same as before
274  *
275  * Revision 1.4 2005/09/14 17:14:21 msd
276  * Large update, added new pair-cut system, added pair density plots for new analysis mode (4), added event mixing cuts (rewrote buffer for this)
277  *
278  * Revision 1.3 2005/03/03 01:30:43 porter
279  * updated StEStruct2ptCorrelations to include pt-correlations and removed
280  * old version of pt-correlations from chunhuih (StEStruct2ptPtNbar)
281  *
282  * Revision 1.2 2004/06/25 03:11:49 porter
283  * New cut-binning implementation and modified pair-cuts for chunhui to review
284  *
285  * Revision 1.1 2003/10/15 18:20:46 porter
286  * initial check in of Estruct Analysis maker codes.
287  *
288  *
289  *********************************************************************/
290 
291 
292 
293 
294 
295 
296 
297 
298 
float maxSEta
sigma phi bins
float maxDEta
delta phi bins
float maxEta
phi bins