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