18 #include "StFlowEvent.h"
19 #include "StFlowTrackCollection.h"
20 #include "StFlowSelection.h"
21 #include "StFlowConstants.h"
22 #include "PhysicalConstants.h"
23 #include "SystemOfUnits.h"
28 #define PR(x) cout << "##### FlowEvent: " << (#x) << " = " << (x) << endl;
47 Float_t StFlowEvent::mV1FtpcWestDetctWgtG_Mix[Flow::nSels] ={1., 1.};
48 Float_t StFlowEvent::mV1FtpcEastDetctWgtG_Mix[Flow::nSels] ={1., 1.};
50 Float_t StFlowEvent::mV2TPCDetctWgtG_Mix[Flow::nSels] ={1., 1.};
51 Float_t StFlowEvent::mV2FtpcWestDetctWgtG_Mix[Flow::nSels] ={1., 0.};
52 Float_t StFlowEvent::mV2FtpcEastDetctWgtG_Mix[Flow::nSels] ={1., 0.};
54 Float_t StFlowEvent::mEtaTpcCuts[2][2][Flow::nSels] = {{{0.,0.5},
62 Float_t StFlowEvent::mEtaFtpcCuts[4][2][Flow::nSels] = {{{-4.0,-4.0},
71 Float_t StFlowEvent::mPtTpcCuts[2][2][Flow::nSels] = {{{0.15,0.15},
75 Float_t StFlowEvent::mPtFtpcCuts[2][2][Flow::nSels] = {{{0.15,0.15},
80 Float_t StFlowEvent::mPiPlusCuts[2] = {-3., 3.};
81 Float_t StFlowEvent::mPiMinusCuts[2] = {-3., 3.};
82 Float_t StFlowEvent::mProtonCuts[2] = {-3., 3.};
83 Float_t StFlowEvent::mAntiProtonCuts[2] = {-3., 3.};
84 Float_t StFlowEvent::mKMinusCuts[2] = {-3., 3.};
85 Float_t StFlowEvent::mKPlusCuts[2] = {-3., 3.};
86 Float_t StFlowEvent::mDeuteronCuts[2] = {-3., 3.};
87 Float_t StFlowEvent::mAntiDeuteronCuts[2] = {-3., 3.};
88 Float_t StFlowEvent::mElectronCuts[2] = {-3., 3.};
89 Float_t StFlowEvent::mPositronCuts[2] = {-3., 3.};
90 Float_t StFlowEvent::mDcaGlobalTpcCuts[2] = { 0., 0.};
91 Float_t StFlowEvent::mDcaGlobalFtpcCuts[2] = { 0., 0.};
92 Float_t StFlowEvent::mPtWgtSaturation = 2.;
93 Bool_t StFlowEvent::mPtWgt = kTRUE;
94 Bool_t StFlowEvent::mEtaWgt = kTRUE;
95 Bool_t StFlowEvent::mProbPid = kFALSE;
96 Bool_t StFlowEvent::mEtaSubs = kFALSE;
97 Bool_t StFlowEvent::mRanSubs = kFALSE;
98 Bool_t StFlowEvent::mFirstLastPhiWgt = kFALSE;
99 Bool_t StFlowEvent::mFirstLastPoints = kFALSE;
100 Bool_t StFlowEvent::mUseZDCSMD = kFALSE;
101 Char_t StFlowEvent::mPid[10] = {
'\0'};
105 StFlowEvent::StFlowEvent() {
108 pTrackCollection =
new StFlowTrackCollection;
114 StFlowEvent::~StFlowEvent() {
116 delete pTrackCollection;
122 Double_t StFlowEvent::PhiWeightRaw(Int_t selN, Int_t harN,
StFlowTrack*
126 bool oddHar = (harN+1) % 2;
127 harN = oddHar ? 0 : 1;
130 float phi = pFlowTrack->Phi();
131 if (phi < 0.) phi += twopi;
132 float eta = pFlowTrack->Eta();
134 Double_t phiWgt = 0.;
137 float vertexZ = mVertexPos.z();
138 if (map.hasHitInDetector(kTpcId) || (map.data(0) == 0 && map.data(1) == 0)) {
140 n = (int)((phi/twopi)*Flow::nPhiBins);
141 if (mFirstLastPhiWgt) {
142 float zFirstPoint = pFlowTrack->ZFirstPoint();
143 float zLastPoint = pFlowTrack->ZLastPoint();
144 if (zFirstPoint > 0. && zLastPoint > 0.) {
145 phiWgt = mPhiWgtFarWest[selN][harN][n];
146 }
else if (zFirstPoint > 0. && zLastPoint < 0.) {
147 phiWgt = mPhiWgtWest[selN][harN][n];
148 }
else if (zFirstPoint < 0. && zLastPoint > 0.) {
149 phiWgt = mPhiWgtEast[selN][harN][n];
151 phiWgt = mPhiWgtFarEast[selN][harN][n];
154 if (eta > 0. && vertexZ > 0.) {
155 phiWgt = mPhiWgtFarWest[selN][harN][n];
156 }
else if (eta > 0. && vertexZ < 0.) {
157 phiWgt = mPhiWgtWest[selN][harN][n];
158 }
else if (eta < 0. && vertexZ > 0.) {
159 phiWgt = mPhiWgtEast[selN][harN][n];
161 phiWgt = mPhiWgtFarEast[selN][harN][n];
166 else if (map.trackFtpcEast()) {
167 n = (int)((phi/twopi)*Flow::nPhiBinsFtpc);
169 phiWgt = mPhiWgtFtpcFarEast[selN][harN][n];
172 phiWgt = mPhiWgtFtpcEast[selN][harN][n];
176 else if (map.trackFtpcWest()) {
177 n = (int)((phi/twopi)*Flow::nPhiBinsFtpc);
179 phiWgt = mPhiWgtFtpcFarWest[selN][harN][n];
182 phiWgt = mPhiWgtFtpcWest[selN][harN][n];
191 Double_t StFlowEvent::Weight(Int_t selN, Int_t harN,
StFlowTrack*
197 wgt *= PtAbsWgtValue(pFlowTrack->Pt());
198 float eta = pFlowTrack->Eta();
199 wgt *= EtaAbsWgtValue(eta);
201 if (harN == 0 && eta < 0.) { wgt *= -1. ; }
208 Double_t StFlowEvent::PtAbsWgtValue(Double_t pt)
const {
210 return ((mPtWgt) ? ((pt < mPtWgtSaturation) ? pt : mPtWgtSaturation) : 1.);
215 Double_t StFlowEvent::EtaAbsWgtValue(Double_t eta)
const {
217 return ((mEtaWgt) ? ((fabs(eta)<0.005) ? 0.005 : fabs(eta)) : 1.);
222 Double_t StFlowEvent::PhiWeight(Int_t selN, Int_t harN,
StFlowTrack*
227 Double_t phiWgtRaw = PhiWeightRaw(selN, harN, pFlowTrack);
228 Double_t weight = Weight(selN, harN, pFlowTrack);
230 return phiWgtRaw * weight;
235 Double_t StFlowEvent::ZDCSMD_PsiWgtEast() {
238 TH1F *mZDCSMD_PsiWgt =
new TH1F(
"ZDCSMD_PsiWgt",
"ZDCSMD_PsiWgt",
239 Flow::zdcsmd_nPsiBins,-twopi/2.,twopi/2.);
240 Int_t n = mZDCSMD_PsiWgt->FindBin(ZDCSMD_PsiEst());
241 mZDCSMD_PsiWgt->Delete();
243 return mZDCSMD_PsiWgtEast[n-1];
248 Double_t StFlowEvent::ZDCSMD_PsiWgtWest() {
251 TH1F *mZDCSMD_PsiWgt =
new TH1F(
"ZDCSMD_PsiWgt",
"ZDCSMD_PsiWgt",
252 Flow::zdcsmd_nPsiBins,-twopi/2.,twopi/2.);
253 Int_t n = mZDCSMD_PsiWgt->FindBin(ZDCSMD_PsiWst());
254 mZDCSMD_PsiWgt->Delete();
256 return mZDCSMD_PsiWgtWest[n-1];
260 Double_t StFlowEvent::ZDCSMD_PsiWgtFull() {
262 TH1F *mZDCSMD_PsiWgt=
new TH1F(
"ZDCSMD_PsiWgt",
"ZDCSMD_PsiWgt",Flow::zdcsmd_nPsiBins,0.,twopi);
264 Int_t n =mZDCSMD_PsiWgt->FindBin(Q(mFlowSelect).Phi());
265 mZDCSMD_PsiWgt->Delete();
267 return mZDCSMD_PsiWgtFull[n-1];
277 StFlowTrackIterator itr;
278 for (itr = TrackCollection()->begin();
279 itr != TrackCollection()->end(); itr++) {
281 if (pFlowSelect->Select(pFlowTrack)) mult++;
294 StFlowTrackIterator itr;
295 for (itr = TrackCollection()->begin();
296 itr != TrackCollection()->end(); itr++) {
298 if (pFlowSelect->SelectPart(pFlowTrack)) mult++;
312 StFlowTrackIterator itr;
313 for (itr = TrackCollection()->begin();
314 itr != TrackCollection()->end(); itr++) {
316 if (pFlowSelect->Select(pFlowTrack)) {
317 sumPt += pFlowTrack->Pt();
322 return (mult) ? sumPt/(float)mult : 0.;
331 Double_t mQx=0., mQy=0.;
334 Float_t eXsum=0., eYsum=0., wXsum=0., wYsum=0.;
335 Float_t eXWgt=0., eYWgt=0., wXWgt=0., wYWgt=0.;
336 for (
int v=1; v<8; v++) {
337 eXsum += ZDCSMD_GetPosition(0,0,v)*ZDCSMD(0,0,v);
338 wXsum += ZDCSMD_GetPosition(1,0,v)*ZDCSMD(1,0,v);
339 eXWgt += ZDCSMD(0,0,v);
340 wXWgt += ZDCSMD(1,0,v);
342 for (
int h=1;h<9;h++) {
343 eYsum += ZDCSMD_GetPosition(0,1,h)*ZDCSMD(0,1,h);
344 wYsum += ZDCSMD_GetPosition(1,1,h)*ZDCSMD(1,1,h);
345 eYWgt += ZDCSMD(0,1,h);
346 wYWgt += ZDCSMD(1,1,h);
348 mQx= (eXWgt>0. && wXWgt>0. && eYWgt>0. && wYWgt>0.) ?
349 eXsum/eXWgt - wXsum/wXWgt:0.;
350 mQy= (eXWgt>0. && wXWgt>0. && eYWgt>0. && wYWgt>0.) ?
351 eYsum/eYWgt - wYsum/wYWgt:0.;
354 int selN = pFlowSelect->Sel();
355 int harN = pFlowSelect->Har();
356 double order = (double)(harN + 1);
358 StFlowTrackIterator itr;
359 for (itr = TrackCollection()->begin();
360 itr != TrackCollection()->end(); itr++) {
362 if (pFlowSelect->Select(pFlowTrack)) {
363 double phiWgt = PhiWeight(selN, harN, pFlowTrack);
364 float phi = pFlowTrack->Phi();
365 reCent = ReCentEP(selN, harN, pFlowTrack);
366 mQx += (phiWgt * cos(order * phi) - reCent.X());
367 mQy += (phiWgt * sin(order * phi) - reCent.Y());
379 TVector2 StFlowEvent::ReCentPar(
StFlowSelection* pFlowSelect,
const char* TPC) {
386 Double_t mQx=0., mQy=0., SumOfWeight=0.;
388 int selN = pFlowSelect->Sel();
389 int harN = pFlowSelect->Har();
390 double order = (double)(harN + 1);
393 StFlowTrackIterator itr;
394 for (itr = TrackCollection()->begin();
395 itr != TrackCollection()->end(); itr++) {
397 if (pFlowSelect->SelectPart(pFlowTrack)) {
398 map = pFlowTrack->TopologyMap();
399 if ((!strcmp(TPC,
"TPCE") && map.trackFtpcEast()) ||
400 (!strcmp(TPC,
"TPCW") && map.trackFtpcWest()) ||
401 (!strcmp(TPC,
"TPC") && map.hasHitInDetector(kTpcId))) {
402 float phi = pFlowTrack->Phi();
403 double wgt = fabs(Weight(selN, harN, pFlowTrack));
404 mQx += wgt * cos(order * phi);
405 mQy += wgt * sin(order * phi);
412 mQ.Set(mQx/SumOfWeight, mQy/SumOfWeight);
420 TVector2 StFlowEvent::ReCentEPPar(
StFlowSelection* pFlowSelect,
const char* TPC) {
427 Double_t mult=0., mQx=0., mQy=0.;
429 int selN = pFlowSelect->Sel();
430 int harN = pFlowSelect->Har();
431 double order = (double)(harN + 1);
434 StFlowTrackIterator itr;
435 for (itr = TrackCollection()->begin();
436 itr != TrackCollection()->end(); itr++) {
438 if (pFlowSelect->Select(pFlowTrack)) {
439 map = pFlowTrack->TopologyMap();
440 float eta = pFlowTrack->Eta();
441 if ((!strcmp(TPC,
"FTPCE") && map.trackFtpcEast()) ||
442 (!strcmp(TPC,
"FTPCW") && map.trackFtpcWest()) ||
443 (!strcmp(TPC,
"TPCE") && eta < 0. && map.hasHitInDetector(kTpcId)) ||
444 (!strcmp(TPC,
"TPCW") && eta > 0. && map.hasHitInDetector(kTpcId)) ) {
445 float phi = pFlowTrack->Phi();
446 double phiWgt = PhiWeight(selN, harN, pFlowTrack);
447 mQx += phiWgt * cos(order * phi);
448 mQy += phiWgt * sin(order * phi);
454 if (mult) { mQ.Set(mQx/mult, mQy/mult); }
455 else { mQ.Set(0.,0.); }
462 TVector2 StFlowEvent::ReCent(Int_t selN, Int_t harN,
StFlowTrack* pFlowTrack)
const {
466 Double_t reCentX, reCentY;
469 if (map.hasHitInDetector(kTpcId)) {
470 reCentX = mReCentX[selN][harN][2];
471 reCentY = mReCentY[selN][harN][2];
472 }
else if (map.trackFtpcEast()) {
473 reCentX = mReCentX[selN][harN][0];
474 reCentY = mReCentY[selN][harN][0];
475 }
else if (map.trackFtpcWest()) {
476 reCentX = mReCentX[selN][harN][1];
477 reCentY = mReCentY[selN][harN][1];
483 reCent.Set(reCentX, reCentY);
489 TVector2 StFlowEvent::ReCentEP(Int_t selN, Int_t harN,
StFlowTrack* pFlowTrack)
const {
493 Double_t reCentX, reCentY;
496 if (map.hasHitInDetector(kTpcId)) {
497 float eta = pFlowTrack->Eta();
499 reCentX = mReCentX[selN][harN][3];
500 reCentY = mReCentY[selN][harN][3];
502 reCentX = mReCentX[selN][harN][2];
503 reCentY = mReCentY[selN][harN][2];
505 }
else if (map.trackFtpcEast()) {
506 reCentX = mReCentX[selN][harN][0];
507 reCentY = mReCentY[selN][harN][0];
508 }
else if (map.trackFtpcWest()) {
509 reCentX = mReCentX[selN][harN][1];
510 reCentY = mReCentY[selN][harN][1];
516 reCent.Set(reCentX, reCentY);
526 Double_t mQx=0., mQy=0.;
528 int selN = pFlowSelect->Sel();
529 int harN = pFlowSelect->Har();
530 double order = (double)(harN + 1);
532 StFlowTrackIterator itr;
533 for (itr = TrackCollection()->begin();
534 itr != TrackCollection()->end(); itr++) {
536 if (pFlowSelect->SelectPart(pFlowTrack)) {
537 double phiWgt = PhiWeight(selN, harN, pFlowTrack);
538 float phi = pFlowTrack->Phi();
539 reCent = ReCent(selN, harN, pFlowTrack);
540 mQx += phiWgt * (cos(order * phi) - reCent.X());
541 mQy += phiWgt * (sin(order * phi) - reCent.Y());
556 Double_t mQx=0., mQy=0.;
557 int selN = pFlowSelect->Sel();
558 int harN = pFlowSelect->Har();
559 double order = (double)(harN + 1);
560 double SumOfWeightSqr = 0;
563 StFlowTrackIterator itr;
564 for (itr = TrackCollection()->begin();
565 itr != TrackCollection()->end(); itr++) {
567 if (pFlowSelect->Select(pFlowTrack)) {
569 double phiWgt = PhiWeight(selN, harN, pFlowTrack);
570 SumOfWeightSqr += phiWgt*phiWgt;
572 float phi = pFlowTrack->Phi();
573 reCent = ReCent(selN, harN, pFlowTrack);
574 mQx += phiWgt * (cos(order * phi) - reCent.X());
575 mQy += phiWgt * (sin(order * phi) - reCent.Y());
580 mQ.Set(mQx/::sqrt(SumOfWeightSqr), mQy/::sqrt(SumOfWeightSqr));
592 Double_t mQx=0., mQy=0.;
593 int selN = pFlowSelect->Sel();
594 int harN = pFlowSelect->Har();
595 double order = (double)(harN + 1);
596 double SumOfWeightSqr = 0;
599 StFlowTrackIterator itr;
600 for (itr = TrackCollection()->begin();
601 itr != TrackCollection()->end(); itr++) {
603 if (pFlowSelect->Select(pFlowTrack)) {
605 double phiWgt = PhiWeightRaw(selN, harN, pFlowTrack);
606 SumOfWeightSqr += phiWgt*phiWgt;
608 float phi = pFlowTrack->Phi();
609 reCent = ReCent(selN, harN, pFlowTrack);
610 mQx += phiWgt * (cos(order * phi) - reCent.X());
611 mQy += phiWgt * (sin(order * phi) - reCent.Y());
616 mQ.Set(mQx/::sqrt(SumOfWeightSqr), mQy/::sqrt(SumOfWeightSqr));
632 int selN = pFlowSelect->Sel();
633 int harN = pFlowSelect->Har();
634 Double_t SumOfWeightSqr = 0;
636 StFlowTrackIterator itr;
637 for (itr = TrackCollection()->begin();
638 itr != TrackCollection()->end(); itr++) {
640 if (pFlowSelect->Select(pFlowTrack)) {
642 double phiWgt = Weight(selN, harN, pFlowTrack);
643 SumOfWeightSqr += phiWgt*phiWgt;
647 if (SumOfWeightSqr < 0.)
return Mult(pFlowSelect);
649 return SumOfWeightSqr;
654 Float_t StFlowEvent::Qtheta(
StFlowSelection* pFlowSelect, Float_t theta) {
660 int selN = pFlowSelect->Sel();
661 int harN = pFlowSelect->Har();
662 double order = (double)(harN + 1);
666 StFlowTrackIterator itr;
667 for (itr = TrackCollection()->begin();
668 itr != TrackCollection()->end(); itr++) {
670 if (pFlowSelect->SelectPart(pFlowTrack)) {
671 double wgt = Weight(selN, harN, pFlowTrack);
672 float phi = pFlowTrack->Phi();
673 reCent = ReCent(selN, harN, pFlowTrack);
674 reCentTheta = reCent.X() * cos(order*theta) + reCent.Y() * sin(order*theta);
675 Qtheta += wgt * (cos(order * (phi - theta)) - reCentTheta);
684 TComplex StFlowEvent::Grtheta(
StFlowSelection* pFlowSelect, Float_t r, Float_t theta) {
688 TComplex G = TComplex::One();
689 int selN = pFlowSelect->Sel();
690 int harN = pFlowSelect->Har();
691 double order = (double)(harN + 1);
695 StFlowTrackIterator itr;
696 for (itr = TrackCollection()->begin();
697 itr != TrackCollection()->end(); itr++) {
699 if (pFlowSelect->SelectPart(pFlowTrack)) {
700 double wgt = Weight(selN, harN, pFlowTrack);
701 float phi = pFlowTrack->Phi();
702 reCent = ReCent(selN, harN, pFlowTrack);
703 reCentTheta = reCent.X() * cos(order*theta) + reCent.Y() * sin(order*theta);
704 double Gim = r * wgt * (cos(order * (phi - theta)) - reCentTheta);
705 TComplex G_i(1., Gim);
716 TComplex StFlowEvent::GV1r0theta(
StFlowSelection* pFlowSelect, Float_t r0, Float_t theta1, Float_t theta) {
720 TComplex G = TComplex::One();
724 StFlowTrackIterator itr;
725 for (itr = TrackCollection()->begin();
726 itr != TrackCollection()->end(); itr++) {
728 if (pFlowSelect->SelectPart(pFlowTrack)) {
729 double wgt1 = Weight(1, 0, pFlowTrack);
730 double wgt2 = Weight(1, 1, pFlowTrack);
731 float phi = pFlowTrack->Phi();
734 reCentTheta = reCent.X() * cos(1.*theta1) + reCent.Y() * sin(1.*theta1);
735 double Gim1 = r0 * Flow::epsV1 * wgt1 * (cos(phi - theta1) - reCentTheta);
738 reCentTheta = reCent.X() * cos(2.*theta) + reCent.Y() * sin(2.*theta);
739 double Gim2 = r0 * wgt2 * (cos(2*(phi - theta)) - reCentTheta);
740 TComplex G_i(1., Gim1+Gim2);
749 TComplex StFlowEvent::Gder_r0theta(
StFlowSelection* pFlowSelect, Float_t r0, Float_t theta) {
755 TComplex Gder(0.,0.);
756 int selN = pFlowSelect->Sel();
757 int harN = pFlowSelect->Har();
758 double order = (double)(harN + 1);
762 StFlowTrackIterator itr;
763 for (itr = TrackCollection()->begin();
764 itr != TrackCollection()->end(); itr++) {
766 if (pFlowSelect->SelectPart(pFlowTrack)) {
767 double wgt = Weight(selN, harN, pFlowTrack);
768 float phi = pFlowTrack->Phi();
769 reCent = ReCent(selN, harN, pFlowTrack);
770 reCentTheta = reCent.X() * cos(order*theta) + reCent.Y() * sin(order*theta);
771 double cosTerm = wgt * (cos(order * (phi - theta)) - reCentTheta);
772 TComplex denom(1., r0*cosTerm);
773 Gder += (cosTerm / denom);
785 int harN = pFlowSelect->Har();
786 float order = (float)(harN + 1);
789 TVector2 mQ = Q(pFlowSelect);
792 psi= mQ.Phi() / order;
793 if (psi < 0.) { psi += twopi / order; }
801 Float_t StFlowEvent::ZDCSMD_PsiCorr() {
804 Float_t psi_e = ZDCSMD_PsiEst();
805 Float_t psi_w = ZDCSMD_PsiWst();
806 Float_t psi_w_shift = psi_w + twopi/2.;
808 if(psi_w_shift > twopi/2.) psi_w_shift -= twopi;
809 if(psi_w_shift < -twopi/2.) psi_w_shift += twopi;
811 Float_t psi_delta = psi_e - psi_w_shift;
813 if(psi_delta > twopi/2.) psi_delta -= twopi;
814 if(psi_delta < -twopi/2.) psi_delta += twopi;
821 Float_t StFlowEvent::ZDCSMD_PsiEst() {
824 Float_t eXsum=0., eYsum=0., eXWgt=0., eYWgt=0.;
826 for(
int v=1; v<8; v++) {
827 eXsum += ZDCSMD_GetPosition(0,0,v)*ZDCSMD(0,0,v);
828 eXWgt += ZDCSMD(0,0,v);
830 for(
int h=1; h<9; h++) {
831 eYsum += ZDCSMD_GetPosition(0,1,h)*ZDCSMD(0,1,h);
832 eYWgt += ZDCSMD(0,1,h);
835 Float_t psi_e = atan2((eYWgt>0.) ? eYsum/eYWgt:0.,(eXWgt>0.) ? eXsum/eXWgt:0.);
842 Float_t StFlowEvent::ZDCSMD_PsiWst() {
845 Float_t wXsum=0.,wYsum=0.,wXWgt=0.,wYWgt=0.;
847 for(
int v=1;v<8;v++) {
848 wXsum += ZDCSMD_GetPosition(1,0,v)*ZDCSMD(1,0,v);
849 wXWgt += ZDCSMD(1,0,v);
851 for(
int h=1;h<9;h++) {
852 wYsum += ZDCSMD_GetPosition(1,1,h)*ZDCSMD(1,1,h);
853 wYWgt += ZDCSMD(1,1,h);
856 Float_t psi_w = atan2((wYWgt>0.) ? wYsum/wYWgt:0.,(wXWgt>0.) ? wXsum/wXWgt:0.);
863 Float_t StFlowEvent::ZDCSMD_GetPosition(
int eastwest,
int verthori,
int strip) {
866 Float_t zdcsmd_x[7] = {0.5,2,3.5,5,6.5,8,9.5};
867 Float_t zdcsmd_y[8] = {1.25,3.25,5.25,7.25,9.25,11.25,13.25,15.25};
869 if(eastwest==0 && verthori==0)
return zdcsmd_x[strip-1]-mZDCSMDCenterex;
870 if(eastwest==1 && verthori==0)
return mZDCSMDCenterwx-zdcsmd_x[strip-1];
871 if(eastwest==0 && verthori==1)
return zdcsmd_y[strip-1]/sqrt(2.)-mZDCSMDCenterey;
872 if(eastwest==1 && verthori==1)
return zdcsmd_y[strip-1]/sqrt(2.)-mZDCSMDCenterwy;
879 Double_t StFlowEvent::G_New(
StFlowSelection* pFlowSelect, Double_t Zx, Double_t Zy) {
882 int selN = pFlowSelect->Sel();
883 int harN = pFlowSelect->Har();
884 double order = (double)(harN + 1);
886 double mult = (double)Mult(pFlowSelect);
889 StFlowTrackIterator itr;
890 for (itr = TrackCollection()->begin();
891 itr != TrackCollection()->end(); itr++) {
893 if (pFlowSelect->Select(pFlowTrack)) {
895 double phiWgt = Weight(selN, harN, pFlowTrack);
896 float phi = pFlowTrack->Phi();
897 theG *= (1. + (phiWgt/mult) * (2.* Zx * cos(order * phi) +
898 2.* Zy * sin(order * phi) ) );
907 Double_t StFlowEvent::G_Mix(
StFlowSelection* pFlowSelect, Double_t Z1x, Double_t Z1y, Double_t Z2x, Double_t Z2y) {
912 int selN = pFlowSelect->Sel();
913 int harN = pFlowSelect->Har();
914 double order = (double)(harN + 1);
916 bool oddHar = (harN+1) % 2;
920 double mult = (double)Mult(pFlowSelect);
923 StFlowTrackIterator itr;
924 for (itr = TrackCollection()->begin();
925 itr != TrackCollection()->end(); itr++) {
927 if (pFlowSelect->Select(pFlowTrack)) {
929 double detectorV1Wgt = 1.;
931 if (pFlowTrack->TopologyMap().hasHitInDetector(kTpcId) ||
932 (pFlowTrack->TopologyMap().data(0) == 0 &&
933 pFlowTrack->TopologyMap().data(1) == 0)) {
935 detectorV1Wgt =mV1TPCDetctWgtG_Mix[selN];
936 }
else if (pFlowTrack->TopologyMap().trackFtpcEast() ) {
937 detectorV1Wgt =mV1FtpcEastDetctWgtG_Mix[selN];
938 }
else if (pFlowTrack->TopologyMap().trackFtpcWest() ) {
939 detectorV1Wgt =mV1FtpcWestDetctWgtG_Mix[selN];
942 double detectorV2Wgt = 1.;
944 if (pFlowTrack->TopologyMap().hasHitInDetector(kTpcId) ||
945 (pFlowTrack->TopologyMap().data(0) == 0 &&
946 pFlowTrack->TopologyMap().data(1) == 0)) {
948 detectorV2Wgt =mV2TPCDetctWgtG_Mix[selN];
949 }
else if (pFlowTrack->TopologyMap().trackFtpcEast() ) {
950 detectorV2Wgt =mV2FtpcEastDetctWgtG_Mix[selN];
951 }
else if (pFlowTrack->TopologyMap().trackFtpcWest() ) {
952 detectorV2Wgt =mV2FtpcWestDetctWgtG_Mix[selN];
956 float phi = pFlowTrack->Phi();
957 double pt = pFlowTrack->Pt();
958 double eta = pFlowTrack->Eta();
960 if (oddHar) etaWgt =( (eta>0) ? (EtaAbsWgtValue(eta)) : (-1.*EtaAbsWgtValue(eta)) );
962 ptWgt = PtAbsWgtValue(pt);
965 (1. + (phiWgt*etaWgt*detectorV1Wgt/mult) * (2.* Z1x * cos(order * phi) +
966 2.* Z1y * sin(order * phi) )
967 + (phiWgt*ptWgt*detectorV2Wgt/mult) * (2.* Z2x * cos(phi * order*2.) +
968 2.* Z2y * sin(phi * order*2.) ) );
977 void StFlowEvent::SetSelections() {
980 StFlowTrackIterator itr;
981 for (itr = TrackCollection()->begin();
982 itr != TrackCollection()->end(); itr++) {
984 double eta = (double)(pFlowTrack->Eta());
985 float Pt = pFlowTrack->Pt();
989 if (mPid[0] !=
'\0') {
990 if (strstr(mPid,
"h")!=0) {
991 int charge = pFlowTrack->Charge();
992 if (strcmp(
"h+", mPid)==0 && charge != 1)
continue;
993 if (strcmp(
"h-", mPid)==0 && charge != -1)
continue;
996 strcpy(pid, pFlowTrack->Pid());
997 if (strstr(pid, mPid)==0)
continue;
1002 float gDca = pFlowTrack->DcaGlobal();
1004 if (map.hasHitInDetector(kTpcId) || (map.data(0) == 0 && map.data(1) == 0)) {
1007 if (mDcaGlobalTpcCuts[1] > mDcaGlobalTpcCuts[0] &&
1008 (gDca < mDcaGlobalTpcCuts[0] || gDca >= mDcaGlobalTpcCuts[1]))
continue;
1010 else if (map.trackFtpcEast() || map.trackFtpcWest()) {
1013 if (mDcaGlobalFtpcCuts[1] > mDcaGlobalFtpcCuts[0] &&
1014 (gDca < mDcaGlobalFtpcCuts[0] || gDca >= mDcaGlobalFtpcCuts[1]))
continue;
1017 for (
int selN = 0; selN < Flow::nSels; selN++) {
1018 for (
int harN = 0; harN < Flow::nHars; harN++) {
1020 if (map.hasHitInDetector(kTpcId) || (map.data(0) == 0 && map.data(1) == 0)) {
1027 int etaCut = harN ? 1 : 0;
1028 if (mEtaTpcCuts[1][etaCut][selN] > mEtaTpcCuts[0][etaCut][selN] &&
1029 (fabs(eta) < mEtaTpcCuts[0][etaCut][selN] ||
1030 fabs(eta) >= mEtaTpcCuts[1][etaCut][selN]))
continue;
1033 if (mPtTpcCuts[1][harN%2][selN] > mPtTpcCuts[0][harN%2][selN] &&
1034 (Pt < mPtTpcCuts[0][harN%2][selN] ||
1035 Pt >= mPtTpcCuts[1][harN%2][selN]))
continue;
1037 else if (map.trackFtpcEast() || map.trackFtpcWest()) {
1042 if (mEtaFtpcCuts[1][harN%2][selN] > mEtaFtpcCuts[0][harN%2][selN] &&
1043 (eta < mEtaFtpcCuts[0][harN%2][selN] ||
1044 eta >= mEtaFtpcCuts[1][harN%2][selN]))
continue;
1047 if (mEtaFtpcCuts[3][harN%2][selN] > mEtaFtpcCuts[2][harN%2][selN] &&
1048 (eta < mEtaFtpcCuts[2][harN%2][selN] ||
1049 eta >= mEtaFtpcCuts[3][harN%2][selN]))
continue;
1053 if (mPtFtpcCuts[1][harN%2][selN] > mPtFtpcCuts[0][harN%2][selN] &&
1054 (Pt < mPtFtpcCuts[0][harN%2][selN] ||
1055 Pt >= mPtFtpcCuts[1][harN%2][selN]))
continue;
1058 pFlowTrack->SetSelect(harN, selN);
1066 void StFlowEvent::MakeSubEvents() {
1069 StFlowTrackIterator itr;
1070 int eventMult[Flow::nHars][Flow::nSels] = {{0}};
1071 int harN, selN, subN = 0;
1074 for (itr = TrackCollection()->begin();
1075 itr != TrackCollection()->end(); itr++) {
1077 for (selN = 0; selN < Flow::nSels; selN++) {
1078 for (harN = 0; harN < Flow::nHars; harN++) {
1079 if (pFlowTrack->Select(harN, selN)) {
1080 eventMult[harN][selN]++;
1087 for (selN = 0; selN < Flow::nSels; selN++) {
1088 for (harN = 0; harN < Flow::nHars; harN++) {
1089 int subEventMult = eventMult[harN][selN] / Flow::nSubs;
1093 for (itr = TrackCollection()->begin();
1094 itr != TrackCollection()->end(); itr++) {
1096 if (pFlowTrack->Select(harN, selN)) {
1097 pFlowTrack->SetSubevent(harN, selN, subN);
1099 if (countN % subEventMult == 0.) subN++;
1110 void StFlowEvent::MakeEtaSubEvents() {
1113 StFlowTrackIterator itr;
1117 for (selN = 0; selN < Flow::nSels; selN++) {
1118 for (harN = 0; harN < Flow::nHars; harN++) {
1119 for (itr = TrackCollection()->begin();
1120 itr != TrackCollection()->end(); itr++) {
1122 if (pFlowTrack->Select(harN, selN)) {
1123 float eta = pFlowTrack->Eta();
1125 pFlowTrack->SetSubevent(harN, selN, 0);
1127 pFlowTrack->SetSubevent(harN, selN, 1);
1138 void StFlowEvent::SetPidsDeviant() {
1141 StFlowTrackIterator itr;
1143 for (itr = TrackCollection()->begin();
1144 itr != TrackCollection()->end(); itr++) {
1147 Char_t pid[10] =
"NA";
1148 Short_t charge = pFlowTrack->Charge();
1150 bool bPiPlus = kFALSE;
1151 bool bPiMinus = kFALSE;
1152 bool bProton = kFALSE;
1153 bool bAntiProton = kFALSE;
1154 bool bKplus = kFALSE;
1155 bool bKminus = kFALSE;
1156 bool bDeuteron = kFALSE;
1157 bool bAntiDeuteron = kFALSE;
1158 bool bElectron = kFALSE;
1159 bool bPositron = kFALSE;
1162 float piPlus = pFlowTrack->PidPiPlus();
1163 float proton = pFlowTrack->PidProton();
1164 float kPlus = pFlowTrack->PidKaonPlus();
1165 float deuteron = pFlowTrack->PidDeuteron();
1166 float positron = pFlowTrack->PidPositron();
1167 if (piPlus > mPiPlusCuts[0] &&
1168 piPlus < mPiPlusCuts[1]) {
1171 if ( proton > mProtonCuts[0] &&
1172 proton < mProtonCuts[1]) {
1175 if ( kPlus > mKPlusCuts[0] &&
1176 kPlus < mKPlusCuts[1]) {
1179 if ( deuteron > mDeuteronCuts[0] &&
1180 deuteron < mDeuteronCuts[1]) {
1183 if ( positron > mPositronCuts[0] &&
1184 positron < mPositronCuts[1]) {
1187 }
else if (charge == -1) {
1188 float piMinus = pFlowTrack->PidPiMinus();
1189 float antiProton = pFlowTrack->PidAntiProton();
1190 float kMinus = pFlowTrack->PidKaonMinus();
1191 float antiDeuteron = pFlowTrack->PidAntiDeuteron();
1192 float electron = pFlowTrack->PidElectron();
1193 if (piMinus > mPiMinusCuts[0] &&
1194 piMinus < mPiMinusCuts[1]) {
1197 if ( antiProton > mAntiProtonCuts[0] &&
1198 antiProton < mAntiProtonCuts[1]) {
1199 bAntiProton = kTRUE;
1201 if ( kMinus > mKMinusCuts[0] &&
1202 kMinus < mKMinusCuts[1]) {
1205 if ( antiDeuteron > mAntiDeuteronCuts[0] &&
1206 antiDeuteron < mAntiDeuteronCuts[1]) {
1207 bAntiDeuteron = kTRUE;
1209 if ( electron > mElectronCuts[0] &&
1210 electron < mElectronCuts[1]) {
1215 if (bPiPlus && !bPiMinus && !bProton && !bAntiProton &&
1216 !bKplus && !bKminus && !bDeuteron && !bAntiDeuteron &&
1217 !bElectron && !bPositron) { strcpy(pid,
"pi+"); }
1218 if (!bPiPlus && bPiMinus && !bProton && !bAntiProton &&
1219 !bKplus && !bKminus && !bDeuteron && !bAntiDeuteron &&
1220 !bElectron && !bPositron) { strcpy(pid,
"pi-"); }
1221 if (!bPiPlus && !bPiMinus && bProton && !bAntiProton &&
1222 !bKplus && !bKminus && !bDeuteron && !bAntiDeuteron &&
1223 !bElectron && !bPositron) { strcpy(pid,
"pr+"); }
1224 if (!bPiPlus && !bPiMinus && !bProton && bAntiProton &&
1225 !bKplus && !bKminus && !bDeuteron && !bAntiDeuteron &&
1226 !bElectron && !bPositron) { strcpy(pid,
"pr-"); }
1227 if (!bPiPlus && !bPiMinus && !bProton && !bAntiProton &&
1228 bKplus && !bKminus && !bDeuteron && !bAntiDeuteron &&
1229 !bElectron && !bPositron) { strcpy(pid,
"k+"); }
1230 if (!bPiPlus && !bPiMinus && !bProton && !bAntiProton &&
1231 !bKplus && bKminus && !bDeuteron && !bAntiDeuteron &&
1232 !bElectron && !bPositron) { strcpy(pid,
"k-"); }
1233 if (!bPiPlus && !bPiMinus && !bProton && !bAntiProton &&
1234 !bKplus && !bKminus && bDeuteron && !bAntiDeuteron &&
1235 !bElectron && !bPositron) { strcpy(pid,
"d+"); }
1236 if (!bPiPlus && !bPiMinus && !bProton && !bAntiProton &&
1237 !bKplus && !bKminus && !bDeuteron && bAntiDeuteron &&
1238 !bElectron && !bPositron) { strcpy(pid,
"d-"); }
1239 if (!bPiPlus && !bPiMinus && !bProton && !bAntiProton &&
1240 !bKplus && !bKminus && !bDeuteron && !bAntiDeuteron &&
1241 bElectron && !bPositron) { strcpy(pid,
"e-"); }
1242 if (!bPiPlus && !bPiMinus && !bProton && !bAntiProton &&
1243 !bKplus && !bKminus && !bDeuteron && !bAntiDeuteron &&
1244 !bElectron && bPositron) { strcpy(pid,
"e+"); }
1246 pFlowTrack->SetPid(pid);
1253 void StFlowEvent::SetPidsProb() {
1256 StFlowTrackIterator itr;
1258 for (itr = TrackCollection()->begin();
1259 itr != TrackCollection()->end(); itr++) {
1262 Char_t pid[10] =
"NA";
1264 if (pFlowTrack->MostLikelihoodPID() == 8 &&
1265 pFlowTrack->MostLikelihoodProb() > 0.9)
1266 { strcpy(pid,
"pi+"); }
1267 if (pFlowTrack->MostLikelihoodPID() == 9 &&
1268 pFlowTrack->MostLikelihoodProb() > 0.9)
1269 { strcpy(pid,
"pi-"); }
1270 if (pFlowTrack->MostLikelihoodPID() == 14 &&
1271 pFlowTrack->MostLikelihoodProb() > 0.9)
1272 { strcpy(pid,
"pr+"); }
1273 if (pFlowTrack->MostLikelihoodPID() == 15 &&
1274 pFlowTrack->MostLikelihoodProb() > 0.9)
1275 { strcpy(pid,
"pr-"); }
1276 if (pFlowTrack->MostLikelihoodPID() == 11 &&
1277 pFlowTrack->MostLikelihoodProb() > 0.9)
1278 { strcpy(pid,
"k+"); }
1279 if (pFlowTrack->MostLikelihoodPID() == 12 &&
1280 pFlowTrack->MostLikelihoodProb() > 0.9)
1281 { strcpy(pid,
"k-"); }
1282 if (pFlowTrack->MostLikelihoodPID() == 45 &&
1283 pFlowTrack->MostLikelihoodProb() > 0.9)
1284 { strcpy(pid,
"d+"); }
1288 if (pFlowTrack->MostLikelihoodPID() == 3 &&
1289 pFlowTrack->MostLikelihoodProb() > 0.9)
1290 { strcpy(pid,
"e-"); }
1291 if (pFlowTrack->MostLikelihoodPID() == 2 &&
1292 pFlowTrack->MostLikelihoodProb() > 0.9)
1293 { strcpy(pid,
"e+"); }
1295 pFlowTrack->SetPid(pid);
1302 void StFlowEvent::SetCentrality() {
1306 Int_t tracks = mMultEta;
1308 if (mRunID > 8000000) {
1309 cent = Flow::cent200Year7;
1310 }
else if (mRunID > 4000000) {
1311 if (mCenterOfMassEnergy >= 199.) {
1312 if (fabs(mMagneticField) >= 4.) {
1313 cent = Flow::cent200Year4Full;
1315 cent = Flow::cent200Year4Half;
1317 }
else if (mCenterOfMassEnergy >60. && mCenterOfMassEnergy < 65.) {
1318 cent = Flow::cent62;
1320 }
else if (mCenterOfMassEnergy >= 199.) {
1321 if (fabs(mMagneticField) >= 4.) {
1322 cent = Flow::cent200Full;
1324 cent = Flow::cent200Half;
1326 }
else if (mCenterOfMassEnergy == 0.) {
1327 cent = Flow::cent130;
1328 }
else if (mCenterOfMassEnergy <= 25.){
1329 cent = Flow::cent22;
1332 if (tracks < cent[0]) { mCentrality = 0; }
1333 else if (tracks < cent[1]) { mCentrality = 1; }
1334 else if (tracks < cent[2]) { mCentrality = 2; }
1335 else if (tracks < cent[3]) { mCentrality = 3; }
1336 else if (tracks < cent[4]) { mCentrality = 4; }
1337 else if (tracks < cent[5]) { mCentrality = 5; }
1338 else if (tracks < cent[6]) { mCentrality = 6; }
1339 else if (tracks < cent[7]) { mCentrality = 7; }
1340 else if (tracks < cent[8]) { mCentrality = 8; }
1341 else { mCentrality = 9; }
1347 void StFlowEvent::PrintSelectionList() {
1351 cout <<
"#######################################################" << endl;
1352 cout <<
"# Weighting and Striping:" << endl;
1354 cout <<
"# PtWgt= TRUE, also for output of PhiWgt file" << endl;
1355 cout <<
"# PtWgt Saturation= " << mPtWgtSaturation << endl;
1357 cout <<
"# PtWgt= FALSE" << endl;
1360 cout <<
"# EtaWgt= TRUE, also for output of PhiWgt file for 1st harmonic" << endl;
1362 cout <<
"# EtaWgt= FALSE" << endl;
1365 cout <<
"# EtaSubs= TRUE" << endl;
1367 cout <<
"# EtaSubs= FALSE" << endl;
1370 cout <<
"# RanSubs= TRUE" << endl;
1372 cout <<
"# RanSubs= FALSE" << endl;
1374 cout <<
"#######################################################" << endl;
1375 cout <<
"# Pid Deviant Cuts:" << endl;
1376 cout <<
"# PiPlus cuts= " << mPiPlusCuts[0] <<
", "
1377 << mPiPlusCuts[1] << endl;
1378 cout <<
"# PiMinus cuts= " << mPiMinusCuts[0] <<
", "
1379 << mPiMinusCuts[1] << endl;
1380 cout <<
"# Proton cuts= " << mProtonCuts[0] <<
", "
1381 << mProtonCuts[1] << endl;
1382 cout <<
"# Anti Proton cuts= " << mAntiProtonCuts[0] <<
", "
1383 << mAntiProtonCuts[1] << endl;
1384 cout <<
"# Deuteron cuts= " << mDeuteronCuts[0] <<
", "
1385 << mDeuteronCuts[1] << endl;
1386 cout <<
"# Anti Deuteron cuts= " << mAntiDeuteronCuts[0] <<
", "
1387 << mAntiDeuteronCuts[1] << endl;
1388 cout <<
"# K- cuts= " << mKMinusCuts[0] <<
", "
1389 << mKMinusCuts[1] << endl;
1390 cout <<
"# K+ cuts= " << mKPlusCuts[0] <<
", "
1391 << mKPlusCuts[1] << endl;
1392 cout <<
"# Electron cuts= " << mElectronCuts[0] <<
", "
1393 << mElectronCuts[1] << endl;
1394 cout <<
"# Positron cuts= " << mPositronCuts[0] <<
", "
1395 << mPositronCuts[1] << endl;
1396 cout <<
"#######################################################" << endl;
1397 cout <<
"# Tracks used for the event plane:" << endl;
1398 cout <<
"# Particle ID= " << mPid << endl;
1399 cout <<
"# Global Dca Tpc cuts= " << mDcaGlobalTpcCuts[0] <<
", "
1400 << mDcaGlobalTpcCuts[1] << endl;
1401 cout <<
"# Global Dca Ftpc cuts= " << mDcaGlobalFtpcCuts[0] <<
", "
1402 << mDcaGlobalFtpcCuts[1] << endl;
1403 for (
int k = 0; k < Flow::nSels; k++) {
1404 for (
int j = 0; j < 2; j++) {
1405 cout <<
"# selection= " << k+1 <<
" harmonic= "
1407 cout <<
"# abs(Eta) Tpc cuts= " << mEtaTpcCuts[0][j][k] <<
", "
1408 << mEtaTpcCuts[1][j][k] << endl;
1409 cout <<
"# Eta Ftpc cuts= " << mEtaFtpcCuts[0][j][k] <<
", "
1410 << mEtaFtpcCuts[1][j][k] <<
", " << mEtaFtpcCuts[2][j][k] <<
", "
1411 << mEtaFtpcCuts[3][j][k] << endl;
1412 cout <<
"# Pt Tpc cuts= " << mPtTpcCuts[0][j][k] <<
", "
1413 << mPtTpcCuts[1][j][k] << endl;
1414 cout <<
"# Pt Ftpc cuts= " << mPtFtpcCuts[0][j][k] <<
", "
1415 << mPtFtpcCuts[1][j][k] << endl;
1418 cout <<
"#######################################################" << endl;