27 #include "Riostream.h"
28 #include "TObjArray.h"
32 #include "TParticle.h"
39 #include "TParameter.h"
54 fTrackCollection(NULL),
55 fReferenceMultiplicity(0),
57 fUseGlauberMCSymmetryPlanes(kFALSE),
58 fUseExternalSymmetryPlanes(kFALSE),
67 fMCReactionPlaneAngle(0.),
68 fMCReactionPlaneAngleIsSet(kFALSE),
69 fAfterBurnerPrecision(0.001),
70 fUserModified(kFALSE),
71 fNumberOfTracksWrap(NULL),
72 fNumberOfRPsWrap(NULL),
73 fNumberOfPOIsWrap(NULL),
74 fMCReactionPlaneAngleWrap(NULL),
75 fShuffledIndexes(NULL),
76 fShuffleTracks(kFALSE),
77 fMothersCollection(NULL),
88 for(Int_t i(0); i < 2; i++) {
92 for(Int_t i(0); i < 3; i++) {
95 cout <<
"AliFlowEventSimple: Default constructor to be used only by root for io" << endl;
106 fTrackCollection(new TObjArray(n)),
107 fReferenceMultiplicity(0),
109 fUseGlauberMCSymmetryPlanes(kFALSE),
110 fUseExternalSymmetryPlanes(kFALSE),
119 fMCReactionPlaneAngle(0.),
120 fMCReactionPlaneAngleIsSet(kFALSE),
121 fAfterBurnerPrecision(0.001),
122 fUserModified(kFALSE),
123 fNumberOfTracksWrap(NULL),
124 fNumberOfRPsWrap(NULL),
125 fNumberOfPOIsWrap(NULL),
126 fMCReactionPlaneAngleWrap(NULL),
127 fShuffledIndexes(NULL),
128 fShuffleTracks(kFALSE),
129 fMothersCollection(new TObjArray()),
137 fNumberOfPOItypes(2),
138 fNumberOfPOIs(new Int_t[fNumberOfPOItypes])
146 Generate(n,ptDist,phiMin,phiMax,etaMin,etaMax);
148 for(Int_t i(0); i < 2; i++) {
152 for(Int_t i(0); i < 3; i++) {
160 fTrackCollection((TObjArray*)(anEvent.fTrackCollection)->Clone()),
161 fReferenceMultiplicity(anEvent.fReferenceMultiplicity),
162 fNumberOfTracks(anEvent.fNumberOfTracks),
163 fUseGlauberMCSymmetryPlanes(anEvent.fUseGlauberMCSymmetryPlanes),
164 fUseExternalSymmetryPlanes(anEvent.fUseExternalSymmetryPlanes),
165 fPsi1(anEvent.fPsi1),
166 fPsi2(anEvent.fPsi2),
167 fPsi3(anEvent.fPsi3),
168 fPsi4(anEvent.fPsi4),
169 fPsi5(anEvent.fPsi5),
170 fPsi1Psi3(anEvent.fPsi1Psi3),
171 fPsi2Psi4(anEvent.fPsi2Psi4),
172 fPsi3Psi5(anEvent.fPsi3Psi5),
173 fMCReactionPlaneAngle(anEvent.fMCReactionPlaneAngle),
174 fMCReactionPlaneAngleIsSet(anEvent.fMCReactionPlaneAngleIsSet),
175 fAfterBurnerPrecision(anEvent.fAfterBurnerPrecision),
176 fUserModified(anEvent.fUserModified),
177 fNumberOfTracksWrap(anEvent.fNumberOfTracksWrap),
178 fNumberOfRPsWrap(anEvent.fNumberOfRPsWrap),
179 fNumberOfPOIsWrap(anEvent.fNumberOfPOIsWrap),
180 fMCReactionPlaneAngleWrap(anEvent.fMCReactionPlaneAngleWrap),
181 fShuffledIndexes(NULL),
182 fShuffleTracks(anEvent.fShuffleTracks),
183 fMothersCollection(new TObjArray()),
184 fCentrality(anEvent.fCentrality),
185 fCentralityCL1(anEvent.fCentralityCL1),
186 fNITSCL1(anEvent.fNITSCL1),
187 fCentralityTRK(anEvent.fCentralityTRK),
189 fZNCM(anEvent.fZNCM),
190 fZNAM(anEvent.fZNAM),
191 fNumberOfPOItypes(anEvent.fNumberOfPOItypes),
192 fNumberOfPOIs(new Int_t[fNumberOfPOItypes])
196 for(Int_t i(0); i < 2; i++) {
200 for(Int_t i(0); i < 3; i++) {
214 Int_t* tmp =
new Int_t[n];
215 for (Int_t j=0; j<n; j++) { tmp[j]=0; }
237 if (&anEvent==
this)
return *
this;
273 for(Int_t i(0); i < 2; i++) {
277 for(Int_t i(0); i < 3; i++) {
309 fPsi1Psi3 =
new TF1(
"fPsi1Psi3",
"[0]*x+[1]",0.,2.*TMath::Pi());
317 fPsi2Psi4 =
new TF1(
"fPsi2Psi4",
"[0]*x+[1]",0.,2.*TMath::Pi());
325 fPsi3Psi5 =
new TF1(
"fPsi3Psi5",
"[0]*x+[1]",0.,2.*TMath::Pi());
343 static TF1 ptdistribution(
"ptSpectra",
"x*TMath::Exp(-pow(0.13957*0.13957+x*x,0.5)/0.4)",0.1,10.);
344 ptDist=&ptdistribution;
347 for (Int_t i=0; i<nParticles; i++)
352 track->
SetPt( ptDist->GetRandom() );
357 Double_t betaParameter =
gRandom->Gaus(0.,1.3);
358 fPsi1Psi3->SetParameter(1,betaParameter);
360 betaParameter =
gRandom->Gaus(0.,0.9);
361 fPsi2Psi4->SetParameter(1,betaParameter);
363 betaParameter =
gRandom->Gaus(0.,1.5);
364 fPsi3Psi5->SetParameter(1,betaParameter);
370 else if(
fPsi3 > 2.*TMath::Pi())
fPsi3 -= 2.*TMath::Pi();
373 else if(
fPsi4 > 2.*TMath::Pi())
fPsi4 -= 2.*TMath::Pi();
376 else if(
fPsi5 > 2.*TMath::Pi())
fPsi5 -= 2.*TMath::Pi();
416 Printf(
"Tracks shuffled! tracks: %i",fNumberOfTracks);
423 if (fNumberOfTracks < fTrackCollection->GetEntriesFast())
463 Bool_t usePhiWeights,
465 Bool_t useEtaWeights )
474 Double_t sumOfWeights = 0.;
478 Double_t dWeight = 1.;
483 Double_t dBinWidthPt = 0.;
484 Double_t dPtMin = 0.;
485 Double_t dBinWidthEta = 0.;
486 Double_t dEtaMin = 0.;
492 TH1F *phiWeights = NULL;
493 TH1D *ptWeights = NULL;
494 TH1D *etaWeights = NULL;
500 phiWeights =
dynamic_cast<TH1F *
>(weightsList->FindObject(
"phi_weights"));
501 if(phiWeights) nBinsPhi = phiWeights->GetNbinsX();
505 ptWeights =
dynamic_cast<TH1D *
>(weightsList->FindObject(
"pt_weights"));
508 dBinWidthPt = ptWeights->GetBinWidth(1);
509 dPtMin = (ptWeights->GetXaxis())->GetXmin();
514 etaWeights =
dynamic_cast<TH1D *
>(weightsList->FindObject(
"eta_weights"));
517 dBinWidthEta = etaWeights->GetBinWidth(1);
518 dEtaMin = (etaWeights->GetXaxis())->GetXmin();
531 dPhi = pTrack->
Phi();
533 dEta = pTrack->
Eta();
534 dWeight = pTrack->
Weight();
537 if(phiWeights && nBinsPhi)
539 wPhi = phiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*nBinsPhi/TMath::TwoPi())));
542 if(ptWeights && dBinWidthPt)
544 wPt=ptWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-dPtMin)/dBinWidthPt)));
547 if(etaWeights && dBinWidthEta)
549 wEta=etaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-dEtaMin)/dBinWidthEta)));
553 dQX += dWeight*wPhi*wPt*wEta*TMath::Cos(iOrder*dPhi);
554 dQY += dWeight*wPhi*wPt*wEta*TMath::Sin(iOrder*dPhi);
557 sumOfWeights += dWeight*wPhi*wPt*wEta;
563 cerr <<
"no particle!!!"<<endl;
581 Bool_t usePhiWeights,
583 Bool_t useEtaWeights )
591 Double_t sumOfWeights = 0.;
595 Double_t dWeight = 1.;
599 Int_t iNbinsPhiSub0 = 0;
600 Int_t iNbinsPhiSub1 = 0;
601 Double_t dBinWidthPt = 0.;
602 Double_t dPtMin = 0.;
603 Double_t dBinWidthEta= 0.;
604 Double_t dEtaMin = 0.;
610 TH1F* phiWeightsSub0 = NULL;
611 TH1F* phiWeightsSub1 = NULL;
612 TH1D* ptWeights = NULL;
613 TH1D* etaWeights = NULL;
619 phiWeightsSub0 =
dynamic_cast<TH1F *
>(weightsList->FindObject(
"phi_weights_sub0"));
621 iNbinsPhiSub0 = phiWeightsSub0->GetNbinsX();
623 phiWeightsSub1 =
dynamic_cast<TH1F *
>(weightsList->FindObject(
"phi_weights_sub1"));
625 iNbinsPhiSub1 = phiWeightsSub1->GetNbinsX();
630 ptWeights =
dynamic_cast<TH1D *
>(weightsList->FindObject(
"pt_weights"));
633 dBinWidthPt = ptWeights->GetBinWidth(1);
634 dPtMin = (ptWeights->GetXaxis())->GetXmin();
639 etaWeights =
dynamic_cast<TH1D *
>(weightsList->FindObject(
"eta_weights"));
642 dBinWidthEta = etaWeights->GetBinWidth(1);
643 dEtaMin = (etaWeights->GetXaxis())->GetXmin();
649 for (Int_t s=0; s<2; s++)
657 cerr <<
"no particle!!!"<<endl;
662 dPhi = pTrack->
Phi();
664 dEta = pTrack->
Eta();
665 dWeight = pTrack->
Weight();
670 if(phiWeightsSub0 && iNbinsPhiSub0) {
671 Int_t phiBin = 1+(Int_t)(TMath::Floor(dPhi*iNbinsPhiSub0/TMath::TwoPi()));
673 dPhi = phiWeightsSub0->GetBinCenter(phiBin);
674 dWphi = phiWeightsSub0->GetBinContent(phiBin);
679 if(phiWeightsSub1 && iNbinsPhiSub1) {
680 Int_t phiBin = 1+(Int_t)(TMath::Floor(dPhi*iNbinsPhiSub1/TMath::TwoPi()));
682 dPhi = phiWeightsSub1->GetBinCenter(phiBin);
683 dWphi = phiWeightsSub1->GetBinContent(phiBin);
688 if(ptWeights && dBinWidthPt)
690 dWpt=ptWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-dPtMin)/dBinWidthPt)));
694 if(etaWeights && dBinWidthEta)
696 dWeta=etaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-dEtaMin)/dBinWidthEta)));
700 dQX += dWeight*dWphi*dWpt*dWeta*TMath::Cos(iOrder*dPhi);
701 dQY += dWeight*dWphi*dWpt*dWeta*TMath::Sin(iOrder*dPhi);
704 sumOfWeights+=dWeight*dWphi*dWpt*dWeta;
709 Qarray[s].Set(dQX,dQY);
710 Qarray[s].
SetMult(sumOfWeights);
767 printf(
"Class.Print Name = %s, #tracks= %d, Number of RPs= %d, Number of POIs = %d, MC EventPlaneAngle= %f\n",
770 TString optionstr(option);
771 if (!optionstr.Contains(
"all"))
return;
778 printf(
"Empty track collection \n");
814 fTrackCollection(NULL),
815 fReferenceMultiplicity(0),
817 fUseGlauberMCSymmetryPlanes(kFALSE),
818 fUseExternalSymmetryPlanes(kFALSE),
827 fMCReactionPlaneAngle(0.),
828 fMCReactionPlaneAngleIsSet(kFALSE),
829 fAfterBurnerPrecision(0.001),
830 fUserModified(kFALSE),
831 fNumberOfTracksWrap(NULL),
832 fNumberOfRPsWrap(NULL),
833 fNumberOfPOIsWrap(NULL),
834 fMCReactionPlaneAngleWrap(NULL),
835 fShuffledIndexes(NULL),
836 fShuffleTracks(kFALSE),
837 fMothersCollection(new TObjArray()),
843 fNumberOfPOItypes(2),
844 fNumberOfPOIs(new Int_t[fNumberOfPOItypes])
849 Int_t numberOfInputTracks = inputTree->GetEntries() ;
852 TParticle* pParticle =
new TParticle();
853 inputTree->SetBranchAddress(
"Particles",&pParticle);
855 for (Int_t i=0; i<numberOfInputTracks; i++)
857 inputTree->GetEntry(i);
859 if (!pParticle)
continue;
860 if (!pParticle->IsPrimary())
continue;
862 Bool_t rpOK = (rpCuts->
PassesCuts(pParticle)>0);
863 Bool_t poiOK = poiCuts->
PassesCuts(pParticle);
873 pTrack->
TagRP(kTRUE);
880 pTrack->
Tag(poiType);
882 printf(
"fNumberOfPOIs[%i] = %i",poiType,
fNumberOfPOIs[poiType]);
890 for(Int_t i(0); i < 2; i++) {
894 for(Int_t i(0); i < 3; i++) {
906 for (Int_t i=0; i<n; i++)
908 for (Int_t itrack=0; itrack<ntracks; itrack++)
911 if (!track)
continue;
940 if (!track)
continue;
942 Double_t eta=track->
Eta();
955 if (!track)
continue;
1050 Double_t rp1, Double_t rp2, Double_t rp3, Double_t rp4, Double_t rp5 )
1056 if (track) track->
AddFlow(v1,v2,v3,v4,v5,rp1,rp2,rp3,rp4,rp5,
fAfterBurnerPrecision);
1080 if (!track)
continue;
1081 Double_t v2 = ptDepV2->Eval(track->
Pt());
1094 if (!track)
continue;
1095 Double_t v2 = ptEtaDepV2->Eval(track->
Pt(), track->
Eta());
1108 if (!track)
continue;
1130 if (!track)
continue;
1141 track->
Tag(poiType,pass);
1163 Double_t eta = track->
Eta();
1164 Double_t phi = track->
Phi();
1165 if (eta>etaMin && eta<etaMax && phi>phiMin && phi<phiMax)
1186 if (!track)
continue;
1187 if (track->
IsDead()) {
delete track;track=NULL;ncleaned++;}
1190 fNumberOfTracks-=ncleaned;
1199 return new TF1(
"StandardPtDepV2",
"((x<1.0)*(0.05/1.0)*x+(x>=1.0)*0.05)");
1206 return new TF2 (
"f",
"((x<1)*.1*x+(x>=1)*.1)*(1-0.2*TMath::Abs(y))");
1213 return new TF1(
"StandardPtSpectrum",
"x*TMath::Exp(-pow(0.13957*0.13957+x*x,0.5)/0.4)",0.1,10.);
void SetCharge(Int_t charge)
void Print(Option_t *option="") const
void SetForSubevent(Int_t i)
virtual AliFlowVector GetQ(Int_t n=2, TList *weightsList=NULL, Bool_t usePhiWeights=kFALSE, Bool_t usePtWeights=kFALSE, Bool_t useEtaWeights=kFALSE)
void SetEta(Double_t eta)
virtual ~AliFlowEventSimple()
virtual Int_t GetNDaughters() const
virtual void GetVertexPosition(Double_t *pos)
AliFlowTrackSimple * GetTrack(Int_t i)
void AddV1(Double_t v1, Double_t reactionPlaneAngle, Double_t precision, Int_t maxNumberOfIterations=100)
ClassImp(AliFlowEventSimple) AliFlowEventSimple
Bool_t InSubevent(Int_t i) const
Int_t GetNumberOfRPs() const
virtual void SetZDC2Qsub(Double_t *QVC, Double_t MC, Double_t *QVA, Double_t MA)
void AddV5(Double_t v5, Double_t reactionPlaneAngle, Double_t precision, Int_t maxNumberOfIterations=100)
void AddFlow(Double_t v1, Double_t v2, Double_t v3, Double_t v4, Double_t v5)
virtual AliFlowTrackSimple * Clone(const char *option="") const
void TagSubeventsByCharge()
TParameter< Int_t > * fNumberOfRPsWrap
number of tracks in TBrowser
void TagRP(const AliFlowTrackSimpleCuts *cuts)
static TF2 * SimplePtEtaDepV2()
void TagTracks(const AliFlowTrackSimpleCuts *cutsRP, const AliFlowTrackSimpleCuts *cutsPOI)
AliFlowEventSimple & operator=(const AliFlowEventSimple &anEvent)
static TF1 * SimplePtSpectrum()
Int_t fReferenceMultiplicity
void SetSubeventNumber(Int_t n)
void AddTrack(AliFlowTrackSimple *track)
void TagPOI(const AliFlowTrackSimpleCuts *cuts, Int_t poiType=1)
Bool_t PassesCuts(const AliFlowTrackSimple *track) const
void SetUserModified(Bool_t s=kTRUE)
Double_t fMCReactionPlaneAngle
void TagRP(Bool_t b=kTRUE)
Bool_t InRPSelection() const
virtual void SetVertexPosition(Double_t *pos)
void IncrementNumberOfPOIs(Int_t poiType=1)
Int_t * fShuffledIndexes
the angle of the reaction plane from the MC truth in TBrowser
TParameter< Double_t > * fMCReactionPlaneAngleWrap
number of tracks that have passed the POI selection in TBrowser
void SetForRPSelection(Bool_t b=kTRUE)
void SetHarmonic(Int_t h)
void CloneTracks(Int_t n)
TParameter< Int_t > * fNumberOfPOIsWrap
number of tracks that have passed the RP selection in TBrowser
void SetNumberOfPOIs(Int_t nubmerOfPOIs, Int_t poiType=1)
Bool_t fUseGlauberMCSymmetryPlanes
void AddV4(Double_t v4, Double_t reactionPlaneAngle, Double_t precision, Int_t maxNumberOfIterations=100)
void ResolutionPt(Double_t res)
void SetMult(Double_t mult)
Int_t GetNumberOfPOIs(Int_t i=1) const
void Tag(Int_t n, Bool_t b=kTRUE)
void ResolutionPt(Double_t resolution)
virtual void Generate(Int_t nParticles, TF1 *ptDist=NULL, Double_t phiMin=0.0, Double_t phiMax=TMath::TwoPi(), Double_t etaMin=-1.0, Double_t etaMax=1.0)
Bool_t fShuffleTracks
placeholder for randomized indexes
TObjArray * fTrackCollection
virtual void Get2Qsub(AliFlowVector *Qarray, Int_t n=2, TList *weightsList=NULL, Bool_t usePhiWeights=kFALSE, Bool_t usePtWeights=kFALSE, Bool_t useEtaWeights=kFALSE)
void SetPhi(Double_t phi)
void DefineDeadZone(Double_t etaMin, Double_t etaMax, Double_t phiMin, Double_t phiMax)
AliFlowTrackSimple * MakeNewTrack()
void AddV2(Double_t v2, Double_t reactionPlaneAngle, Double_t precision, Int_t maxNumberOfIterations=100)
virtual void GetZDC2Qsub(AliFlowVector *Qarray)
void AddFlow(Double_t v1, Double_t v2, Double_t v3, Double_t v4, Double_t reactionPlaneAngle, Double_t precision, Int_t maxNumberOfIterations=100)
void AddV3(Double_t v3, Double_t reactionPlaneAngle, Double_t precision, Int_t maxNumberOfIterations=100)
TParameter< Int_t > * fNumberOfTracksWrap
Double_t fAfterBurnerPrecision
Bool_t fUseExternalSymmetryPlanes
TObjArray * fMothersCollection
Bool_t fMCReactionPlaneAngleIsSet
void TagSubeventsInEta(Double_t etaMinA, Double_t etaMaxA, Double_t etaMinB, Double_t etaMaxB)
void SetUseExternalSymmetryPlanes(TF1 *gPsi1Psi3=0x0, TF1 *gPsi2Psi4=0x0, TF1 *gPsi3Psi5=0x0)
static TF1 * SimplePtDepV2()
Bool_t InPOISelection(Int_t poiType=1) const
Double_t fCentrality
cache the particles with daughters
Int_t CleanUpDeadTracks()
Bool_t MC(TH1F *hs, TH1F *hb, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmaused, Int_t &status)