1)Terminate() method implemented in the frame. Simple examples on what to do with...
[u/mrichter/AliRoot.git] / PWG4 / PartCorrBase / AliCaloTrackReader.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 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() :
6639984f 46 TObject(), fEventNumber(-1), fDataType(0), fDebug(0),
47 fFidutialCut(0x0),
1c5acb87 48 fCTSPtMin(0), fEMCALPtMin(0),fPHOSPtMin(0),
49 fAODCTS(0x0), fAODEMCAL(0x0), fAODPHOS(0x0),
50 fEMCALCells(0x0), fPHOSCells(0x0),
51 fESD(0x0), fAOD(0x0),fMC(0x0),
52 fFillCTS(0),fFillEMCAL(0),fFillPHOS(0),
53 fFillEMCALCells(0),fFillPHOSCells(0)
54{
55 //Ctor
56
57 //Initialize parameters
58 InitParameters();
59}
60
61//____________________________________________________________________________
62AliCaloTrackReader::AliCaloTrackReader(const AliCaloTrackReader & g) :
6639984f 63 TObject(g), fEventNumber(g.fEventNumber), fDataType(g.fDataType), fDebug(g.fDebug),
64 fFidutialCut(g.fFidutialCut),
1c5acb87 65 fCTSPtMin(g.fCTSPtMin), fEMCALPtMin(g.fEMCALPtMin),fPHOSPtMin(g.fPHOSPtMin),
66 fAODCTS(new TClonesArray(*g.fAODCTS)),
67 fAODEMCAL(new TClonesArray(*g.fAODEMCAL)),
68 fAODPHOS(new TClonesArray(*g.fAODPHOS)),
69 fEMCALCells(new TNamed(*g.fEMCALCells)),
70 fPHOSCells(new TNamed(*g.fPHOSCells)),
71 fESD(g.fESD), fAOD(g.fAOD), fMC(g.fMC),
72 fFillCTS(g.fFillCTS),fFillEMCAL(g.fFillEMCAL),fFillPHOS(g.fFillPHOS),
73 fFillEMCALCells(g.fFillEMCALCells),fFillPHOSCells(g.fFillPHOSCells)
74{
75 // cpy ctor
76
77}
78
79//_________________________________________________________________________
80AliCaloTrackReader & AliCaloTrackReader::operator = (const AliCaloTrackReader & source)
81{
82 // assignment operator
83
84 if(&source == this) return *this;
85
6639984f 86 fDataType = source.fDataType ;
87 fDebug = source.fDebug ;
88 fEventNumber = source.fEventNumber ;
1c5acb87 89 fFidutialCut = source.fFidutialCut;
90
6639984f 91 fCTSPtMin = source.fCTSPtMin ;
1c5acb87 92 fEMCALPtMin = source.fEMCALPtMin ;
6639984f 93 fPHOSPtMin = source.fPHOSPtMin ;
1c5acb87 94
6639984f 95 fAODCTS = new TClonesArray(*source.fAODCTS) ;
96 fAODEMCAL = new TClonesArray(*source.fAODEMCAL) ;
97 fAODPHOS = new TClonesArray(*source.fAODPHOS) ;
1c5acb87 98 fEMCALCells = new TNamed(*source.fEMCALCells) ;
6639984f 99 fPHOSCells = new TNamed(*source.fPHOSCells) ;
1c5acb87 100
101 fESD = source.fESD;
6639984f 102 fAOD = source.fAOD;
103 fMC = source.fMC;
1c5acb87 104
6639984f 105 fFillCTS = source.fFillCTS;
106 fFillEMCAL = source.fFillEMCAL;
107 fFillPHOS = source.fFillPHOS;
1c5acb87 108 fFillEMCALCells = source.fFillEMCALCells;
6639984f 109 fFillPHOSCells = source.fFillPHOSCells;
1c5acb87 110
111 return *this;
112
113}
114
115//_________________________________
116AliCaloTrackReader::~AliCaloTrackReader() {
117 //Dtor
118
119 if(fFidutialCut) delete fFidutialCut ;
120
121 if(fAODCTS){
122 fAODCTS->Clear() ;
123 delete fAODCTS ;
124 }
125
126 if(fAODEMCAL){
127 fAODEMCAL->Clear() ;
128 delete fAODEMCAL ;
129 }
130
131 if(fAODPHOS){
132 fAODPHOS->Clear() ;
133 delete fAODPHOS ;
134 }
135
136 if(fEMCALCells){
137 fEMCALCells->Clear() ;
138 delete fEMCALCells ;
139 }
140
141 if(fPHOSCells){
142 fPHOSCells->Clear() ;
143 delete fPHOSCells ;
144 }
145
146 if(fESD) delete fESD ;
147 if(fAOD) delete fAOD ;
148 if(fMC) delete fMC ;
149}
150
151//____________________________________________________________________________
152AliStack* AliCaloTrackReader::GetStack() const {
153 //Return pointer to stack
154 if(fMC)
155 return fMC->Stack();
156 else{
157 printf("stack is not available");
158 return 0x0 ;
159 }
160}
161
162//____________________________________________________________________________
163AliHeader* AliCaloTrackReader::GetHeader() const {
164 //Return pointer to header
165 if(fMC)
166 return fMC->Header();
167 else{
6639984f 168 printf("Header is not available\n");
1c5acb87 169 return 0x0 ;
170 }
171}
172//____________________________________________________________________________
173AliGenEventHeader* AliCaloTrackReader::GetGenEventHeader() const {
174 //Return pointer to Generated event header
175 if(fMC)
176 return fMC->GenEventHeader();
177 else{
6639984f 178 printf("GenEventHeader is not available\n");
1c5acb87 179 return 0x0 ;
180 }
181}
182
183//_______________________________________________________________
184void AliCaloTrackReader::InitParameters()
185{
186
187 //Initialize the parameters of the analysis.
188 fDataType = kESD ;
189
190 fCTSPtMin = 0.2 ;
191 fEMCALPtMin = 0.5 ;
192 fPHOSPtMin = 0.5 ;
193
194 fFillEMCAL = kTRUE;
195 fFillPHOS = kTRUE;
196 fFillCTS = kTRUE;
197 fFillEMCALCells = kFALSE;
198 fFillPHOSCells = kFALSE;
199
200 fFidutialCut = new AliFidutialCut();
201
202}
203
204
205//________________________________________________________________
206void AliCaloTrackReader::Print(const Option_t * opt) const
207{
208
209 //Print some relevant parameters set for the analysis
210 if(! opt)
211 return;
212
213 printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
214 printf("Data type : %d\n", fDataType) ;
215 printf("CTS Min pT : %2.1f GeV/c\n", fCTSPtMin) ;
216 printf("EMCAL Min pT : %2.1f GeV/c\n", fEMCALPtMin) ;
217 printf("PHOS Min pT : %2.1f GeV/c\n", fPHOSPtMin) ;
218 printf("Use CTS = %d\n", fFillCTS) ;
219 printf("Use EMCAL = %d\n", fFillEMCAL) ;
220 printf("Use PHOS = %d\n", fFillPHOS) ;
221 printf("Use EMCAL Cells = %d\n", fFillEMCALCells) ;
222 printf("Use PHOS Cells = %d\n", fFillPHOSCells) ;
223 printf(" \n") ;
224}
225
226//___________________________________________________
6639984f 227void AliCaloTrackReader::FillInputEvent(Int_t iEntry) {
228 //Fill the event counter and input lists that are needed, called by the analysis maker.
229
230 fEventNumber = iEntry;
1c5acb87 231 if(fFillCTS) FillInputCTS();
232 if(fFillEMCAL) FillInputEMCAL();
233 if(fFillPHOS) FillInputPHOS();
234 if(fFillEMCALCells) FillInputEMCALCells();
235 if(fFillPHOSCells) FillInputPHOSCells();
236
237}
238
239//__________________________________________________
240void AliCaloTrackReader::ResetLists() {
241 // Reset lists, called by the analysis maker
242
243 if(fAODCTS) fAODCTS -> Clear();
244 if(fAODEMCAL) fAODEMCAL -> Clear();
245 if(fAODPHOS) fAODPHOS -> Clear();
246 if(fEMCALCells) fEMCALCells -> Clear();
247 if(fPHOSCells) fPHOSCells -> Clear();
248
249}