13 #ifndef __STESTRUCTBINNING__H
14 #define __STESTRUCTBINNING__H
36 #define ESTRUCT_PHI_BINS 26
37 #define ESTRUCT_ETA_BINS 26
38 #define ESTRUCT_YT_BINS 26
40 #define ESTRUCT_MEANPT_BINS 501
41 #define ESTRUCT_PT_BINS 31
42 #define ESTRUCT_XT_BINS 26
44 #define ESTRUCT_DPHI_BINS 14
45 #define ESTRUCT_DETA_BINS 14
46 #define ESTRUCT_DYT_BINS 15
47 #define ESTRUCT_DPT_BINS 31
49 #define ESTRUCT_SPHI_BINS 26
50 #define ESTRUCT_SETA_BINS 26
51 #define ESTRUCT_SYT_BINS 51
52 #define ESTRUCT_SPT_BINS 41
54 #define ESTRUCT_Q_BINS 51
55 #define ESTRUCT_TPCSEP_BINS 51
56 #define ESTRUCT_TPCSEPPHI_BINS 51
57 #define ESTRUCT_TPCQUALITY_BINS 51
59 #define ESTRUCT_DEDX_BINS 151
60 #define ESTRUCT_PTOT_BINS 151
63 #define ESTRUCT_QAPHI_BINS 101
64 #define ESTRUCT_QAETA_BINS 101
65 #define ESTRUCT_QAPT_BINS 101
68 float q[ESTRUCT_Q_BINS];
72 double phi[ESTRUCT_PHI_BINS];
75 double dphi[ESTRUCT_DPHI_BINS];
78 double sphi[ESTRUCT_SPHI_BINS];
82 double eta[ESTRUCT_ETA_BINS];
85 double deta[ESTRUCT_DETA_BINS];
89 double seta[ESTRUCT_SETA_BINS];
94 double yt[ESTRUCT_YT_BINS];
97 double dyt[ESTRUCT_DYT_BINS];
100 double syt[ESTRUCT_SYT_BINS];
104 float pt[ESTRUCT_PT_BINS];
107 float dpt[ESTRUCT_DPT_BINS];
110 float spt[ESTRUCT_SPT_BINS];
114 double xt[ESTRUCT_XT_BINS];
119 float sep[ESTRUCT_TPCSEP_BINS];
122 float sep[ESTRUCT_TPCSEPPHI_BINS];
125 float sep[ESTRUCT_TPCQUALITY_BINS];
129 float dEdx[ESTRUCT_DEDX_BINS];
133 float Ptot[ESTRUCT_PTOT_BINS];
137 float Eta[ESTRUCT_QAETA_BINS];
141 float Phi[ESTRUCT_QAPHI_BINS];
145 float Pt[ESTRUCT_QAPT_BINS];
162 float maxPhi, minPhi, dPhi;
168 int nPhi, nEta, nYt, nPt, nXt, nmeanPt;
189 float maxTPCSep, minTPCSep, dTPCSep;
192 float maxdEdx, mindEdx, ddEdx;
193 float maxPtot, minPtot, dPtot;
194 int nTPCSep, nTPCSepPhi, nTPCQuality, ndEdx, nPtot;
196 float maxQAEta, minQAEta, dQAEta;
197 float maxQAPhi, minQAPhi, dQAPhi;
198 float maxQAPt, minQAPt, dQAPt;
199 int nQAEta, nQAPhi, nQAPt;
212 void calculateDEtaWeights();
213 double getDEtaWeight(
float deta);
215 void setEtaRange(
float etamin,
float etamax);
221 int imeanpt(
float pt);
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);
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);
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);
249 int idphi(
float phi);
250 int ideta(
float eta);
254 float dphiVal(
int idphi,
int which);
255 float detaVal(
int ideta);
256 float dytVal(
int idyt);
257 float dptVal(
int idpt);
259 int isphi(
float phi);
260 int iseta(
float eta);
264 float sphiVal(
int isphi);
265 float setaVal(
int iseta);
266 float sytVal(
int isyt);
267 float sptVal(
int ispt);
269 float qMax() {
return maxQ; }
270 float qMin() {
return minQ; }
271 float getBinWidthQ() {
return dQ; }
272 int qBins() {
return nQ; }
274 float phiMax() {
return maxPhi; }
275 float phiMin() {
return minPhi; }
276 float getBinWidthPhi() {
return dPhi; }
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) {
286 dEta = (
maxEta-minEta)/(
float)nEta;
287 calculateDEtaWeights();
291 float ytMax() {
return maxYt; }
292 float ytMin() {
return minYt; }
293 float getBinWidthYt() {
return dYt; }
294 int ytBins() {
return nYt; }
296 float xtMax() {
return maxXt; }
297 float xtMin() {
return minXt; }
298 float getBinWidthXt() {
return dXt; }
299 int xtBins() {
return nXt; }
302 float meanptMin() {
return minMeanPt; }
303 float getBinWidthMeanPt() {
return dmeanPt; }
304 int meanptBins() {
return nmeanPt; }
306 float ptMax() {
return maxPt; }
307 float ptMin() {
return minPt; }
308 float getBinWidthPt() {
return dPt; }
309 int ptBins() {
return nPt; }
311 float dEdxMax() {
return maxdEdx; }
312 float dEdxMin() {
return mindEdx; }
313 float getBinWidthdEdx() {
return ddEdx; }
316 float PtotMax() {
return maxPtot; }
317 float PtotMin() {
return minPtot; }
318 float getBinWidthPtot() {
return dPtot; }
325 return 3*M_PI/2 + M_PI/(hdphiBins()-1);
332 return -M_PI/2 - M_PI/(hdphiBins()-1);
337 float getBinWidthDPhi() {
return dDPhi; }
339 int setNDPhiBins(
int nbins ) {
351 int hdphiBin(
float phi) {
352 return 1 + int( (phi-dphiMin()) /
dDPhi);
355 float detaMax() {
return maxDEta; }
356 float detaMin() {
return -
maxDEta; }
357 float getBinWidthDEta() {
return dDEta; }
359 int setNDEtaBins(
int nbins) {
361 dDEta = (
maxDEta-minDEta)/((
float)nDEta-0.5);
362 calculateDEtaWeights();
365 int hdetaBins() {
return 2*nDEta-1; };
366 int hdetaBin(
float eta) {
367 return 1 + int( (eta-detaMin()) / dDEta);
370 float dytMax() {
return maxDYt; }
371 float dytMin() {
return minDYt; }
372 float getBinWidthDYt() {
return dDYt; }
375 float dptMax() {
return maxDPt; }
376 float dptMin() {
return minDPt; }
377 float getBinWidthDPt() {
return dDPt; }
380 float sphiMax() {
return maxSPhi; }
381 float sphiMin() {
return minSPhi; }
382 float getBinWidthSPhi() {
return dSPhi; }
385 float setaMax() {
return maxSEta; }
386 float setaMin() {
return minSEta; }
387 float getBinWidthSEta() {
return dSEta; }
389 int setNSEtaBins(
int nbins ) {
391 dSEta = (
maxSEta-minSEta)/(
float)nSEta;
392 calculateDEtaWeights();
396 float sytMax() {
return maxSYt; }
397 float sytMin() {
return minSYt; }
398 float getBinWidthSYt() {
return dSYt; }
401 float sptMax() {
return maxSPt; }
402 float sptMin() {
return minSPt; }
403 float getBinWidthSPt() {
return dSPt; }
406 float TPCSepMax() {
return maxTPCSep; }
407 float TPCSepMin() {
return minTPCSep; }
410 float TPCSepPhiMin() {
return minTPCSepPhi; }
413 float TPCQualityMin() {
return minTPCQuality; }
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; }
435 inline double StEStructBinning::getDEtaWeight(
float deta){
436 return mdetaWeights.x.deta[ideta(deta)];
439 inline float StEStructBinning::qVal(
int iq){
440 return minQ+iq*dQ+dQ/2;
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;
449 inline float StEStructBinning::sepVal(
int is){
450 return minTPCSep+is*dTPCSep+dTPCSep/2;
452 inline float StEStructBinning::sepphiVal(
int is){
453 return minTPCSepPhi+is*dTPCSepPhi+dTPCSepPhi/2;
455 inline float StEStructBinning::qualityVal(
int is){
456 return minTPCQuality+is*dTPCQuality+dTPCQuality/2;
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;
464 inline int StEStructBinning::isepphi(
float dphi){
466 dphi = 2*M_PI - dphi;
467 }
else if (dphi<-M_PI) {
468 dphi = 2*M_PI + dphi;
470 int j = (int)((dphi + dTPCSepPhi/2 - minTPCSepPhi)/dTPCSepPhi);
471 return (j > ESTRUCT_TPCSEPPHI_BINS - 2) ? ESTRUCT_TPCSEPPHI_BINS - 1 : j;
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;
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;
485 inline int StEStructBinning::idphi(
float dphi){
488 dphi = 2*M_PI - dphi;
490 if( dphi < 0 )
return ESTRUCT_DPHI_BINS - 1;
492 return (j > ESTRUCT_DPHI_BINS - 2) ? ESTRUCT_DPHI_BINS - 1 : j;
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;
501 inline float StEStructBinning::phiVal(
int iphi){
502 return minPhi+iphi*dPhi+dPhi/2;
505 inline float StEStructBinning::sphiVal(
int isphi){
506 return minSPhi+isphi*dSPhi+dSPhi/2;
509 inline float StEStructBinning::dphiVal(
int idphi,
int which) {
510 float dphi = idphi*
dDPhi;
513 }
else if (2 == which) {
520 return 2*M_PI - dphi;
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;
532 inline int StEStructBinning::ideta(
float 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;
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;
545 inline float StEStructBinning::etaVal(
int ieta){
546 return minEta+ieta*dEta+dEta/2;
549 inline float StEStructBinning::setaVal(
int iseta){
550 return minSEta+iseta*dSEta+dSEta/2;
553 inline float StEStructBinning::detaVal(
int ideta){
554 return minDEta+ideta*dDEta;
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;
563 inline int StEStructBinning::idyt(
float 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;
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;
576 inline float StEStructBinning::ytVal(
int iyt){
577 return minYt+iyt*dYt+dYt/2;
580 inline float StEStructBinning::sytVal(
int isyt){
581 return minSYt+isyt*dSYt+dSYt/2;
584 inline float StEStructBinning::dytVal(
int idyt) {
588 return minDYt+idyt*dDYt;
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;
609 inline float StEStructBinning::xtVal(
int ixt){
610 return minXt+ixt*dXt+dXt/2;
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;
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;
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;
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;
636 inline float StEStructBinning::meanptVal(
int ipt){
637 return minMeanPt+ipt*dmeanPt+dmeanPt/2;
639 inline float StEStructBinning::ptVal(
int ipt){
640 return minPt+ipt*dPt+dPt/2;
643 inline float StEStructBinning::sptVal(
int ispt){
644 return minSPt+ispt*dSPt+dSPt/2;
647 inline float StEStructBinning::dptVal(
int idpt){
648 return minDPt+idpt*dDPt+dDPt/2;
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;
658 inline float StEStructBinning::dedxVal(
int idedx){
659 return mindEdx+idedx*ddEdx+ddEdx/2;
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;
668 inline float StEStructBinning::ptotVal(
int iptot){
669 return minPtot+iptot*dPtot+dPtot/2;
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;
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;
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;
688 inline float StEStructBinning::qaetaVal(
int ieta){
689 return minQAEta+ieta*dQAEta+dQAEta/2;
691 inline float StEStructBinning::qaphiVal(
int iphi){
692 return minQAPhi+iphi*dQAPhi+dQAPhi/2;
694 inline float StEStructBinning::qaptVal(
int ipt){
695 return minQAPt+ipt*dQAPt+dQAPt/2;
float maxDPt
delta yt (x) bins
int nDPhi
delta mt (x) bins
float maxMeanPt
mt (x) bins
float maxSEta
sigma phi bins
float maxDEta
delta phi bins
float maxTPCSepPhi
TPC separation dist.
float maxTPCQuality
TPC separation dist.
float maxSYt
sigma eta bins
float maxSPt
sigma yt (x) bins
float maxDYt
delta eta bins
int nSPhi
sigma mt (x) bins