]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/PartCorrBase/AliCaloTrackReader.h
Move GetModuleNumberXXX methods from QA analysis to a common place for other analysis...
[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 // -- Author: Gustavo Conesa (INFN-LNF)
16
17 // --- ROOT system ---
18 #include "TObject.h" 
19 class TObjArray ; 
20 class TLorentzVector ;
21 #include "TString.h"
22 #include "TObjArray.h"
23 class TArrayF;  
24 class TTree ;
25 #include "TH2I.h"
26
27 //--- ANALYSIS system ---
28 class AliStack ; 
29 class AliHeader ; 
30 class AliGenEventHeader ; 
31 class AliVEvent;
32 class AliAODEvent;
33 class AliMCEvent;
34 class AliFiducialCut;
35 class AliAODMCHeader;
36 #include "AliPHOSGeoUtils.h"
37 #include "AliEMCALGeoUtils.h"
38
39 class AliCaloTrackReader : public TObject {
40
41 public: 
42   
43   AliCaloTrackReader() ; // ctor
44   AliCaloTrackReader(const AliCaloTrackReader & g) ; // cpy ctor
45   virtual ~AliCaloTrackReader() ;//virtual dtor
46
47 private:
48   AliCaloTrackReader & operator = (const AliCaloTrackReader & g) ;//cpy assignment
49
50 public:
51   enum inputDataType {kESD, kAOD, kMC};
52   
53   //Select generated events, depending on comparison of pT hard and jets.
54   virtual Bool_t ComparePtHardAndJetPt() ;
55   virtual Bool_t IsPtHardAndJetPtComparisonSet() const {return  fComparePtHardAndJetPt ;}
56   virtual void SetPtHardAndJetPtComparison(Bool_t compare) { fComparePtHardAndJetPt = compare ;}        
57   virtual Float_t GetPtHardAndJetFactor() const {return  fPtHardAndJetPtFactor ;}
58   virtual void SetPtHardAndJetPtFactor(Float_t factor) { fPtHardAndJetPtFactor = factor ;}              
59         
60   virtual void InitParameters();
61   virtual void Print(const Option_t * opt) const;
62
63   virtual Int_t GetDebug()         const { return fDebug ; }
64   virtual void  SetDebug(Int_t d)        { fDebug = d ; }
65   virtual Int_t GetDataType()      const { return fDataType ; }
66   virtual void  SetDataType(Int_t data ) { fDataType = data ; }
67
68   virtual Int_t   GetEventNumber()     const {return fEventNumber ; }
69   virtual TString GetCurrentFileName() const {return fCurrentFileName ; }
70         
71   //Minimum pt setters and getters 
72   virtual Float_t  GetEMCALPtMin() const { return fEMCALPtMin  ; }
73   virtual Float_t  GetPHOSPtMin()  const { return fPHOSPtMin  ; }
74   virtual Float_t  GetCTSPtMin()   const { return fCTSPtMin  ; }
75
76   virtual void SetEMCALPtMin(Float_t  pt) { fEMCALPtMin = pt ; }
77   virtual void SetPHOSPtMin(Float_t  pt)  { fPHOSPtMin = pt ; }
78   virtual void SetCTSPtMin(Float_t  pt)   { fCTSPtMin = pt ; }
79   
80   //Input setters and getters
81
82   Bool_t IsCTSSwitchedOn()  const { return fFillCTS ; }
83   void SwitchOnCTS()    {fFillCTS = kTRUE ; }
84   void SwitchOffCTS()   {fFillCTS = kFALSE ; }
85
86   Bool_t IsEMCALSwitchedOn() const { return fFillEMCAL ; }
87   void SwitchOnEMCAL()  {fFillEMCAL = kTRUE ; }
88   void SwitchOffEMCAL() {fFillEMCAL = kFALSE ; }
89
90   Bool_t IsPHOSSwitchedOn()  const { return fFillPHOS ; }
91   void SwitchOnPHOS()   {fFillPHOS = kTRUE ; }
92   void SwitchOffPHOS()  {fFillPHOS = kFALSE ; }
93
94   Bool_t IsEMCALCellsSwitchedOn() const { return fFillEMCALCells ; }
95   void SwitchOnEMCALCells()  {fFillEMCALCells = kTRUE ; }
96   void SwitchOffEMCALCells() {fFillEMCALCells = kFALSE ; }
97
98   Bool_t IsPHOSCellsSwitchedOn()  const { return fFillPHOSCells ; }
99   void SwitchOnPHOSCells()   {fFillPHOSCells = kTRUE ; }
100   void SwitchOffPHOSCells()  {fFillPHOSCells = kFALSE ; }
101
102   virtual Bool_t FillInputEvent(const Int_t iEntry, const char *currentFileName)  ;
103   virtual void FillInputCTS()   {;}
104   virtual void FillInputEMCAL() {;}
105   virtual void FillInputPHOS()  {;}
106   virtual void FillInputEMCALCells() {;}
107   virtual void FillInputPHOSCells()  {;}
108
109   virtual TObjArray* GetAODCTS()   const {return fAODCTS ;}
110   virtual TObjArray* GetAODEMCAL() const {return fAODEMCAL ;}
111   virtual TObjArray* GetAODPHOS()  const {return fAODPHOS ;}
112   virtual TNamed* GetEMCALCells()  const {return fEMCALCells ;}
113   virtual TNamed* GetPHOSCells()   const {return fPHOSCells ;}
114
115   //Get MC  informatio
116   //Kinematics and galice.root available 
117   virtual AliStack*    GetStack()      const ;
118   virtual AliHeader*   GetHeader()     const ;
119   virtual AliGenEventHeader* GetGenEventHeader() const ;
120   //Filtered kinematics in AOD  
121   virtual TClonesArray*   GetAODMCParticles(Int_t input = 0) const ;
122   virtual AliAODMCHeader* GetAODMCHeader(Int_t input = 0)    const ;
123         
124   virtual AliVEvent*   GetInputEvent()  const {return fInputEvent;}
125   virtual AliAODEvent* GetOutputEvent() const {return fOutputEvent;}
126   virtual AliMCEvent*  GetMC()          const {return fMC;}
127   virtual void         GetVertex(Double_t *) const {;}
128   virtual void         GetSecondInputAODVertex(Double_t *) const {;}
129   virtual Double_t     GetBField() const { return 0.;}
130         
131   virtual void Init();
132         
133   virtual void SetInputEvent(AliVEvent* const input)  {fInputEvent  = input;}
134   virtual void SetOutputEvent(AliAODEvent* const aod) {fOutputEvent = aod;}
135   virtual void SetMC(AliMCEvent* const mc)            {fMC  = mc;}
136
137   virtual void ResetLists();
138
139   virtual AliFiducialCut * GetFiducialCut() const {return  fFiducialCut ;}
140   virtual void SetFiducialCut(AliFiducialCut * const fc) { fFiducialCut = fc ;}
141         
142   virtual void SetInputOutputMCEvent(AliVEvent* /*esd*/, AliAODEvent* /*aod*/, AliMCEvent* /*mc*/) {;}
143         
144   //Methods for mixing with external input file (AOD)
145   virtual TTree* GetSecondInputAODTree() const {return  fSecondInputAODTree ; } 
146   //virtual void SetSecondInputAODTree(TTree * tree) {fSecondInputAODTree = tree ;
147   //                                                                                              fSecondInputAODEvent->ReadFromTree(tree);}//Connect tree and AOD event.
148                                         
149   virtual AliAODEvent* GetSecondInputAODEvent() const { return fSecondInputAODEvent ; } 
150         
151   TString GetSecondInputFileName() const    {return fSecondInputFileName ; }
152   void SetSecondInputFileName(TString name) { fSecondInputFileName = name ; }
153
154   Int_t GetSecondInputFirstEvent() const    {return fSecondInputFirstEvent ; }
155   void SetSecondInputFirstEvent(Int_t iEvent0) { fSecondInputFirstEvent = iEvent0 ; }   
156         
157   Int_t GetAODCTSNormalInputEntries()   {if(!fSecondInputAODTree) { fAODCTSNormalInputEntries   = fAODCTS->GetEntriesFast()  ;}
158                                                                                  return fAODCTSNormalInputEntries ; }
159   Int_t GetAODEMCALNormalInputEntries() {if(!fSecondInputAODTree) { fAODEMCALNormalInputEntries = fAODEMCAL->GetEntriesFast();}
160                                                                                  return fAODEMCALNormalInputEntries ; }
161   Int_t GetAODPHOSNormalInputEntries()  {if(!fSecondInputAODTree) { fAODPHOSNormalInputEntries  = fAODPHOS->GetEntriesFast() ;}
162                                                                                  return fAODPHOSNormalInputEntries ; }
163         
164   ULong_t GetTrackStatus() const    {return fTrackStatus ; }
165   void SetTrackStatus(ULong_t bit) { fTrackStatus = bit ; }             
166         
167   void SwitchOnStack()              { fReadStack          = kTRUE  ; }
168   void SwitchOffStack()             { fReadStack          = kFALSE ; }
169   void SwitchOnAODMCParticles()     { fReadAODMCParticles = kTRUE  ; }
170   void SwitchOffAODMCParticles()    { fReadAODMCParticles = kFALSE ; }
171   Bool_t ReadStack()          const { return fReadStack            ; }
172   Bool_t ReadAODMCParticles() const { return fReadAODMCParticles   ; }
173         
174   void SwitchOnCleanStdAOD()  {fCleanOutputStdAOD = kTRUE;}
175   void SwitchOffCleanStdAOD() {fCleanOutputStdAOD = kFALSE;}
176         
177   void SetDeltaAODFileName(TString name ) {fDeltaAODFileName = name ; }
178   TString GetDeltaAODFileName() const {return fDeltaAODFileName ; }
179
180   void SetFiredTriggerClassName(TString name ) {fFiredTriggerClassName = name ; }
181   TString GetFiredTriggerClassName() const {return fFiredTriggerClassName ; }
182   virtual TString GetFiredTriggerClasses() {return "";}
183         
184   //Calorimeters Geometry Methods
185   void SetEMCALGeometryName(TString name)   { fEMCALGeoName = name ; }
186   TString EMCALGeometryName() const { return fEMCALGeoName ; }
187   void InitEMCALGeometry() ; 
188   AliEMCALGeoUtils * GetEMCALGeometry() const {return fEMCALGeo;}
189   Bool_t IsEMCALGeoMatrixSet() {return fEMCALGeoMatrixSet; }
190
191   void SetPHOSGeometryName(TString name)   { fPHOSGeoName = name ; }
192   TString PHOSGeometryName() const { return fPHOSGeoName ; }
193   void InitPHOSGeometry() ; 
194   AliPHOSGeoUtils * GetPHOSGeometry() const {return fPHOSGeo;}  
195   Bool_t IsPHOSGeoMatrixSet()  {return fPHOSGeoMatrixSet ; }
196
197   void AnalyzeOnlyLED()     {fAnaLED = kTRUE;}
198   void AnalyzeOnlyPhysics() {fAnaLED = kFALSE;}
199         
200   // Bad channels
201         
202   Bool_t IsBadChannelsRemovalSwitchedOn()  const { return fRemoveBadChannels ; }
203   void SwitchOnBadChannelsRemoval()    {fRemoveBadChannels = kTRUE ; }
204   void SwitchOffBadChannelsRemoval()   {fRemoveBadChannels = kFALSE ; }
205         
206   void InitEMCALBadChannelStatusMap() ;
207   void InitPHOSBadChannelStatusMap () ;
208
209   Int_t GetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow) const { 
210     if(fEMCALBadChannelMap->GetEntries()>0) return (Int_t) ((TH2I*)fEMCALBadChannelMap->At(iSM))->GetBinContent(iCol,iRow); 
211     else return -1;}
212
213   Int_t GetPHOSChannelStatus (Int_t imod, Int_t iCol, Int_t iRow) const { 
214     if(fPHOSBadChannelMap->GetEntries()>0)return (Int_t) ((TH2I*)fPHOSBadChannelMap->At(imod))->GetBinContent(iCol,iRow); 
215     else return -1;}
216   
217   void SetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) { 
218     if(!fEMCALBadChannelMap->GetEntries())InitEMCALBadChannelStatusMap() ;
219     ((TH2I*)fEMCALBadChannelMap->At(iSM))->SetBinContent(iCol,iRow,c);}
220   
221   void SetPHOSChannelStatus (Int_t imod, Int_t iCol, Int_t iRow, Double_t c = 1) {
222         if(!fPHOSBadChannelMap->GetEntries()) InitPHOSBadChannelStatusMap() ; 
223         ((TH2I*)fPHOSBadChannelMap->At(imod))->SetBinContent(iCol,iRow,c);}
224     
225   TH2I * GetEMCALChannelStatusMap(Int_t iSM) const {return (TH2I*)fEMCALBadChannelMap->At(iSM);}
226   TH2I * GetPHOSChannelStatusMap(Int_t imod) const {return (TH2I*)fPHOSBadChannelMap->At(imod);}
227
228   void SetEMCALChannelStatusMap(TObjArray *map) {fEMCALBadChannelMap = map;}
229   void SetPHOSChannelStatusMap (TObjArray *map) {fPHOSBadChannelMap  = map;}
230         
231   Bool_t ClusterContainsBadChannel(TString calorimeter,UShort_t* cellList, Int_t nCells);
232         
233   TString  GetTaskName() const {return fTaskName;}
234   void SetTaskName(TString name) {fTaskName = name;}
235
236   //Calorimeter indexes information
237   Int_t GetModuleNumberCellIndexes(const Int_t absId, const TString calo, Int_t & icol, Int_t & irow, Int_t &iRCU) const ;
238         
239  protected:
240   Int_t            fEventNumber; // Event number
241   TString          fCurrentFileName; // Current file name under analysis
242   Int_t            fDataType ;   // Select MC:Kinematics, Data:ESD/AOD, MCData:Both
243   Int_t            fDebug;       // Debugging level
244   AliFiducialCut * fFiducialCut; //! Acceptance cuts
245         
246   Bool_t           fComparePtHardAndJetPt;  // In MonteCarlo, jet events, reject fake events with wrong jet energy.
247   Float_t          fPtHardAndJetPtFactor;   // Factor between ptHard and jet pT to reject/accept event.
248
249   Float_t        fCTSPtMin;      // pT Threshold on charged particles 
250   Float_t        fEMCALPtMin;    // pT Threshold on emcal clusters
251   Float_t        fPHOSPtMin;     // pT Threshold on phos clusters
252
253   TObjArray *    fAODCTS ;        //! temporal referenced array with tracks
254   TObjArray *    fAODEMCAL ;      //! temporal referenced array with EMCAL CaloClusters
255   TObjArray *    fAODPHOS ;       //! temporal referenced array with PHOS CaloClusters
256   TNamed *       fEMCALCells ;    //! temporal array with EMCAL CaloCells, ESD or AOD
257   TNamed *       fPHOSCells ;     //! temporal array with PHOS CaloCells, ESD or AOD
258
259   AliVEvent   *  fInputEvent;     //! pointer to esd or aod input
260   AliAODEvent *  fOutputEvent;    //! pointer to aod output
261   AliMCEvent  *  fMC;             //! Monte Carlo Event Handler  
262
263   Bool_t         fFillCTS;        // use data from CTS
264   Bool_t         fFillEMCAL;      // use data from EMCAL
265   Bool_t         fFillPHOS;       // use data from PHOS
266   Bool_t         fFillEMCALCells; // use data from EMCAL
267   Bool_t         fFillPHOSCells;  // use data from PHOS
268
269   TTree *        fSecondInputAODTree;    // Tree with second input AOD, for mixing analysis.    
270   AliAODEvent*   fSecondInputAODEvent;   //! pointer to second input AOD event.
271   TString        fSecondInputFileName;   // File with AOD data to mix with normal stream of data.
272   Int_t          fSecondInputFirstEvent; // First event to be considered in the mixing.
273         
274   Int_t          fAODCTSNormalInputEntries;   // Number of entries in CTS   in case of standard input, larger with mixing.
275   Int_t          fAODEMCALNormalInputEntries; // Number of entries in EMCAL in case of standard input, larger with mixing.
276   Int_t          fAODPHOSNormalInputEntries;  // Number of entries in PHOS  in case of standard input, larger with mixing.
277         
278   ULong_t        fTrackStatus        ; // Track selection bit, select tracks refitted in TPC, ITS ...
279   Bool_t         fReadStack          ; // Access kine information from stack
280   Bool_t             fReadAODMCParticles ; // Access kine information from filtered AOD MC particles
281         
282   Bool_t             fCleanOutputStdAOD;   // clean the written standard tracks and caloclusters in output AOD
283   TString        fDeltaAODFileName ;   // Delta AOD file name
284   TString        fFiredTriggerClassName  ;  // Name of trigger event type used to do the analysis
285
286   TString        fEMCALGeoName;       // Name of geometry to use for EMCAL.
287   TString        fPHOSGeoName;        // Name of geometry to use for PHOS.      
288   AliEMCALGeoUtils * fEMCALGeo ;      //! EMCAL geometry pointer
289   AliPHOSGeoUtils  * fPHOSGeo  ;      //! PHOS  geometry pointer  
290   Bool_t         fEMCALGeoMatrixSet;  // Check if the transformation matrix is set for EMCAL
291   Bool_t         fPHOSGeoMatrixSet ;  // Check if the transformation matrix is set for PHOS
292   Bool_t         fAnaLED;             // Analyze LED data only.
293   Bool_t         fRemoveBadChannels;  // Check the channel status provided and remove clusters with bad channels
294   TObjArray     *fEMCALBadChannelMap; //! Array of histograms with map of bad channels, EMCAL
295   TObjArray     *fPHOSBadChannelMap;  //! Array of histograms with map of bad channels, PHOS
296   TString fTaskName;           // Name of task that executes the analysis
297
298   ClassDef(AliCaloTrackReader,13)
299 } ;
300
301
302 #endif //ALICALOTRACKREADER_H
303
304
305