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"
15 ClassImp(AliForwardFlowUtil)
17 //_____________________________________________________________________
18 AliForwardFlowUtil::AliForwardFlowUtil() :
23 // Default Constructor
26 //_____________________________________________________________________
27 AliForwardFlowUtil::AliForwardFlowUtil(TList* outputList) :
35 // TList: list containing histograms for flow analysis
39 //_____________________________________________________________________
40 Bool_t AliForwardFlowUtil::AODCheck(const AliAODForwardMult* aodfm) const
43 // Function to check that and AOD event meets the cuts
46 // AliAODForwardMult: forward mult object with trigger and vertex info
48 if (!aodfm->IsTriggerBits(AliAODForwardMult::kInel)) return kFALSE;
49 if (!aodfm->HasIpZ()) return kFALSE;
50 if (!aodfm->InRange(-fZvertex,fZvertex)) return kFALSE;
54 //_____________________________________________________________________
55 Bool_t AliForwardFlowUtil::LoopAODFMD(const AliAODEvent* aodevent) const
58 // Loop over AliAODFowardMult object and fill histograms provided
61 AliAODForwardMult* aodfmult = static_cast<AliAODForwardMult*>(aodevent->FindListObject("Forward"));
62 if (!aodfmult) return kFALSE;
63 if (!AODCheck(aodfmult)) return kFALSE;
65 TH2D hdNdetadphi = aodfmult->GetHistogram();
66 TH1D* dNdphi = (TH1D*)fList->FindObject("hdNdphiSE");
67 TH2D* dNdetadphi = (TH2D*)fList->FindObject("hdNdetadphiSE");
75 for (Int_t etaBin = 1; etaBin<=hdNdetadphi.GetNbinsX(); etaBin++) {
76 eta = hdNdetadphi.GetXaxis()->GetBinCenter(etaBin);
77 for (Int_t phiBin = 1; phiBin<=hdNdetadphi.GetNbinsY(); phiBin++) {
78 phi = hdNdetadphi.GetYaxis()->GetBinCenter(phiBin);
79 weight = hdNdetadphi.GetBinContent(etaBin, phiBin);
80 dNdetadphi->Fill(eta, phi, weight);
81 if (eta < 4.) dNdphi->Fill(phi, weight);
85 dNdphi->SetBinContent(0, mult);
86 // if (aodfmult->HasCentrality()) dNdphi->SetBinContent(dNdphi->GetNbinsX()+1, aodfmult->GetCentrality());
87 // else dNdphi->SetBinContent(dNdphi->GetNbinsX()+1, -1);
89 dNdphi->SetBinContent(dNdphi->GetNbinsX()+1, GetCentFromMC(aodevent));
92 //_____________________________________________________________________
93 Bool_t AliForwardFlowUtil::LoopAODSPD(const AliAODEvent* aodevent) const
96 // Loop over AliAODCentralMult object and fill histograms
97 // provided by flow task
99 AliAODCentralMult* aodcmult = static_cast<AliAODCentralMult*>(aodevent->FindListObject("CentralClusters"));
100 if (!aodcmult) return kFALSE;
102 TH2D hdNdetadphi = aodcmult->GetHistogram();
103 TH2D* dNdetadphi = (TH2D*)fList->FindObject("hdNdetadphiSESPD");
109 for (Int_t etaBin = 1; etaBin<=hdNdetadphi.GetNbinsX(); etaBin++) {
110 eta = hdNdetadphi.GetXaxis()->GetBinCenter(etaBin);
111 for (Int_t phiBin = 1; phiBin<=hdNdetadphi.GetNbinsY(); phiBin++) {
112 phi = hdNdetadphi.GetYaxis()->GetBinCenter(phiBin);
113 weight = hdNdetadphi.GetBinContent(etaBin, phiBin);
114 dNdetadphi->Fill(eta, phi, weight);
119 //_____________________________________________________________________
120 Bool_t AliForwardFlowUtil::LoopAODtrrefHits(const AliAODEvent* aodevent) const
123 // Loop over AliAODForwardMult object, get MC track ref information
124 // and fill flow histograms
127 AliAODForwardMult* aodfmult = static_cast<AliAODForwardMult*>(aodevent->FindListObject("ForwardMC"));
128 if (!aodfmult) return kFALSE;
129 // if (!AODCheck(aodfmult)) return kFALSE;
131 TH2D hdNdetadphi = aodfmult->GetHistogram();
132 TH1D* dNdphi = (TH1D*)fList->FindObject("hdNdphiSETrRef");
133 TH2D* dNdetadphi = (TH2D*)fList->FindObject("hdNdetadphiSETrRef");
141 for(Int_t etaBin = 1; etaBin<=hdNdetadphi.GetNbinsX(); etaBin++) {
142 eta = hdNdetadphi.GetXaxis()->GetBinCenter(etaBin);
143 for(Int_t phiBin = 1; phiBin<=hdNdetadphi.GetNbinsY(); phiBin++) {
144 phi = hdNdetadphi.GetYaxis()->GetBinCenter(phiBin);
145 weight = hdNdetadphi.GetBinContent(etaBin, phiBin);
146 dNdetadphi->Fill(eta, phi, weight);
147 dNdphi->Fill(phi, weight);
151 dNdphi->SetBinContent(0, mult);
155 //_____________________________________________________________________
156 Bool_t AliForwardFlowUtil::LoopAODmc(const AliAODEvent* aodevent,
157 TString addFlow = "",
159 Int_t order = 2) const
162 // Loop over AliAODParticle branch and fill flow histograms
165 //retreive MC particles from event
166 TClonesArray* mcArray = (TClonesArray*)aodevent->FindListObject(AliAODMCParticle::StdBranchName());
168 AliWarning("No MC array found in AOD. Try making it again.");
173 if (addFlow.Length() > 1) {
174 AliAODMCHeader* header = (AliAODMCHeader*)aodevent->FindListObject(AliAODMCHeader::StdBranchName());
175 rp = header->GetReactionPlaneAngle();
178 TH2D* dNdetadphi = (TH2D*)fList->FindObject("hdNdetadphiSEMC");
179 TH1D* dNdphi = (TH1D*)fList->FindObject("hdNdphiSEMC");
183 Int_t ntracks = mcArray->GetEntriesFast();
185 // Track loop: chek how many particles will be accepted
188 for (Int_t it = 0; it < ntracks; it++) {
190 AliAODMCParticle* particle = (AliAODMCParticle*)mcArray->At(it);
192 AliError(Form("Could not receive track %d", it));
195 if (!particle->IsPhysicalPrimary()) continue;
196 if (particle->Charge() == 0) continue;
197 if (particle->Eta() > -3.4 && particle->Eta() < 5) {
198 // Add flow if it is in the argument
199 if (addFlow.Length() > 1) {
200 if (addFlow.Contains("pt"))
201 weight += AddptFlow(particle->Pt(), type);
202 if (addFlow.Contains("pid"))
203 weight += AddpidFlow(particle->PdgCode(), type);
204 if (addFlow.Contains("eta"))
205 weight += AddetaFlow(particle->Eta(), type);
206 if (addFlow.Contains("flat"))
208 weight *= 2.*TMath::Cos((Double_t)order*(particle->Phi()-rp));
212 dNdphi->Fill(particle->Phi(), weight);
213 dNdetadphi->Fill(particle->Eta(), particle->Phi(), weight);
218 dNdphi->SetBinContent(0, mult);
222 //_____________________________________________________________________
223 Double_t AliForwardFlowUtil::AddptFlow(Double_t Pt = 0, Int_t type = 0) const
226 // Add pt dependent flow factor
230 if (type == 1) weight = 0.125*Pt;
233 weight = 0.2*(Pt/2.0);
234 if (Pt > 2.0) weight = 0.2;
238 weight = 0.05*(Pt/2.0);
239 if (Pt < 2.0) weight = 0.05;
243 weight = 0.2*(Pt/1.0);
244 if (Pt > 1.0) weight = 0.2;
248 weight = 0.05*(Pt/1.0);
249 if (Pt < 1.0) weight = 0.05;
253 weight = 0.2*(Pt/3.0);
254 if (Pt > 3.0) weight = 0.2;
259 //_____________________________________________________________________
260 Double_t AliForwardFlowUtil::AddpidFlow(Int_t ID = 0, Int_t type = 0) const
263 // Add pid dependent flow factor
269 if (TMath::Abs(ID) == 211) // pion flow
271 if (TMath::Abs(ID) == 2212) // proton flow
277 if (TMath::Abs(ID) == 211) // pion flow
279 if (TMath::Abs(ID) == 2212) // proton flow
285 if (TMath::Abs(ID) == 211) // pion flow
287 if (TMath::Abs(ID) == 2212) // proton flow
293 if (TMath::Abs(ID) == 211) // pion flow
295 if (TMath::Abs(ID) == 2212) // proton flow
301 //_____________________________________________________________________
302 Double_t AliForwardFlowUtil::AddetaFlow(Double_t eta = 0, Int_t type = 0) const
305 // Add eta dependent flow factor
309 if (type == 1) weight = 0.03 + 0.07 * (1 - TMath::Abs(eta) / 6.);
311 if (type == 2) weight = 0.07 * (1 - TMath::Abs(eta) / 6.);
313 if (type == 3) weight = 0.07 * (1 - TMath::Abs(eta) / 8.);
315 if (type == 4) weight = 0.07 * (1 - TMath::Abs(eta) / 10.);
317 if (type == 5) weight = 0.07 * (1 - TMath::Abs(eta) / 12.);
319 if (type == 6) weight = 0.07 * (1 - TMath::Abs(eta) / 14.);
321 if (type == 7) weight = 0.07 * (1 - TMath::Abs(eta) / 16.);
325 //_____________________________________________________________________
326 Double_t AliForwardFlowUtil::GetCentFromMC(const AliAODEvent* aodevent) const
329 // Get centrality from MC impact parameter.
330 // Values taken from: https://twiki.cern.ch/twiki/bin/viewauth/ALICE/CentStudies
334 AliAODMCHeader* header = (AliAODMCHeader*)aodevent->FindListObject(AliAODMCHeader::StdBranchName());
335 if (!header) return cent;
336 b = header->GetImpactParameter();
338 if ( 0.00 <= b && b < 3.50)
340 if ( 3.50 <= b && b < 4.95)
342 if ( 4.95 <= b && b < 6.98)
344 if ( 6.98 <= b && b < 8.55)
346 if ( 8.55 <= b && b < 9.88)
348 if ( 9.88 <= b && b < 11.04)
350 if (11.04 <= b && b < 12.09)
352 if (12.09 <= b && b < 13.06)
354 if (13.06 <= b && b < 13.97)
356 if (13.97 <= b && b < 19.61)
361 //_____________________________________________________________________