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