AliPhysics  d497afb (d497afb)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskRhoMassBase.cxx
Go to the documentation of this file.
1 // $Id$
2 //
3 // Base class for rho mass calculation.
4 // Calculates parameterized rho mass for given centrality independent of input.
5 //
6 // Author: M. Verweij. Similar to AliAnalysisTaskRhoBase
7 
8 #include <TF1.h>
9 #include <TH1F.h>
10 #include <TH2F.h>
11 #include <TClonesArray.h>
12 
13 #include "AliLog.h"
14 #include "AliRhoParameter.h"
15 #include "AliEmcalJet.h"
16 #include "AliParticleContainer.h"
17 #include "AliClusterContainer.h"
18 
20 
22 
23 //________________________________________________________________________
26  fOutRhoMassName(),
27  fOutRhoMassScaledName(),
28  fCompareRhoMassName(),
29  fCompareRhoMassScaledName(),
30  fRhoMassFunction(0),
31  fScaleFunction(0),
32  fAttachToEvent(kTRUE),
33  fOutRhoMass(0),
34  fOutRhoMassScaled(0),
35  fCompareRhoMass(0),
36  fCompareRhoMassScaled(0),
37  fHistJetMassvsCent(0),
38  fHistRhoMassvsCent(0),
39  fHistRhoMassScaledvsCent(0),
40  fHistDeltaRhoMassvsCent(0),
41  fHistDeltaRhoMassScalevsCent(0),
42  fHistRhoMassvsNtrack(0),
43  fHistRhoMassScaledvsNtrack(0),
44  fHistDeltaRhoMassvsNtrack(0),
45  fHistDeltaRhoMassScalevsNtrack(0),
46  fHistRhoMassvsNcluster(0),
47  fHistRhoMassScaledvsNcluster(0),
48  fHistGammaVsNtrack(0)
49 {
50  // Constructor.
51 }
52 
53 //________________________________________________________________________
55  AliAnalysisTaskEmcalJet(name, histo),
56  fOutRhoMassName(),
57  fOutRhoMassScaledName(),
58  fCompareRhoMassName(),
59  fCompareRhoMassScaledName(),
60  fRhoMassFunction(0),
61  fScaleFunction(0),
62  fAttachToEvent(kTRUE),
63  fOutRhoMass(0),
64  fOutRhoMassScaled(0),
65  fCompareRhoMass(0),
66  fCompareRhoMassScaled(0),
67  fHistJetMassvsCent(0),
68  fHistRhoMassvsCent(0),
69  fHistRhoMassScaledvsCent(0),
70  fHistDeltaRhoMassvsCent(0),
71  fHistDeltaRhoMassScalevsCent(0),
72  fHistRhoMassvsNtrack(0),
73  fHistRhoMassScaledvsNtrack(0),
74  fHistDeltaRhoMassvsNtrack(0),
75  fHistDeltaRhoMassScalevsNtrack(0),
76  fHistRhoMassvsNcluster(0),
77  fHistRhoMassScaledvsNcluster(0),
78  fHistGammaVsNtrack(0)
79 {
80  // Constructor.
81 
83 }
84 
85 //________________________________________________________________________
87 {
88  // User create output objects, called at the beginning of the analysis.
89 
90  if (!fCreateHisto)
91  return;
92 
94 
95  //ranges for PbPb
96  Float_t Ntrackrange[2] = {0, 6000};
97 
98  Int_t nBinsRhom = 200;
99  Double_t minRhom = 0.;
100  Double_t maxRhom = 20.;
101 
102  Int_t nBinsM = 100;
103  Double_t minM = -20.;
104  Double_t maxM = 80.;
105 
106  if(!fIsPbPb){
107  //set multiplicity related axes to a smaller max value
108  Ntrackrange[1] = 200.;
109  maxRhom = 0.25;
110  }
111 
112  fHistRhoMassvsCent = new TH2F("fHistRhoMassvsCent", "fHistRhoMassvsCent", 101, -1, 100, nBinsRhom,minRhom,maxRhom);
113  fHistRhoMassvsCent->GetXaxis()->SetTitle("Centrality (%)");
114  fHistRhoMassvsCent->GetYaxis()->SetTitle("#rho_{m} (GeV/c * rad^{-1})");
116 
117  if (fParticleCollArray.GetEntriesFast()>0) {
118  fHistRhoMassvsNtrack = new TH2F("fHistRhoMassvsNtrack", "fHistRhoMassvsNtrack", 150, Ntrackrange[0], Ntrackrange[1], nBinsRhom,minRhom,maxRhom);
119  fHistRhoMassvsNtrack->GetXaxis()->SetTitle("No. of tracks");
120  fHistRhoMassvsNtrack->GetYaxis()->SetTitle("#rho_{m} (GeV/c * rad^{-1})");
122 
123  //fHistGammaVsNtrack
124  fHistGammaVsNtrack = new TH2F("fHistGammaVsNtrack", "fHistGammaVsNtrack", 150, Ntrackrange[0], Ntrackrange[1], 100,0.,10.);
125  fHistGammaVsNtrack->GetXaxis()->SetTitle("No. of tracks");
126  fHistGammaVsNtrack->GetYaxis()->SetTitle("#gamma = #LT E #GT / #LT M #GT");
128  }
129 
130  if (fClusterCollArray.GetEntriesFast()>0) {
131  fHistRhoMassvsNcluster = new TH2F("fHistRhoMassvsNcluster", "fHistRhoMassvsNcluster", 50, 0, 1500, nBinsRhom,minRhom,maxRhom);
132  fHistRhoMassvsNcluster->GetXaxis()->SetTitle("No. of tracks");
133  fHistRhoMassvsNcluster->GetYaxis()->SetTitle("#rho_{m} (GeV/c * rad^{-1})");
135  }
136 
137  if (fJetCollArray.GetEntriesFast()>0) {
138  fHistJetMassvsCent = new TH2F("fHistJetMassvsCent", "fHistJetMassvsCent", 101, -1, 100, nBinsM,minM,maxM);
139  fHistJetMassvsCent->GetXaxis()->SetTitle("Centrality (%)");
140  fHistJetMassvsCent->GetYaxis()->SetTitle("#it{M}_{jet} (GeV/c)");
142  }
143 
144  if (!fCompareRhoMassName.IsNull()) {
145  fHistDeltaRhoMassvsCent = new TH2F("fHistDeltaRhoMassvsCent", "fHistDeltaRhoMassvsCent", 101, -1, 100, fNbins, -fMaxBinPt, fMaxBinPt);
146  fHistDeltaRhoMassvsCent->GetXaxis()->SetTitle("Centrality (%)");
147  fHistDeltaRhoMassvsCent->GetYaxis()->SetTitle("#Delta#rho (GeV/c * rad^{-1})");
149 
150  if (fParticleCollArray.GetEntriesFast()>0) {
151  fHistDeltaRhoMassvsNtrack = new TH2F("fHistDeltaRhoMassvsNtrack", "fHistDeltaRhoMassvsNtrack", 150, Ntrackrange[0], Ntrackrange[1], fNbins, -fMaxBinPt, fMaxBinPt);
152  fHistDeltaRhoMassvsNtrack->GetXaxis()->SetTitle("No. of tracks");
153  fHistDeltaRhoMassvsNtrack->GetYaxis()->SetTitle("#Delta#rho (GeV/c * rad^{-1})");
155  }
156  }
157 
158  if (fScaleFunction) {
159  fHistRhoMassScaledvsCent = new TH2F("fHistRhoMassScaledvsCent", "fHistRhoMassScaledvsCent", 101, -1, 100, nBinsRhom,minRhom,maxRhom);
160  fHistRhoMassScaledvsCent->GetXaxis()->SetTitle("Centrality (%)");
161  fHistRhoMassScaledvsCent->GetYaxis()->SetTitle("#rho_{m,scaled} (GeV/c * rad^{-1})");
163 
164  if (fParticleCollArray.GetEntriesFast()>0) {
165  fHistRhoMassScaledvsNtrack = new TH2F("fHistRhoMassScaledvsNtrack", "fHistRhoMassScaledvsNtrack", 150, Ntrackrange[0], Ntrackrange[1], nBinsRhom,minRhom,maxRhom);
166  fHistRhoMassScaledvsNtrack->GetXaxis()->SetTitle("No. of tracks");
167  fHistRhoMassScaledvsNtrack->GetYaxis()->SetTitle("#rho_{m,scaled} (GeV/c * rad^{-1})");
169  }
170 
171  if (fClusterCollArray.GetEntriesFast()>0) {
172  fHistRhoMassScaledvsNcluster = new TH2F("fHistRhoMassScaledvsNcluster", "fHistRhoMassScaledvsNcluster", 50, 0, 1500, nBinsRhom,minRhom,maxRhom);
173  fHistRhoMassScaledvsNcluster->GetXaxis()->SetTitle("No. of clusters");
174  fHistRhoMassScaledvsNcluster->GetYaxis()->SetTitle("#rho_{m,scaled} (GeV/c * rad^{-1})");
176  }
177 
178  if (!fCompareRhoMassScaledName.IsNull()) {
179  fHistDeltaRhoMassScalevsCent = new TH2F("fHistDeltaRhoMassScalevsCent", "fHistDeltaRhoMassScalevsCent", 101, -1, 100, nBinsRhom,minRhom,maxRhom);
180  fHistDeltaRhoMassScalevsCent->GetXaxis()->SetTitle("Centrality (%)");
181  fHistDeltaRhoMassScalevsCent->GetYaxis()->SetTitle("#Delta#rho_{m,scaled} (GeV/c * rad^{-1})");
183 
184  if (fParticleCollArray.GetEntriesFast()>0) {
185  fHistDeltaRhoMassScalevsNtrack = new TH2F("fHistDeltaRhoMassScalevsNtrack", "fHistDeltaRhoMassScalevsNtrack", 150, Ntrackrange[0], Ntrackrange[1], fNbins, -fMaxBinPt, fMaxBinPt);
186  fHistDeltaRhoMassScalevsNtrack->GetXaxis()->SetTitle("No. of tracks");
187  fHistDeltaRhoMassScalevsNtrack->GetYaxis()->SetTitle("#Delta#rho_{m,scaled} (GeV/c * rad^{-1})");
189  }
190  }
191  }
192 }
193 
194 //________________________________________________________________________
196 {
197  // Run the analysis.
198 
200  fOutRhoMass->SetVal(rhom);
201 
202  if (fScaleFunction) {
203  Double_t rhomScaled = rhom * GetScaleFactor(fCent);
204  fOutRhoMassScaled->SetVal(rhomScaled);
205  }
206 
207  return kTRUE;
208 }
209 
210 //________________________________________________________________________
212 {
213  // Fill histograms.
214 
215  Int_t Ntracks = 0;
216  Int_t Nclusters = 0;
217 
218  // Loop over all possible contianers
219  AliParticleContainer * partCont = 0;
220  TIter nextPartCont(&fParticleCollArray);
221  while ((partCont = static_cast<AliParticleContainer*>(nextPartCont()))) {
222  Ntracks += partCont->GetNAcceptedParticles();
223  }
224  AliClusterContainer * clusCont = 0;
225  TIter nextClusCont(&fClusterCollArray);
226  while ((clusCont = static_cast<AliClusterContainer*>(nextClusCont()))) {
227  Nclusters += clusCont->GetNAcceptedClusters();
228  }
229 
230  if (fJets) {
231  Int_t Njets = fJets->GetEntries();
232  Int_t NjetAcc = 0;
233 
234  for (Int_t i = 0; i < Njets; ++i) {
235  AliEmcalJet *jet = static_cast<AliEmcalJet*>(fJets->At(i));
236  if (!jet) {
237  AliError(Form("%s: Could not receive jet %d", GetName(), i));
238  continue;
239  }
240 
241  if (!AcceptJet(jet))
242  continue;
243 
244  fHistJetMassvsCent->Fill(fCent, jet->M());
245  NjetAcc++;
246  }
247  }
248 
249  fHistRhoMassvsCent->Fill(fCent, fOutRhoMass->GetVal());
250 
251  if (fTracks)
252  fHistRhoMassvsNtrack->Fill(Ntracks, fOutRhoMass->GetVal());
253  if (fCaloClusters)
254  fHistRhoMassvsNcluster->Fill(Nclusters, fOutRhoMass->GetVal());
255  if (fCompareRhoMass) {
256  fHistDeltaRhoMassvsCent->Fill(fCent, fOutRhoMass->GetVal() - fCompareRhoMass->GetVal());
257  if (fTracks)
258  fHistDeltaRhoMassvsNtrack->Fill(Ntracks, fOutRhoMass->GetVal() - fCompareRhoMass->GetVal());
259  }
260 
261  if (fOutRhoMassScaled) {
263  if (fTracks)
264  fHistRhoMassScaledvsNtrack->Fill(Ntracks, fOutRhoMassScaled->GetVal());
265  if (fCaloClusters)
266  fHistRhoMassScaledvsNcluster->Fill(Nclusters, fOutRhoMassScaled->GetVal());
267  if (fCompareRhoMassScaled) {
269  if (fTracks)
270  fHistDeltaRhoMassScalevsNtrack->Fill(Ntracks, fOutRhoMassScaled->GetVal() - fCompareRhoMassScaled->GetVal());
271  }
272  }
273 
274  return kTRUE;
275 }
276 
277 
278 //________________________________________________________________________
280 {
281  // Init the analysis.
282 
283  if (!fOutRhoMass) {
285 
286  if (fAttachToEvent) {
287  if (!(InputEvent()->FindListObject(fOutRhoMassName))) {
288  InputEvent()->AddObject(fOutRhoMass);
289  } else {
290  AliFatal(Form("%s: Container with same name %s already present. Aborting", GetName(), fOutRhoMassName.Data()));
291  return;
292  }
293  }
294  }
295 
298 
299  if (fAttachToEvent) {
300  if (!(InputEvent()->FindListObject(fOutRhoMassScaledName))) {
301  InputEvent()->AddObject(fOutRhoMassScaled);
302  } else {
303  AliFatal(Form("%s: Container with same name %s already present. Aborting", GetName(), fOutRhoMassScaledName.Data()));
304  return;
305  }
306  }
307  }
308 
309  if (!fCompareRhoMassName.IsNull() && !fCompareRhoMass) {
310  fCompareRhoMass = dynamic_cast<AliRhoParameter*>(InputEvent()->FindListObject(fCompareRhoMassName));
311  if (!fCompareRhoMass) {
312  AliWarning(Form("%s: Could not retrieve rho %s!", GetName(), fCompareRhoMassName.Data()));
313  }
314  }
315 
317  fCompareRhoMassScaled = dynamic_cast<AliRhoParameter*>(InputEvent()->FindListObject(fCompareRhoMassScaledName));
318  if (!fCompareRhoMassScaled) {
319  AliWarning(Form("%s: Could not retrieve rho %s!", GetName(), fCompareRhoMassScaledName.Data()));
320  }
321  }
322 
324 }
325 
326 //________________________________________________________________________
328 {
329  // Return rho per centrality.
330 
331  Double_t rho = 0;
332  if (fRhoMassFunction)
333  rho = fRhoMassFunction->Eval(cent);
334  return rho;
335 }
336 
337 //________________________________________________________________________
339 {
340  // Get scale factor.
341 
342  Double_t scale = 1;
343  if (fScaleFunction)
344  scale = fScaleFunction->Eval(cent);
345  return scale;
346 }
AliRhoParameter * fCompareRhoMass
output scaled rho object
TH2F * fHistDeltaRhoMassvsNtrack
rho mass scaled vs. no. of tracks
TH2F * fHistRhoMassvsNcluster
delta rho mass scaled vs. no. of tracks
TObjArray fClusterCollArray
cluster collection array
AliRhoParameter * fCompareRhoMassScaled
rho object to compare
double Double_t
Definition: External.C:58
Definition: External.C:236
TH2F * fHistDeltaRhoMassvsCent
rho mass scaled vs. centrality
Bool_t FillHistograms()
Function filling histograms.
virtual Double_t GetScaleFactor(Double_t cent)
AliRhoParameter * fOutRhoMassScaled
output rho object
TH2F * fHistRhoMassvsCent
jet mass vs. centrality
virtual Double_t GetRhoMassFactor(Double_t cent)
Container for particles within the EMCAL framework.
TObjArray fParticleCollArray
particle/track collection array
TClonesArray * fCaloClusters
!clusters
int Int_t
Definition: External.C:63
TH2F * fHistDeltaRhoMassScalevsCent
delta rho mass vs. centrality
float Float_t
Definition: External.C:68
Int_t GetNAcceptedClusters() const
Double_t fCent
!event centrality
TH2F * fHistRhoMassScaledvsNcluster
rho mass vs. no. of clusters
TH2F * fHistGammaVsNtrack
rho mass scaled vs. no. of clusters
TObjArray fJetCollArray
jet collection array
TClonesArray * fJets
! jets
TH2F * fHistRhoMassScaledvsNtrack
rho mass vs. no. of tracks
void ExecOnce()
Perform steps needed to initialize the analysis.
TH2F * fHistDeltaRhoMassScalevsNtrack
delta rho mass vs. no. of tracks
AliEmcalList * fOutput
!output list
Double_t fMaxBinPt
max pt in histograms
TClonesArray * fTracks
!tracks
Bool_t fCreateHisto
whether or not create histograms
void SetMakeGeneralHistograms(Bool_t g)
Base task in the EMCAL jet framework.
Represent a jet reconstructed using the EMCal jet framework.
Definition: AliEmcalJet.h:51
TH2F * fHistRhoMassScaledvsCent
rho mass vs. centrality
void UserCreateOutputObjects()
Main initialization function on the worker.
TH2F * fHistRhoMassvsNtrack
delta rho mass scaled vs. centrality
virtual Bool_t AcceptJet(AliEmcalJet *jet, Int_t c=0)
bool Bool_t
Definition: External.C:53
TH2F * fHistJetMassvsCent
scaled rho object to compare
Int_t GetNAcceptedParticles() const
Container structure for EMCAL clusters.
Double_t M() const
Definition: AliEmcalJet.h:120
Int_t fNbins
no. of pt bins
Bool_t Run()
Run function. This is the core function of the analysis and contains the user code. Therefore users have to implement this function.