]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/AliCaloTrackReader.cxx
code cleanup, bugfixes
[u/mrichter/AliRoot.git] / PWG4 / AliCaloTrackReader.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
d92b41ad 17//_________________________________________________________________________
18// Base class for reading data: MonteCarlo, ESD or AOD, of PHOS EMCAL and
19// Central Barrel Tracking detectors (CTS).
20// Not all MC particles/tracks/clusters are kept, some kinematical/fidutial restrictions are done.
21// Mother class of : AliCaloTrackESDReader: Fills ESD data in 3 TClonesArrays (PHOS, EMCAL, CTS)
22// : AliCaloTrackMCReader: Fills Kinematics data in 3 TClonesArrays (PHOS, EMCAL, CTS)
23// : AliCaloTrackAODReader: Fills AOD data in 3 TClonesArrays (PHOS, EMCAL, CTS)
24//
25//-- Author: Gustavo Conesa (LNF-INFN)
26//////////////////////////////////////////////////////////////////////////////
27
28
29// --- ROOT system ---
30#include <TMath.h>
31#include <TLorentzVector.h>
32#include <TString.h>
33
34//---- ANALYSIS system ----
35#include "AliCaloTrackReader.h"
36#include "AliLog.h"
37#include "AliStack.h"
38#include "AliHeader.h"
39#include "AliGenEventHeader.h"
40
41ClassImp(AliCaloTrackReader)
42
43
44//____________________________________________________________________________
45 AliCaloTrackReader::AliCaloTrackReader() :
46 TObject(), fDataType(0), fDebug(0), fFidutialCut(0x0),
47 fCTSPtMin(0), fEMCALPtMin(0),fPHOSPtMin(0),
48 fAODCTS(0x0), fAODEMCAL(0x0), fAODPHOS(0x0),
49 fEMCALCells(0x0), fPHOSCells(0x0),
50 fESD(0x0), fAOD(0x0),fMC(0x0),
51 fFillCTS(0),fFillEMCAL(0),fFillPHOS(0),
52 fFillEMCALCells(0),fFillPHOSCells(0)
53{
54 //Ctor
55
56 //Initialize parameters
57 InitParameters();
58}
59
60//____________________________________________________________________________
61AliCaloTrackReader::AliCaloTrackReader(const AliCaloTrackReader & g) :
62 TObject(g), fDataType(g.fDataType), fDebug(g.fDebug),fFidutialCut(g.fFidutialCut),
63 fCTSPtMin(g.fCTSPtMin), fEMCALPtMin(g.fEMCALPtMin),fPHOSPtMin(g.fPHOSPtMin),
64 fAODCTS(new TClonesArray(*g.fAODCTS)),
65 fAODEMCAL(new TClonesArray(*g.fAODEMCAL)),
66 fAODPHOS(new TClonesArray(*g.fAODPHOS)),
67 fEMCALCells(new TNamed(*g.fEMCALCells)),
68 fPHOSCells(new TNamed(*g.fPHOSCells)),
69 fESD(g.fESD), fAOD(g.fAOD), fMC(g.fMC),
70 fFillCTS(g.fFillCTS),fFillEMCAL(g.fFillEMCAL),fFillPHOS(g.fFillPHOS),
71 fFillEMCALCells(g.fFillEMCALCells),fFillPHOSCells(g.fFillPHOSCells)
72{
73 // cpy ctor
74
75}
76
77//_________________________________________________________________________
78AliCaloTrackReader & AliCaloTrackReader::operator = (const AliCaloTrackReader & source)
79{
80 // assignment operator
81
82 if(&source == this) return *this;
83
84 fDataType = source.fDataType ;
85 fDebug = source.fDebug ;
86
87 fFidutialCut = source.fFidutialCut;
88
89 fCTSPtMin = source.fCTSPtMin ;
90 fEMCALPtMin = source.fEMCALPtMin ;
91 fPHOSPtMin = source.fPHOSPtMin ;
92
93 fAODCTS = new TClonesArray(*source.fAODCTS) ;
94 fAODEMCAL = new TClonesArray(*source.fAODEMCAL) ;
95 fAODPHOS = new TClonesArray(*source.fAODPHOS) ;
96 fEMCALCells = new TNamed(*source.fEMCALCells) ;
97 fPHOSCells = new TNamed(*source.fPHOSCells) ;
98
99 fESD = source.fESD;
100 fAOD= source.fAOD;
101 fMC = source.fMC;
102
103 fFillCTS = source.fFillCTS;
104 fFillEMCAL = source.fFillEMCAL;
105 fFillPHOS = source.fFillPHOS;
106 fFillEMCALCells = source.fFillEMCALCells;
107 fFillPHOSCells = source.fFillPHOSCells;
108
109 return *this;
110
111}
112
113//_________________________________
114AliCaloTrackReader::~AliCaloTrackReader() {
115 //Dtor
116
117 if(fFidutialCut) delete fFidutialCut ;
118
119 if(fAODCTS){
120 fAODCTS->Clear() ;
121 delete fAODCTS ;
122 }
123
124 if(fAODEMCAL){
125 fAODEMCAL->Clear() ;
126 delete fAODEMCAL ;
127 }
128
129 if(fAODPHOS){
130 fAODPHOS->Clear() ;
131 delete fAODPHOS ;
132 }
133
134 if(fEMCALCells){
135 fEMCALCells->Clear() ;
136 delete fEMCALCells ;
137 }
138
139 if(fPHOSCells){
140 fPHOSCells->Clear() ;
141 delete fPHOSCells ;
142 }
143
144 if(fESD) delete fESD ;
145 if(fAOD) delete fAOD ;
146 if(fMC) delete fMC ;
147}
148
149//____________________________________________________________________________
150AliStack* AliCaloTrackReader::GetStack() const {
151 //Return pointer to stack
152 if(fMC)
153 return fMC->Stack();
154 else{
155 printf("stack is not available");
156 return 0x0 ;
157 }
158}
159
160//____________________________________________________________________________
161AliHeader* AliCaloTrackReader::GetHeader() const {
162 //Return pointer to header
163 if(fMC)
164 return fMC->Header();
165 else{
166 printf("header is not available");
167 return 0x0 ;
168 }
169}
170//____________________________________________________________________________
171AliGenEventHeader* AliCaloTrackReader::GetGenEventHeader() const {
172 //Return pointer to Generated event header
173 if(fMC)
174 return fMC->GenEventHeader();
175 else{
176 printf("GenEventHeader is not available");
177 return 0x0 ;
178 }
179}
180
181//_______________________________________________________________
182void AliCaloTrackReader::InitParameters()
183{
184
185 //Initialize the parameters of the analysis.
186 fDataType = kESD ;
187
188 fCTSPtMin = 0.2 ;
189 fEMCALPtMin = 0.5 ;
190 fPHOSPtMin = 0.5 ;
191
192 fFillEMCAL = kTRUE;
193 fFillPHOS = kTRUE;
194 fFillCTS = kTRUE;
195 fFillEMCALCells = kFALSE;
196 fFillPHOSCells = kFALSE;
197
198 fFidutialCut = new AliFidutialCut();
199
200}
201
202
203//________________________________________________________________
204void AliCaloTrackReader::Print(const Option_t * opt) const
205{
206
207 //Print some relevant parameters set for the analysis
208 if(! opt)
209 return;
210
211 printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
212 printf("Data type : %d\n", fDataType) ;
213 printf("CTS Min pT : %2.1f GeV/c\n", fCTSPtMin) ;
214 printf("EMCAL Min pT : %2.1f GeV/c\n", fEMCALPtMin) ;
215 printf("PHOS Min pT : %2.1f GeV/c\n", fPHOSPtMin) ;
216 printf("Use CTS = %d\n", fFillCTS) ;
217 printf("Use EMCAL = %d\n", fFillEMCAL) ;
218 printf("Use PHOS = %d\n", fFillPHOS) ;
219 printf("Use EMCAL Cells = %d\n", fFillEMCALCells) ;
220 printf("Use PHOS Cells = %d\n", fFillPHOSCells) ;
221 printf(" \n") ;
222}
223
224//___________________________________________________
225void AliCaloTrackReader::FillInputEvent() {
226 //Fill the input lists that are needed, called by the analysis maker.
227
228 if(fFillCTS) FillInputCTS();
229 if(fFillEMCAL) FillInputEMCAL();
230 if(fFillPHOS) FillInputPHOS();
231 if(fFillEMCALCells) FillInputEMCALCells();
232 if(fFillPHOSCells) FillInputPHOSCells();
233
234}
235
236//__________________________________________________
237void AliCaloTrackReader::ResetLists() {
238 // Reset lists, called by the analysis maker
239
240 if(fAODCTS) fAODCTS -> Clear();
241 if(fAODEMCAL) fAODEMCAL -> Clear();
242 if(fAODPHOS) fAODPHOS -> Clear();
243 if(fEMCALCells) fEMCALCells -> Clear();
244 if(fPHOSCells) fPHOSCells -> Clear();
245
246}