2 // Class used to handle the input from AODs and put it into histograms
3 // the Forward Flow tasks can run on.
4 // It can also add flow to AliAODMCParticles.
7 #include "AliForwardFlowUtil.h"
8 #include "AliAODCentralMult.h"
9 #include "AliAODMCParticle.h"
10 #include "AliAODMCHeader.h"
12 #include "AliAODForwardMult.h"
13 #include "AliAODEvent.h"
14 #include "TProfile2D.h"
18 ClassImp(AliForwardFlowUtil)
20 //_____________________________________________________________________
21 AliForwardFlowUtil::AliForwardFlowUtil() :
32 // Default Constructor
34 //_____________________________________________________________________
35 AliForwardFlowUtil::AliForwardFlowUtil(TList* outputList) :
49 // TList: list containing histograms for flow analysis
53 Double_t xCumulant4thTPCrefMultTPConlyAll[] = {2.5,7.5,15,25,35,45,55,65};
54 Double_t yCumulant4thTPCrefMultTPConlyAll[] = {0.017855,0.032440,0.055818,0.073137,0.083898,0.086690,0.082040,0.077777};
55 Int_t nPointsCumulant4thTPCrefMultTPConlyAll = sizeof(xCumulant4thTPCrefMultTPConlyAll)/sizeof(Double_t);
56 fAliceCent4th = new TGraph(nPointsCumulant4thTPCrefMultTPConlyAll,xCumulant4thTPCrefMultTPConlyAll,
57 yCumulant4thTPCrefMultTPConlyAll);
59 Double_t xCumulant2nd4050ALICE[] = {0.000000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
60 1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000};
61 Double_t yCumulant2nd4050ALICE[] = {0.000000,0.043400,0.059911,0.073516,0.089756,0.105486,0.117391,0.128199,0.138013,
62 0.158271,0.177726,0.196383,0.208277,0.216648,0.242954,0.249961,0.240131,0.269006,0.207796};
63 Int_t nPointsCumulant2nd4050ALICE = sizeof(xCumulant2nd4050ALICE)/sizeof(Double_t);
64 fAlicePt2nd4050 = new TGraph(nPointsCumulant2nd4050ALICE,xCumulant2nd4050ALICE,yCumulant2nd4050ALICE);
66 Double_t xCumulant4th3040ALICE[] = {0.00000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
67 1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000,
68 5.500000,7.000000,9.000000};
69 Double_t yCumulant4th3040ALICE[] = {0.000000,0.037071,0.048566,0.061083,0.070910,0.078831,0.091396,0.102026,0.109691,
70 0.124449,0.139819,0.155561,0.165701,0.173678,0.191149,0.202015,0.204540,0.212560,0.195885,
71 0.000000,0.000000,0.000000};
72 Int_t nPointsCumulant4th3040ALICE = sizeof(xCumulant4th3040ALICE)/sizeof(Double_t);
73 fAlicePt4th3040 = new TGraph(nPointsCumulant4th3040ALICE,xCumulant4th3040ALICE,yCumulant4th3040ALICE);
75 Double_t xCumulant4th4050ALICE[] = {0.000000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
76 1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000};
77 Double_t yCumulant4th4050ALICE[] = {0.000000,0.038646,0.049824,0.066662,0.075856,0.081583,0.099778,0.104674,0.118545,
78 0.131874,0.152959,0.155348,0.169751,0.179052,0.178532,0.198851,0.185737,0.239901,0.186098};
79 Int_t nPointsCumulant4th4050ALICE = sizeof(xCumulant4th4050ALICE)/sizeof(Double_t);
80 fAlicePt4th4050 = new TGraph(nPointsCumulant4th4050ALICE, xCumulant4th4050ALICE, yCumulant4th4050ALICE);
82 Double_t impactParam[] = {0.,1.75,4.225,5.965,7.765,9.215,10.46,11.565,12.575,13.515,16.679};
83 Double_t centrality[] = {0.,2.5,7.5,15,25,35,45,55,65,75,90};
85 Int_t nPoints = sizeof(impactParam)/sizeof(Double_t);
86 fImpactParToCent = new TGraph(nPoints, impactParam, centrality);
89 //_____________________________________________________________________
90 Bool_t AliForwardFlowUtil::AODCheck(const AliAODForwardMult* aodfm)
93 // Function to check that and AOD event meets the cuts
96 // AliAODForwardMult: forward mult object with trigger and vertex info
101 if (!aodfm->IsTriggerBits(AliAODForwardMult::kOffline)) return kFALSE;
102 fCent = (Double_t)aodfm->GetCentrality();
103 if (0. >= fCent || fCent >= 100.) return kFALSE;
104 TH1D* vertex = (TH1D*)fList->FindObject("VertexAll");
105 fVertex = aodfm->GetIpZ();
106 vertex->Fill(fVertex);
107 if (TMath::Abs(fVertex) >= 5.) return kFALSE;
110 //_____________________________________________________________________
111 Bool_t AliForwardFlowUtil::LoopAODFMD(const AliAODEvent* aodevent)
114 // Loop over AliAODFowardMult object and fill histograms provided
118 AliAODForwardMult* aodfmult = static_cast<AliAODForwardMult*>(aodevent->FindListObject("Forward"));
119 if (!aodfmult) return kFALSE;
120 if (!AODCheck(aodfmult)) return kFALSE;
122 TH2D hdNdetadphi = aodfmult->GetHistogram();
123 TH2D* vertex = (TH2D*)fList->FindObject("CoverageVsVertex");
124 TH2D* dNdphi = (TH2D*)fList->FindObject("hdNdphiSEFMD");
125 TH2D* dNdetadphi = (TH2D*)fList->FindObject("hdNdetadphiSEFMD");
133 for (Int_t etaBin = 1; etaBin<=hdNdetadphi.GetNbinsX(); etaBin++) {
134 eta = hdNdetadphi.GetXaxis()->GetBinCenter(etaBin);
135 if (TMath::Abs(eta) < 1.75) continue;
136 for (Int_t phiBin = 0; phiBin<=hdNdetadphi.GetNbinsY(); phiBin++) {
137 phi = hdNdetadphi.GetYaxis()->GetBinCenter(phiBin);
138 weight = hdNdetadphi.GetBinContent(etaBin, phiBin);
140 vertex->Fill(eta, fVertex, weight);
143 dNdetadphi->Fill(eta, phi, weight);
144 dNdphi->Fill(eta, phi, weight);
145 dNdphi->Fill(-1.*eta, phi, weight);
149 // fCent = GetCentFromMC(aodevent);
154 //_____________________________________________________________________
155 Bool_t AliForwardFlowUtil::LoopAODSPD(const AliAODEvent* aodevent) const
158 // Loop over AliAODCentralMult object and fill histograms
159 // provided by flow task
161 AliAODCentralMult* aodcmult = static_cast<AliAODCentralMult*>(aodevent->FindListObject("CentralClusters"));
162 if (!aodcmult) return kFALSE;
164 TH2D hdNdetadphi = aodcmult->GetHistogram();
165 TH2D* vertex = (TH2D*)fList->FindObject("CoverageVsVertex");
166 TH2D* dNdetadphi = (TH2D*)fList->FindObject("hdNdetadphiSESPD");
167 TH2D* dNdphi = (TH2D*)fList->FindObject("hdNdphiSESPD");
175 for (Int_t etaBin = 1; etaBin<=hdNdetadphi.GetNbinsX(); etaBin++) {
176 eta = hdNdetadphi.GetXaxis()->GetBinCenter(etaBin);
177 if (TMath::Abs(eta) > 1.75) continue;
178 for (Int_t phiBin = 0; phiBin<=hdNdetadphi.GetNbinsY(); phiBin++) {
179 phi = hdNdetadphi.GetYaxis()->GetBinCenter(phiBin);
180 weight = hdNdetadphi.GetBinContent(etaBin, phiBin);
182 vertex->Fill(eta, fVertex, weight);
185 dNdetadphi->Fill(eta, phi, weight);
186 if (TMath::Abs(eta) < 0.5) continue;
187 dNdphi->Fill(eta, phi, weight);
188 // dNdphi->Fill(-1.*eta, phi, weight);
195 //_____________________________________________________________________
196 Bool_t AliForwardFlowUtil::LoopAODFMDtrrefHits(const AliAODEvent* aodevent) const
199 // Loop over AliAODForwardMult object, get MC track ref information
200 // and fill flow histograms
203 AliAODForwardMult* aodfmult = static_cast<AliAODForwardMult*>(aodevent->FindListObject("ForwardMC"));
204 if (!aodfmult) return kFALSE;
206 TH2D hdNdetadphi = aodfmult->GetHistogram();
207 TH2D* dNdphi = (TH2D*)fList->FindObject("hdNdphiSEFMDTR");
208 TH2D* dNdetadphi = (TH2D*)fList->FindObject("hdNdetadphiSEFMDTR");
216 for(Int_t etaBin = 1; etaBin<=hdNdetadphi.GetNbinsX(); etaBin++) {
217 eta = hdNdetadphi.GetXaxis()->GetBinCenter(etaBin);
218 if (TMath::Abs(eta) < 1.75) continue;
219 for(Int_t phiBin = 1; phiBin<=hdNdetadphi.GetNbinsY(); phiBin++) {
220 phi = hdNdetadphi.GetYaxis()->GetBinCenter(phiBin);
221 weight = hdNdetadphi.GetBinContent(etaBin, phiBin);
222 dNdetadphi->Fill(eta, phi, weight);
223 dNdphi->Fill(eta, phi, weight);
224 dNdphi->Fill(-1.*eta, phi, weight);
231 //_____________________________________________________________________
232 Bool_t AliForwardFlowUtil::LoopAODSPDtrrefHits(const AliAODEvent* aodevent) const
235 // Loop over AliAODCentralMult object and fill histograms
236 // provided by flow task
238 AliAODCentralMult* aodcmult = static_cast<AliAODCentralMult*>(aodevent->FindListObject("CentralClustersMC"));
239 if (!aodcmult) return kFALSE;
241 TH2D hdNdetadphi = aodcmult->GetHistogram();
242 TH2D* dNdphi = (TH2D*)fList->FindObject("hdNdphiSESPDTR");
243 TH2D* dNdetadphi = (TH2D*)fList->FindObject("hdNdetadphiSESPDTR");
251 for (Int_t etaBin = 1; etaBin<=hdNdetadphi.GetNbinsX(); etaBin++) {
252 eta = hdNdetadphi.GetXaxis()->GetBinCenter(etaBin);
253 if (TMath::Abs(eta) > 1.75) continue;
254 for (Int_t phiBin = 1; phiBin<=hdNdetadphi.GetNbinsY(); phiBin++) {
255 phi = hdNdetadphi.GetYaxis()->GetBinCenter(phiBin);
256 weight = hdNdetadphi.GetBinContent(etaBin, phiBin);
257 dNdetadphi->Fill(eta, phi, weight);
258 dNdphi->Fill(eta, phi, weight);
259 dNdphi->Fill(-1.*eta, phi, weight);
266 //_____________________________________________________________________
267 Bool_t AliForwardFlowUtil::LoopAODmc(const AliAODEvent* aodevent,
268 TString addFlow = "",
270 Int_t order = 2) const
273 // Loop over AliAODParticle branch and fill flow histograms
276 //retreive MC particles from event
277 TClonesArray* mcArray = (TClonesArray*)aodevent->FindListObject(AliAODMCParticle::StdBranchName());
279 // AliWarning("No MC array found in AOD. Try making it again.");
284 AliAODMCHeader* header = dynamic_cast<AliAODMCHeader*>(aodevent->FindListObject(AliAODMCHeader::StdBranchName()));
286 AliWarning("No header file found.");
289 rp = header->GetReactionPlaneAngle();
292 TH2D* dNdetadphi = (TH2D*)fList->FindObject("hdNdetadphiSEMC");
293 TH2D* dNdphi = (TH2D*)fList->FindObject("hdNdphiSEMC");
294 TProfile2D* mcTruth = (TProfile2D*)fList->FindObject("pMCTruth");
298 Int_t ntracks = mcArray->GetEntriesFast();
300 // Track loop: chek how many particles will be accepted
303 for (Int_t it = 0; it < ntracks; it++) {
305 AliAODMCParticle* particle = (AliAODMCParticle*)mcArray->At(it);
307 AliError(Form("Could not receive track %d", it));
310 if (!particle->IsPhysicalPrimary()) continue;
311 if (particle->Charge() == 0) continue;
312 Double_t pT = particle->Pt();
313 // if (pT <= 0.2 || pT >= 5.) continue;
314 Double_t eta = particle->Eta();
315 Double_t phi = particle->Phi();
316 if (TMath::Abs(eta) < 6.) {
317 // Add flow if it is in the argument
318 if (addFlow.Length() > 1) {
319 if (addFlow.Contains("pt"))
320 weight *= AddptFlow(pT, type);
321 // weight *= AddptFlow(pT, 1);
322 if (addFlow.Contains("pid"))
323 weight *= AddpidFlow(particle->PdgCode(), 1);
324 if (addFlow.Contains("eta"))
325 weight *= AddetaFlow(eta, type);
326 // weight *= AddetaFlow(eta, 2);
327 if (addFlow.Contains("cent"))
328 weight *= fAliceCent4th->Eval(fCent)/fAliceCent4th->Eval(45);
330 weight *= 20*2.*TMath::Cos((Double_t)order*(phi-rp));
333 dNdphi->Fill(eta, phi, weight);
334 dNdphi->Fill(-1.*eta, phi, weight);
335 dNdetadphi->Fill(eta, phi, weight);
336 mcTruth->Fill(eta, fCent, weight*TMath::Cos(2.*(phi-rp)));
343 //_____________________________________________________________________
344 Double_t AliForwardFlowUtil::AddptFlow(Double_t pt = 0, Int_t type = 0) const
347 // Add pt dependent flow factor
353 case 1: weight = fAlicePt2nd4050->Eval(pt)*0.5+fAlicePt4th4050->Eval(pt)*0.5;
355 case 2: weight = fAlicePt2nd4050->Eval(pt);
357 case 3: weight = fAlicePt4th3040->Eval(pt);
359 case 4: weight = fAlicePt4th4050->Eval(pt);
365 //_____________________________________________________________________
366 Double_t AliForwardFlowUtil::AddpidFlow(Int_t id = 0, Int_t type = 0) const
369 // Add pid dependent flow factor
375 case 1: if (TMath::Abs(id) == 211) // pion flow
377 else if (TMath::Abs(id) == 2212) // proton flow
382 case 2: weight = 1.207;
388 //_____________________________________________________________________
389 Double_t AliForwardFlowUtil::AddetaFlow(Double_t eta = 0, Int_t type = 0) const
392 // Add eta dependent flow factor
396 TF1 gaus = TF1("gaus", "gaus", -6, 6);
400 case 1: gaus.SetParameters(0.1, 0., 9);
402 case 2: gaus.SetParameters(0.1, 0., 3);
404 case 3: gaus.SetParameters(0.1, 0., 15);
408 weight = gaus.Eval(eta);
412 //_____________________________________________________________________
413 Double_t AliForwardFlowUtil::GetCentFromMC(const AliAODEvent* aodevent) const
416 // Get centrality from MC impact parameter.
417 // Values taken from: https://twiki.cern.ch/twiki/bin/viewauth/ALICE/CentStudies
421 AliAODMCHeader* header = (AliAODMCHeader*)aodevent->FindListObject(AliAODMCHeader::StdBranchName());
422 if (!header) return cent;
423 b = header->GetImpactParameter();
425 cent = fImpactParToCent->Eval(b);
429 //_____________________________________________________________________