]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/PartCorrBase/AliCaloTrackReader.cxx
moving CTP functionality of the component base class to the AliHLTCTPData class, and
[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.
477d6cee 21// Mother class of : AliCaloTrackESDReader: Fills ESD data in 3 TRefArrays (PHOS, EMCAL, CTS)
22// : AliCaloTrackMCReader: Fills Kinematics data in 3 TRefArrays (PHOS, EMCAL, CTS)
23// : AliCaloTrackAODReader: Fills AOD data in 3 TRefArrays (PHOS, EMCAL, CTS)
1c5acb87 24//
25//-- Author: Gustavo Conesa (LNF-INFN)
26//////////////////////////////////////////////////////////////////////////////
27
28
29// --- ROOT system ---
477d6cee 30#include <TRefArray.h>
1c5acb87 31
32//---- ANALYSIS system ----
33#include "AliCaloTrackReader.h"
477d6cee 34#include "AliFidutialCut.h"
35#include "AliAODEvent.h"
36#include "AliMCEvent.h"
1c5acb87 37
38ClassImp(AliCaloTrackReader)
39
40
41//____________________________________________________________________________
42 AliCaloTrackReader::AliCaloTrackReader() :
a79a2424 43 TObject(), fEventNumber(-1), fCurrentFileName(""),fDataType(0), fDebug(0),
477d6cee 44 fFidutialCut(0x0),
1c5acb87 45 fCTSPtMin(0), fEMCALPtMin(0),fPHOSPtMin(0),
477d6cee 46 fAODCTS(new TRefArray()), fAODEMCAL(new TRefArray()), fAODPHOS(new TRefArray()),
1c5acb87 47 fEMCALCells(0x0), fPHOSCells(0x0),
477d6cee 48 fInputEvent(0x0), fOutputEvent(0x0),fMC(0x0),
1c5acb87 49 fFillCTS(0),fFillEMCAL(0),fFillPHOS(0),
50 fFillEMCALCells(0),fFillPHOSCells(0)
51{
52 //Ctor
53
54 //Initialize parameters
55 InitParameters();
56}
57
58//____________________________________________________________________________
59AliCaloTrackReader::AliCaloTrackReader(const AliCaloTrackReader & g) :
a79a2424 60 TObject(g), fEventNumber(g.fEventNumber), fCurrentFileName(g.fCurrentFileName),
61 fDataType(g.fDataType), fDebug(g.fDebug),
6639984f 62 fFidutialCut(g.fFidutialCut),
1c5acb87 63 fCTSPtMin(g.fCTSPtMin), fEMCALPtMin(g.fEMCALPtMin),fPHOSPtMin(g.fPHOSPtMin),
477d6cee 64 fAODCTS(new TRefArray(*g.fAODCTS)),
65 fAODEMCAL(new TRefArray(*g.fAODEMCAL)),
66 fAODPHOS(new TRefArray(*g.fAODPHOS)),
1c5acb87 67 fEMCALCells(new TNamed(*g.fEMCALCells)),
68 fPHOSCells(new TNamed(*g.fPHOSCells)),
477d6cee 69 fInputEvent(g.fInputEvent), fOutputEvent(g.fOutputEvent), fMC(g.fMC),
1c5acb87 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
6639984f 84 fDataType = source.fDataType ;
85 fDebug = source.fDebug ;
86 fEventNumber = source.fEventNumber ;
a79a2424 87 fCurrentFileName = source.fCurrentFileName ;
1c5acb87 88 fFidutialCut = source.fFidutialCut;
89
6639984f 90 fCTSPtMin = source.fCTSPtMin ;
1c5acb87 91 fEMCALPtMin = source.fEMCALPtMin ;
6639984f 92 fPHOSPtMin = source.fPHOSPtMin ;
1c5acb87 93
477d6cee 94 fAODCTS = new TRefArray(*source.fAODCTS) ;
95 fAODEMCAL = new TRefArray(*source.fAODEMCAL) ;
96 fAODPHOS = new TRefArray(*source.fAODPHOS) ;
1c5acb87 97 fEMCALCells = new TNamed(*source.fEMCALCells) ;
6639984f 98 fPHOSCells = new TNamed(*source.fPHOSCells) ;
1c5acb87 99
477d6cee 100 fInputEvent = source.fInputEvent;
101 fOutputEvent = source.fOutputEvent;
102 fMC = source.fMC;
1c5acb87 103
6639984f 104 fFillCTS = source.fFillCTS;
105 fFillEMCAL = source.fFillEMCAL;
106 fFillPHOS = source.fFillPHOS;
1c5acb87 107 fFillEMCALCells = source.fFillEMCALCells;
6639984f 108 fFillPHOSCells = source.fFillPHOSCells;
1c5acb87 109
110 return *this;
111
112}
113
114//_________________________________
115AliCaloTrackReader::~AliCaloTrackReader() {
116 //Dtor
117
118 if(fFidutialCut) delete fFidutialCut ;
119
120 if(fAODCTS){
121 fAODCTS->Clear() ;
122 delete fAODCTS ;
123 }
124
125 if(fAODEMCAL){
126 fAODEMCAL->Clear() ;
127 delete fAODEMCAL ;
128 }
129
130 if(fAODPHOS){
131 fAODPHOS->Clear() ;
132 delete fAODPHOS ;
133 }
134
135 if(fEMCALCells){
136 fEMCALCells->Clear() ;
137 delete fEMCALCells ;
138 }
139
140 if(fPHOSCells){
141 fPHOSCells->Clear() ;
142 delete fPHOSCells ;
143 }
144
477d6cee 145 if(fInputEvent) delete fInputEvent ;
146 if(fOutputEvent) delete fOutputEvent ;
147 if(fMC) delete fMC ;
1c5acb87 148}
149
477d6cee 150
1c5acb87 151//____________________________________________________________________________
152AliStack* AliCaloTrackReader::GetStack() const {
153 //Return pointer to stack
154 if(fMC)
155 return fMC->Stack();
156 else{
477d6cee 157 if(fDebug > 1) printf("AliCaloTrackReader::GetStack() - Stack is not available\n");
1c5acb87 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{
477d6cee 168 printf("AliCaloTrackReader::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{
477d6cee 178 printf("AliCaloTrackReader::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//___________________________________________________
a79a2424 227void AliCaloTrackReader::FillInputEvent(const Int_t iEntry, const char * currentFileName) {
6639984f 228 //Fill the event counter and input lists that are needed, called by the analysis maker.
229
230 fEventNumber = iEntry;
a79a2424 231 fCurrentFileName = TString(currentFileName);
232
477d6cee 233 if((fDataType != kAOD) && ((fOutputEvent->GetCaloClusters())->GetEntriesFast()!=0 ||(fOutputEvent->GetTracks())->GetEntriesFast()!=0)){
234 printf("ABORT: AliCaloTrackReader::AODCaloClusters or AODTracks already filled by the filter, do not use the ESD reader, use the AOD reader\n");
235 abort();
236 }
237 if(fFillCTS) FillInputCTS();
1c5acb87 238 if(fFillEMCAL) FillInputEMCAL();
477d6cee 239 if(fFillPHOS) FillInputPHOS();
1c5acb87 240 if(fFillEMCALCells) FillInputEMCALCells();
477d6cee 241 if(fFillPHOSCells) FillInputPHOSCells();
1c5acb87 242
243}
244
245//__________________________________________________
246void AliCaloTrackReader::ResetLists() {
247 // Reset lists, called by the analysis maker
248
477d6cee 249 if(fAODCTS) fAODCTS -> Clear();
1c5acb87 250 if(fAODEMCAL) fAODEMCAL -> Clear();
477d6cee 251 if(fAODPHOS) fAODPHOS -> Clear();
1c5acb87 252 if(fEMCALCells) fEMCALCells -> Clear();
477d6cee 253 if(fPHOSCells) fPHOSCells -> Clear();
1c5acb87 254
255}