]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/CaloTrackCorrBase/AliCaloTrackReader.h
Placeholder for like and unlike sign selection
[u/mrichter/AliRoot.git] / PWG / CaloTrackCorrBase / 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
6 //_________________________________________________________________________
7 // Base class for reading data: MonteCarlo, ESD or AOD, of PHOS EMCAL and 
8 // Central Barrel Tracking detectors.
9 // Not all MC particles/tracks/clusters are kept, some kinematical restrictions are done.
10 // Mother class of : AliCaloTrackESDReader: Fills ESD data in 3 TObjArrays (PHOS, EMCAL, CTS)
11 //                 : AliCaloTrackMCReader : Fills Kinematics data in 3 TObjArrays (PHOS, EMCAL, CTS)
12 //                 : AliCaloTrackAODReader: Fills AOD data in 3 TObjArrays (PHOS, EMCAL, CTS)   
13 // -- Author: Gustavo Conesa (INFN-LNF)
14 //////////////////////////////////////////////////////////////////////////////
15
16 // --- ROOT system ---
17 #include <TObject.h> 
18 #include <TString.h>
19 class TObjArray ; 
20 class TTree ;
21 class TArrayI ;
22
23 //--- ANALYSIS system ---
24 #include "AliVEvent.h"
25 class AliVCaloCells;
26 class AliStack; 
27 class AliHeader; 
28 class AliGenEventHeader; 
29 class AliAODEvent;
30 class AliMCEvent;
31 class AliMixedEvent;
32 class AliAODMCHeader;
33 class AliESDtrackCuts;
34 class AliCentrality;
35 class AliTriggerAnalysis;
36 class AliEventplane;
37 class AliVCluster;
38
39 // --- CaloTrackCorr / EMCAL ---
40 #include "AliFiducialCut.h"
41 class AliEMCALRecoUtils;
42 class AliCalorimeterUtils;
43
44 class AliCaloTrackReader : public TObject {
45
46 public: 
47   
48   AliCaloTrackReader() ;          // ctor
49   virtual ~AliCaloTrackReader() ; // virtual dtor
50   
51   //--------------------------------
52   // General methods
53   //--------------------------------
54
55   virtual void    Init();
56     
57   virtual void    InitParameters();
58   
59   virtual void    Print(const Option_t * opt) const;
60   
61   virtual void    ResetLists();
62
63   virtual Int_t   GetDebug()                         const { return fDebug                 ; }
64   virtual void    SetDebug(Int_t d)                        { fDebug = d                    ; }
65   
66   enum inputDataType {kESD, kAOD, kMC};
67   virtual Int_t   GetDataType()                      const { return fDataType              ; }
68   virtual void    SetDataType(Int_t data )                 { fDataType = data              ; }
69
70   virtual Int_t   GetEventNumber()                   const { return fEventNumber           ; }
71         
72   TString         GetTaskName()                      const { return fTaskName              ; }
73   void            SetTaskName(TString name)                { fTaskName = name              ; }
74     
75   //---------------------------------------
76   //Input/output event setters and getters
77   //---------------------------------------
78   virtual void    SetInputEvent(AliVEvent* const input) ;
79   virtual void    SetOutputEvent(AliAODEvent* const aod)   { fOutputEvent = aod            ; }
80   virtual void    SetMC(AliMCEvent* const mc)              { fMC          = mc             ; }
81   virtual void    SetInputOutputMCEvent(AliVEvent* /*esd*/, AliAODEvent* /*aod*/, AliMCEvent* /*mc*/) { ; }
82   
83   // Delta AODs
84   virtual TList * GetAODBranchList()                 const { return fAODBranchList         ; }
85   void            SetDeltaAODFileName(TString name )       { fDeltaAODFileName = name      ; }
86   TString         GetDeltaAODFileName()              const { return fDeltaAODFileName      ; }
87   void            SwitchOnWriteDeltaAOD()                  { fWriteOutputDeltaAOD = kTRUE  ; }
88   void            SwitchOffWriteDeltaAOD()                 { fWriteOutputDeltaAOD = kFALSE ; }
89   Bool_t          WriteDeltaAODToFile()              const { return fWriteOutputDeltaAOD   ; } 
90   
91   //------------------------------------------------------------
92   //Clusters/Tracks arrays filtering/filling methods and switchs 
93   //------------------------------------------------------------
94   
95   //Minimum pt setters and getters 
96   Float_t          GetEMCALPtMin()                   const { return fEMCALPtMin            ; }
97   Float_t          GetPHOSPtMin()                    const { return fPHOSPtMin             ; }
98   Float_t          GetCTSPtMin()                     const { return fCTSPtMin              ; }
99   Float_t          GetEMCALPtMax()                   const { return fEMCALPtMax            ; }
100   Float_t          GetPHOSPtMax()                    const { return fPHOSPtMax             ; }
101   Float_t          GetCTSPtMax()                     const { return fCTSPtMax              ; }
102   
103   void             SetEMCALPtMin(Float_t  pt)              { fEMCALPtMin = pt              ; }
104   void             SetPHOSPtMin (Float_t  pt)              { fPHOSPtMin  = pt              ; }
105   void             SetCTSPtMin  (Float_t  pt)              { fCTSPtMin   = pt              ; }  
106   
107   void             SetEMCALPtMax(Float_t  pt)              { fEMCALPtMax = pt              ; }
108   void             SetPHOSPtMax (Float_t  pt)              { fPHOSPtMax  = pt              ; }
109   void             SetCTSPtMax  (Float_t  pt)              { fCTSPtMax   = pt              ; }  
110    
111   Float_t          GetEMCALEMin()                    const { return GetEMCALPtMin()        ; }
112   Float_t          GetPHOSEMin()                     const { return GetPHOSPtMin()         ; }
113   Float_t          GetEMCALEMax()                    const { return GetEMCALPtMax()        ; }
114   Float_t          GetPHOSEMax()                     const { return GetPHOSPtMax()         ; }
115   
116   void             SetEMCALEMin (Float_t  e)               { SetEMCALPtMin(e)              ; }
117   void             SetPHOSEMin  (Float_t  e)               { SetPHOSPtMin (e)              ; }
118   void             SetEMCALEMax (Float_t  e)               { SetEMCALPtMax(e)              ; }
119   void             SetPHOSEMax  (Float_t  e)               { SetPHOSPtMax (e)              ; }
120   
121   // Track DCA cut
122   Bool_t           AcceptDCA(const Float_t pt, const Float_t dca);
123   Double_t         GetTrackDCACut(Int_t i)           const { if(i >= 0 && i < 3 ) return fTrackDCACut[i] ;
124                                                              else return -999              ; }
125   
126   void             SetTrackDCACut(Int_t i, Float_t cut)    { if(i >= 0 && i < 3 )
127                                                              fTrackDCACut[i] = cut         ; }
128   
129   void             SwitchOnUseTrackDCACut()                { fUseTrackDCACut = kTRUE       ; }
130   void             SwitchOffUseTrackDCACut()               { fUseTrackDCACut = kFALSE      ; }
131   Bool_t           IsDCACutOn()                      const { return fUseTrackDCACut        ; }
132   
133   //Time cut
134   
135   Double_t         GetTrackTimeCutMin()              const { return fTrackTimeCutMin       ; }
136   Double_t         GetTrackTimeCutMax()              const { return fTrackTimeCutMax       ; }
137   
138   void             SetTrackTimeCut(Double_t a, Double_t b) { fTrackTimeCutMin = a ;
139                                                              fTrackTimeCutMax = b          ; } // ns
140   
141   void             SwitchOnUseTrackTimeCut()               { fUseTrackTimeCut = kTRUE      ; }
142   void             SwitchOffUseTrackTimeCut()              { fUseTrackTimeCut = kFALSE     ; }
143   
144   Double_t         GetEMCALTimeCutMin()              const { return fEMCALTimeCutMin       ; }
145   Double_t         GetEMCALTimeCutMax()              const { return fEMCALTimeCutMax       ; }  
146
147   Bool_t           IsInTimeWindow(const Double_t tof, const Float_t energy)  const ;
148   
149   void             SetEMCALTimeCut(Double_t a, Double_t b) { fEMCALTimeCutMin = a ; 
150                                                              fEMCALTimeCutMax = b          ; } // ns
151   
152   void             SetEMCALParametrizedMinTimeCut(Int_t i, Float_t par) { fEMCALParamTimeCutMin[i] = par ; } 
153   void             SetEMCALParametrizedMaxTimeCut(Int_t i, Float_t par) { fEMCALParamTimeCutMax[i] = par ; } 
154   
155   void             SwitchOnUseEMCALTimeCut()               { fUseEMCALTimeCut = kTRUE      ; }
156   void             SwitchOffUseEMCALTimeCut()              { fUseEMCALTimeCut = kFALSE     ; }
157   
158   void             SwitchOnUseParametrizedTimeCut()        { fUseParamTimeCut = kTRUE      ; }
159   void             SwitchOffUseParametrizedTimeCut()       { fUseParamTimeCut = kFALSE     ; }
160
161   // Fidutial cuts  
162   virtual AliFiducialCut * GetFiducialCut()                { 
163                     if(!fFiducialCut) fFiducialCut = new AliFiducialCut(); 
164                     return  fFiducialCut                                                   ; }
165   virtual void     SetFiducialCut(AliFiducialCut * const fc) { fFiducialCut = fc           ; }
166   virtual Bool_t   IsFiducialCutOn()                 const { return fCheckFidCut           ; }
167   virtual void     SwitchOnFiducialCut()                   { fCheckFidCut = kTRUE          ; 
168                                                              fFiducialCut = new AliFiducialCut() ; }
169   virtual void     SwitchOffFiducialCut()                  { fCheckFidCut = kFALSE         ; }
170   
171   // Cluster origin
172   Bool_t           IsEMCALCluster(AliVCluster *clus) const;
173   Bool_t           IsPHOSCluster (AliVCluster *clus) const;
174   //Patch for cluster origin for Old AODs implementation
175   void             SwitchOnOldAODs()                       { fOldAOD = kTRUE               ; }
176   void             SwitchOffOldAODs()                      { fOldAOD = kFALSE              ; }
177   
178   // Cluster/track/cells switchs
179   Bool_t           IsCTSSwitchedOn()                 const { return fFillCTS               ; }
180   void             SwitchOnCTS()                           { fFillCTS = kTRUE              ; }
181   void             SwitchOffCTS()                          { fFillCTS = kFALSE             ; }
182
183   Bool_t           IsEMCALSwitchedOn()               const { return fFillEMCAL             ; }
184   void             SwitchOnEMCAL()                         { fFillEMCAL = kTRUE            ; }
185   void             SwitchOffEMCAL()                        { fFillEMCAL = kFALSE           ; }
186
187   Bool_t           IsPHOSSwitchedOn()                const { return fFillPHOS              ; }
188   void             SwitchOnPHOS()                          { fFillPHOS = kTRUE             ; }
189   void             SwitchOffPHOS()                         { fFillPHOS = kFALSE            ; }
190
191   Bool_t           IsEMCALCellsSwitchedOn()          const { return fFillEMCALCells        ; }
192   void             SwitchOnEMCALCells()                    { fFillEMCALCells = kTRUE       ; }
193   void             SwitchOffEMCALCells()                   { fFillEMCALCells = kFALSE      ; }
194
195   Bool_t           IsPHOSCellsSwitchedOn()           const { return fFillPHOSCells         ; }
196   void             SwitchOnPHOSCells()                     { fFillPHOSCells = kTRUE        ; }
197   void             SwitchOffPHOSCells()                    { fFillPHOSCells = kFALSE       ; }
198
199   Bool_t           AreClustersRecalculated()         const { return fRecalculateClusters   ; }
200   void             SwitchOnClusterRecalculation()          { fRecalculateClusters = kTRUE  ; }
201   void             SwitchOffClusterRecalculation()         { fRecalculateClusters = kFALSE ; }  
202   
203   Bool_t           IsEmbeddedClusterSelectionOn()    const { return fSelectEmbeddedClusters   ; }
204   void             SwitchOnEmbeddedClustersSelection()     { fSelectEmbeddedClusters = kTRUE  ; }
205   void             SwitchOffEmbeddedClustersSelection()    { fSelectEmbeddedClusters = kFALSE ; }
206   
207   // Filling/ filtering / detector information access methods
208   virtual Bool_t   FillInputEvent(const Int_t iEntry, const char *currentFileName)  ;
209   virtual void     FillInputCTS() ;
210   virtual void     FillInputEMCAL() ;
211   virtual void     FillInputEMCALAlgorithm(AliVCluster * clus, const Int_t iclus) ;
212   virtual void     FillInputPHOS() ;
213   virtual void     FillInputEMCALCells() ;
214   virtual void     FillInputPHOSCells() ;
215   virtual void     FillInputVZERO() ;  
216   
217   Int_t            GetV0Signal(Int_t i)              const { return fV0ADC[i]               ; }
218   Int_t            GetV0Multiplicity(Int_t i)        const { return fV0Mul[i]               ; }
219   
220   void             SetEMCALClusterListName(TString &name)  { fEMCALClustersListName = name  ; }
221   TString          GetEMCALClusterListName()         const { return fEMCALClustersListName  ; }
222
223   // Arrayes with clusters/track/cells access method
224   virtual TObjArray*     GetCTSTracks()              const { return fCTSTracks              ; }
225   virtual TObjArray*     GetEMCALClusters()          const { return fEMCALClusters          ; }
226   virtual TObjArray*     GetPHOSClusters()           const { return fPHOSClusters           ; }
227   virtual AliVCaloCells* GetEMCALCells()             const { return fEMCALCells             ; }
228   virtual AliVCaloCells* GetPHOSCells()              const { return fPHOSCells              ; }
229    
230   //-------------------------------------
231   // Event/track selection methods
232   //-------------------------------------
233   
234   void             AcceptFastClusterEvents()               { fAcceptFastCluster     = kTRUE  ; } 
235   void             RejectFastClusterEvents()               { fAcceptFastCluster     = kFALSE ; }  
236   Bool_t           IsFastClusterAccepted()           const { return fAcceptFastCluster       ; }   
237   
238   void             SwitchOnLEDEventsRemoval()              { fRemoveLEDEvents       = kTRUE  ; }
239   void             SwitchOffLEDEventsRemoval()             { fRemoveLEDEvents       = kFALSE ; } 
240   Bool_t           IsLEDEventRemoved()               const { return fRemoveLEDEvents         ; }   
241
242   void             SetFiredTriggerClassName(TString name ) { fFiredTriggerClassName = name   ; }
243   TString          GetFiredTriggerClassName()        const { return fFiredTriggerClassName   ; }
244   TString          GetFiredTriggerClasses() ;               
245   
246   UInt_t           GetEventTriggerMask()             const { return fEventTriggerMask        ; }
247   void             SetEventTriggerMaks(UInt_t evtTrig = AliVEvent::kAny) 
248                                                            { fEventTriggerMask = evtTrig     ; }
249
250   UInt_t           GetMixEventTriggerMask()             const { return fMixEventTriggerMask  ; }
251   void             SetMixEventTriggerMaks(UInt_t evtTrig = AliVEvent::kAnyINT) 
252                                                            { fMixEventTriggerMask = evtTrig  ; }
253   
254   
255   Bool_t           IsEventTriggerAtSEOn()            const { return fEventTriggerAtSE        ; }
256   void             SwitchOnEventTriggerAtSE()              { fEventTriggerAtSE      = kTRUE  ; }
257   void             SwitchOffEventTriggerAtSE()             { fEventTriggerAtSE      = kFALSE ; }
258   
259   void             SwitchOnEventSelection()                { fDoEventSelection      = kTRUE  ; }
260   void             SwitchOffEventSelection()               { fDoEventSelection      = kFALSE ; }
261   Bool_t           IsEventSelectionDone()            const { return fDoEventSelection        ; }
262   
263   void             SwitchOnV0ANDSelection()                { fDoV0ANDEventSelection = kTRUE  ; }
264   void             SwitchOffV0ANDSelection()               { fDoV0ANDEventSelection = kFALSE ; }
265   Bool_t           IsV0ANDEventSelectionDone()       const { return fDoV0ANDEventSelection   ; } 
266
267   void             SwitchOnVertexBCEventSelection()        { fDoVertexBCEventSelection = kTRUE  ; }
268   void             SwitchOffVertexBCEventSelection()       { fDoVertexBCEventSelection = kFALSE ; }
269   Bool_t           IsVertexBCEventSelectionDone()    const { return fDoVertexBCEventSelection   ; }
270   
271   void             SwitchOnPrimaryVertexSelection()        { fUseEventsWithPrimaryVertex = kTRUE  ; }
272   void             SwitchOffPrimaryVertexSelection()       { fUseEventsWithPrimaryVertex = kFALSE ; }
273   Bool_t           IsPrimaryVertexSelectionDone()    const { return fUseEventsWithPrimaryVertex   ; } 
274   
275   void             SwitchOnRejectNoTrackEvents()           { fDoRejectNoTrackEvents = kTRUE  ; }
276   void             SwitchOffRejectNoTrackEvents()          { fDoRejectNoTrackEvents = kFALSE ; }
277   Bool_t           IsEventWithNoTrackRejectionDone() const { return fDoRejectNoTrackEvents   ; }
278   
279   //Time Stamp
280   
281   Double_t         GetRunTimeStampMin()              const { return fTimeStampRunMin         ; }
282   Double_t         GetRunTimeStampMax()              const { return fTimeStampRunMax         ; }
283   
284   void             SetRunTimeStamp(Double_t a, Double_t b) { fTimeStampRunMin = a            ;
285                                                              fTimeStampRunMax = b            ; } // seconds
286   
287   Float_t          GetEventTimeStampFractionMin()    const { return fTimeStampEventFracMin   ; }
288   Float_t          GetEventTimeStampFractionMax()    const { return fTimeStampEventFracMax   ; }
289   
290   void             SetEventTimeStampFraction(Float_t a, Float_t b) { fTimeStampEventFracMin = a ;
291                                                                      fTimeStampEventFracMax = b ; }
292   
293   void             SwitchOnSelectEventTimeStamp()          { fTimeStampEventSelect = kTRUE   ; }
294   void             SwitchOffSelectEventTimeStamp()         { fTimeStampEventSelect = kFALSE  ; }
295   
296   Bool_t           IsSelectEventTimeStampOn()              {return  fTimeStampEventSelect    ; }
297   
298   Bool_t           IsPileUpFromSPD()               const ;
299   Bool_t           IsPileUpFromEMCal()             const ;
300   Bool_t           IsPileUpFromSPDAndEMCal()       const ;
301   Bool_t           IsPileUpFromSPDOrEMCal()        const ;
302   Bool_t           IsPileUpFromSPDAndNotEMCal()    const ;
303   Bool_t           IsPileUpFromEMCalAndNotSPD()    const ;
304   Bool_t           IsPileUpFromNotSPDAndNotEMCal() const ;
305
306   void             SetPileUpParamForSPD  (Int_t i, Double_t param)
307                                                            { fPileUpParamSPD[i]  = param  ; }
308   void             SetPileUpParamForEMCal(Int_t param)     { fNPileUpClustersCut = param  ; }
309   
310   Int_t            GetNPileUpClusters()                    { return  fNPileUpClusters     ; }
311   Int_t            GetNNonPileUpClusters()                 { return  fNNonPileUpClusters  ; }
312   
313   Int_t            GetEMCalEventBC(Int_t bc)     const     { if(bc >=0 && bc < 19) return  fEMCalBCEvent   [bc] ; else return 0 ; }
314   Int_t            GetTrackEventBC(Int_t bc)     const     { if(bc >=0 && bc < 19) return  fTrackBCEvent   [bc] ; else return 0 ; }
315   Int_t            GetEMCalEventBCcut(Int_t bc)  const     { if(bc >=0 && bc < 19) return  fEMCalBCEventCut[bc] ; else return 0 ; }
316   Int_t            GetTrackEventBCcut(Int_t bc)  const     { if(bc >=0 && bc < 19) return  fTrackBCEventCut[bc] ; else return 0 ; }
317
318   void             SetEMCalEventBC(Int_t bc)               { if(bc >=0 && bc < 19) fEMCalBCEvent   [bc] = 1 ; }
319   void             SetTrackEventBC(Int_t bc)               { if(bc >=0 && bc < 19) fTrackBCEvent   [bc] = 1 ; }
320   void             SetEMCalEventBCcut(Int_t bc)            { if(bc >=0 && bc < 19) fEMCalBCEventCut[bc] = 1 ; }
321   void             SetTrackEventBCcut(Int_t bc)            { if(bc >=0 && bc < 19) fTrackBCEventCut[bc] = 1 ; }
322
323   Int_t           GetVertexBC(const AliVVertex * vtx);
324   Int_t           GetVertexBC()                  const     { return fVertexBC              ; }
325   void            SwitchOnRecalculateVertexBC()            { fRecalculateVertexBC = kTRUE  ; }
326   void            SwitchOffRecalculateVertexBC()           { fRecalculateVertexBC = kFALSE ; }
327   
328   // Track selection
329   ULong_t          GetTrackStatus()                  const { return fTrackStatus          ; }
330   void             SetTrackStatus(ULong_t bit)             { fTrackStatus = bit           ; }           
331
332   ULong_t          GetTrackFilterMask()              const {return fTrackFilterMask       ; }
333   void             SetTrackFilterMask(ULong_t bit)         { fTrackFilterMask = bit       ; }           
334   
335   AliESDtrackCuts* GetTrackCuts()                    const { return fESDtrackCuts         ; }
336   void             SetTrackCuts(AliESDtrackCuts * cuts)    ;
337
338   AliESDtrackCuts* GetTrackComplementaryCuts()       const { return fESDtrackComplementaryCuts ; }
339   void             SetTrackComplementaryCuts(AliESDtrackCuts * cuts)  ;
340
341   
342   void             SwitchOnConstrainTrackToVertex()        { fConstrainTrack     = kTRUE  ; } 
343   void             SwitchOffConstrainTrackToVertex()       { fConstrainTrack     = kFALSE ; }
344   
345   void             SwitchOnAODHybridTrackSelection()       { fSelectHybridTracks = kTRUE  ; } 
346   void             SwitchOffAODHybridTrackSelection()      { fSelectHybridTracks = kFALSE ; }      
347   
348   void             SwitchOnTrackHitSPDSelection()          { fSelectSPDHitTracks = kTRUE  ; }
349   void             SwitchOffTrackHitSPDSelection()         { fSelectSPDHitTracks = kFALSE ; }
350   
351   Int_t            GetTrackMultiplicity()            const { return fTrackMult            ; }
352   Float_t          GetTrackMultiplicityEtaCut()      const { return fTrackMultEtaCut      ; }
353   void             SetTrackMultiplicityEtaCut(Float_t eta) { fTrackMultEtaCut = eta       ; }           
354   
355   // Calorimeter specific and patches
356   void             AnalyzeOnlyLED()                        { fAnaLED             = kTRUE  ; }
357   void             AnalyzeOnlyPhysics()                    { fAnaLED             = kFALSE ; }
358   
359   void             SwitchOnCaloFilterPatch()               { fCaloFilterPatch    = kTRUE  ; 
360                                                              fFillCTS            = kFALSE ; }
361   void             SwitchOffCaloFilterPatch()              { fCaloFilterPatch    = kFALSE ; }
362   Bool_t           IsCaloFilterPatchOn()             const { 
363                     if(fDataType == kAOD) { return fCaloFilterPatch ; } 
364                     else                  { return kFALSE           ; }                     }
365         
366   //-------------------------------
367   //Vertex methods
368   //-------------------------------
369   virtual void      GetVertex(Double_t v[3])         const ;
370   virtual Double_t* GetVertex(const Int_t evtIndex)  const { return fVertex[evtIndex]            ; }
371   virtual void      GetVertex(Double_t vertex[3],    const Int_t evtIndex) const ;
372   virtual void      FillVertexArray();
373   virtual Bool_t    CheckForPrimaryVertex();
374   virtual Float_t   GetZvertexCut()                  const { return fZvtxCut                     ; } //cut on vertex position  
375   virtual void      SetZvertexCut(Float_t zcut=10.)        { fZvtxCut=zcut                       ; } //cut on vertex position
376
377   //--------------------------
378   // Centrality / Event Plane
379   //--------------------------
380   virtual AliCentrality* GetCentrality()             const { if(fDataType!=kMC) return fInputEvent->GetCentrality() ; 
381                                                              else               return 0x0       ; } 
382   virtual void     SetCentralityClass(TString name)        { fCentralityClass   = name           ; }
383   virtual void     SetCentralityOpt(Int_t opt)             { fCentralityOpt     = opt            ; }
384   virtual TString  GetCentralityClass()              const { return fCentralityClass             ; }
385   virtual Int_t    GetCentralityOpt()                const { return fCentralityOpt               ; }
386   virtual Int_t    GetEventCentrality()              const ;
387   virtual void     SetCentralityBin(Int_t min, Int_t max) //Set the centrality bin to select the event. If used, then need to get percentile
388                                                            { fCentralityBin[0]=min; fCentralityBin[1]=max;  
389                                                              if(min>=0 && max > 0) fCentralityOpt = 100 ; }
390   virtual Float_t  GetCentralityBin(Int_t i)         const { if(i < 0 || i > 1) return 0 ; 
391                                                              else return fCentralityBin[i]              ; }
392   
393   virtual AliEventplane* GetEventPlane()             const { if(fDataType!=kMC) return fInputEvent->GetEventplane() ;
394                                                              else               return 0x0       ; }  
395   virtual Double_t       GetEventPlaneAngle()        const ;          
396   virtual void           SetEventPlaneMethod(TString m)    { fEventPlaneMethod = m               ; }
397   virtual TString        GetEventPlaneMethod()       const { return fEventPlaneMethod            ; }
398
399   //--------------------
400   // Mixing
401   //--------------------
402
403   Int_t   GetLastCaloMixedEvent()                    const { return fLastMixedCaloEvent          ; }
404   Int_t   GetLastTracksMixedEvent ()                 const { return fLastMixedTracksEvent        ; }
405   
406   TList * GetListWithMixedEventsForCalo  (Int_t bi)  const { if(fListMixedCaloEvents)   return fListMixedCaloEvents[bi]     ; else return 0 ; }
407   TList * GetListWithMixedEventsForTracks(Int_t bi)  const { if(fListMixedTracksEvents) return fListMixedTracksEvents [bi]  ; else return 0 ; }  
408    
409   Bool_t  ListWithMixedEventsForCaloExists()         const { if(fListMixedCaloEvents) return kTRUE  ;
410                                                              else                     return kFALSE ; }
411
412   Bool_t  ListWithMixedEventsForTracksExists()       const { if(fListMixedTracksEvents) return kTRUE  ;
413                                                              else                       return kFALSE ; }
414   
415   void    SetLastCaloMixedEvent  (Int_t e)                 { fLastMixedCaloEvent    = e          ; }
416   void    SetLastTracksMixedEvent(Int_t e)                 { fLastMixedTracksEvent  = e          ; }
417   
418   void    SetListWithMixedEventsForCalo (TList ** l)       { 
419             if(fListMixedCaloEvents) printf("AliCaloTrackReader::SetListWithMixedEventsForCalo() - Track Mixing event list already set, nothing done\n");
420             else                        fListMixedCaloEvents    = l ; }
421   
422   void    SetListWithMixedEventsForTracks(TList ** l)      { 
423             if(fListMixedTracksEvents)  printf("AliCaloTrackReader::SetListWithMixedEventsForTracks() - Calorimeter Mixing event list already set, nothing done\n");
424             else                        fListMixedTracksEvents  = l ; }
425   
426   //-------------------------------------
427   // Other methods
428   //-------------------------------------
429   AliCalorimeterUtils * GetCaloUtils()               const { return fCaloUtils                   ; }
430   void             SetCaloUtils(AliCalorimeterUtils * caloutils)  { fCaloUtils = caloutils       ; }  
431   
432   virtual Double_t GetBField()                       const { return fInputEvent->GetMagneticField()  ; } 
433   
434   void    SetImportGeometryFromFile(Bool_t import, 
435                                     TString path = "")     { 
436                                                              fImportGeometryFromFile = import    ; 
437                                                              fImportGeometryFilePath = path      ; }      
438   
439   //------------------------------------------------
440   // MC analysis specific methods
441   //-------------------------------------------------
442   
443   //Kinematics and galice.root available 
444   virtual AliStack*          GetStack()              const ;
445   virtual AliHeader*         GetHeader()             const ;
446   virtual AliGenEventHeader* GetGenEventHeader()     const ;
447   
448   //Filtered kinematics in AOD  
449   virtual TClonesArray*     GetAODMCParticles()      const ;
450   virtual AliAODMCHeader*   GetAODMCHeader   ()      const ;
451   
452   virtual AliVEvent*        GetInputEvent()          const { return fInputEvent            ; }
453   virtual AliVEvent*        GetOriginalInputEvent()  const { return 0x0                    ; }
454   virtual AliAODEvent*      GetOutputEvent()         const { return fOutputEvent           ; }
455   virtual AliMCEvent*       GetMC()                  const { return fMC                    ; }
456   virtual AliMixedEvent*    GetMixedEvent()          const { return fMixedEvent            ; }
457   virtual Int_t             GetNMixedEvent()         const { return fNMixedEvent           ; } 
458   
459   void             SwitchOnStack()                         { fReadStack          = kTRUE   ; }
460   void             SwitchOffStack()                        { fReadStack          = kFALSE  ; }
461   void             SwitchOnAODMCParticles()                { fReadAODMCParticles = kTRUE   ; }
462   void             SwitchOffAODMCParticles()               { fReadAODMCParticles = kFALSE  ; }
463   Bool_t           ReadStack()                       const { return fReadStack             ; }
464   Bool_t           ReadAODMCParticles()              const { return fReadAODMCParticles    ; }
465         
466   //Select generated events, depending on comparison of pT hard and jets.
467   virtual Bool_t   ComparePtHardAndJetPt() ;
468   virtual Bool_t   IsPtHardAndJetPtComparisonSet()       const { return  fComparePtHardAndJetPt   ; }
469   virtual void     SetPtHardAndJetPtComparison(Bool_t compare) { fComparePtHardAndJetPt = compare ; }   
470   virtual Float_t  GetPtHardAndJetFactor()               const { return  fPtHardAndJetPtFactor    ; }
471   virtual void     SetPtHardAndJetPtFactor(Float_t factor)     { fPtHardAndJetPtFactor = factor   ; }           
472   
473   virtual Bool_t   ComparePtHardAndClusterPt() ;
474   virtual Bool_t   IsPtHardAndClusterPtComparisonSet()       const { return  fComparePtHardAndClusterPt   ; }
475   virtual void     SetPtHardAndClusterPtComparison(Bool_t compare) { fComparePtHardAndClusterPt = compare ; }   
476   virtual Float_t  GetPtHardAndClusterFactor()               const { return  fPtHardAndClusterPtFactor    ; }
477   virtual void     SetPtHardAndClusterPtFactor(Float_t factor)     { fPtHardAndClusterPtFactor = factor   ; }           
478   
479   
480   //MC reader methods, declared there to allow compilation, they are only used in the MC reader:
481   
482   virtual void AddNeutralParticlesArray(TArrayI & /*array*/) { ; }  
483   virtual void AddChargedParticlesArray(TArrayI & /*array*/) { ; } 
484   virtual void AddStatusArray(TArrayI & /*array*/)           { ; }
485   
486   virtual void SwitchOnPi0Decay()                            { ; } 
487   virtual void SwitchOffPi0Decay()                           { ; } 
488   virtual void SwitchOnStatusSelection()                     { ; }
489   virtual void SwitchOffStatusSelection()                    { ; }
490   virtual void SwitchOnOverlapCheck()                        { ; }
491   virtual void SwitchOffOverlapCheck()                       { ; }
492   virtual void SwitchOnOnlyGeneratorParticles()              { ; }
493   virtual void SwitchOffOnlyGeneratorParticles()             { ; }
494
495   virtual void SetEMCALOverlapAngle(Float_t /*angle*/)       { ; }
496   virtual void SetPHOSOverlapAngle(Float_t /*angle*/)        { ; }
497
498   
499  protected:
500   Int_t            fEventNumber;            // Event number
501   Int_t            fDataType ;              // Select MC:Kinematics, Data:ESD/AOD, MCData:Both
502   Int_t            fDebug;                  // Debugging level
503   AliFiducialCut * fFiducialCut;            //! Acceptance cuts
504   Bool_t           fCheckFidCut ;           // Do analysis for clusters in defined region         
505
506   Bool_t           fComparePtHardAndJetPt;  // In MonteCarlo, jet events, reject fake events with wrong jet energy.
507   Float_t          fPtHardAndJetPtFactor;   // Factor between ptHard and jet pT to reject/accept event.
508
509   Bool_t           fComparePtHardAndClusterPt;  // In MonteCarlo, jet events, reject events with too large cluster energy
510   Float_t          fPtHardAndClusterPtFactor;   // Factor between ptHard and cluster pT to reject/accept event.
511   
512   Float_t          fCTSPtMin;               // pT Threshold on charged particles 
513   Float_t          fEMCALPtMin;             // pT Threshold on emcal clusters
514   Float_t          fPHOSPtMin;              // pT Threshold on phos clusters
515   Float_t          fCTSPtMax;               // pT Threshold on charged particles 
516   Float_t          fEMCALPtMax;             // pT Threshold on emcal clusters
517   Float_t          fPHOSPtMax;              // pT Threshold on phos clusters
518   Bool_t           fUseEMCALTimeCut;        // Do time cut selection
519   Bool_t           fUseParamTimeCut;        // Use simple or parametrized time cut
520   Bool_t           fUseTrackTimeCut;        // Do time cut selection
521   Double_t         fEMCALTimeCutMin;        // Remove clusters/cells with time smaller than this value, in ns
522   Double_t         fEMCALTimeCutMax;        // Remove clusters/cells with time larger than this value, in ns
523   Float_t          fEMCALParamTimeCutMin[4];// Remove clusters/cells with time smaller than parametrized value, in ns
524   Double_t         fEMCALParamTimeCutMax[4];// Remove clusters/cells with time larger than parametrized value, in ns
525   Double_t         fTrackTimeCutMin;        // Remove tracks with time smaller than this value, in ns
526   Double_t         fTrackTimeCutMax;        // Remove tracks with time larger than this value, in ns
527   Bool_t           fUseTrackDCACut;         // Do DCA selection
528   Double_t         fTrackDCACut[3];         // Remove tracks with DCA larger than cut, parameters of function stored here
529
530   TList          * fAODBranchList ;         //-> List with AOD branches created and needed in analysis
531   TObjArray      * fCTSTracks ;             //-> temporal array with tracks
532   TObjArray      * fEMCALClusters ;         //-> temporal array with EMCAL CaloClusters
533   TObjArray      * fPHOSClusters ;          //-> temporal array with PHOS  CaloClusters
534   AliVCaloCells  * fEMCALCells ;            //! temporal array with EMCAL CaloCells
535   AliVCaloCells  * fPHOSCells ;             //! temporal array with PHOS  CaloCells
536
537   AliVEvent      * fInputEvent;             //! pointer to esd or aod input
538   AliAODEvent    * fOutputEvent;            //! pointer to aod output
539   AliMCEvent     * fMC;                     //! Monte Carlo Event Handler  
540
541   Bool_t           fFillCTS;                // use data from CTS
542   Bool_t           fFillEMCAL;              // use data from EMCAL
543   Bool_t           fFillPHOS;               // use data from PHOS
544   Bool_t           fFillEMCALCells;         // use data from EMCAL
545   Bool_t           fFillPHOSCells;          // use data from PHOS
546   Bool_t           fRecalculateClusters;    // Correct clusters, recalculate them if recalibration parameters is given
547   Bool_t           fSelectEmbeddedClusters; // Use only simulated clusters that come from embedding.
548   
549   ULong_t          fTrackStatus        ;    // Track selection bit, select tracks refitted in TPC, ITS ...
550   ULong_t          fTrackFilterMask    ;    // Track selection bit, for AODs (any difference with track status?)
551   AliESDtrackCuts *fESDtrackCuts       ;    // Track cut
552   AliESDtrackCuts *fESDtrackComplementaryCuts;    // Track cut, complementary cuts for hybrids
553   Bool_t           fConstrainTrack     ;    // Constrain Track to vertex
554   Bool_t           fSelectHybridTracks ;    // Select CTS tracks of type hybrid (only for AODs)
555   Bool_t           fSelectSPDHitTracks ;    // Ensure that track hits SPD layers
556   Int_t            fTrackMult          ;    // Track multiplicity
557   Float_t          fTrackMultEtaCut    ;    // Track multiplicity eta cut
558   Bool_t           fReadStack          ;    // Access kine information from stack
559   Bool_t                 fReadAODMCParticles ;    // Access kine information from filtered AOD MC particles
560         
561   TString          fDeltaAODFileName   ;    // Delta AOD file name
562   TString          fFiredTriggerClassName;  // Name of trigger event type used to do the analysis
563
564   UInt_t           fEventTriggerMask ;      // select this triggerered event
565   UInt_t           fMixEventTriggerMask ;   // select this triggerered event for mixing, tipically kMB or kAnyINT
566   Bool_t           fEventTriggerAtSE;       // select triggered event at SE base task or here
567   
568   Bool_t           fAnaLED;                 // Analyze LED data only.
569
570   TString          fTaskName;               // Name of task that executes the analysis
571         
572   AliCalorimeterUtils * fCaloUtils ;        //  Pointer to CalorimeterUtils
573
574   AliMixedEvent  * fMixedEvent  ;           //! mixed event object. This class is not the owner
575   Int_t            fNMixedEvent ;           // number of events in mixed event buffer
576   Double_t      ** fVertex      ;           //! vertex array 3 dim for each mixed event buffer
577   
578   TList **         fListMixedTracksEvents ; //! Container for tracks stored for different events, used in case of own mixing, set in analysis class
579   TList **         fListMixedCaloEvents;    //! Container for photon stored for different events, used in case of own mixing, set in analysis class
580   Int_t            fLastMixedTracksEvent  ; //  Temporary container with the last event added to the mixing list for tracks
581   Int_t            fLastMixedCaloEvent ;    //  Temporary container with the last event added to the mixing list for photons
582   
583   Bool_t           fWriteOutputDeltaAOD;    // Write the created delta AOD objects into file  
584         Bool_t           fOldAOD;                 // Old AODs, before revision 4.20
585   
586   Int_t            fV0ADC[2]    ;           // Integrated V0 signal
587   Int_t            fV0Mul[2]    ;           // Integrated V0 Multiplicity
588
589   Bool_t           fCaloFilterPatch;        // CaloFilter patch
590   TString          fEMCALClustersListName;  // Alternative list of clusters produced elsewhere and not from InputEvent
591   
592   // Event selection
593   Float_t          fZvtxCut ;                      // Cut on vertex position
594   Bool_t           fAcceptFastCluster;           // Accept events from fast cluster, exclude these events for LHC11a
595   Bool_t           fRemoveLEDEvents;             // Remove events where LED was wrongly firing - EMCAL LHC11a
596   Bool_t           fDoEventSelection;            // Select events depending on V0, pileup, vertex well reconstructed, at least 1 track ...
597   Bool_t           fDoV0ANDEventSelection;       // Select events depending on V0, fDoEventSelection should be on
598   Bool_t           fDoVertexBCEventSelection;    // Select events with vertex on BC=0 or -100
599   Bool_t           fDoRejectNoTrackEvents;       // Reject events with no selected tracks in event
600   Bool_t           fUseEventsWithPrimaryVertex ; // Select events with primary vertex
601   AliTriggerAnalysis* fTriggerAnalysis;          // Access to trigger selection algorithm for V0AND calculation
602   
603   Bool_t           fTimeStampEventSelect;        // Select events within a fraction of data taking time
604   Float_t          fTimeStampEventFracMin;       // Minimum value of time stamp fraction event
605   Float_t          fTimeStampEventFracMax;       // Maximum value of time stamp fraction event
606   Double_t         fTimeStampRunMin;             // Minimum value of time stamp in run
607   Double_t         fTimeStampRunMax;             // Maximum value of time stamp in run
608   
609   Double_t         fPileUpParamSPD[5];           // Parameters to pass to method IsPileupFromSPD: Int_t minContributors,
610                                                  // Double_t minZdist, 
611                                                  // Double_t nSigmaZdist, 
612                                                  // Double_t nSigmaDiamXY, 
613                                                  // Double_t nSigmaDiamZ)
614   
615   // Pile-up in EMCal
616   Int_t            fNPileUpClusters;             // Number of clusters with time avobe 20 ns
617   Int_t            fNNonPileUpClusters;          // Number of clusters with time below 20 ns
618   Int_t            fNPileUpClustersCut;          // Cut to select event as pile-up
619   Int_t            fEMCalBCEvent[19];            // Fill one entry per event if there is a cluster in a given BC
620   Int_t            fEMCalBCEventCut[19];         // Fill one entry per event if there is a cluster in a given BC, depend on cluster E, acceptance cut
621   Int_t            fTrackBCEvent[19];            // Fill one entry per event if there is a track in a given BC
622   Int_t            fTrackBCEventCut[19];         // Fill one entry per event if there is a track in a given BC, depend on track pT, acceptance cut
623   Int_t            fVertexBC;                    // Vertex BC
624   Bool_t           fRecalculateVertexBC;         // Recalculate vertex BC from tracks pointing to vertex
625   
626   //Centrality/Event plane
627   TString          fCentralityClass;        // Name of selected centrality class     
628   Int_t            fCentralityOpt;          // Option for the returned value of the centrality, possible options 5, 10, 100
629   Int_t            fCentralityBin[2];       // Minimum and maximum value of the centrality for the analysis
630   TString          fEventPlaneMethod;       // Name of event plane method, by default "Q"
631   
632   Bool_t           fImportGeometryFromFile; // Import geometry settings in geometry.root file
633   TString          fImportGeometryFilePath; // path fo geometry.root file
634
635   
636   AliCaloTrackReader(              const AliCaloTrackReader & r) ; // cpy ctor
637   AliCaloTrackReader & operator = (const AliCaloTrackReader & r) ; // cpy assignment
638   
639   ClassDef(AliCaloTrackReader,51)
640   
641 } ;
642
643
644 #endif //ALICALOTRACKREADER_H
645
646
647