AliPhysics  323987d (323987d)
 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  if (GetParticleContainer(0))
220  if (GetClusterContainer(0))
221  Nclusters = GetClusterContainer(0)->GetNAcceptedClusters();
222 
223  if (fJets) {
224  Int_t Njets = fJets->GetEntries();
225  Int_t NjetAcc = 0;
226 
227  for (Int_t i = 0; i < Njets; ++i) {
228  AliEmcalJet *jet = static_cast<AliEmcalJet*>(fJets->At(i));
229  if (!jet) {
230  AliError(Form("%s: Could not receive jet %d", GetName(), i));
231  continue;
232  }
233 
234  if (!AcceptJet(jet))
235  continue;
236 
237  fHistJetMassvsCent->Fill(fCent, jet->M());
238  NjetAcc++;
239  }
240  }
241 
242  fHistRhoMassvsCent->Fill(fCent, fOutRhoMass->GetVal());
243 
244  if (fTracks)
245  fHistRhoMassvsNtrack->Fill(Ntracks, fOutRhoMass->GetVal());
246  if (fCaloClusters)
247  fHistRhoMassvsNcluster->Fill(Nclusters, fOutRhoMass->GetVal());
248  if (fCompareRhoMass) {
249  fHistDeltaRhoMassvsCent->Fill(fCent, fOutRhoMass->GetVal() - fCompareRhoMass->GetVal());
250  if (fTracks)
251  fHistDeltaRhoMassvsNtrack->Fill(Ntracks, fOutRhoMass->GetVal() - fCompareRhoMass->GetVal());
252  }
253 
254  if (fOutRhoMassScaled) {
256  if (fTracks)
257  fHistRhoMassScaledvsNtrack->Fill(Ntracks, fOutRhoMassScaled->GetVal());
258  if (fCaloClusters)
259  fHistRhoMassScaledvsNcluster->Fill(Nclusters, fOutRhoMassScaled->GetVal());
260  if (fCompareRhoMassScaled) {
262  if (fTracks)
263  fHistDeltaRhoMassScalevsNtrack->Fill(Ntracks, fOutRhoMassScaled->GetVal() - fCompareRhoMassScaled->GetVal());
264  }
265  }
266 
267  return kTRUE;
268 }
269 
270 
271 //________________________________________________________________________
273 {
274  // Init the analysis.
275 
276  if (!fOutRhoMass) {
278 
279  if (fAttachToEvent) {
280  if (!(InputEvent()->FindListObject(fOutRhoMassName))) {
281  InputEvent()->AddObject(fOutRhoMass);
282  } else {
283  AliFatal(Form("%s: Container with same name %s already present. Aborting", GetName(), fOutRhoMassName.Data()));
284  return;
285  }
286  }
287  }
288 
291 
292  if (fAttachToEvent) {
293  if (!(InputEvent()->FindListObject(fOutRhoMassScaledName))) {
294  InputEvent()->AddObject(fOutRhoMassScaled);
295  } else {
296  AliFatal(Form("%s: Container with same name %s already present. Aborting", GetName(), fOutRhoMassScaledName.Data()));
297  return;
298  }
299  }
300  }
301 
302  if (!fCompareRhoMassName.IsNull() && !fCompareRhoMass) {
303  fCompareRhoMass = dynamic_cast<AliRhoParameter*>(InputEvent()->FindListObject(fCompareRhoMassName));
304  if (!fCompareRhoMass) {
305  AliWarning(Form("%s: Could not retrieve rho %s!", GetName(), fCompareRhoMassName.Data()));
306  }
307  }
308 
310  fCompareRhoMassScaled = dynamic_cast<AliRhoParameter*>(InputEvent()->FindListObject(fCompareRhoMassScaledName));
311  if (!fCompareRhoMassScaled) {
312  AliWarning(Form("%s: Could not retrieve rho %s!", GetName(), fCompareRhoMassScaledName.Data()));
313  }
314  }
315 
317 }
318 
319 //________________________________________________________________________
321 {
322  // Return rho per centrality.
323 
324  Double_t rho = 0;
325  if (fRhoMassFunction)
326  rho = fRhoMassFunction->Eval(cent);
327  return rho;
328 }
329 
330 //________________________________________________________________________
332 {
333  // Get scale factor.
334 
335  Double_t scale = 1;
336  if (fScaleFunction)
337  scale = fScaleFunction->Eval(cent);
338  return scale;
339 }
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
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)
TObjArray fParticleCollArray
particle/track collection array
AliParticleContainer * GetParticleContainer(Int_t i=0) const
TClonesArray * fCaloClusters
!clusters
int Int_t
Definition: External.C:63
TH2F * fHistDeltaRhoMassScalevsCent
delta rho mass vs. centrality
float Float_t
Definition: External.C:68
AliClusterContainer * GetClusterContainer(Int_t i=0) const
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
ClassImp(AliAnalysisTaskRhoMassBase) AliAnalysisTaskRhoMassBase
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:44
TH2F * fHistRhoMassScaledvsCent
rho mass vs. centrality
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
Double_t M() const
Definition: AliEmcalJet.h:107
Int_t fNbins
no. of pt bins