]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/CaloTrackCorrBase/AliCaloTrackReader.h
new version of trigger patch-cluster matching more detailed histograms
[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   Bool_t           RejectLEDEvents();
242   
243   void             SetFiredTriggerClassName(TString name ) { fFiredTriggerClassName = name   ; }
244   TString          GetFiredTriggerClassName()        const { return fFiredTriggerClassName   ; }
245   TString          GetFiredTriggerClasses() ;               
246   
247   UInt_t           GetEventTriggerMask()             const { return fEventTriggerMask        ; }
248   void             SetEventTriggerMaks(UInt_t evtTrig = AliVEvent::kAny) 
249                                                            { fEventTriggerMask = evtTrig     ; }
250   
251   TArrayI          GetL0TriggerPatches();
252   // void            RejectExoticEvents(TArrayI patches);
253   //void             RejectTriggeredEventsByPileUp(TArrayI patches);
254   void             MatchTriggerCluster(TArrayI patches);
255
256   Bool_t           IsExoticEvent()                         { return fIsExoticEvent           ; }  
257   Bool_t           IsBadCellTriggerEvent()                 { return fIsBadCellEvent          ; }
258   Bool_t           IsTriggerMatched()                      { return fIsTriggerMatch          ; }
259   Int_t            GetTriggerClusterBC()                   { return fTriggerClusterBC        ; }
260   Int_t            GetTriggerClusterIndex()                { return fTriggerClusterIndex     ; }
261   Int_t            GetTriggerClusterId()                   { return fTriggerClusterId        ; }
262   
263   Float_t          GetEventTriggerThreshold()              { return fTriggerEventThreshold   ; }
264   void             SetEventTriggerThreshold(Float_t tr)    { fTriggerEventThreshold   = tr   ; }
265
266   void             SetTriggerPatchTimeWindow(Int_t min, Int_t max) { fTriggerPatchTimeWindow[0] = min ;
267                                                                      fTriggerPatchTimeWindow[1] = max ; }
268   
269   void             SwitchOffBadTriggerEventsRemoval()      { fRemoveBadTriggerEvents   = kFALSE ; }
270   void             SwitchOnBadTriggerEventsRemoval()       { fRemoveBadTriggerEvents   = kTRUE  ; }
271
272   void             SwitchOffTriggerPatchMatching()         { fTriggerPatchClusterMatch = kFALSE ; }
273   void             SwitchOnTriggerPatchMatching()          { fTriggerPatchClusterMatch = kTRUE  ; }
274
275   UInt_t           GetMixEventTriggerMask()             const { return fMixEventTriggerMask  ; }
276   void             SetMixEventTriggerMaks(UInt_t evtTrig = AliVEvent::kAnyINT) 
277                                                            { fMixEventTriggerMask = evtTrig  ; }
278   
279   Bool_t           IsEventTriggerAtSEOn()            const { return fEventTriggerAtSE        ; }
280   void             SwitchOnEventTriggerAtSE()              { fEventTriggerAtSE      = kTRUE  ; }
281   void             SwitchOffEventTriggerAtSE()             { fEventTriggerAtSE      = kFALSE ; }
282   
283   void             SwitchOnEventSelection()                { fDoEventSelection      = kTRUE  ; }
284   void             SwitchOffEventSelection()               { fDoEventSelection      = kFALSE ; }
285   Bool_t           IsEventSelectionDone()            const { return fDoEventSelection        ; }
286   
287   void             SwitchOnV0ANDSelection()                { fDoV0ANDEventSelection = kTRUE  ; }
288   void             SwitchOffV0ANDSelection()               { fDoV0ANDEventSelection = kFALSE ; }
289   Bool_t           IsV0ANDEventSelectionDone()       const { return fDoV0ANDEventSelection   ; } 
290
291   void             SwitchOnVertexBCEventSelection()        { fDoVertexBCEventSelection = kTRUE  ; }
292   void             SwitchOffVertexBCEventSelection()       { fDoVertexBCEventSelection = kFALSE ; }
293   Bool_t           IsVertexBCEventSelectionDone()    const { return fDoVertexBCEventSelection   ; }
294   
295   void             SwitchOnPrimaryVertexSelection()        { fUseEventsWithPrimaryVertex = kTRUE  ; }
296   void             SwitchOffPrimaryVertexSelection()       { fUseEventsWithPrimaryVertex = kFALSE ; }
297   Bool_t           IsPrimaryVertexSelectionDone()    const { return fUseEventsWithPrimaryVertex   ; } 
298   
299   void             SwitchOnRejectNoTrackEvents()           { fDoRejectNoTrackEvents = kTRUE  ; }
300   void             SwitchOffRejectNoTrackEvents()          { fDoRejectNoTrackEvents = kFALSE ; }
301   Bool_t           IsEventWithNoTrackRejectionDone() const { return fDoRejectNoTrackEvents   ; }
302   
303   //Time Stamp
304   
305   Double_t         GetRunTimeStampMin()              const { return fTimeStampRunMin         ; }
306   Double_t         GetRunTimeStampMax()              const { return fTimeStampRunMax         ; }
307   
308   void             SetRunTimeStamp(Double_t a, Double_t b) { fTimeStampRunMin = a            ;
309                                                              fTimeStampRunMax = b            ; } // seconds
310   
311   Float_t          GetEventTimeStampFractionMin()    const { return fTimeStampEventFracMin   ; }
312   Float_t          GetEventTimeStampFractionMax()    const { return fTimeStampEventFracMax   ; }
313   
314   void             SetEventTimeStampFraction(Float_t a, Float_t b) { fTimeStampEventFracMin = a ;
315                                                                      fTimeStampEventFracMax = b ; }
316   
317   void             SwitchOnSelectEventTimeStamp()          { fTimeStampEventSelect = kTRUE   ; }
318   void             SwitchOffSelectEventTimeStamp()         { fTimeStampEventSelect = kFALSE  ; }
319   
320   Bool_t           IsSelectEventTimeStampOn()              {return  fTimeStampEventSelect    ; }
321   
322   Bool_t           IsPileUpFromSPD()               const ;
323   Bool_t           IsPileUpFromEMCal()             const ;
324   Bool_t           IsPileUpFromSPDAndEMCal()       const ;
325   Bool_t           IsPileUpFromSPDOrEMCal()        const ;
326   Bool_t           IsPileUpFromSPDAndNotEMCal()    const ;
327   Bool_t           IsPileUpFromEMCalAndNotSPD()    const ;
328   Bool_t           IsPileUpFromNotSPDAndNotEMCal() const ;
329
330   void             SetPileUpParamForSPD  (Int_t i, Double_t param)
331                                                            { fPileUpParamSPD[i]  = param  ; }
332   void             SetPileUpParamForEMCal(Int_t param)     { fNPileUpClustersCut = param  ; }
333   
334   Int_t            GetNPileUpClusters()                    { return  fNPileUpClusters     ; }
335   Int_t            GetNNonPileUpClusters()                 { return  fNNonPileUpClusters  ; }
336   
337   Int_t            GetEMCalEventBC(Int_t bc)     const     { if(bc >=0 && bc < 19) return  fEMCalBCEvent   [bc] ; else return 0 ; }
338   Int_t            GetTrackEventBC(Int_t bc)     const     { if(bc >=0 && bc < 19) return  fTrackBCEvent   [bc] ; else return 0 ; }
339   Int_t            GetEMCalEventBCcut(Int_t bc)  const     { if(bc >=0 && bc < 19) return  fEMCalBCEventCut[bc] ; else return 0 ; }
340   Int_t            GetTrackEventBCcut(Int_t bc)  const     { if(bc >=0 && bc < 19) return  fTrackBCEventCut[bc] ; else return 0 ; }
341
342   void             SetEMCalEventBC(Int_t bc)               { if(bc >=0 && bc < 19) fEMCalBCEvent   [bc] = 1 ; }
343   void             SetTrackEventBC(Int_t bc)               { if(bc >=0 && bc < 19) fTrackBCEvent   [bc] = 1 ; }
344   void             SetEMCalEventBCcut(Int_t bc)            { if(bc >=0 && bc < 19) fEMCalBCEventCut[bc] = 1 ; }
345   void             SetTrackEventBCcut(Int_t bc)            { if(bc >=0 && bc < 19) fTrackBCEventCut[bc] = 1 ; }
346
347   Int_t            GetVertexBC(const AliVVertex * vtx);
348   Int_t            GetVertexBC()                  const    { return fVertexBC              ; }
349   void             SwitchOnRecalculateVertexBC()           { fRecalculateVertexBC = kTRUE  ; }
350   void             SwitchOffRecalculateVertexBC()          { fRecalculateVertexBC = kFALSE ; }
351   
352   // Track selection
353   ULong_t          GetTrackStatus()                  const { return fTrackStatus          ; }
354   void             SetTrackStatus(ULong_t bit)             { fTrackStatus = bit           ; }           
355
356   ULong_t          GetTrackFilterMask()              const {return fTrackFilterMask       ; }
357   void             SetTrackFilterMask(ULong_t bit)         { fTrackFilterMask = bit       ; }           
358   
359   AliESDtrackCuts* GetTrackCuts()                    const { return fESDtrackCuts         ; }
360   void             SetTrackCuts(AliESDtrackCuts * cuts)    ;
361
362   AliESDtrackCuts* GetTrackComplementaryCuts()       const { return fESDtrackComplementaryCuts ; }
363   void             SetTrackComplementaryCuts(AliESDtrackCuts * cuts)  ;
364
365   
366   void             SwitchOnConstrainTrackToVertex()        { fConstrainTrack     = kTRUE  ; } 
367   void             SwitchOffConstrainTrackToVertex()       { fConstrainTrack     = kFALSE ; }
368   
369   void             SwitchOnAODHybridTrackSelection()       { fSelectHybridTracks = kTRUE  ; } 
370   void             SwitchOffAODHybridTrackSelection()      { fSelectHybridTracks = kFALSE ; }      
371   
372   void             SwitchOnTrackHitSPDSelection()          { fSelectSPDHitTracks = kTRUE  ; }
373   void             SwitchOffTrackHitSPDSelection()         { fSelectSPDHitTracks = kFALSE ; }
374   
375   Int_t            GetTrackMultiplicity()            const { return fTrackMult            ; }
376   Float_t          GetTrackMultiplicityEtaCut()      const { return fTrackMultEtaCut      ; }
377   void             SetTrackMultiplicityEtaCut(Float_t eta) { fTrackMultEtaCut = eta       ; }           
378   
379   // Calorimeter specific and patches
380   void             AnalyzeOnlyLED()                        { fAnaLED             = kTRUE  ; }
381   void             AnalyzeOnlyPhysics()                    { fAnaLED             = kFALSE ; }
382   
383   void             SwitchOnCaloFilterPatch()               { fCaloFilterPatch    = kTRUE  ; 
384                                                              fFillCTS            = kFALSE ; }
385   void             SwitchOffCaloFilterPatch()              { fCaloFilterPatch    = kFALSE ; }
386   Bool_t           IsCaloFilterPatchOn()             const { 
387                     if(fDataType == kAOD) { return fCaloFilterPatch ; } 
388                     else                  { return kFALSE           ; }                     }
389         
390   //-------------------------------
391   //Vertex methods
392   //-------------------------------
393   virtual void      GetVertex(Double_t v[3])         const ;
394   virtual Double_t* GetVertex(const Int_t evtIndex)  const { return fVertex[evtIndex]            ; }
395   virtual void      GetVertex(Double_t vertex[3],    const Int_t evtIndex) const ;
396   virtual void      FillVertexArray();
397   virtual Bool_t    CheckForPrimaryVertex();
398   virtual Float_t   GetZvertexCut()                  const { return fZvtxCut                     ; } //cut on vertex position  
399   virtual void      SetZvertexCut(Float_t zcut=10.)        { fZvtxCut=zcut                       ; } //cut on vertex position
400
401   //--------------------------
402   // Centrality / Event Plane
403   //--------------------------
404   virtual AliCentrality* GetCentrality()             const { if(fDataType!=kMC) return fInputEvent->GetCentrality() ; 
405                                                              else               return 0x0       ; } 
406   virtual void     SetCentralityClass(TString name)        { fCentralityClass   = name           ; }
407   virtual void     SetCentralityOpt(Int_t opt)             { fCentralityOpt     = opt            ; }
408   virtual TString  GetCentralityClass()              const { return fCentralityClass             ; }
409   virtual Int_t    GetCentralityOpt()                const { return fCentralityOpt               ; }
410   virtual Int_t    GetEventCentrality()              const ;
411   virtual void     SetCentralityBin(Int_t min, Int_t max) //Set the centrality bin to select the event. If used, then need to get percentile
412                                                            { fCentralityBin[0]=min; fCentralityBin[1]=max;  
413                                                              if(min>=0 && max > 0) fCentralityOpt = 100 ; }
414   virtual Float_t  GetCentralityBin(Int_t i)         const { if(i < 0 || i > 1) return 0 ; 
415                                                              else return fCentralityBin[i]              ; }
416   
417   virtual AliEventplane* GetEventPlane()             const { if(fDataType!=kMC) return fInputEvent->GetEventplane() ;
418                                                              else               return 0x0       ; }  
419   virtual Double_t       GetEventPlaneAngle()        const ;          
420   virtual void           SetEventPlaneMethod(TString m)    { fEventPlaneMethod = m               ; }
421   virtual TString        GetEventPlaneMethod()       const { return fEventPlaneMethod            ; }
422
423   //--------------------
424   // Mixing
425   //--------------------
426
427   Int_t   GetLastCaloMixedEvent()                    const { return fLastMixedCaloEvent          ; }
428   Int_t   GetLastTracksMixedEvent ()                 const { return fLastMixedTracksEvent        ; }
429   
430   TList * GetListWithMixedEventsForCalo  (Int_t bi)  const { if(fListMixedCaloEvents)   return fListMixedCaloEvents[bi]     ; else return 0 ; }
431   TList * GetListWithMixedEventsForTracks(Int_t bi)  const { if(fListMixedTracksEvents) return fListMixedTracksEvents [bi]  ; else return 0 ; }  
432    
433   Bool_t  ListWithMixedEventsForCaloExists()         const { if(fListMixedCaloEvents) return kTRUE  ;
434                                                              else                     return kFALSE ; }
435
436   Bool_t  ListWithMixedEventsForTracksExists()       const { if(fListMixedTracksEvents) return kTRUE  ;
437                                                              else                       return kFALSE ; }
438   
439   void    SetLastCaloMixedEvent  (Int_t e)                 { fLastMixedCaloEvent    = e          ; }
440   void    SetLastTracksMixedEvent(Int_t e)                 { fLastMixedTracksEvent  = e          ; }
441   
442   void    SetListWithMixedEventsForCalo (TList ** l)       { 
443             if(fListMixedCaloEvents) printf("AliCaloTrackReader::SetListWithMixedEventsForCalo() - Track Mixing event list already set, nothing done\n");
444             else                        fListMixedCaloEvents    = l ; }
445   
446   void    SetListWithMixedEventsForTracks(TList ** l)      { 
447             if(fListMixedTracksEvents)  printf("AliCaloTrackReader::SetListWithMixedEventsForTracks() - Calorimeter Mixing event list already set, nothing done\n");
448             else                        fListMixedTracksEvents  = l ; }
449   
450   //-------------------------------------
451   // Other methods
452   //-------------------------------------
453   AliCalorimeterUtils * GetCaloUtils()               const { return fCaloUtils                   ; }
454   void             SetCaloUtils(AliCalorimeterUtils * caloutils)  { fCaloUtils = caloutils       ; }  
455   
456   virtual Double_t GetBField()                       const { return fInputEvent->GetMagneticField()  ; } 
457   
458   void    SetImportGeometryFromFile(Bool_t import, 
459                                     TString path = "")     { 
460                                                              fImportGeometryFromFile = import    ; 
461                                                              fImportGeometryFilePath = path      ; }      
462   
463   //------------------------------------------------
464   // MC analysis specific methods
465   //-------------------------------------------------
466   
467   //Kinematics and galice.root available 
468   virtual AliStack*          GetStack()              const ;
469   virtual AliHeader*         GetHeader()             const ;
470   virtual AliGenEventHeader* GetGenEventHeader()     const ;
471   
472   //Filtered kinematics in AOD  
473   virtual TClonesArray*     GetAODMCParticles()      const ;
474   virtual AliAODMCHeader*   GetAODMCHeader   ()      const ;
475   
476   virtual AliVEvent*        GetInputEvent()          const { return fInputEvent            ; }
477   virtual AliVEvent*        GetOriginalInputEvent()  const { return 0x0                    ; }
478   virtual AliAODEvent*      GetOutputEvent()         const { return fOutputEvent           ; }
479   virtual AliMCEvent*       GetMC()                  const { return fMC                    ; }
480   virtual AliMixedEvent*    GetMixedEvent()          const { return fMixedEvent            ; }
481   virtual Int_t             GetNMixedEvent()         const { return fNMixedEvent           ; } 
482   
483   void             SwitchOnStack()                         { fReadStack          = kTRUE   ; }
484   void             SwitchOffStack()                        { fReadStack          = kFALSE  ; }
485   void             SwitchOnAODMCParticles()                { fReadAODMCParticles = kTRUE   ; }
486   void             SwitchOffAODMCParticles()               { fReadAODMCParticles = kFALSE  ; }
487   Bool_t           ReadStack()                       const { return fReadStack             ; }
488   Bool_t           ReadAODMCParticles()              const { return fReadAODMCParticles    ; }
489         
490   //Select generated events, depending on comparison of pT hard and jets.
491   virtual Bool_t   ComparePtHardAndJetPt() ;
492   virtual Bool_t   IsPtHardAndJetPtComparisonSet()       const { return  fComparePtHardAndJetPt   ; }
493   virtual void     SetPtHardAndJetPtComparison(Bool_t compare) { fComparePtHardAndJetPt = compare ; }   
494   virtual Float_t  GetPtHardAndJetFactor()               const { return  fPtHardAndJetPtFactor    ; }
495   virtual void     SetPtHardAndJetPtFactor(Float_t factor)     { fPtHardAndJetPtFactor = factor   ; }           
496   
497   virtual Bool_t   ComparePtHardAndClusterPt() ;
498   virtual Bool_t   IsPtHardAndClusterPtComparisonSet()       const { return  fComparePtHardAndClusterPt   ; }
499   virtual void     SetPtHardAndClusterPtComparison(Bool_t compare) { fComparePtHardAndClusterPt = compare ; }   
500   virtual Float_t  GetPtHardAndClusterFactor()               const { return  fPtHardAndClusterPtFactor    ; }
501   virtual void     SetPtHardAndClusterPtFactor(Float_t factor)     { fPtHardAndClusterPtFactor = factor   ; }           
502   
503   
504   //MC reader methods, declared there to allow compilation, they are only used in the MC reader:
505   
506   virtual void AddNeutralParticlesArray(TArrayI & /*array*/) { ; }  
507   virtual void AddChargedParticlesArray(TArrayI & /*array*/) { ; } 
508   virtual void AddStatusArray(TArrayI & /*array*/)           { ; }
509   
510   virtual void SwitchOnPi0Decay()                            { ; } 
511   virtual void SwitchOffPi0Decay()                           { ; } 
512   virtual void SwitchOnStatusSelection()                     { ; }
513   virtual void SwitchOffStatusSelection()                    { ; }
514   virtual void SwitchOnOverlapCheck()                        { ; }
515   virtual void SwitchOffOverlapCheck()                       { ; }
516   virtual void SwitchOnOnlyGeneratorParticles()              { ; }
517   virtual void SwitchOffOnlyGeneratorParticles()             { ; }
518
519   virtual void SetEMCALOverlapAngle(Float_t /*angle*/)       { ; }
520   virtual void SetPHOSOverlapAngle(Float_t /*angle*/)        { ; }
521
522   
523  protected:
524   Int_t            fEventNumber;            // Event number
525   Int_t            fDataType ;              // Select MC:Kinematics, Data:ESD/AOD, MCData:Both
526   Int_t            fDebug;                  // Debugging level
527   AliFiducialCut * fFiducialCut;            // Acceptance cuts
528   Bool_t           fCheckFidCut ;           // Do analysis for clusters in defined region         
529
530   Bool_t           fComparePtHardAndJetPt;  // In MonteCarlo, jet events, reject fake events with wrong jet energy.
531   Float_t          fPtHardAndJetPtFactor;   // Factor between ptHard and jet pT to reject/accept event.
532
533   Bool_t           fComparePtHardAndClusterPt;  // In MonteCarlo, jet events, reject events with too large cluster energy
534   Float_t          fPtHardAndClusterPtFactor;   // Factor between ptHard and cluster pT to reject/accept event.
535   
536   Float_t          fCTSPtMin;               // pT Threshold on charged particles 
537   Float_t          fEMCALPtMin;             // pT Threshold on emcal clusters
538   Float_t          fPHOSPtMin;              // pT Threshold on phos clusters
539   Float_t          fCTSPtMax;               // pT Threshold on charged particles 
540   Float_t          fEMCALPtMax;             // pT Threshold on emcal clusters
541   Float_t          fPHOSPtMax;              // pT Threshold on phos clusters
542   Bool_t           fUseEMCALTimeCut;        // Do time cut selection
543   Bool_t           fUseParamTimeCut;        // Use simple or parametrized time cut
544   Bool_t           fUseTrackTimeCut;        // Do time cut selection
545   Double_t         fEMCALTimeCutMin;        // Remove clusters/cells with time smaller than this value, in ns
546   Double_t         fEMCALTimeCutMax;        // Remove clusters/cells with time larger than this value, in ns
547   Float_t          fEMCALParamTimeCutMin[4];// Remove clusters/cells with time smaller than parametrized value, in ns
548   Double_t         fEMCALParamTimeCutMax[4];// Remove clusters/cells with time larger than parametrized value, in ns
549   Double_t         fTrackTimeCutMin;        // Remove tracks with time smaller than this value, in ns
550   Double_t         fTrackTimeCutMax;        // Remove tracks with time larger than this value, in ns
551   Bool_t           fUseTrackDCACut;         // Do DCA selection
552   Double_t         fTrackDCACut[3];         // Remove tracks with DCA larger than cut, parameters of function stored here
553
554   TList          * fAODBranchList ;         //-> List with AOD branches created and needed in analysis
555   TObjArray      * fCTSTracks ;             //-> temporal array with tracks
556   TObjArray      * fEMCALClusters ;         //-> temporal array with EMCAL CaloClusters
557   TObjArray      * fPHOSClusters ;          //-> temporal array with PHOS  CaloClusters
558   AliVCaloCells  * fEMCALCells ;            //! temporal array with EMCAL CaloCells
559   AliVCaloCells  * fPHOSCells ;             //! temporal array with PHOS  CaloCells
560
561   AliVEvent      * fInputEvent;             //! pointer to esd or aod input
562   AliAODEvent    * fOutputEvent;            //! pointer to aod output
563   AliMCEvent     * fMC;                     //! Monte Carlo Event Handler  
564
565   Bool_t           fFillCTS;                // use data from CTS
566   Bool_t           fFillEMCAL;              // use data from EMCAL
567   Bool_t           fFillPHOS;               // use data from PHOS
568   Bool_t           fFillEMCALCells;         // use data from EMCAL
569   Bool_t           fFillPHOSCells;          // use data from PHOS
570   Bool_t           fRecalculateClusters;    // Correct clusters, recalculate them if recalibration parameters is given
571   Bool_t           fSelectEmbeddedClusters; // Use only simulated clusters that come from embedding.
572   
573   ULong_t          fTrackStatus        ;    // Track selection bit, select tracks refitted in TPC, ITS ...
574   ULong_t          fTrackFilterMask    ;    // Track selection bit, for AODs (any difference with track status?)
575   AliESDtrackCuts *fESDtrackCuts       ;    // Track cut
576   AliESDtrackCuts *fESDtrackComplementaryCuts;    // Track cut, complementary cuts for hybrids
577   Bool_t           fConstrainTrack     ;    // Constrain Track to vertex
578   Bool_t           fSelectHybridTracks ;    // Select CTS tracks of type hybrid (only for AODs)
579   Bool_t           fSelectSPDHitTracks ;    // Ensure that track hits SPD layers
580   Int_t            fTrackMult          ;    // Track multiplicity
581   Float_t          fTrackMultEtaCut    ;    // Track multiplicity eta cut
582   Bool_t           fReadStack          ;    // Access kine information from stack
583   Bool_t                 fReadAODMCParticles ;    // Access kine information from filtered AOD MC particles
584         
585   TString          fDeltaAODFileName   ;    // Delta AOD file name
586   TString          fFiredTriggerClassName;  // Name of trigger event type used to do the analysis
587
588   UInt_t           fEventTriggerMask ;      // select this triggerered event
589   UInt_t           fMixEventTriggerMask ;   // select this triggerered event for mixing, tipically kMB or kAnyINT
590   Bool_t           fEventTriggerAtSE;       // select triggered event at SE base task or here
591   
592   Bool_t           fAnaLED;                 // Analyze LED data only.
593
594   TString          fTaskName;               // Name of task that executes the analysis
595         
596   AliCalorimeterUtils * fCaloUtils ;        //  Pointer to CalorimeterUtils
597
598   AliMixedEvent  * fMixedEvent  ;           //! mixed event object. This class is not the owner
599   Int_t            fNMixedEvent ;           // number of events in mixed event buffer
600   Double_t      ** fVertex      ;           //! vertex array 3 dim for each mixed event buffer
601   
602   TList **         fListMixedTracksEvents ; //! Container for tracks stored for different events, used in case of own mixing, set in analysis class
603   TList **         fListMixedCaloEvents;    //! Container for photon stored for different events, used in case of own mixing, set in analysis class
604   Int_t            fLastMixedTracksEvent  ; //  Temporary container with the last event added to the mixing list for tracks
605   Int_t            fLastMixedCaloEvent ;    //  Temporary container with the last event added to the mixing list for photons
606   
607   Bool_t           fWriteOutputDeltaAOD;    // Write the created delta AOD objects into file  
608         Bool_t           fOldAOD;                 // Old AODs, before revision 4.20
609   
610   Int_t            fV0ADC[2]    ;           // Integrated V0 signal
611   Int_t            fV0Mul[2]    ;           // Integrated V0 Multiplicity
612
613   Bool_t           fCaloFilterPatch;        // CaloFilter patch
614   TString          fEMCALClustersListName;  // Alternative list of clusters produced elsewhere and not from InputEvent
615   
616   // Event selection
617   Float_t          fZvtxCut ;                      // Cut on vertex position
618   Bool_t           fAcceptFastCluster;           // Accept events from fast cluster, exclude these events for LHC11a
619   Bool_t           fRemoveLEDEvents;             // Remove events where LED was wrongly firing - EMCAL LHC11a
620   
621   Bool_t           fRemoveBadTriggerEvents;      // Remove triggered events because trigger was exotic, bad, or out of BC
622   Bool_t           fTriggerPatchClusterMatch;    // Search for the trigger patch and check if associated cluster was the trigger
623   Int_t            fTriggerPatchTimeWindow[2];   // Trigger patch selection window
624   Float_t          fTriggerEventThreshold;       // Threshold to look for triggered events
625   Int_t            fTriggerClusterBC;            // Event triggered by a cluster in BC -5 0 to 5
626   Int_t            fTriggerClusterIndex;         // Index in clusters array of trigger cluster
627   Int_t            fTriggerClusterId;            // Id of trigger cluster (cluster->GetID())
628   Bool_t           fIsExoticEvent;               // Exotic trigger event flag
629   Bool_t           fIsBadCellEvent;              // Bad cell triggered event flag
630   Int_t            fIsTriggerMatch;              // Could not match the event to a trigger patch
631   
632   Bool_t           fDoEventSelection;            // Select events depending on V0, pileup, vertex well reconstructed, at least 1 track ...
633   Bool_t           fDoV0ANDEventSelection;       // Select events depending on V0, fDoEventSelection should be on
634   Bool_t           fDoVertexBCEventSelection;    // Select events with vertex on BC=0 or -100
635   Bool_t           fDoRejectNoTrackEvents;       // Reject events with no selected tracks in event
636   Bool_t           fUseEventsWithPrimaryVertex ; // Select events with primary vertex
637   AliTriggerAnalysis* fTriggerAnalysis;          // Access to trigger selection algorithm for V0AND calculation
638   
639   Bool_t           fTimeStampEventSelect;        // Select events within a fraction of data taking time
640   Float_t          fTimeStampEventFracMin;       // Minimum value of time stamp fraction event
641   Float_t          fTimeStampEventFracMax;       // Maximum value of time stamp fraction event
642   Double_t         fTimeStampRunMin;             // Minimum value of time stamp in run
643   Double_t         fTimeStampRunMax;             // Maximum value of time stamp in run
644   
645   Double_t         fPileUpParamSPD[5];           // Parameters to pass to method IsPileupFromSPD: Int_t minContributors,
646                                                  // Double_t minZdist, 
647                                                  // Double_t nSigmaZdist, 
648                                                  // Double_t nSigmaDiamXY, 
649                                                  // Double_t nSigmaDiamZ)
650   
651   // Pile-up in EMCal
652   Int_t            fNPileUpClusters;             // Number of clusters with time avobe 20 ns
653   Int_t            fNNonPileUpClusters;          // Number of clusters with time below 20 ns
654   Int_t            fNPileUpClustersCut;          // Cut to select event as pile-up
655   Int_t            fEMCalBCEvent[19];            // Fill one entry per event if there is a cluster in a given BC
656   Int_t            fEMCalBCEventCut[19];         // Fill one entry per event if there is a cluster in a given BC, depend on cluster E, acceptance cut
657   Int_t            fTrackBCEvent[19];            // Fill one entry per event if there is a track in a given BC
658   Int_t            fTrackBCEventCut[19];         // Fill one entry per event if there is a track in a given BC, depend on track pT, acceptance cut
659   Int_t            fVertexBC;                    // Vertex BC
660   Bool_t           fRecalculateVertexBC;         // Recalculate vertex BC from tracks pointing to vertex
661   
662   //Centrality/Event plane
663   TString          fCentralityClass;        // Name of selected centrality class     
664   Int_t            fCentralityOpt;          // Option for the returned value of the centrality, possible options 5, 10, 100
665   Int_t            fCentralityBin[2];       // Minimum and maximum value of the centrality for the analysis
666   TString          fEventPlaneMethod;       // Name of event plane method, by default "Q"
667   
668   Bool_t           fImportGeometryFromFile; // Import geometry settings in geometry.root file
669   TString          fImportGeometryFilePath; // path fo geometry.root file
670
671   
672   AliCaloTrackReader(              const AliCaloTrackReader & r) ; // cpy ctor
673   AliCaloTrackReader & operator = (const AliCaloTrackReader & r) ; // cpy assignment
674   
675   ClassDef(AliCaloTrackReader,54)
676   
677 } ;
678
679
680 #endif //ALICALOTRACKREADER_H
681
682
683