Move the rejection of events with large z vertex from the analysis code to the reader...
[u/mrichter/AliRoot.git] / PWG4 / PartCorrBase / AliCaloTrackReader.h
CommitLineData
1c5acb87 1#ifndef ALICALOTRACKREADER_H
2#define ALICALOTRACKREADER_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5/* $Id: $ */
6
7//_________________________________________________________________________
8// Base class for reading data: MonteCarlo, ESD or AOD, of PHOS EMCAL and
9// Central Barrel Tracking detectors.
10// Not all MC particles/tracks/clusters are kept, some kinematical restrictions are done.
591cc579 11// Mother class of : AliCaloTrackESDReader: Fills ESD data in 3 TObjArrays (PHOS, EMCAL, CTS)
12// : AliCaloTrackMCReader: Fills Kinematics data in 3 TObjArrays (PHOS, EMCAL, CTS)
13// : AliCaloTrackAODReader: Fills AOD data in 3 TObjArrays (PHOS, EMCAL, CTS)
1e68a3f4 14//
15// This part is commented: Mixing analysis can be done, input AOD with events
16// is opened in the AliCaloTrackReader::Init()
17
1c5acb87 18// -- Author: Gustavo Conesa (INFN-LNF)
19
20// --- ROOT system ---
21#include "TObject.h"
591cc579 22class TObjArray ;
a97cd470 23#include "TString.h"
591cc579 24class TTree ;
1c5acb87 25
26//--- ANALYSIS system ---
27class AliStack ;
28class AliHeader ;
29class AliGenEventHeader ;
477d6cee 30class AliVEvent;
8dacfd76 31class AliAODEvent;
477d6cee 32class AliMCEvent;
c8fe2783 33class AliMixedEvent;
34#include "AliVCaloCells.h"
decca433 35#include "AliFiducialCut.h"
591cc579 36class AliAODMCHeader;
765d44e7 37#include "AliCalorimeterUtils.h"
3a58eee6 38class AliESDtrackCuts;
b6dd6ad2 39class AliCentrality;
1c5acb87 40
41class AliCaloTrackReader : public TObject {
42
03190ad7 43public:
1c5acb87 44 AliCaloTrackReader() ; // ctor
1c5acb87 45 virtual ~AliCaloTrackReader() ;//virtual dtor
03190ad7 46private:
78219bac 47 AliCaloTrackReader(const AliCaloTrackReader & g) ; // cpy ctor
03190ad7 48 AliCaloTrackReader & operator = (const AliCaloTrackReader & g) ;//cpy assignment
49
50public:
1c5acb87 51 enum inputDataType {kESD, kAOD, kMC};
f37fa8d2 52
591cc579 53 //Select generated events, depending on comparison of pT hard and jets.
54 virtual Bool_t ComparePtHardAndJetPt() ;
55 virtual Bool_t IsPtHardAndJetPtComparisonSet() const {return fComparePtHardAndJetPt ;}
56 virtual void SetPtHardAndJetPtComparison(Bool_t compare) { fComparePtHardAndJetPt = compare ;}
57 virtual Float_t GetPtHardAndJetFactor() const {return fPtHardAndJetPtFactor ;}
58 virtual void SetPtHardAndJetPtFactor(Float_t factor) { fPtHardAndJetPtFactor = factor ;}
59
1c5acb87 60 virtual void InitParameters();
61 virtual void Print(const Option_t * opt) const;
62
63 virtual Int_t GetDebug() const { return fDebug ; }
64 virtual void SetDebug(Int_t d) { fDebug = d ; }
65 virtual Int_t GetDataType() const { return fDataType ; }
66 virtual void SetDataType(Int_t data ) { fDataType = data ; }
67
a79a2424 68 virtual Int_t GetEventNumber() const {return fEventNumber ; }
69 virtual TString GetCurrentFileName() const {return fCurrentFileName ; }
70
1c5acb87 71 //Minimum pt setters and getters
72 virtual Float_t GetEMCALPtMin() const { return fEMCALPtMin ; }
73 virtual Float_t GetPHOSPtMin() const { return fPHOSPtMin ; }
74 virtual Float_t GetCTSPtMin() const { return fCTSPtMin ; }
75
76 virtual void SetEMCALPtMin(Float_t pt) { fEMCALPtMin = pt ; }
77 virtual void SetPHOSPtMin(Float_t pt) { fPHOSPtMin = pt ; }
78 virtual void SetCTSPtMin(Float_t pt) { fCTSPtMin = pt ; }
79
80 //Input setters and getters
f37fa8d2 81 Bool_t IsEMCALCluster(AliVCluster *clus) const;
82 Bool_t IsPHOSCluster (AliVCluster *clus) const;
83 void SwitchOnOldAODs() {fOldAOD = kTRUE ; }
84 void SwitchOffOldAODs() {fOldAOD = kFALSE ; }
85
1c5acb87 86 Bool_t IsCTSSwitchedOn() const { return fFillCTS ; }
f37fa8d2 87 void SwitchOnCTS() {fFillCTS = kTRUE ; }
1c5acb87 88 void SwitchOffCTS() {fFillCTS = kFALSE ; }
89
90 Bool_t IsEMCALSwitchedOn() const { return fFillEMCAL ; }
f37fa8d2 91 void SwitchOnEMCAL() {fFillEMCAL = kTRUE ; }
1c5acb87 92 void SwitchOffEMCAL() {fFillEMCAL = kFALSE ; }
93
94 Bool_t IsPHOSSwitchedOn() const { return fFillPHOS ; }
f37fa8d2 95 void SwitchOnPHOS() {fFillPHOS = kTRUE ; }
1c5acb87 96 void SwitchOffPHOS() {fFillPHOS = kFALSE ; }
97
98 Bool_t IsEMCALCellsSwitchedOn() const { return fFillEMCALCells ; }
f37fa8d2 99 void SwitchOnEMCALCells() {fFillEMCALCells = kTRUE ; }
1c5acb87 100 void SwitchOffEMCALCells() {fFillEMCALCells = kFALSE ; }
101
102 Bool_t IsPHOSCellsSwitchedOn() const { return fFillPHOSCells ; }
f37fa8d2 103 void SwitchOnPHOSCells() {fFillPHOSCells = kTRUE ; }
1c5acb87 104 void SwitchOffPHOSCells() {fFillPHOSCells = kFALSE ; }
105
29b2ceec 106 virtual Bool_t FillInputEvent(const Int_t iEntry, const char *currentFileName) ;
c8fe2783 107 virtual void FillInputCTS() ;
108 virtual void FillInputEMCAL() ;
c4eec29f 109 virtual void FillInputEMCALAlgorithm(AliVCluster * clus, const Int_t iclus) ;
c8fe2783 110 virtual void FillInputPHOS() ;
111 virtual void FillInputEMCALCells() ;
112 virtual void FillInputPHOSCells() ;
c4eec29f 113 void SetEMCALClusterListName(TString &name) {fEMCALClustersListName = name;}
114
f37fa8d2 115 virtual TList * GetAODBranchList() const { return fAODBranchList ; }
1c5acb87 116
f37fa8d2 117 virtual TObjArray* GetAODCTS() const {return fAODCTS ;}
591cc579 118 virtual TObjArray* GetAODEMCAL() const {return fAODEMCAL ;}
f37fa8d2 119 virtual TObjArray* GetAODPHOS() const {return fAODPHOS ;}
c8fe2783 120 virtual AliVCaloCells* GetEMCALCells() const { return fEMCALCells ;}
f37fa8d2 121 virtual AliVCaloCells* GetPHOSCells() const { return fPHOSCells ;}
1c5acb87 122
591cc579 123 //Get MC informatio
124 //Kinematics and galice.root available
477d6cee 125 virtual AliStack* GetStack() const ;
126 virtual AliHeader* GetHeader() const ;
1c5acb87 127 virtual AliGenEventHeader* GetGenEventHeader() const ;
591cc579 128 //Filtered kinematics in AOD
129 virtual TClonesArray* GetAODMCParticles(Int_t input = 0) const ;
130 virtual AliAODMCHeader* GetAODMCHeader(Int_t input = 0) const ;
131
f8006433 132 virtual AliVEvent* GetInputEvent() const {return fInputEvent;}
133 virtual AliAODEvent* GetOutputEvent() const {return fOutputEvent;}
134 virtual AliMCEvent* GetMC() const {return fMC;}
135 virtual AliMixedEvent* GetMixedEvent() const {return fMixedEvent;}
136 virtual Int_t GetNMixedEvent() const {return fNMixedEvent ; }
137
138 virtual Double_t GetBField() const { return 0.;}
591cc579 139
140 virtual void Init();
f8006433 141
c8fe2783 142// virtual void SetInputEvent(AliVEvent* const input) {fInputEvent = input;}
143 virtual void SetInputEvent(AliVEvent* const input) ;
8dacfd76 144 virtual void SetOutputEvent(AliAODEvent* const aod) {fOutputEvent = aod;}
145 virtual void SetMC(AliMCEvent* const mc) {fMC = mc;}
1c5acb87 146
147 virtual void ResetLists();
148
decca433 149 virtual AliFiducialCut * GetFiducialCut() {if(!fFiducialCut) fFiducialCut = new AliFiducialCut();
150 return fFiducialCut ;}
ff45398a 151 virtual void SetFiducialCut(AliFiducialCut * const fc) { fFiducialCut = fc ;}
decca433 152 virtual Bool_t IsFiducialCutOn() {return fCheckFidCut ; }
153 virtual void SwitchOnFiducialCut() { fCheckFidCut = kTRUE; fFiducialCut = new AliFiducialCut();}
154 virtual void SwitchOffFiducialCut() { fCheckFidCut = kFALSE;}
29b2ceec 155
477d6cee 156 virtual void SetInputOutputMCEvent(AliVEvent* /*esd*/, AliAODEvent* /*aod*/, AliMCEvent* /*mc*/) {;}
591cc579 157
158 //Methods for mixing with external input file (AOD)
1e68a3f4 159 //virtual TTree* GetSecondInputAODTree() const {return fSecondInputAODTree ; }
591cc579 160 //virtual void SetSecondInputAODTree(TTree * tree) {fSecondInputAODTree = tree ;
161 // fSecondInputAODEvent->ReadFromTree(tree);}//Connect tree and AOD event.
162
1e68a3f4 163 //virtual AliAODEvent* GetSecondInputAODEvent() const { return fSecondInputAODEvent ; }
591cc579 164
1e68a3f4 165 //TString GetSecondInputFileName() const {return fSecondInputFileName ; }
166 //void SetSecondInputFileName(TString name) { fSecondInputFileName = name ; }
1c5acb87 167
1e68a3f4 168 //Int_t GetSecondInputFirstEvent() const {return fSecondInputFirstEvent ; }
169 //void SetSecondInputFirstEvent(Int_t iEvent0) { fSecondInputFirstEvent = iEvent0 ; }
591cc579 170
1e68a3f4 171// Int_t GetAODCTSNormalInputEntries() {if(!fSecondInputAODTree) { fAODCTSNormalInputEntries = fAODCTS->GetEntriesFast() ;}
172// return fAODCTSNormalInputEntries ; }
173// Int_t GetAODEMCALNormalInputEntries() {if(!fSecondInputAODTree) { fAODEMCALNormalInputEntries = fAODEMCAL->GetEntriesFast();}
174// return fAODEMCALNormalInputEntries ; }
175// Int_t GetAODPHOSNormalInputEntries() {if(!fSecondInputAODTree) { fAODPHOSNormalInputEntries = fAODPHOS->GetEntriesFast() ;}
176// return fAODPHOSNormalInputEntries ; }
591cc579 177
3a58eee6 178 // Track selection
179 ULong_t GetTrackStatus() const {return fTrackStatus ; }
591cc579 180 void SetTrackStatus(ULong_t bit) { fTrackStatus = bit ; }
181
3a58eee6 182 AliESDtrackCuts* GetTrackCuts() const { return fESDtrackCuts ; }
183 void SetTrackCuts(AliESDtrackCuts * cuts) { fESDtrackCuts = cuts ; }
184 Int_t GetTrackMultiplicity() const { return fTrackMult ; }
185 Float_t GetTrackMultiplicityEtaCut() const { return fTrackMultEtaCut ; }
186 void SetTrackMultiplicityEtaCut(Float_t eta) { fTrackMultEtaCut = eta ; }
187
188 //MC switchs
591cc579 189 void SwitchOnStack() { fReadStack = kTRUE ; }
190 void SwitchOffStack() { fReadStack = kFALSE ; }
191 void SwitchOnAODMCParticles() { fReadAODMCParticles = kTRUE ; }
192 void SwitchOffAODMCParticles() { fReadAODMCParticles = kFALSE ; }
193 Bool_t ReadStack() const { return fReadStack ; }
194 Bool_t ReadAODMCParticles() const { return fReadAODMCParticles ; }
195
42dc8e7d 196 void SetDeltaAODFileName(TString name ) {fDeltaAODFileName = name ; }
197 TString GetDeltaAODFileName() const {return fDeltaAODFileName ; }
72d2488e 198
199 void SetFiredTriggerClassName(TString name ) {fFiredTriggerClassName = name ; }
200 TString GetFiredTriggerClassName() const {return fFiredTriggerClassName ; }
201 virtual TString GetFiredTriggerClasses() {return "";}
0866d83a 202
c1ac3823 203 void AnalyzeOnlyLED() {fAnaLED = kTRUE;}
204 void AnalyzeOnlyPhysics() {fAnaLED = kFALSE;}
205
486258c9 206 TString GetTaskName() const {return fTaskName;}
207 void SetTaskName(TString name) {fTaskName = name;}
208
765d44e7 209 AliCalorimeterUtils * GetCaloUtils() const {return fCaloUtils ; }
210 void SetCaloUtils(AliCalorimeterUtils * caloutils) { fCaloUtils = caloutils ; }
c8fe2783 211
f8006433 212 virtual void GetVertex(Double_t v[3]) const ;
213 virtual Double_t* GetVertex(const Int_t evtIndex) const {return fVertex[evtIndex];}
214 virtual void GetVertex(Double_t vertex[3], const Int_t evtIndex) const ;
215 virtual void FillVertexArray();
216 // virtual void GetSecondInputAODVertex(Double_t *) const {;}
0b13c1f9 217 virtual Float_t GetZvertexCut() const {return fZvtxCut ;} //cut on vertex position
218 virtual void SetZvertexCut(Float_t zcut=10.){fZvtxCut=zcut ;} //cut on vertex position
219
f37fa8d2 220 void SwitchOnWriteDeltaAOD() {fWriteOutputDeltaAOD = kTRUE ; }
221 void SwitchOffWriteDeltaAOD() {fWriteOutputDeltaAOD = kFALSE ; }
222 Bool_t WriteDeltaAODToFile() const {return fWriteOutputDeltaAOD ; }
1e68a3f4 223
798a9b04 224 virtual void FillInputVZERO(){;}
225 Int_t GetV0Signal(Int_t i) const { return fV0ADC[i];}
226 Int_t GetV0Multiplicity(Int_t i) const { return fV0Mul[i];}
227
af7b3903 228 void SwitchOnCaloFilterPatch() {fCaloFilterPatch = kTRUE ; fFillCTS = kFALSE; }
229 void SwitchOffCaloFilterPatch() {fCaloFilterPatch = kFALSE ; }
230 Bool_t IsCaloFilterPatchOn() {if(fDataType == kAOD) { return fCaloFilterPatch ; }
231 else { return kFALSE ; } }
eb3e2665 232
b6dd6ad2 233 virtual AliCentrality* GetCentrality() const {return 0x0;}
eb3e2665 234
235
0ae57829 236 //MC reader methods:
237
238 virtual void AddNeutralParticlesArray(TArrayI & /*array*/) { ; }
239 virtual void AddChargedParticlesArray(TArrayI & /*array*/) { ; }
240 virtual void AddStatusArray(TArrayI & /*array*/) { ; }
241
242 virtual void SwitchOnPi0Decay() { ; }
243 virtual void SwitchOffPi0Decay() { ; }
244 virtual void SwitchOnStatusSelection() { ; }
245 virtual void SwitchOffStatusSelection() { ; }
246 virtual void SwitchOnOverlapCheck() { ; }
247 virtual void SwitchOffOverlapCheck() { ; }
248
249 virtual void SetEMCALOverlapAngle(Float_t /*angle*/) { ; }
250 virtual void SetPHOSOverlapAngle(Float_t /*angle*/) { ; }
af7b3903 251
0ae57829 252
1c5acb87 253 protected:
7e25653f 254 Int_t fEventNumber; // Event number
255 TString fCurrentFileName;// Current file name under analysis
256 Int_t fDataType ; // Select MC:Kinematics, Data:ESD/AOD, MCData:Both
257 Int_t fDebug; // Debugging level
258 AliFiducialCut * fFiducialCut; //! Acceptance cuts
259 Bool_t fCheckFidCut ; // Do analysis for clusters in defined region
decca433 260
591cc579 261 Bool_t fComparePtHardAndJetPt; // In MonteCarlo, jet events, reject fake events with wrong jet energy.
262 Float_t fPtHardAndJetPtFactor; // Factor between ptHard and jet pT to reject/accept event.
263
7e25653f 264 Float_t fCTSPtMin; // pT Threshold on charged particles
265 Float_t fEMCALPtMin; // pT Threshold on emcal clusters
266 Float_t fPHOSPtMin; // pT Threshold on phos clusters
1c5acb87 267
7e25653f 268 TList * fAODBranchList ; //! List with AOD branches created and needed in analysis
269 TObjArray * fAODCTS ; //! temporal referenced array with tracks
270 TObjArray * fAODEMCAL ; //! temporal referenced array with EMCAL CaloClusters
271 TObjArray * fAODPHOS ; //! temporal referenced array with PHOS CaloClusters
272 AliVCaloCells * fEMCALCells ; //! temporal array with EMCAL CaloCells, ESD or AOD
273 AliVCaloCells * fPHOSCells ; //! temporal array with PHOS CaloCells, ESD or AOD
1c5acb87 274
7e25653f 275 AliVEvent * fInputEvent; //! pointer to esd or aod input
276 AliAODEvent * fOutputEvent; //! pointer to aod output
277 AliMCEvent * fMC; //! Monte Carlo Event Handler
1c5acb87 278
7e25653f 279 Bool_t fFillCTS; // use data from CTS
280 Bool_t fFillEMCAL; // use data from EMCAL
281 Bool_t fFillPHOS; // use data from PHOS
282 Bool_t fFillEMCALCells; // use data from EMCAL
283 Bool_t fFillPHOSCells; // use data from PHOS
1c5acb87 284
1e68a3f4 285// TTree * fSecondInputAODTree; // Tree with second input AOD, for mixing analysis.
286// AliAODEvent* fSecondInputAODEvent; //! pointer to second input AOD event.
287// TString fSecondInputFileName; // File with AOD data to mix with normal stream of data.
288// Int_t fSecondInputFirstEvent; // First event to be considered in the mixing.
289//
290// Int_t fAODCTSNormalInputEntries; // Number of entries in CTS in case of standard input, larger with mixing.
291// Int_t fAODEMCALNormalInputEntries; // Number of entries in EMCAL in case of standard input, larger with mixing.
292// Int_t fAODPHOSNormalInputEntries; // Number of entries in PHOS in case of standard input, larger with mixing.
591cc579 293
7e25653f 294 ULong_t fTrackStatus ; // Track selection bit, select tracks refitted in TPC, ITS ...
3a58eee6 295 AliESDtrackCuts *fESDtrackCuts ; // Track cut
296 Int_t fTrackMult ; // Track multiplicity
297 Float_t fTrackMultEtaCut ; // Track multiplicity eta cut
7e25653f 298 Bool_t fReadStack ; // Access kine information from stack
299 Bool_t fReadAODMCParticles ; // Access kine information from filtered AOD MC particles
591cc579 300
7e25653f 301 TString fDeltaAODFileName ; // Delta AOD file name
302 TString fFiredTriggerClassName; // Name of trigger event type used to do the analysis
afabc52f 303
7e25653f 304 Bool_t fAnaLED; // Analyze LED data only.
c1ac3823 305
7e25653f 306 TString fTaskName; // Name of task that executes the analysis
765d44e7 307
7e25653f 308 AliCalorimeterUtils * fCaloUtils ; // Pointer to CalorimeterUtils
c8fe2783 309
7e25653f 310 AliMixedEvent * fMixedEvent ; //! mixed event object. This class is not the owner
311 Int_t fNMixedEvent ; // number of events in mixed event buffer
312 Double_t ** fVertex ; //! vertex array 3 dim for each mixed event buffer
c8fe2783 313
7e25653f 314 Bool_t fWriteOutputDeltaAOD;// Write the created delta AOD objects into file
315 Bool_t fOldAOD; // Old AODs, before revision 4.20
f37fa8d2 316
798a9b04 317 Int_t fV0ADC[2] ; // Integrated V0 signal
318 Int_t fV0Mul[2] ; // Integrated V0 Multiplicity
319
af7b3903 320 Bool_t fCaloFilterPatch; // CaloFilter patch
c4eec29f 321 TString fEMCALClustersListName; //Alternative list of clusters produced elsewhere and not from InputEvent
0b13c1f9 322 Float_t fZvtxCut ; // Cut on vertex position
323
c4eec29f 324 ClassDef(AliCaloTrackReader,22)
1c5acb87 325} ;
326
327
328#endif //ALICALOTRACKREADER_H
329
330
331