]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/PartCorrBase/AliAnaPartCorrBaseClass.cxx
fix warnings
[u/mrichter/AliRoot.git] / PWG4 / PartCorrBase / AliAnaPartCorrBaseClass.cxx
CommitLineData
1c5acb87 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15/* $Id: $ */
16
17//_________________________________________________________________________
18// Base class for analysis algorithms
19//-- Author: Gustavo Conesa (LNF-INFN)
20//_________________________________________________________________________
21
22
23// --- ROOT system ---
24#include <TClonesArray.h>
25
26//---- AliRoot system ----
27#include "AliAODPWG4Particle.h"
28#include "AliAODCaloCluster.h"
29#include "AliAODCaloCells.h"
30#include "AliAODTrack.h"
31#include "AliAnaPartCorrBaseClass.h"
32#include "AliCaloTrackReader.h"
33#include "AliCaloPID.h"
34#include "AliFidutialCut.h"
35#include "AliIsolationCut.h"
6639984f 36#include "AliMCAnalysisUtils.h"
1c5acb87 37#include "AliNeutralMesonSelection.h"
38#include "AliLog.h"
39#include "AliAODPWG4ParticleCorrelation.h"
40
41ClassImp(AliAnaPartCorrBaseClass)
42
43
44//_______________________________________________
45 AliAnaPartCorrBaseClass::AliAnaPartCorrBaseClass() :
46 TObject(), fDataMC(0), fDebug(0), fCheckFidCut(0),
47 fCheckCaloPID(0), fRecalculateCaloPID(0), fMinPt(0), fMaxPt(0),
3c769bf6 48 fReader(0x0), fInputAODBranch(0x0), fInputAODName(""),
49 fOutputAODBranch(0x0), fNewAOD(kFALSE),
50 fOutputAODName(""), fOutputAODClassName(""),
51 fAODCaloClusters(0x0), fAODCaloCells(0x0),
52 fCaloPID(0x0), fFidCut(0x0), fIC(0x0),fMCUtils(0x0), fNMS(0x0),
53 fHistoNPtBins(0), fHistoPtMax(0.), fHistoPtMin(0.),
54 fHistoNPhiBins(0), fHistoPhiMax(0.), fHistoPhiMin(0.),
55 fHistoNEtaBins(0), fHistoEtaMax(0.), fHistoEtaMin(0.)
1c5acb87 56{
57 //Default Ctor
58
59 fReader = new AliCaloTrackReader();
60 fCaloPID = new AliCaloPID();
61 fFidCut = new AliFidutialCut();
62 fIC = new AliIsolationCut();
6639984f 63 fMCUtils = new AliMCAnalysisUtils();
1c5acb87 64
65 //Initialize parameters
66 InitParameters();
67}
68
69//___________________________________________________________
70AliAnaPartCorrBaseClass::AliAnaPartCorrBaseClass(const AliAnaPartCorrBaseClass & abc) :
71 TObject(), fDataMC(abc.fDataMC), fDebug(abc.fDebug),
72 fCheckFidCut(abc.fCheckFidCut), fCheckCaloPID(abc. fCheckCaloPID),
73 fRecalculateCaloPID(abc.fRecalculateCaloPID),
74 fMinPt(abc.fMinPt), fMaxPt(abc.fMaxPt), fReader(abc.fReader),
75 fInputAODBranch(new TClonesArray(*abc.fInputAODBranch)), fInputAODName(abc.fInputAODName),
76 fOutputAODBranch(new TClonesArray(*abc.fOutputAODBranch)),fNewAOD(abc.fNewAOD),
77 fOutputAODName(abc.fOutputAODName), fOutputAODClassName(abc.fOutputAODClassName),
78 fAODCaloClusters(new TClonesArray(*abc.fAODCaloClusters)),
79 fAODCaloCells(new AliAODCaloCells(*abc.fAODCaloCells)),
6639984f 80 fCaloPID(abc.fCaloPID), fFidCut(abc.fFidCut), fIC(abc.fIC),fMCUtils(abc.fMCUtils), fNMS(abc.fNMS),
1c5acb87 81 fHistoNPtBins(abc.fHistoNPtBins), fHistoPtMax(abc.fHistoPtMax), fHistoPtMin(abc.fHistoPtMin),
82 fHistoNPhiBins(abc.fHistoNPhiBins), fHistoPhiMax(abc.fHistoPhiMax), fHistoPhiMin(abc.fHistoPhiMin),
83 fHistoNEtaBins(abc.fHistoNEtaBins), fHistoEtaMax(abc.fHistoEtaMax), fHistoEtaMin(abc.fHistoEtaMin)
84{
85 // cpy ctor
86
87}
88
89//_________________________________________________________________________
90AliAnaPartCorrBaseClass & AliAnaPartCorrBaseClass::operator = (const AliAnaPartCorrBaseClass & abc)
91{
92 // assignment operator
93
94 if(this == &abc) return *this;
95 ((TObject *)this)->operator=(abc);
96
97 fDataMC = abc.fDataMC;
98 fDebug = abc.fDebug ;
99 fRecalculateCaloPID = abc.fRecalculateCaloPID ;
100 fCheckCaloPID = abc.fCheckCaloPID ;
101 fCheckFidCut = abc.fCheckFidCut ;
102
103 fReader = abc.fReader ;
104 fAODCaloClusters = new TClonesArray(*abc.fAODCaloClusters) ;
105 fAODCaloCells = new AliAODCaloCells(*abc.fAODCaloCells) ;
106
107 fMinPt = abc.fMinPt;
108 fMaxPt = abc.fMaxPt;
109 fCaloPID = abc.fCaloPID;
110 fFidCut = abc.fFidCut;
111 fIC = abc.fIC;
6639984f 112 fMCUtils = abc.fMCUtils;
1c5acb87 113 fNMS = abc.fNMS;
6639984f 114
1c5acb87 115 fInputAODBranch = new TClonesArray(*abc.fInputAODBranch) ;
116 fInputAODName = abc.fInputAODName;
117 fOutputAODBranch = new TClonesArray(*abc.fOutputAODBranch) ;
118 fNewAOD = abc.fNewAOD ;
119 fOutputAODName = abc.fOutputAODName;
120 fOutputAODClassName = abc.fOutputAODClassName;
121
1c5acb87 122 fHistoNPtBins = abc.fHistoNPtBins; fHistoPtMax = abc.fHistoPtMax; fHistoPtMin = abc.fHistoPtMin;
123 fHistoNPhiBins = abc.fHistoNPhiBins; fHistoPhiMax = abc.fHistoPhiMax; fHistoPhiMin = abc.fHistoPhiMin;
124 fHistoNEtaBins = abc.fHistoNEtaBins; fHistoEtaMax = abc.fHistoEtaMax; fHistoEtaMin = abc.fHistoEtaMin;
125
126 return *this;
127
128}
129
130//____________________________________________________________________________
131AliAnaPartCorrBaseClass::~AliAnaPartCorrBaseClass()
132{
133 // Remove all pointers except analysis output pointers.
134
135 if(fOutputAODBranch){
136 fOutputAODBranch->Clear() ;
137 delete fOutputAODBranch ;
138 }
139
140 if(fInputAODBranch){
141 fInputAODBranch->Clear() ;
142 delete fInputAODBranch ;
143 }
144
145 if(fAODCaloClusters){
146 fAODCaloClusters->Clear() ;
147 delete fAODCaloClusters ;
148 }
149
150 if(fAODCaloCells){
151 fAODCaloCells->Clear() ;
152 delete fAODCaloCells ;
153 }
154
6639984f 155 if(fReader) delete fReader ;
1c5acb87 156 if(fCaloPID) delete fCaloPID ;
6639984f 157 if(fFidCut) delete fFidCut ;
158 if(fIC) delete fIC ;
159 if(fMCUtils) delete fMCUtils ;
160 if(fNMS) delete fNMS ;
1c5acb87 161
162}
163
164//____________________________________________________________________________
165void AliAnaPartCorrBaseClass::AddAODCaloCluster(AliAODCaloCluster calo) {
166 //Put AOD calo cluster in the CaloClusters array
167
168 Int_t i = fAODCaloClusters->GetEntriesFast();
169 new((*fAODCaloClusters)[i]) AliAODCaloCluster(calo);
170
171}
172
173
174//____________________________________________________________________________
175void AliAnaPartCorrBaseClass::AddAODParticle(AliAODPWG4Particle pc) {
176 //Put AOD calo cluster in the AODParticleCorrelation array
177
178 if(fOutputAODBranch){
179
180 Int_t i = fOutputAODBranch->GetEntriesFast();
181 //new((*fOutputAODBranch)[i]) AliAODPWG4Particle(pc);
182 if(strcmp(fOutputAODBranch->GetClass()->GetName(),"AliAODPWG4Particle")==0)
183 new((*fOutputAODBranch)[i]) AliAODPWG4Particle(pc);
184 else if(strcmp(fOutputAODBranch->GetClass()->GetName(),"AliAODPWG4ParticleCorrelation")==0)
185 new((*fOutputAODBranch)[i]) AliAODPWG4ParticleCorrelation(pc);
186 else
187 AliFatal(Form(">>> Cannot add an object of type < %s >, to the AOD TClonesArray \n",
188 fOutputAODBranch->GetClass()->GetName()));
189 }
190 else AliFatal("AddAODParticle: No AOD branch available!!!");
191
192}
193
194
195//___________________________________________________
196void AliAnaPartCorrBaseClass::ConnectAODCaloClusters() {
197 //Recover the list of AODCaloClusters
198
199 fAODCaloClusters = fReader->GetAOD()->GetCaloClusters();
200
201}
202
203//___________________________________________________
204void AliAnaPartCorrBaseClass::ConnectAODPHOSCells() {
205 //Recover the list of PHOS AODCaloCells
206
207 fAODCaloCells = fReader->GetAOD()->GetPHOSCells();
208
209}
210
211//___________________________________________________
212void AliAnaPartCorrBaseClass::ConnectAODEMCALCells() {
213 //Recover the list of EMCAL AODCaloCells
214
215 fAODCaloCells = fReader->GetAOD()->GetEMCALCells();
216
217}
218
219//___________________________________________________
220void AliAnaPartCorrBaseClass::ConnectInputOutputAODBranches() {
221 //Recover ouput and input AOD pointers for each event in the maker
222 fOutputAODBranch = (TClonesArray *) fReader->GetAOD()->FindListObject(fOutputAODName);
223 fInputAODBranch = (TClonesArray *) fReader->GetAOD()->FindListObject(fInputAODName);
224}
225
226//__________________________________________________
227TClonesArray * AliAnaPartCorrBaseClass::GetAODCTS() const {
228 //Get list of tracks from reader
229
230 return fReader->GetAODCTS();
231
232}
233
234//__________________________________________________
235TClonesArray * AliAnaPartCorrBaseClass::GetAODPHOS() const {
236 //Get list of PHOS calo clusters from reader
237
238 return fReader->GetAODPHOS();
239
240}
241
242
243//__________________________________________________
244TClonesArray * AliAnaPartCorrBaseClass::GetAODEMCAL() const {
245 //Get list of emcal caloclusters from reader
246
247 return fReader->GetAODEMCAL();
248
249}
250
251//__________________________________________________
252TString AliAnaPartCorrBaseClass::GetBaseParametersList() {
253 //Put data member values in string to keep in output container
254
255 TString parList ; //this will be list of parameters used for this analysis.
256 char onePar[255] ;
257 sprintf(onePar,"--- AliAnaPartCorrBaseClass ---\n") ;
258 parList+=onePar ;
259 sprintf(onePar,"Minimal P_t: %2.2f ; Max\n", fMinPt) ;
260 parList+=onePar ;
261 sprintf(onePar,"Minimal P_t: %2.2f ; Max\n", fMaxPt) ;
262 parList+=onePar ;
263 sprintf(onePar,"fDataMC =%d (Check MC information, on/off) \n",fDataMC) ;
264 parList+=onePar ;
265 sprintf(onePar,"fCheckFidCut=%d (Check Fidutial cut selection on/off) \n",fCheckFidCut) ;
266 parList+=onePar ;
267 sprintf(onePar,"fCheckCaloPIC =%d (Use Bayesian PID in calorimetes, on/off) \n",fCheckCaloPID) ;
268 parList+=onePar ;
269 sprintf(onePar,"fRecalculateCaloPID =%d (Calculate PID from shower/tof/tracking parameters, on/off) \n",fRecalculateCaloPID) ;
270 parList+=onePar ;
271
272 return parList;
273
274}
275
276//__________________________________________________
277 TClonesArray * AliAnaPartCorrBaseClass::GetCreateOutputAODBranch() {
278 //Create AOD branch filled in the analysis
279
280 //if(fDebug > 0 )
281 printf("Create AOD branch of %s objects and with name < %s >\n",
282 fOutputAODClassName.Data(),fOutputAODName.Data()) ;
283
284 TClonesArray * aodBranch = new TClonesArray(fOutputAODClassName, 0);
285 aodBranch->SetName(fOutputAODName);
286
287 return aodBranch ;
288
289 }
290
291//__________________________________________________
292TNamed * AliAnaPartCorrBaseClass::GetPHOSCells() const {
293 //Get list of PHOS calo cells (ESD or AOD) from reader
294
295 return fReader->GetPHOSCells();
296
297}
298
299
300//__________________________________________________
301TNamed * AliAnaPartCorrBaseClass::GetEMCALCells() const {
302 //Get list of emcal calo cells (ESD or AOD) from reader
303
304 return fReader->GetEMCALCells();
305
306}
307
6639984f 308//__________________________________________________
309Int_t AliAnaPartCorrBaseClass::GetEventNumber() const {
310 //Get current event number
311
312 return fReader->GetEventNumber() ;
313}
314
1c5acb87 315//__________________________________________________
316AliStack * AliAnaPartCorrBaseClass::GetMCStack() const {
317 //Get stack pointer from reader
318
319 return fReader->GetStack();
320
321}
322//__________________________________________________
323AliHeader * AliAnaPartCorrBaseClass::GetMCHeader() const {
324 //Get header pointer from reader
325
326 return fReader->GetHeader();
327
328}
329
330//__________________________________________________
331AliGenEventHeader * AliAnaPartCorrBaseClass::GetMCGenEventHeader() const {
332 //Get GenEventHeader pointer from reader
333
334 return fReader->GetGenEventHeader();
335
336}
337
338//__________________________________________________
339void AliAnaPartCorrBaseClass::InitParameters()
340{
341 //Initialize the parameters of the analysis.
342 fDataMC = kFALSE;
343 fDebug = -1;
344 fCheckCaloPID = kTRUE ;
345 fCheckFidCut = kFALSE ;
346 fRecalculateCaloPID = kFALSE ;
347 fMinPt = 0.2 ; //Min pt in particle analysis
348 fMaxPt = 300. ; //Max pt in particle analysis
349
350 fCaloPID = new AliCaloPID ;
351 fFidCut = new AliFidutialCut;
352 fIC = new AliIsolationCut;
353 fNMS = new AliNeutralMesonSelection;
354 fNewAOD = kFALSE ;
355 fOutputAODName = "PartCorr";
356 fOutputAODClassName = "AliAODPWG4Particle";
357 fInputAODName = "PartCorr";
358
359 //Histogrammes settings
360 fHistoNPtBins = 240 ;
361 fHistoPtMax = 120 ;
362 fHistoPtMin = 0. ;
363
364 fHistoNPhiBins = 120 ;
365 fHistoPhiMax = TMath::TwoPi();
366 fHistoPhiMin = 0. ;
367
368 fHistoNEtaBins = 100 ;
369 fHistoEtaMax = 1 ;
370 fHistoEtaMin = -1 ;
371
372}
373
374//__________________________________________________________________
375void AliAnaPartCorrBaseClass::Print(const Option_t * opt) const
376{
377 //Print some relevant parameters set for the analysis
378
379 if(! opt)
380 return;
381 printf("New AOD: = %d\n",fNewAOD);
382 printf("Input AOD name: = %s\n",fInputAODName.Data());
383 printf("Output AOD name: = %s\n",fOutputAODName.Data());
384 printf("Output AOD Class name: = %s\n",fOutputAODClassName.Data());
385 printf("Min Photon pT = %2.2f\n", fMinPt) ;
386 printf("Max Photon pT = %3.2f\n", fMaxPt) ;
387 printf("Check PID = %d\n", fCheckCaloPID) ;
388 printf("Recalculate PID = %d\n", fRecalculateCaloPID) ;
389 printf("Check Fidutial cut = %d\n", fCheckFidCut) ;
390 printf("Check MC labels = %d\n", fDataMC);
391 printf("Debug Level = %d\n", fDebug);
392 printf("Histograms: %3.1f < pT < %3.1f, Nbin = %d\n", fHistoPtMin, fHistoPtMax, fHistoNPtBins);
393 printf("Histograms: %3.1f < phi < %3.1f, Nbin = %d\n", fHistoPhiMin, fHistoPhiMax, fHistoNPhiBins);
394 printf("Histograms: %3.1f < eta < %3.1f, Nbin = %d\n", fHistoEtaMin, fHistoEtaMax, fHistoNEtaBins);
395
396 printf(" \n") ;
397
398}