AliPhysics  master (3d17d9d)
AliAnalysisTaskRhoMassBase.cxx
Go to the documentation of this file.
1 /************************************************************************************
2  * Copyright (C) 2014, Copyright Holders of the ALICE Collaboration *
3  * All rights reserved. *
4  * *
5  * Redistribution and use in source and binary forms, with or without *
6  * modification, are permitted provided that the following conditions are met: *
7  * * Redistributions of source code must retain the above copyright *
8  * notice, this list of conditions and the following disclaimer. *
9  * * Redistributions in binary form must reproduce the above copyright *
10  * notice, this list of conditions and the following disclaimer in the *
11  * documentation and/or other materials provided with the distribution. *
12  * * Neither the name of the <organization> nor the *
13  * names of its contributors may be used to endorse or promote products *
14  * derived from this software without specific prior written permission. *
15  * *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
19  * DISCLAIMED. IN NO EVENT SHALL ALICE COLLABORATION BE LIABLE FOR ANY *
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
26  ************************************************************************************/
27 #include <TF1.h>
28 #include <TH1F.h>
29 #include <TH2F.h>
30 #include <TClonesArray.h>
31 
32 #include "AliLog.h"
33 #include "AliRhoParameter.h"
34 #include "AliEmcalJet.h"
35 #include "AliParticleContainer.h"
36 #include "AliClusterContainer.h"
37 
39 
41 
44  fOutRhoMassName(),
45  fOutRhoMassScaledName(),
46  fCompareRhoMassName(),
47  fCompareRhoMassScaledName(),
48  fRhoMassFunction(0),
49  fScaleFunction(0),
50  fAttachToEvent(kTRUE),
51  fOutRhoMass(0),
52  fOutRhoMassScaled(0),
53  fCompareRhoMass(0),
54  fCompareRhoMassScaled(0),
55  fHistJetMassvsCent(0),
56  fHistRhoMassvsCent(0),
57  fHistRhoMassScaledvsCent(0),
58  fHistDeltaRhoMassvsCent(0),
59  fHistDeltaRhoMassScalevsCent(0),
60  fHistRhoMassvsNtrack(0),
61  fHistRhoMassScaledvsNtrack(0),
62  fHistDeltaRhoMassvsNtrack(0),
63  fHistDeltaRhoMassScalevsNtrack(0),
64  fHistRhoMassvsNcluster(0),
65  fHistRhoMassScaledvsNcluster(0),
66  fHistGammaVsNtrack(0)
67 {
68 }
69 
71  AliAnalysisTaskEmcalJet(name, histo),
72  fOutRhoMassName(),
73  fOutRhoMassScaledName(),
74  fCompareRhoMassName(),
75  fCompareRhoMassScaledName(),
76  fRhoMassFunction(0),
77  fScaleFunction(0),
78  fAttachToEvent(kTRUE),
79  fOutRhoMass(0),
80  fOutRhoMassScaled(0),
81  fCompareRhoMass(0),
82  fCompareRhoMassScaled(0),
83  fHistJetMassvsCent(0),
84  fHistRhoMassvsCent(0),
85  fHistRhoMassScaledvsCent(0),
86  fHistDeltaRhoMassvsCent(0),
87  fHistDeltaRhoMassScalevsCent(0),
88  fHistRhoMassvsNtrack(0),
89  fHistRhoMassScaledvsNtrack(0),
90  fHistDeltaRhoMassvsNtrack(0),
91  fHistDeltaRhoMassScalevsNtrack(0),
92  fHistRhoMassvsNcluster(0),
93  fHistRhoMassScaledvsNcluster(0),
94  fHistGammaVsNtrack(0)
95 {
97 }
98 
100 {
101  if (!fCreateHisto)
102  return;
103 
105 
106  //ranges for PbPb
107  Float_t Ntrackrange[2] = {0, 6000};
108 
109  Int_t nBinsRhom = 200;
110  Double_t minRhom = 0.;
111  Double_t maxRhom = 20.;
112 
113  Int_t nBinsM = 100;
114  Double_t minM = -20.;
115  Double_t maxM = 80.;
116 
117  if(!fIsPbPb){
118  //set multiplicity related axes to a smaller max value
119  Ntrackrange[1] = 200.;
120  maxRhom = 0.25;
121  }
122 
123  fHistRhoMassvsCent = new TH2F("fHistRhoMassvsCent", "fHistRhoMassvsCent", 101, -1, 100, nBinsRhom,minRhom,maxRhom);
124  fHistRhoMassvsCent->GetXaxis()->SetTitle("Centrality (%)");
125  fHistRhoMassvsCent->GetYaxis()->SetTitle("#rho_{m} (GeV/c * rad^{-1})");
127 
128  if (fParticleCollArray.GetEntriesFast()>0) {
129  fHistRhoMassvsNtrack = new TH2F("fHistRhoMassvsNtrack", "fHistRhoMassvsNtrack", 150, Ntrackrange[0], Ntrackrange[1], nBinsRhom,minRhom,maxRhom);
130  fHistRhoMassvsNtrack->GetXaxis()->SetTitle("No. of tracks");
131  fHistRhoMassvsNtrack->GetYaxis()->SetTitle("#rho_{m} (GeV/c * rad^{-1})");
133 
134  //fHistGammaVsNtrack
135  fHistGammaVsNtrack = new TH2F("fHistGammaVsNtrack", "fHistGammaVsNtrack", 150, Ntrackrange[0], Ntrackrange[1], 100,0.,10.);
136  fHistGammaVsNtrack->GetXaxis()->SetTitle("No. of tracks");
137  fHistGammaVsNtrack->GetYaxis()->SetTitle("#gamma = #LT E #GT / #LT M #GT");
139  }
140 
141  if (fClusterCollArray.GetEntriesFast()>0) {
142  fHistRhoMassvsNcluster = new TH2F("fHistRhoMassvsNcluster", "fHistRhoMassvsNcluster", 50, 0, 1500, nBinsRhom,minRhom,maxRhom);
143  fHistRhoMassvsNcluster->GetXaxis()->SetTitle("No. of tracks");
144  fHistRhoMassvsNcluster->GetYaxis()->SetTitle("#rho_{m} (GeV/c * rad^{-1})");
146  }
147 
148  if (fJetCollArray.GetEntriesFast()>0) {
149  fHistJetMassvsCent = new TH2F("fHistJetMassvsCent", "fHistJetMassvsCent", 101, -1, 100, nBinsM,minM,maxM);
150  fHistJetMassvsCent->GetXaxis()->SetTitle("Centrality (%)");
151  fHistJetMassvsCent->GetYaxis()->SetTitle("#it{M}_{jet} (GeV/c)");
153  }
154 
155  if (!fCompareRhoMassName.IsNull()) {
156  fHistDeltaRhoMassvsCent = new TH2F("fHistDeltaRhoMassvsCent", "fHistDeltaRhoMassvsCent", 101, -1, 100, fNbins, -fMaxBinPt, fMaxBinPt);
157  fHistDeltaRhoMassvsCent->GetXaxis()->SetTitle("Centrality (%)");
158  fHistDeltaRhoMassvsCent->GetYaxis()->SetTitle("#Delta#rho (GeV/c * rad^{-1})");
160 
161  if (fParticleCollArray.GetEntriesFast()>0) {
162  fHistDeltaRhoMassvsNtrack = new TH2F("fHistDeltaRhoMassvsNtrack", "fHistDeltaRhoMassvsNtrack", 150, Ntrackrange[0], Ntrackrange[1], fNbins, -fMaxBinPt, fMaxBinPt);
163  fHistDeltaRhoMassvsNtrack->GetXaxis()->SetTitle("No. of tracks");
164  fHistDeltaRhoMassvsNtrack->GetYaxis()->SetTitle("#Delta#rho (GeV/c * rad^{-1})");
166  }
167  }
168 
169  if (fScaleFunction) {
170  fHistRhoMassScaledvsCent = new TH2F("fHistRhoMassScaledvsCent", "fHistRhoMassScaledvsCent", 101, -1, 100, nBinsRhom,minRhom,maxRhom);
171  fHistRhoMassScaledvsCent->GetXaxis()->SetTitle("Centrality (%)");
172  fHistRhoMassScaledvsCent->GetYaxis()->SetTitle("#rho_{m,scaled} (GeV/c * rad^{-1})");
174 
175  if (fParticleCollArray.GetEntriesFast()>0) {
176  fHistRhoMassScaledvsNtrack = new TH2F("fHistRhoMassScaledvsNtrack", "fHistRhoMassScaledvsNtrack", 150, Ntrackrange[0], Ntrackrange[1], nBinsRhom,minRhom,maxRhom);
177  fHistRhoMassScaledvsNtrack->GetXaxis()->SetTitle("No. of tracks");
178  fHistRhoMassScaledvsNtrack->GetYaxis()->SetTitle("#rho_{m,scaled} (GeV/c * rad^{-1})");
180  }
181 
182  if (fClusterCollArray.GetEntriesFast()>0) {
183  fHistRhoMassScaledvsNcluster = new TH2F("fHistRhoMassScaledvsNcluster", "fHistRhoMassScaledvsNcluster", 50, 0, 1500, nBinsRhom,minRhom,maxRhom);
184  fHistRhoMassScaledvsNcluster->GetXaxis()->SetTitle("No. of clusters");
185  fHistRhoMassScaledvsNcluster->GetYaxis()->SetTitle("#rho_{m,scaled} (GeV/c * rad^{-1})");
187  }
188 
189  if (!fCompareRhoMassScaledName.IsNull()) {
190  fHistDeltaRhoMassScalevsCent = new TH2F("fHistDeltaRhoMassScalevsCent", "fHistDeltaRhoMassScalevsCent", 101, -1, 100, nBinsRhom,minRhom,maxRhom);
191  fHistDeltaRhoMassScalevsCent->GetXaxis()->SetTitle("Centrality (%)");
192  fHistDeltaRhoMassScalevsCent->GetYaxis()->SetTitle("#Delta#rho_{m,scaled} (GeV/c * rad^{-1})");
194 
195  if (fParticleCollArray.GetEntriesFast()>0) {
196  fHistDeltaRhoMassScalevsNtrack = new TH2F("fHistDeltaRhoMassScalevsNtrack", "fHistDeltaRhoMassScalevsNtrack", 150, Ntrackrange[0], Ntrackrange[1], fNbins, -fMaxBinPt, fMaxBinPt);
197  fHistDeltaRhoMassScalevsNtrack->GetXaxis()->SetTitle("No. of tracks");
198  fHistDeltaRhoMassScalevsNtrack->GetYaxis()->SetTitle("#Delta#rho_{m,scaled} (GeV/c * rad^{-1})");
200  }
201  }
202  }
203 }
204 
206 {
208  fOutRhoMass->SetVal(rhom);
209 
210  if (fScaleFunction) {
211  Double_t rhomScaled = rhom * GetScaleFactor(fCent);
212  fOutRhoMassScaled->SetVal(rhomScaled);
213  }
214 
215  return kTRUE;
216 }
217 
219 {
220  Int_t Ntracks = 0;
221  Int_t Nclusters = 0;
222 
223  // Loop over all possible contianers
224  AliParticleContainer * partCont = 0;
225  TIter nextPartCont(&fParticleCollArray);
226  while ((partCont = static_cast<AliParticleContainer*>(nextPartCont()))) {
227  Ntracks += partCont->GetNAcceptedParticles();
228  }
229  AliClusterContainer * clusCont = 0;
230  TIter nextClusCont(&fClusterCollArray);
231  while ((clusCont = static_cast<AliClusterContainer*>(nextClusCont()))) {
232  Nclusters += clusCont->GetNAcceptedClusters();
233  }
234 
235  if (fJets) {
236  Int_t Njets = fJets->GetEntries();
237  Int_t NjetAcc = 0;
238 
239  for (Int_t i = 0; i < Njets; ++i) {
240  AliEmcalJet *jet = static_cast<AliEmcalJet*>(fJets->At(i));
241  if (!jet) {
242  AliError(Form("%s: Could not receive jet %d", GetName(), i));
243  continue;
244  }
245 
246  if (!AcceptJet(jet))
247  continue;
248 
249  fHistJetMassvsCent->Fill(fCent, jet->M());
250  NjetAcc++;
251  }
252  }
253 
254  fHistRhoMassvsCent->Fill(fCent, fOutRhoMass->GetVal());
255 
256  if (fTracks)
257  fHistRhoMassvsNtrack->Fill(Ntracks, fOutRhoMass->GetVal());
258  if (fCaloClusters)
259  fHistRhoMassvsNcluster->Fill(Nclusters, fOutRhoMass->GetVal());
260  if (fCompareRhoMass) {
261  fHistDeltaRhoMassvsCent->Fill(fCent, fOutRhoMass->GetVal() - fCompareRhoMass->GetVal());
262  if (fTracks)
263  fHistDeltaRhoMassvsNtrack->Fill(Ntracks, fOutRhoMass->GetVal() - fCompareRhoMass->GetVal());
264  }
265 
266  if (fOutRhoMassScaled) {
268  if (fTracks)
269  fHistRhoMassScaledvsNtrack->Fill(Ntracks, fOutRhoMassScaled->GetVal());
270  if (fCaloClusters)
271  fHistRhoMassScaledvsNcluster->Fill(Nclusters, fOutRhoMassScaled->GetVal());
272  if (fCompareRhoMassScaled) {
274  if (fTracks)
275  fHistDeltaRhoMassScalevsNtrack->Fill(Ntracks, fOutRhoMassScaled->GetVal() - fCompareRhoMassScaled->GetVal());
276  }
277  }
278 
279  return kTRUE;
280 }
281 
282 
284 {
285  if (!fOutRhoMass) {
287 
288  if (fAttachToEvent) {
289  if (!(InputEvent()->FindListObject(fOutRhoMassName))) {
290  InputEvent()->AddObject(fOutRhoMass);
291  } else {
292  AliFatal(Form("%s: Container with same name %s already present. Aborting", GetName(), fOutRhoMassName.Data()));
293  return;
294  }
295  }
296  }
297 
300 
301  if (fAttachToEvent) {
302  if (!(InputEvent()->FindListObject(fOutRhoMassScaledName))) {
303  InputEvent()->AddObject(fOutRhoMassScaled);
304  } else {
305  AliFatal(Form("%s: Container with same name %s already present. Aborting", GetName(), fOutRhoMassScaledName.Data()));
306  return;
307  }
308  }
309  }
310 
311  if (!fCompareRhoMassName.IsNull() && !fCompareRhoMass) {
312  fCompareRhoMass = dynamic_cast<AliRhoParameter*>(InputEvent()->FindListObject(fCompareRhoMassName));
313  if (!fCompareRhoMass) {
314  AliWarning(Form("%s: Could not retrieve rho %s!", GetName(), fCompareRhoMassName.Data()));
315  }
316  }
317 
319  fCompareRhoMassScaled = dynamic_cast<AliRhoParameter*>(InputEvent()->FindListObject(fCompareRhoMassScaledName));
320  if (!fCompareRhoMassScaled) {
321  AliWarning(Form("%s: Could not retrieve rho %s!", GetName(), fCompareRhoMassScaledName.Data()));
322  }
323  }
324 
326 }
327 
329 {
330  Double_t rho = 0;
331  if (fRhoMassFunction)
332  rho = fRhoMassFunction->Eval(cent);
333  return rho;
334 }
335 
337 {
338  Double_t scale = 1;
339  if (fScaleFunction)
340  scale = fScaleFunction->Eval(cent);
341  return scale;
342 }
AliRhoParameter * fCompareRhoMass
! rho object to compare
TH2F * fHistDeltaRhoMassvsNtrack
! delta rho mass vs. no. of tracks
TString fOutRhoMassScaledName
name of output scaled rho mass object
TH2F * fHistRhoMassvsNcluster
! rho mass vs. no. of clusters
TObjArray fClusterCollArray
cluster collection array
AliRhoParameter * fCompareRhoMassScaled
! scaled rho object to compare
Bool_t fAttachToEvent
whether or not attach rho mass to the event objects list
double Double_t
Definition: External.C:58
Definition: External.C:236
TH2F * fHistDeltaRhoMassvsCent
! delta rho mass vs. centrality
Bool_t fIsPbPb
different histogram ranges for pp/pPb and PbPb
Bool_t FillHistograms()
Fill histograms.
TString fCompareRhoMassScaledName
name of scaled rho mass object to compare
virtual Double_t GetScaleFactor(Double_t cent)
Get scale factor.
TF1 * fRhoMassFunction
pre-computed rho mass as a function of centrality
AliRhoParameter * fOutRhoMassScaled
! output scaled rho object
TH2F * fHistRhoMassvsCent
! rho mass vs. centrality
TString fCompareRhoMassName
name of rho mass object to compare
virtual Double_t GetRhoMassFactor(Double_t cent)
Return rho per centrality.
Container for particles within the EMCAL framework.
TF1 * fScaleFunction
pre-computed scale factor as a function of centrality
TObjArray fParticleCollArray
particle/track collection array
TClonesArray * fCaloClusters
!clusters
int Int_t
Definition: External.C:63
TH2F * fHistDeltaRhoMassScalevsCent
! delta rho mass scaled vs. centrality
float Float_t
Definition: External.C:68
TString fOutRhoMassName
name of output rho mass object
Int_t GetNAcceptedClusters() const
Double_t fCent
!event centrality
void UserCreateOutputObjects()
User create output objects, called at the beginning of the analysis.
TH2F * fHistRhoMassScaledvsNcluster
! rho mass scaled vs. no. of clusters
TH2F * fHistGammaVsNtrack
! Gamma(<E>/<M>) vs Ntrack
TObjArray fJetCollArray
jet collection array
TClonesArray * fJets
! jets
TH2F * fHistRhoMassScaledvsNtrack
! rho mass scaled vs. no. of tracks
TH2F * fHistDeltaRhoMassScalevsNtrack
! delta rho mass scaled vs. no. of tracks
AliEmcalList * fOutput
!output list
Double_t fMaxBinPt
max pt in histograms
TClonesArray * fTracks
!tracks
Base class for rho mass calculation.
AliRhoParameter * fOutRhoMass
! output rho object
Bool_t fCreateHisto
whether or not create histograms
void SetMakeGeneralHistograms(Bool_t g)
Enable general histograms.
Base task in the EMCAL jet framework.
Represent a jet reconstructed using the EMCal jet framework.
Definition: AliEmcalJet.h:51
TH2F * fHistRhoMassScaledvsCent
! rho mass scaled vs. centrality
void UserCreateOutputObjects()
Main initialization function on the worker.
TH2F * fHistRhoMassvsNtrack
! rho mass vs. no. of tracks
virtual Bool_t AcceptJet(AliEmcalJet *jet, Int_t c=0)
bool Bool_t
Definition: External.C:53
TH2F * fHistJetMassvsCent
! jet mass vs. centrality
Int_t GetNAcceptedParticles() const
Container structure for EMCAL clusters.
Double_t M() const
Definition: AliEmcalJet.h:120
Int_t fNbins
no. of pt bins