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