]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/AliAnaBaseClass.cxx
provide adress of the pointer to new AOD branch, not the pointer itself Mihaela G.
[u/mrichter/AliRoot.git] / PWG4 / AliAnaBaseClass.cxx
CommitLineData
d92b41ad 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/* History of cvs commits:
18 *
19 * $Log$
20 *
21 */
22//_________________________________________________________________________
23// Base class for analysis algorithms
24//-- Author: Gustavo Conesa (LNF-INFN)
25//_________________________________________________________________________
26
27
28// --- ROOT system ---
29#include <TClonesArray.h>
30#include <Riostream.h>
31
32//---- AliRoot system ----
33#include "AliAODParticleCorrelation.h"
34#include "AliAODCaloCluster.h"
35#include "AliAODCaloCells.h"
36#include "AliAODTrack.h"
37#include "AliAnaBaseClass.h"
38#include "AliCaloTrackReader.h"
39#include "AliFidutialCut.h"
40#include "AliIsolationCut.h"
41#include "AliNeutralMesonSelection.h"
42#include "AliLog.h"
43// #include "AliStack.h"
44// #include "AliHeader.h"
45// #include "AliGenEventHeader.h"
46
47ClassImp(AliAnaBaseClass)
48
49
50//_______________________________________________
51 AliAnaBaseClass::AliAnaBaseClass() :
52 TObject(), fDataMC(0), fDebug(0), fCheckFidCut(0),
2cc4014d 53 fCheckCaloPID(0), fRecalculateCaloPID(0), fMinPt(0), fMaxPt(0),
54 fReader(0x0), fAODBranch(0x0), fAODCaloClusters(0x0), fAODCaloCells(0x0),
d92b41ad 55 fCaloPID(0x0), fFidCut(0x0), fIC(0x0),fNMS(0x0)
56{
57 //Default Ctor
58
59 fReader = new AliCaloTrackReader();
60 fCaloPID = new AliCaloPID();
61 fFidCut = new AliFidutialCut();
62 fIC = new AliIsolationCut();
63
64 //Initialize parameters
65 InitParameters();
66}
67
68//___________________________________________________________
69AliAnaBaseClass::AliAnaBaseClass(const AliAnaBaseClass & abc) :
70 TObject(), fDataMC(abc.fDataMC), fDebug(abc.fDebug),
71 fCheckFidCut(abc.fCheckFidCut), fCheckCaloPID(abc. fCheckCaloPID),
2cc4014d 72 fRecalculateCaloPID(abc.fRecalculateCaloPID),
73 fMinPt(abc.fMinPt), fMaxPt(abc.fMaxPt), fReader(abc.fReader),
d92b41ad 74 fAODBranch(new TClonesArray(*abc.fAODBranch)),
75 fAODCaloClusters(new TClonesArray(*abc.fAODCaloClusters)),
76 fAODCaloCells(new AliAODCaloCells(*abc.fAODCaloCells)),
77 fCaloPID(abc.fCaloPID), fFidCut(abc.fFidCut), fIC(abc.fIC),fNMS(abc.fNMS)
78{
79 // cpy ctor
80
81}
82
83//_________________________________________________________________________
84AliAnaBaseClass & AliAnaBaseClass::operator = (const AliAnaBaseClass & abc)
85{
86 // assignment operator
87
88 if(this == &abc) return *this;
89 ((TObject *)this)->operator=(abc);
90
91 fDataMC = abc.fDataMC;
92 fDebug = abc.fDebug ;
93 fRecalculateCaloPID = abc.fRecalculateCaloPID ;
94 fCheckCaloPID = abc. fCheckCaloPID ;
95 fCheckFidCut = abc.fCheckFidCut ;
96
97 fReader = abc.fReader ;
98
99 fAODBranch = new TClonesArray(*abc.fAODBranch) ;
100 fAODCaloClusters = new TClonesArray(*abc.fAODCaloClusters) ;
101 fAODCaloCells = new AliAODCaloCells(*abc.fAODCaloCells) ;
102
2cc4014d 103 fMinPt = abc.fMinPt;
104 fMaxPt = abc.fMaxPt;
105
d92b41ad 106 fCaloPID = abc.fCaloPID;
107 fFidCut = abc.fFidCut;
108 fIC = abc.fIC;
109 fNMS = abc.fNMS;
110
111 return *this;
112
113}
114
115//____________________________________________________________________________
116AliAnaBaseClass::~AliAnaBaseClass()
117{
118 // Remove all pointers except analysis output pointers.
119
120 if(fAODBranch){
121 fAODBranch->Clear() ;
122 delete fAODBranch ;
123 }
124
125 if(fAODCaloClusters){
126 fAODCaloClusters->Clear() ;
127 delete fAODCaloClusters ;
128 }
129
130 if(fAODCaloCells){
131 fAODCaloCells->Clear() ;
132 delete fAODCaloCells ;
133 }
134
135 if(fReader) delete fReader ;
136 if(fCaloPID) delete fCaloPID ;
137 if(fFidCut) delete fFidCut ;
138 if(fIC) delete fIC ;
139 if(fNMS) delete fNMS ;
140
141}
142
143//____________________________________________________________________________
144void AliAnaBaseClass::AddAODCaloCluster(AliAODCaloCluster calo) {
145 //Put AOD calo cluster in the CaloClusters array
146
147 Int_t i = fAODCaloClusters->GetEntries();
148 new((*fAODCaloClusters)[i]) AliAODCaloCluster(calo);
149
150}
151
152//____________________________________________________________________________
153void AliAnaBaseClass::AddAODParticleCorrelation(AliAODParticleCorrelation pc) {
154 //Put AOD calo cluster in the AODParticleCorrelation array
155
156 Int_t i = fAODBranch->GetEntries();
157 new((*fAODBranch)[i]) AliAODParticleCorrelation(pc);
158
159}
160
161//___________________________________________________
162void AliAnaBaseClass::ConnectAODCaloClusters() {
163 //Recover the list of AODCaloClusters
164
165 fAODCaloClusters = fReader->GetAOD()->GetCaloClusters();
166
167}
168
169//___________________________________________________
170void AliAnaBaseClass::ConnectAODPHOSCells() {
171 //Recover the list of PHOS AODCaloCells
172
173 fAODCaloCells = fReader->GetAOD()->GetPHOSCells();
174
175}
176
177//___________________________________________________
178void AliAnaBaseClass::ConnectAODEMCALCells() {
179 //Recover the list of EMCAL AODCaloCells
180
181 fAODCaloCells = fReader->GetAOD()->GetEMCALCells();
182
183}
184
185//__________________________________________________
186TClonesArray * AliAnaBaseClass::GetAODCTS() const {
187 //Get list of tracks from reader
188
189 return fReader->GetAODCTS();
190
191}
192
193//__________________________________________________
194TClonesArray * AliAnaBaseClass::GetAODPHOS() const {
195 //Get list of PHOS calo clusters from reader
196
197 return fReader->GetAODPHOS();
198
199}
200
201
202//__________________________________________________
203TClonesArray * AliAnaBaseClass::GetAODEMCAL() const {
204 //Get list of emcal caloclusters from reader
205
206 return fReader->GetAODEMCAL();
207
208}
209
210//__________________________________________________
211TNamed * AliAnaBaseClass::GetPHOSCells() const {
212 //Get list of PHOS calo cells (ESD or AOD) from reader
213
214 return fReader->GetPHOSCells();
215
216}
217
218
219//__________________________________________________
220TNamed * AliAnaBaseClass::GetEMCALCells() const {
221 //Get list of emcal calo cells (ESD or AOD) from reader
222
223 return fReader->GetEMCALCells();
224
225}
226
227//__________________________________________________
228AliStack * AliAnaBaseClass::GetMCStack() const {
229 //Get stack pointer from reader
230
231 return fReader->GetStack();
232
233}
234//__________________________________________________
235AliHeader * AliAnaBaseClass::GetMCHeader() const {
236 //Get header pointer from reader
237
238 return fReader->GetHeader();
239
240}
241
242//__________________________________________________
243AliGenEventHeader * AliAnaBaseClass::GetMCGenEventHeader() const {
244 //Get GenEventHeader pointer from reader
245
246 return fReader->GetGenEventHeader();
247
248}
249
250
251void AliAnaBaseClass::InitParameters()
252{
253 //Initialize the parameters of the analysis.
254 fDataMC = kFALSE;
255 fDebug = -1;
256 fCheckCaloPID = kTRUE ;
257 fCheckFidCut = kFALSE ;
258 fRecalculateCaloPID = kFALSE ;
259 fMinPt = 2. ; //Min pt in particle analysis
260 fMaxPt = 300. ; //Max pt in particle analysis
261
262 fCaloPID = new AliCaloPID ;
263 fFidCut = new AliFidutialCut;
264 fIC = new AliIsolationCut;
265 fNMS = new AliNeutralMesonSelection;
266
267}
268