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"
16 ClassImp(AliForwardFlowUtil)
18 //_____________________________________________________________________
19 AliForwardFlowUtil::AliForwardFlowUtil() :
24 // Default Constructor
26 //_____________________________________________________________________
27 AliForwardFlowUtil::AliForwardFlowUtil(TList* outputList) :
36 // TList: list containing histograms for flow analysis
40 //_____________________________________________________________________
41 Bool_t AliForwardFlowUtil::AODCheck(const AliAODForwardMult* aodfm) const
44 // Function to check that and AOD event meets the cuts
47 // AliAODForwardMult: forward mult object with trigger and vertex info
49 return aodfm->CheckEvent(AliAODForwardMult::kInel, -5, 5, 0, 100);
50 // return aodfm->CheckEvent(AliAODForwardMult::kInel, -5, 5, 0, 0);
52 //_____________________________________________________________________
53 Bool_t AliForwardFlowUtil::LoopAODFMD(const AliAODEvent* aodevent)
56 // Loop over AliAODFowardMult object and fill histograms provided
59 AliAODForwardMult* aodfmult = static_cast<AliAODForwardMult*>(aodevent->FindListObject("Forward"));
60 if (!aodfmult) return kFALSE;
61 if (!AODCheck(aodfmult)) return kFALSE;
63 TH2D hdNdetadphi = aodfmult->GetHistogram();
64 TH2D* vertex = (TH2D*)fList->FindObject("CoverageVsVertex");
65 TH1D* dNdphi = (TH1D*)fList->FindObject("hdNdphiSEFMD");
66 TH2D* dNdetadphi = (TH2D*)fList->FindObject("hdNdetadphiSEFMD");
74 fVertex = aodfmult->GetIpZ();
75 for (Int_t etaBin = 1; etaBin<=hdNdetadphi.GetNbinsX(); etaBin++) {
76 eta = hdNdetadphi.GetXaxis()->GetBinCenter(etaBin);
77 for (Int_t phiBin = 0; phiBin<=hdNdetadphi.GetNbinsY(); phiBin++) {
78 phi = hdNdetadphi.GetYaxis()->GetBinCenter(phiBin);
79 weight = hdNdetadphi.GetBinContent(etaBin, phiBin);
81 vertex->Fill(eta, fVertex, weight);
84 dNdetadphi->Fill(eta, phi, weight);
85 if (eta < 4.) dNdphi->Fill(phi, weight);
89 dNdphi->SetBinContent(0, mult);
91 if (aodfmult->HasCentrality()) fCent = (Double_t)aodfmult->GetCentrality();
93 // fCent = GetCentFromMC(aodevent);
96 //_____________________________________________________________________
97 Bool_t AliForwardFlowUtil::LoopAODSPD(const AliAODEvent* aodevent) const
100 // Loop over AliAODCentralMult object and fill histograms
101 // provided by flow task
103 AliAODCentralMult* aodcmult = static_cast<AliAODCentralMult*>(aodevent->FindListObject("CentralClusters"));
104 if (!aodcmult) return kFALSE;
106 TH2D hdNdetadphi = aodcmult->GetHistogram();
107 TH2D* vertex = (TH2D*)fList->FindObject("CoverageVsVertex");
108 TH2D* dNdetadphi = (TH2D*)fList->FindObject("hdNdetadphiSESPD");
114 for (Int_t etaBin = 1; etaBin<=hdNdetadphi.GetNbinsX(); etaBin++) {
115 eta = hdNdetadphi.GetXaxis()->GetBinCenter(etaBin);
116 for (Int_t phiBin = 0; phiBin<=hdNdetadphi.GetNbinsY(); phiBin++) {
117 phi = hdNdetadphi.GetYaxis()->GetBinCenter(phiBin);
118 weight = hdNdetadphi.GetBinContent(etaBin, phiBin);
120 vertex->Fill(eta, fVertex, weight);
123 dNdetadphi->Fill(eta, phi, weight);
128 //_____________________________________________________________________
129 Bool_t AliForwardFlowUtil::LoopAODFMDtrrefHits(const AliAODEvent* aodevent) const
132 // Loop over AliAODForwardMult object, get MC track ref information
133 // and fill flow histograms
136 AliAODForwardMult* aodfmult = static_cast<AliAODForwardMult*>(aodevent->FindListObject("ForwardMC"));
137 if (!aodfmult) return kFALSE;
138 // if (!AODCheck(aodfmult)) return kFALSE;
140 TH2D hdNdetadphi = aodfmult->GetHistogram();
141 TH1D* dNdphi = (TH1D*)fList->FindObject("hdNdphiSEFMDTR");
142 TH2D* dNdetadphi = (TH2D*)fList->FindObject("hdNdetadphiSEFMDTR");
150 for(Int_t etaBin = 1; etaBin<=hdNdetadphi.GetNbinsX(); etaBin++) {
151 eta = hdNdetadphi.GetXaxis()->GetBinCenter(etaBin);
152 for(Int_t phiBin = 1; phiBin<=hdNdetadphi.GetNbinsY(); phiBin++) {
153 phi = hdNdetadphi.GetYaxis()->GetBinCenter(phiBin);
154 weight = hdNdetadphi.GetBinContent(etaBin, phiBin);
155 dNdetadphi->Fill(eta, phi, weight);
156 if (eta < 4.) dNdphi->Fill(phi, weight);
160 dNdphi->SetBinContent(0, mult);
164 //_____________________________________________________________________
165 Bool_t AliForwardFlowUtil::LoopAODSPDtrrefHits(const AliAODEvent* aodevent) const
168 // Loop over AliAODCentralMult object and fill histograms
169 // provided by flow task
171 AliAODCentralMult* aodcmult = static_cast<AliAODCentralMult*>(aodevent->FindListObject("CentralClustersMC"));
172 if (!aodcmult) return kFALSE;
174 TH2D hdNdetadphi = aodcmult->GetHistogram();
175 TH2D* dNdetadphi = (TH2D*)fList->FindObject("hdNdetadphiSESPDTR");
181 for (Int_t etaBin = 1; etaBin<=hdNdetadphi.GetNbinsX(); etaBin++) {
182 eta = hdNdetadphi.GetXaxis()->GetBinCenter(etaBin);
183 for (Int_t phiBin = 1; phiBin<=hdNdetadphi.GetNbinsY(); phiBin++) {
184 phi = hdNdetadphi.GetYaxis()->GetBinCenter(phiBin);
185 weight = hdNdetadphi.GetBinContent(etaBin, phiBin);
186 dNdetadphi->Fill(eta, phi, weight);
191 //_____________________________________________________________________
192 Bool_t AliForwardFlowUtil::LoopAODmc(const AliAODEvent* aodevent,
193 TString addFlow = "",
195 Int_t order = 2) const
198 // Loop over AliAODParticle branch and fill flow histograms
201 //retreive MC particles from event
202 TClonesArray* mcArray = (TClonesArray*)aodevent->FindListObject(AliAODMCParticle::StdBranchName());
204 AliWarning("No MC array found in AOD. Try making it again.");
209 AliAODMCHeader* header = dynamic_cast<AliAODMCHeader*>(aodevent->FindListObject(AliAODMCHeader::StdBranchName()));
211 AliWarning("No header file found.");
214 rp = header->GetReactionPlaneAngle();
217 TH2D* dNdetadphi = (TH2D*)fList->FindObject("hdNdetadphiSEMC");
218 TH1D* dNdphi = (TH1D*)fList->FindObject("hdNdphiSEMC");
219 TProfile2D* mcTruth = (TProfile2D*)fList->FindObject("pMCTruth");
223 Int_t ntracks = mcArray->GetEntriesFast();
225 // Track loop: chek how many particles will be accepted
228 for (Int_t it = 0; it < ntracks; it++) {
230 AliAODMCParticle* particle = (AliAODMCParticle*)mcArray->At(it);
232 AliError(Form("Could not receive track %d", it));
235 if (!particle->IsPhysicalPrimary()) continue;
236 if (particle->Charge() == 0) continue;
237 Double_t eta = particle->Eta();
238 Double_t phi = particle->Phi();
239 if (eta > -6 && eta < 6) {
240 // Add flow if it is in the argument
241 if (addFlow.Length() > 1) {
242 if (addFlow.Contains("pt"))
243 weight += AddptFlow(particle->Pt(), type);
244 if (addFlow.Contains("pid"))
245 weight += AddpidFlow(particle->PdgCode(), type);
246 if (addFlow.Contains("eta"))
247 weight += AddetaFlow(eta, type);
248 if (addFlow.Contains("flat"))
250 weight *= 2.*TMath::Cos((Double_t)order*(phi-rp));
254 dNdphi->Fill(phi, weight);
255 dNdetadphi->Fill(eta, phi, weight);
256 mcTruth->Fill(eta, fCent, TMath::Cos(2.*(phi-rp)));
261 dNdphi->SetBinContent(0, mult);
265 //_____________________________________________________________________
266 Double_t AliForwardFlowUtil::AddptFlow(Double_t Pt = 0, Int_t type = 0) const
269 // Add pt dependent flow factor
273 if (type == 1) weight = 0.125*Pt;
276 weight = 0.2*(Pt/2.0);
277 if (Pt > 2.0) weight = 0.2;
281 weight = 0.05*(Pt/2.0);
282 if (Pt < 2.0) weight = 0.05;
286 weight = 0.2*(Pt/1.0);
287 if (Pt > 1.0) weight = 0.2;
291 weight = 0.05*(Pt/1.0);
292 if (Pt < 1.0) weight = 0.05;
296 weight = 0.2*(Pt/3.0);
297 if (Pt > 3.0) weight = 0.2;
302 //_____________________________________________________________________
303 Double_t AliForwardFlowUtil::AddpidFlow(Int_t ID = 0, Int_t type = 0) const
306 // Add pid dependent flow factor
312 if (TMath::Abs(ID) == 211) // pion flow
314 if (TMath::Abs(ID) == 2212) // proton flow
320 if (TMath::Abs(ID) == 211) // pion flow
322 if (TMath::Abs(ID) == 2212) // proton flow
328 if (TMath::Abs(ID) == 211) // pion flow
330 if (TMath::Abs(ID) == 2212) // proton flow
336 if (TMath::Abs(ID) == 211) // pion flow
338 if (TMath::Abs(ID) == 2212) // proton flow
344 //_____________________________________________________________________
345 Double_t AliForwardFlowUtil::AddetaFlow(Double_t eta = 0, Int_t type = 0) const
348 // Add eta dependent flow factor
352 if (type == 1) weight = 0.03 + 0.07 * (1 - TMath::Abs(eta) / 6.);
354 if (type == 2) weight = 0.07 * (1 - TMath::Abs(eta) / 6.);
356 if (type == 3) weight = 0.07 * (1 - TMath::Abs(eta) / 8.);
358 if (type == 4) weight = 0.07 * (1 - TMath::Abs(eta) / 10.);
360 if (type == 5) weight = 0.07 * (1 - TMath::Abs(eta) / 12.);
362 if (type == 6) weight = 0.07 * (1 - TMath::Abs(eta) / 14.);
364 if (type == 7) weight = 0.07 * (1 - TMath::Abs(eta) / 16.);
368 //_____________________________________________________________________
369 Double_t AliForwardFlowUtil::GetCentFromMC(const AliAODEvent* aodevent) const
372 // Get centrality from MC impact parameter.
373 // Values taken from: https://twiki.cern.ch/twiki/bin/viewauth/ALICE/CentStudies
377 AliAODMCHeader* header = (AliAODMCHeader*)aodevent->FindListObject(AliAODMCHeader::StdBranchName());
378 if (!header) return cent;
379 b = header->GetImpactParameter();
381 if ( 0.00 <= b && b < 3.50)
383 if ( 3.50 <= b && b < 4.95)
385 if ( 4.95 <= b && b < 6.98)
387 if ( 6.98 <= b && b < 8.55)
389 if ( 8.55 <= b && b < 9.88)
391 if ( 9.88 <= b && b < 11.04)
393 if (11.04 <= b && b < 12.09)
395 if (12.09 <= b && b < 13.06)
397 if (13.06 <= b && b < 13.97)
399 if (13.97 <= b && b < 19.61)
404 //_____________________________________________________________________