StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEStructBinning.h
1 /**********************************************************************
2  *
3  * $Id: StEStructBinning.h,v 1.17 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 #ifndef __STESTRUCTBINNING__H
14 #define __STESTRUCTBINNING__H
15 
16 #include <math.h>
17 #include "TROOT.h"
18 /*
19  * I made these c-structs as floats in order to able to have them contain
20  * more than just the counts. If wts are added I need another word
21  * and it seems to me to be safer to do it in the cstruct rather than
22  * in another separate array.
23  *
24  */
25 /*
26  * The pairdensity plots (which can be used to check pair cuts) use
27  * idpt and dptval. I think these used to be used to make pt plots
28  * covering much of the accpetance, but that role seems to have shifted
29  * to idyt and dytval. Co-opt the dpt stuff so the pairdensity plots
30  * have sensitivity to few MeV differences.
31  *
32  * djp 2-1-2008
33  */
34 
35 // 25 + 1 over&under
36 #define ESTRUCT_PHI_BINS 26
37 #define ESTRUCT_ETA_BINS 26
38 #define ESTRUCT_YT_BINS 26
39 //#define ESTRUCT_DELTAYT_BINS 26 //use dyt instead
40 #define ESTRUCT_MEANPT_BINS 501
41 #define ESTRUCT_PT_BINS 31
42 #define ESTRUCT_XT_BINS 26
43 
44 #define ESTRUCT_DPHI_BINS 14
45 #define ESTRUCT_DETA_BINS 14
46 #define ESTRUCT_DYT_BINS 15
47 #define ESTRUCT_DPT_BINS 31
48 
49 #define ESTRUCT_SPHI_BINS 26
50 #define ESTRUCT_SETA_BINS 26
51 #define ESTRUCT_SYT_BINS 51
52 #define ESTRUCT_SPT_BINS 41
53 
54 #define ESTRUCT_Q_BINS 51
55 #define ESTRUCT_TPCSEP_BINS 51
56 #define ESTRUCT_TPCSEPPHI_BINS 51
57 #define ESTRUCT_TPCQUALITY_BINS 51
58 
59 #define ESTRUCT_DEDX_BINS 151
60 #define ESTRUCT_PTOT_BINS 151
61 
62 // 100 + 1 over&under for QA
63 #define ESTRUCT_QAPHI_BINS 101
64 #define ESTRUCT_QAETA_BINS 101
65 #define ESTRUCT_QAPT_BINS 101
66 
67 struct qBins {
68  float q[ESTRUCT_Q_BINS];
69 };
70 
71 struct phiBins {
72  double phi[ESTRUCT_PHI_BINS];
73 };
74 struct dphiBins {
75  double dphi[ESTRUCT_DPHI_BINS];
76 };
77 struct sphiBins {
78  double sphi[ESTRUCT_SPHI_BINS];
79 };
80 
81 struct etaBins {
82  double eta[ESTRUCT_ETA_BINS];
83 };
84 struct detaBins {
85  double deta[ESTRUCT_DETA_BINS];
86 };
87 
88 struct setaBins {
89  double seta[ESTRUCT_SETA_BINS];
90 };
91 
92 
93 struct ytBins {
94  double yt[ESTRUCT_YT_BINS];
95 };
96 struct dytBins {
97  double dyt[ESTRUCT_DYT_BINS];
98 };
99 struct sytBins {
100  double syt[ESTRUCT_SYT_BINS];
101 };
102 
103 struct ptBins {
104  float pt[ESTRUCT_PT_BINS];
105 };
106 struct dptBins {
107  float dpt[ESTRUCT_DPT_BINS];
108 };
109 struct sptBins {
110  float spt[ESTRUCT_SPT_BINS];
111 };
112 
113 struct xtBins {
114  double xt[ESTRUCT_XT_BINS];
115 };
116 
117 
118 struct TPCSepBins {
119  float sep[ESTRUCT_TPCSEP_BINS];
120 };
122  float sep[ESTRUCT_TPCSEPPHI_BINS];
123 };
125  float sep[ESTRUCT_TPCQUALITY_BINS];
126 };
127 
128 struct dEdxBins {
129  float dEdx[ESTRUCT_DEDX_BINS];
130 };
131 
132 struct PtotBins {
133  float Ptot[ESTRUCT_PTOT_BINS];
134 };
135 
136 struct QAEtaBins {
137  float Eta[ESTRUCT_QAETA_BINS];
138 };
139 
140 struct QAPhiBins {
141  float Phi[ESTRUCT_QAPHI_BINS];
142 };
143 
144 struct QAPtBins {
145  float Pt[ESTRUCT_QAPT_BINS];
146 };
147 
148 
149 // oh-boy... I made c-struct and methods with same names so cannot
150 // use the c-structs directly in the StEStructBinning class.
151 // rather I have to wrap it!
152 
154  public:
155  detaBins x;
156 };
157 
158 class StEStructBinning : public TObject {
159 
160 protected:
161 
162  float maxPhi, minPhi, dPhi;
163  float maxEta, minEta, dEta;
164  float maxYt, minYt, dYt;
165  float maxXt, minXt, dXt;
166  float maxPt, minPt, dPt;
167  float maxMeanPt, minMeanPt, dmeanPt;
168  int nPhi, nEta, nYt, nPt, nXt, nmeanPt;
169 
170  float dDPhi;
171  float maxDEta, minDEta, dDEta;
172  float maxDYt, minDYt, dDYt;
173  float maxDPt, minDPt, dDPt;
174  int nDPhi, nDEta, nDYt, nDPt;
175 
176  float maxSPhi, minSPhi, dSPhi;
177  float maxSEta, minSEta, dSEta;
178  float maxSYt, minSYt, dSYt;
179  float maxSPt, minSPt, dSPt;
180  int nSPhi, nSEta, nSYt, nSPt;
181 
182  //float maxDeltaYt, minDeltaYt, dDeltaYt; //! really yt //use dyt
183  //int nDeltaYt; //! n-bins
184 
185  float maxQ,minQ,dQ;
186  int nQ;
187  int i,j;
188 
189  float maxTPCSep, minTPCSep, dTPCSep;
190  float maxTPCSepPhi, minTPCSepPhi, dTPCSepPhi;
191  float maxTPCQuality, minTPCQuality, dTPCQuality;
192  float maxdEdx, mindEdx, ddEdx;
193  float maxPtot, minPtot, dPtot;
194  int nTPCSep, nTPCSepPhi, nTPCQuality, ndEdx, nPtot;
195 
196  float maxQAEta, minQAEta, dQAEta;
197  float maxQAPhi, minQAPhi, dQAPhi;
198  float maxQAPt, minQAPt, dQAPt;
199  int nQAEta, nQAPhi, nQAPt;
200 
201  EtaDeltaWeights mdetaWeights;
202 
205  static StEStructBinning* mInstance;
206 
207 public:
208 
209  ~StEStructBinning(){};
210  static StEStructBinning* Instance();
211 
212  void calculateDEtaWeights();
213  double getDEtaWeight(float deta);
214 
215  void setEtaRange(float etamin, float etamax);
216 
217  int iphi(float phi);
218  int ieta(float eta);
219  int iyt(float yt);
220  int ixt(float xt);
221  int imeanpt(float pt);
222  int ipt(float pt);
223  int iq(float q);
224  int isep(float sep);
225  int isepphi(float sep);
226  int iqual(float qual);
227  int idedx(float dedx);
228  int iptot(float ptot);
229  int iqaphi(float phi);
230  int iqaeta(float eta);
231  int iqapt(float pt);
232 
233  float phiVal(int iphi);
234  float etaVal(int ieta);
235  float ytVal(int iyt);
236  float xtVal(int ixt);
237  float meanptVal(int ipt);
238  float ptVal(int ipt);
239  float qVal(int iq);
240  float sepVal(int is);
241  float sepphiVal(int is);
242  float qualityVal(int is);
243  float dedxVal(int idedx);
244  float ptotVal(int iptot);
245  float qaetaVal(int ieta);
246  float qaphiVal(int iphi);
247  float qaptVal(int ipt);
248 
249  int idphi(float phi);
250  int ideta(float eta);
251  int idyt(float yt);
252  int idpt(float pt);
253 
254  float dphiVal(int idphi, int which);
255  float detaVal(int ideta);
256  float dytVal(int idyt);
257  float dptVal(int idpt);
258 
259  int isphi(float phi);
260  int iseta(float eta);
261  int isyt(float yt);
262  int ispt(float pt);
263 
264  float sphiVal(int isphi);
265  float setaVal(int iseta);
266  float sytVal(int isyt);
267  float sptVal(int ispt);
268 
269  float qMax() { return maxQ; }
270  float qMin() { return minQ; }
271  float getBinWidthQ() { return dQ; }
272  int qBins() { return nQ; }
273 
274  float phiMax() { return maxPhi; }
275  float phiMin() { return minPhi; }
276  float getBinWidthPhi() { return dPhi; }
277  int phiBins() { return nPhi; }
278 
279 
280  float etaMax() { return maxEta; }
281  float etaMin() { return minEta; }
282  float getBinWidthEta() { return dEta; }
283  int etaBins() { return nEta; };
284  int setNEtaBins( int nbins) {
285  nEta = nbins;
286  dEta = (maxEta-minEta)/(float)nEta;
287  calculateDEtaWeights();
288  return nEta;
289  };
290 
291  float ytMax() { return maxYt; }
292  float ytMin() { return minYt; }
293  float getBinWidthYt() { return dYt; }
294  int ytBins() { return nYt; }
295 
296  float xtMax() { return maxXt; }
297  float xtMin() { return minXt; }
298  float getBinWidthXt() { return dXt; }
299  int xtBins() { return nXt; }
300 
301  float meanptMax() { return maxMeanPt; }
302  float meanptMin() { return minMeanPt; }
303  float getBinWidthMeanPt() { return dmeanPt; }
304  int meanptBins() { return nmeanPt; }
305 
306  float ptMax() { return maxPt; }
307  float ptMin() { return minPt; }
308  float getBinWidthPt() { return dPt; }
309  int ptBins() { return nPt; }
310 
311  float dEdxMax() { return maxdEdx; }
312  float dEdxMin() { return mindEdx; }
313  float getBinWidthdEdx() { return ddEdx; }
314  int dEdxBins() { return ndEdx; }
315 
316  float PtotMax() { return maxPtot; }
317  float PtotMin() { return minPtot; }
318  float getBinWidthPtot() { return dPtot; }
319  int PtotBins() { return nPtot; }
320 
321  // Thse dphi* and deta* are used to size histograms.
322  // For now symmetrize the histograms here.
323  float dphiMax() {
324  if (nDPhi%2 > 0) {
325  return 3*M_PI/2 + M_PI/(hdphiBins()-1);
326  } else {
327  return 3*M_PI/2;
328  }
329  }
330  float dphiMin() {
331  if (nDPhi%2 > 0) {
332  return -M_PI/2 - M_PI/(hdphiBins()-1);
333  } else {
334  return -M_PI/2;
335  }
336  }
337  float getBinWidthDPhi() { return dDPhi; }
338  int dphiBins() { return nDPhi; }
339  int setNDPhiBins( int nbins ) {
340  nDPhi = nbins;
341  dDPhi = M_PI/((float)nDPhi-1.0);
342  return nDPhi;
343  }
344  int hdphiBins() {
345  if (nDPhi%2 > 0) {
346  return 2*nDPhi-1;
347  } else {
348  return 2*(nDPhi-1);
349  }
350  }
351  int hdphiBin(float phi) {
352  return 1 + int( (phi-dphiMin()) / dDPhi);
353  }
354 
355  float detaMax() { return maxDEta; }
356  float detaMin() { return -maxDEta; }
357  float getBinWidthDEta() { return dDEta; }
358  int detaBins() { return nDEta; };
359  int setNDEtaBins( int nbins) {
360  nDEta = nbins;
361  dDEta = (maxDEta-minDEta)/((float)nDEta-0.5);
362  calculateDEtaWeights();
363  return nDEta;
364  };
365  int hdetaBins() { return 2*nDEta-1; };
366  int hdetaBin(float eta) {
367  return 1 + int( (eta-detaMin()) / dDEta);
368  };
369 
370  float dytMax() { return maxDYt; }
371  float dytMin() { return minDYt; }
372  float getBinWidthDYt() { return dDYt; }
373  int dytBins() { return nDYt; }
374 
375  float dptMax() { return maxDPt; }
376  float dptMin() { return minDPt; }
377  float getBinWidthDPt() { return dDPt; }
378  int dptBins() { return nDPt; }
379 
380  float sphiMax() { return maxSPhi; }
381  float sphiMin() { return minSPhi; }
382  float getBinWidthSPhi() { return dSPhi; }
383  int sphiBins() { return nSPhi; }
384 
385  float setaMax() { return maxSEta; }
386  float setaMin() { return minSEta; }
387  float getBinWidthSEta() { return dSEta; }
388  int setaBins() { return nSEta; };
389  int setNSEtaBins( int nbins ) {
390  nSEta = nbins;
391  dSEta = (maxSEta-minSEta)/(float)nSEta;
392  calculateDEtaWeights();
393  return nSEta;
394  };
395 
396  float sytMax() { return maxSYt; }
397  float sytMin() { return minSYt; }
398  float getBinWidthSYt() { return dSYt; }
399  int sytBins() { return nSYt; }
400 
401  float sptMax() { return maxSPt; }
402  float sptMin() { return minSPt; }
403  float getBinWidthSPt() { return dSPt; }
404  int sptBins() { return nSPt; }
405 
406  float TPCSepMax() { return maxTPCSep; }
407  float TPCSepMin() { return minTPCSep; }
408  int TPCSepBins() { return nTPCSep; }
409  float TPCSepPhiMax() { return maxTPCSepPhi; }
410  float TPCSepPhiMin() { return minTPCSepPhi; }
411  int TPCSepPhiBins() { return nTPCSepPhi; }
412  float TPCQualityMax() { return maxTPCQuality; }
413  float TPCQualityMin() { return minTPCQuality; }
414  int TPCQualityBins() { return nTPCQuality; }
415 
416  int QAEtaBins() { return nQAEta; }
417  int QAPhiBins() { return nQAPhi; }
418  int QAPtBins() { return nQAPt; }
419  float QAEtaMax() { return maxQAEta; }
420  float QAEtaMin() { return minQAEta; }
421  float QAPhiMax() { return maxQAPhi; }
422  float QAPhiMin() { return minQAPhi; }
423  float QAPtMax() { return maxQAPt; }
424  float QAPtMin() { return minQAPt; }
425 
426 ClassDef(StEStructBinning,1)
427 
428 };
429 
430 inline StEStructBinning* StEStructBinning::Instance(){
431  if(!mInstance) mInstance=new StEStructBinning;
432  return mInstance;
433 }
434 
435 inline double StEStructBinning::getDEtaWeight(float deta){
436  return mdetaWeights.x.deta[ideta(deta)];
437 }
438 
439 inline float StEStructBinning::qVal(int iq){
440  return minQ+iq*dQ+dQ/2;
441 }
442 
443 inline int StEStructBinning::iq(float q){
444  if( q < minQ ) return ESTRUCT_Q_BINS - 1;
445  int j = (int)((q-minQ)/dQ);
446  return (j > ESTRUCT_Q_BINS - 2) ? ESTRUCT_Q_BINS - 1 : j;
447 }
448 
449 inline float StEStructBinning::sepVal(int is){
450  return minTPCSep+is*dTPCSep+dTPCSep/2;
451 }
452 inline float StEStructBinning::sepphiVal(int is){
453  return minTPCSepPhi+is*dTPCSepPhi+dTPCSepPhi/2;
454 }
455 inline float StEStructBinning::qualityVal(int is){
456  return minTPCQuality+is*dTPCQuality+dTPCQuality/2;
457 }
458 
459 inline int StEStructBinning::isep(float sep){
460  if( sep < minTPCSep ) return ESTRUCT_TPCSEP_BINS - 1;
461  int j = (int)((sep-minTPCSep)/dTPCSep);
462  return (j > ESTRUCT_TPCSEP_BINS - 2) ? ESTRUCT_TPCSEP_BINS - 1 : j;
463 }
464 inline int StEStructBinning::isepphi(float dphi){
465  if (dphi>M_PI) {
466  dphi = 2*M_PI - dphi;
467  } else if (dphi<-M_PI) {
468  dphi = 2*M_PI + dphi;
469  }
470  int j = (int)((dphi + dTPCSepPhi/2 - minTPCSepPhi)/dTPCSepPhi);
471  return (j > ESTRUCT_TPCSEPPHI_BINS - 2) ? ESTRUCT_TPCSEPPHI_BINS - 1 : j;
472 }
473 inline int StEStructBinning::iqual(float qual){
474  if( qual < minTPCQuality ) return ESTRUCT_TPCQUALITY_BINS - 1;
475  int j = (int)((qual-minTPCQuality)/dTPCQuality);
476  return (j > ESTRUCT_TPCQUALITY_BINS - 2) ? ESTRUCT_TPCQUALITY_BINS - 1 : j;
477 }
478 
479 inline int StEStructBinning::iphi(float phi){
480  if( phi < minPhi ) return ESTRUCT_PHI_BINS - 1;
481  int j = (int)((phi-minPhi)/dPhi);
482  return (j > ESTRUCT_PHI_BINS - 2) ? ESTRUCT_PHI_BINS - 1 : j;
483 }
484 
485 inline int StEStructBinning::idphi(float dphi){
486  dphi = fabs(dphi);
487  if (dphi>M_PI) {
488  dphi = 2*M_PI - dphi;
489  }
490  if( dphi < 0 ) return ESTRUCT_DPHI_BINS - 1;
491  int j = (int)((dphi + dDPhi/2)/dDPhi);
492  return (j > ESTRUCT_DPHI_BINS - 2) ? ESTRUCT_DPHI_BINS - 1 : j;
493 }
494 
495 inline int StEStructBinning::isphi(float phi){
496  if( phi < minSPhi ) return ESTRUCT_SPHI_BINS - 1;
497  int j = (int)((phi-minSPhi)/dSPhi);
498  return (j > ESTRUCT_SPHI_BINS - 2) ? ESTRUCT_SPHI_BINS - 1 : j;
499 }
500 
501 inline float StEStructBinning::phiVal(int iphi){
502  return minPhi+iphi*dPhi+dPhi/2;
503 }
504 
505 inline float StEStructBinning::sphiVal(int isphi){
506  return minSPhi+isphi*dSPhi+dSPhi/2;
507 }
508 
509 inline float StEStructBinning::dphiVal(int idphi, int which) {
510  float dphi = idphi*dDPhi;
511  if (1 == which) {
512  return dphi;
513  } else if (2 == which) {
514  //if ((dphiBins()%2 > 0) && (idphi == (dphiBins()-1)/2)) {
515  // return 99;
516  // }
517  if (dphi < M_PI/2) {
518  return -dphi;
519  } else {
520  return 2*M_PI - dphi;
521  }
522  }
523  return 99;
524 }
525 
526 inline int StEStructBinning::ieta(float eta){
527  if( eta < minEta ) return ESTRUCT_ETA_BINS - 1;
528  int j = (int)( (eta - minEta) / dEta );
529  return (j > ESTRUCT_ETA_BINS - 2) ? ESTRUCT_ETA_BINS - 1 : j;
530 }
531 
532 inline int StEStructBinning::ideta(float eta) {
533  eta = fabs(eta);
534  if( eta < minDEta ) return ESTRUCT_DETA_BINS - 1;
535  int j = (int)( (eta + dDEta/2 - minDEta)/dDEta );
536  return (j > ESTRUCT_DETA_BINS - 2) ? ESTRUCT_DETA_BINS - 1 : j;
537 }
538 
539 inline int StEStructBinning::iseta(float eta){
540  if( eta < minSEta ) return ESTRUCT_SETA_BINS - 1;
541  int j = (int)( (eta-minSEta)/dSEta );
542  return (j > ESTRUCT_SETA_BINS - 2) ? ESTRUCT_SETA_BINS - 1 : j;
543 }
544 
545 inline float StEStructBinning::etaVal(int ieta){
546  return minEta+ieta*dEta+dEta/2;
547 }
548 
549 inline float StEStructBinning::setaVal(int iseta){
550  return minSEta+iseta*dSEta+dSEta/2;
551 }
552 
553 inline float StEStructBinning::detaVal(int ideta){
554  return minDEta+ideta*dDEta;
555 }
556 
557 inline int StEStructBinning::iyt(float yt){
558  if( yt < minYt ) return ESTRUCT_YT_BINS - 1;
559  int j = (int)((yt-minYt)/dYt);
560  return (j > ESTRUCT_YT_BINS - 2) ? ESTRUCT_YT_BINS - 1 : j;
561 }
562 
563 inline int StEStructBinning::idyt(float yt){
564  yt = fabs(yt);
565  if( yt < minDYt ) return ESTRUCT_DYT_BINS - 1;
566  int j = (int)((yt+dDYt/2-minDYt)/dDYt);
567  return (j > ESTRUCT_DYT_BINS - 2) ? ESTRUCT_DYT_BINS-1 : j;
568 }
569 
570 inline int StEStructBinning::isyt(float yt){
571  if( yt < minSYt ) return ESTRUCT_SYT_BINS - 1;
572  int j = (int)((yt-minSYt)/dSYt);
573  return (j > ESTRUCT_SYT_BINS - 2) ? ESTRUCT_SYT_BINS-1 : j;
574 }
575 
576 inline float StEStructBinning::ytVal(int iyt){
577  return minYt+iyt*dYt+dYt/2;
578 }
579 
580 inline float StEStructBinning::sytVal(int isyt){
581  return minSYt+isyt*dSYt+dSYt/2;
582 }
583 
584 inline float StEStructBinning::dytVal(int idyt) {
585  if (0 ==idyt) {
586  return 0;
587  } else {
588  return minDYt+idyt*dDYt;
589  }
590 }
591 
592 /*inline int StEStructBinning::iDeltaYt(float yt){
593  if( yt < minDeltaYt ) return ESTRUCT_DELTAYT_BINS - 1;
594  int j = (int)((yt-minDeltaYt)/dDeltaYt);
595  return (j > ESTRUCT_DELTAYT_BINS - 2) ? ESTRUCT_DELTAYT_BINS-1 : j;
596 }
597 
598 inline float StEStructBinning::deltaYtVal(int ideltaYt){
599  return minDeltaYt+ideltaYt*dDeltaYt+dDeltaYt/2;
600  }*/
601 
602 
603 inline int StEStructBinning::ixt(float xt){
604  if( xt < minXt ) return ESTRUCT_XT_BINS - 1;
605  int j = (int)((xt-minXt)/dXt);
606  return (j > ESTRUCT_XT_BINS - 2) ? ESTRUCT_XT_BINS - 1 : j;
607 }
608 
609 inline float StEStructBinning::xtVal(int ixt){
610  return minXt+ixt*dXt+dXt/2;
611 }
612 
613 inline int StEStructBinning::imeanpt(float pt){
614  if( pt < 0 ) return ESTRUCT_MEANPT_BINS - 1;
615  int j = (int)((pt-minMeanPt)/dmeanPt);
616  return (j > ESTRUCT_MEANPT_BINS - 2) ? ESTRUCT_MEANPT_BINS - 1 : j;
617 }
618 inline int StEStructBinning::ipt(float pt){
619  if( pt < minPt ) return ESTRUCT_PT_BINS - 1;
620  int j = (int)((pt-minPt)/dPt);
621  return (j > ESTRUCT_PT_BINS - 2) ? ESTRUCT_PT_BINS - 1 : j;
622 }
623 
624 inline int StEStructBinning::idpt(float pt){
625  if( pt < minDPt ) return ESTRUCT_DPT_BINS - 1;
626  int j = (int)((pt-minDPt)/dDPt);
627  return (j > ESTRUCT_DPT_BINS - 2) ? ESTRUCT_DPT_BINS-1 : j;
628 }
629 
630 inline int StEStructBinning::ispt(float pt){
631  if( pt < minSPt ) return ESTRUCT_SPT_BINS - 1;
632  int j = (int)((pt-minSPt)/dSPt);
633  return (j > ESTRUCT_SPT_BINS - 2) ? ESTRUCT_SPT_BINS-1 : j;
634 }
635 
636 inline float StEStructBinning::meanptVal(int ipt){
637  return minMeanPt+ipt*dmeanPt+dmeanPt/2;
638 }
639 inline float StEStructBinning::ptVal(int ipt){
640  return minPt+ipt*dPt+dPt/2;
641 }
642 
643 inline float StEStructBinning::sptVal(int ispt){
644  return minSPt+ispt*dSPt+dSPt/2;
645 }
646 
647 inline float StEStructBinning::dptVal(int idpt){
648  return minDPt+idpt*dDPt+dDPt/2;
649 }
650 
651 
652 inline int StEStructBinning::idedx(float dedx){
653  if( dedx < mindEdx ) return ESTRUCT_DEDX_BINS - 1;
654  int j = (int)((dedx-mindEdx)/ddEdx);
655  return (j > ESTRUCT_DEDX_BINS - 2) ? ESTRUCT_DEDX_BINS - 1 : j;
656 }
657 
658 inline float StEStructBinning::dedxVal(int idedx){
659  return mindEdx+idedx*ddEdx+ddEdx/2;
660 }
661 
662 inline int StEStructBinning::iptot(float ptot){
663  if( ptot < minPtot ) return ESTRUCT_PTOT_BINS - 1;
664  int j = (int)((ptot-minPtot)/dPtot);
665  return (j > ESTRUCT_PTOT_BINS - 2) ? ESTRUCT_PTOT_BINS - 1 : j;
666 }
667 
668 inline float StEStructBinning::ptotVal(int iptot){
669  return minPtot+iptot*dPtot+dPtot/2;
670 }
671 
672 inline int StEStructBinning::iqaeta(float eta){
673  if( eta < minQAEta ) return ESTRUCT_QAETA_BINS - 1;
674  int j = (int)((eta-minQAEta)/dQAEta);
675  return (j > ESTRUCT_QAETA_BINS - 2) ? ESTRUCT_QAETA_BINS - 1 : j;
676 }
677 inline int StEStructBinning::iqaphi(float phi){
678  if( phi < minQAPhi ) return ESTRUCT_QAPHI_BINS - 1;
679  int j = (int)((phi-minQAPhi)/dQAPhi);
680  return (j > ESTRUCT_QAPHI_BINS - 2) ? ESTRUCT_QAPHI_BINS - 1 : j;
681 }
682 inline int StEStructBinning::iqapt(float pt){
683  if( pt < minQAPt ) return ESTRUCT_QAPT_BINS - 1;
684  int j = (int)((pt-minQAPt)/dQAPt);
685  return (j > ESTRUCT_QAPT_BINS - 2) ? ESTRUCT_QAPT_BINS - 1 : j;
686 }
687 
688 inline float StEStructBinning::qaetaVal(int ieta){
689  return minQAEta+ieta*dQAEta+dQAEta/2;
690 }
691 inline float StEStructBinning::qaphiVal(int iphi){
692  return minQAPhi+iphi*dQAPhi+dQAPhi/2;
693 }
694 inline float StEStructBinning::qaptVal(int ipt){
695  return minQAPt+ipt*dQAPt+dQAPt/2;
696 }
697 
698 
699 #endif
700 
701 /***********************************************************************
702  *
703  * $Log: StEStructBinning.h,v $
704  * Revision 1.17 2012/11/16 21:22:27 prindle
705  * 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
706  * Binning: Add quality cut.
707  * CutBin: modify mode9
708  * PairCuts: modify goodDeltaZ for case of one track leaving via endcap.
709  *
710  * Revision 1.16 2009/05/08 00:09:54 prindle
711  * In 2ptCorrelations we added switches to select blocks of histograms to fill.
712  * (See constructor in StEStruct2ptCorrelations.cxx)
713  * Use a brute force method for checking crossing cuts. I had too many corner
714  * cases with my clever check.
715  * In Binning, change Yt limit and add methods for accessing number of histogram bins
716  * to use (used in Support)
717  *
718  * Revision 1.15 2008/03/19 22:06:00 prindle
719  * Added doInvariantMass flag.
720  * Added some plots in pairDensityHistograms.
721  * SetZOffset used to only be done when doPairDensity was true.
722  * Moved creating/copying pairDensity histograms to same place as other histograms.
723  * Added cutBinHistMode
724  * mode3 neck was defined as yt1<2.2 && yt2<2.2 (and not soft)
725  * now is 1.8<yt1<2.2 && 1.8<yt2<2.2
726  * Added gooddzdxy, Merging2 and Crossing2 to pair cuts.
727  *
728  * Revision 1.14 2007/11/26 19:55:24 prindle
729  * In 2ptCorrelations: Support for keeping all z-bins of selected centralities
730  * Change way \hat{p_t} is calculated for parent distributions in pid case.
731  * Binning Added parent binning (for \hat{p_t}
732  * CutBin: Mode 5 extensively modified.
733  * Added invariant mass cuts (probably a bad idea in general.)
734  *
735  * Revision 1.13 2007/01/26 17:17:08 msd
736  * 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.
737  *
738  * Revision 1.12 2006/10/02 22:20:58 prindle
739  * Store only quadrant of eta_Delta - phi_Delta array/histogram.
740  * Store half of eta_Sigma - phi_Delta array/histogram.
741  * This required modifications in Binning.
742  * I had a bug in the pair loop (which left +- not fully symmetrized)
743  * and had to make changes in cut bins for mode 5 (and 3 I think)
744  * when I fixed this.
745  * Also change crossing cut to use only two parameters, the sign of
746  * the magnetic field being taken from the MuDst.
747  *
748  * Revision 1.11 2006/04/25 21:03:57 msd
749  * Fixed bugs in ideta and iseta
750  *
751  * Revision 1.10 2006/04/10 23:42:32 porter
752  * Added sameSide() & awaySide() methods to PairCut (so only defined in 1 place)
753  * and added the eta_delta weighting as a binned correctin defined by the eta-limits in
754  * the StEStructBinning object
755  *
756  * Revision 1.9 2006/04/04 22:10:11 porter
757  * a handful of changes (specific to correlations)
758  * - added StEStructQAHists so that if NOT input frm Maker, each analysis has its own
759  * - used ability to get any max,min val from the cut class - or z-vertex binning
760  * - put z-vertex binning into 1 place
761  * - switched back 1st line of pair cut method to keep pair if good, not to reject if bad.
762  * - Pair cut object is now pointer in correlations
763  * - some diagnostic printouts available from macro
764  * - Duncan's delta-phi binning change
765  *
766  * Revision 1.8 2006/02/22 22:05:15 prindle
767  * Removed all references to multRef (?)
768  * Added cut mode 5 for particle identified correlations.
769  * Other cut modes should be same as before
770  *
771  * Revision 1.7 2005/09/14 17:14:21 msd
772  * Large update, added new pair-cut system, added pair density plots for new analysis mode (4), added event mixing cuts (rewrote buffer for this)
773  *
774  * Revision 1.6 2005/03/03 01:30:43 porter
775  * updated StEStruct2ptCorrelations to include pt-correlations and removed
776  * old version of pt-correlations from chunhuih (StEStruct2ptPtNbar)
777  *
778  * Revision 1.5 2004/07/23 21:50:33 chunhuih
779  *
780  * changed float to double in the structs. This is necessary when analyzing large
781  * number of particle pairs. When a float reaches (int)2**24, adding 1 to it has no effect
782  * due to IEEE floating point encoding scheme. A double has a much larger value
783  * to meet this problem.
784  *
785  * Revision 1.4 2004/06/25 03:11:49 porter
786  * New cut-binning implementation and modified pair-cuts for chunhui to review
787  *
788  * Revision 1.3 2004/06/10 17:09:22 msd
789  * Quick-fixed EBYE_YT_BINS. Better implementation of cut-binning on the way...
790  *
791  * Revision 1.2 2004/04/13 16:58:37 chunhuih
792  *
793  * changed a set of binning functions, so that when the variable is below the
794  * minimum of the binning range, the function returns the correct overflow bin
795  * index.
796  *
797  * Revision 1.1 2003/10/15 18:20:46 porter
798  * initial check in of Estruct Analysis maker codes.
799  *
800  *
801  *********************************************************************/
802 
803 
804 
805 
806 
float maxDPt
delta yt (x) bins
int nDPhi
delta mt (x) bins
float maxMeanPt
mt (x) bins
int nPhi
mean pt bins
float maxPt
xt bins
float maxXt
yt (x) bins
float maxSEta
sigma phi bins
float dDPhi
n-bins
float maxDEta
delta phi bins
float maxTPCSepPhi
TPC separation dist.
float maxTPCQuality
TPC separation dist.
float maxYt
eta bins
float maxSYt
sigma eta bins
float maxSPt
sigma yt (x) bins
float maxEta
phi bins
float maxDYt
delta eta bins
float maxSPhi
n-bins
int nSPhi
sigma mt (x) bins