]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/EMCALTasks/AliAnalysisTaskEMCALClusterize.h
add possibility to clusterize only within a centrality bin
[u/mrichter/AliRoot.git] / PWGGA / EMCALTasks / AliAnalysisTaskEMCALClusterize.h
1 #ifndef ALIANALYSISTASKEMCALCLUSTERIZE_H
2 #define ALIANALYSISTASKEMCALCLUSTERIZE_H
3
4 // This analysis provides a new list of clusters to be used in other analysis
5 // Author: Gustavo Conesa Balbastre,
6 //         Adapted from analysis class from Deepa Thomas
7
8 //Root
9 class TTree;
10 class TClonesArray;
11
12 #include "AliCentrality.h";
13
14 //EMCAL
15 class AliEMCALGeometry;
16 class AliEMCALCalibData;
17 class AliCaloCalibPedestal;
18 class AliEMCALClusterizer;
19 class AliEMCALAfterBurnerUF;
20 #include "AliEMCALRecParam.h"
21 #include "AliEMCALRecoUtils.h"
22
23
24 #include "AliAnalysisTaskSE.h"
25
26 class AliAnalysisTaskEMCALClusterize : public AliAnalysisTaskSE {
27  public:
28   AliAnalysisTaskEMCALClusterize();
29   AliAnalysisTaskEMCALClusterize(const char *name);
30   virtual ~AliAnalysisTaskEMCALClusterize();
31
32   virtual void   UserCreateOutputObjects();
33   virtual void   UserExec(Option_t *option);
34   virtual void   Init();
35   virtual void   LocalInit()                                    { Init()                       ; }
36     
37   // Event methods, settings
38   void           CheckAndGetEvent();
39   
40   Bool_t         IsExoticEvent();
41   void           SwitchOnExoticEventsRemoval()                  { fRemoveExoticEvents= kTRUE   ; }
42   void           SwitchOffExoticEventsRemoval()                 { fRemoveExoticEvents= kFALSE  ; } 
43   
44   Bool_t         IsLEDEvent(const Int_t run);
45   void           SwitchOnLEDEventsRemoval()                     { fRemoveLEDEvents   = kTRUE   ; }
46   void           SwitchOffLEDEventsRemoval()                    { fRemoveLEDEvents   = kFALSE  ; } 
47   
48   //OCDB
49   Bool_t         AccessOCDB();
50   void           SwitchOnAccessOCDB()                           { fAccessOCDB       = kTRUE    ; }
51   void           SwitchOffAccessOCDB()                          { fAccessOCDB       = kFALSE   ; } 
52   void           SetOCDBPath(const char *path)                  { fOCDBpath         = path     ; }
53   
54   //Geometry methods
55   void           InitGeometry();
56   void           SetGeometryName(TString &name)                 { fGeomName = name             ; }
57   TString        GeometryName()                          const  { return fGeomName             ; }  
58   void           SwitchOnLoadOwnGeometryMatrices()              { fLoadGeomMatrices = kTRUE    ; }
59   void           SwitchOffLoadOwnGeometryMatrices()             { fLoadGeomMatrices = kFALSE   ; } 
60   void           SetGeometryMatrixInSM(TGeoHMatrix* m, Int_t i) { fGeomMatrix[i]    = m        ; }
61
62   void           SetImportGeometryFromFile(Bool_t  im, 
63                                            TString pa = "")     { fImportGeometryFromFile = im ; 
64                                                                   fImportGeometryFilePath = pa ; }    
65   //AOD methods
66   void           SetAODBranchName(TString &name)                { fOutputAODBranchName = name  ; }
67   void           FillAODFile(Bool_t yesno)                      { fFillAODFile         = yesno ; }
68   void           FillAODCaloCells();
69   void           FillAODHeader();
70   void           SwitchOnFillAODHeader()                        { fFillAODHeader     = kTRUE   ; }
71   void           SwitchOffFillAODHeader()                       { fFillAODHeader     = kFALSE  ; } 
72   void           SwitchOnFillAODCaloCells()                     { fFillAODCaloCells  = kTRUE   ; }
73   void           SwitchOffFillAODCaloCells()                    { fFillAODCaloCells  = kFALSE  ; } 
74   
75   //Algorithms settings
76   
77   AliEMCALRecParam * GetRecParam()                              { if(!fRecParam)  fRecParam  = new AliEMCALRecParam  ;
78                                                                   return fRecParam             ; }
79   
80   AliEMCALRecoUtils* GetRecoUtils()                             { if(!fRecoUtils) fRecoUtils = new AliEMCALRecoUtils ;  
81                                                                   return fRecoUtils            ; }
82
83   void           InitClusterization();
84   void           ClusterizeCells();
85   void           ClusterUnfolding();
86   void           JustUnfold(Bool_t yesno)                       { fJustUnfold        = yesno   ; }
87     
88   void           SetConfigFileName(TString name)                { fConfigName        = name    ; }
89   void           SetMaxEvent(Int_t max)                         { fMaxEvent          = max     ; }
90   
91   void           SwitchOnTrackMatching()                        { fDoTrackMatching   = kTRUE   ; }
92   void           SwitchOffTrackMatching()                       { fDoTrackMatching   = kFALSE  ; } 
93
94   // Cell selection after unfolding
95   void           SwitchOnCellEnergySelection()                  { fSelectCell        = kTRUE   ; }
96   void           SwitchOffCellEnergySelection()                 { fSelectCell        = kFALSE  ; } 
97   void           SetCellCuts(Float_t e, Float_t frac)           { fSelectCellMinE    = e       ; 
98                                                                   fSelectCellMinFrac = frac    ; }  
99   // OADB options settings
100   
101   void           AccessOADB() ;
102   
103   TString        GetPass()    ;
104   
105   void           SwitchOnEMCALOADB()                            { fAccessOADB        = kTRUE   ; }
106   void           SwitchOffEMCALOADB()                           { fAccessOADB        = kFALSE  ; }
107     
108   void           SetOADBFilePath(TString path)                  { fOADBFilePath      = path    ; }
109   
110   // Centrality selection
111   
112   AliCentrality* GetCentrality()                                { return InputEvent()->GetCentrality() ; } //Look in AOD reader, different there
113   void     SetCentralityClass(TString name)                     { fCentralityClass   = name            ; }
114   TString  GetCentralityClass()                           const { return fCentralityClass              ; }
115   Int_t    GetEventCentrality()                                 { if(GetCentrality()) return GetCentrality()->GetCentralityPercentile(fCentralityClass) ;
116                                                                   else                return -1        ; }
117   void     SetCentralityBin(Int_t min, Int_t max) //Set the centrality bin to select the event. If used, then need to get percentile
118                                                                 { fCentralityBin[0]=min ; fCentralityBin[1]=max ; }
119   Float_t  GetCentralityBin(Int_t i)                      const { if(i < 0 || i > 1) return -1 ; 
120                                                                   else               return fCentralityBin[i]   ; }
121   
122  private:
123     
124   virtual void   FillCaloClusterInEvent();
125   
126   virtual void   RecPoints2Clusters();
127   
128   
129   AliVEvent             *fEvent;                   // Event 
130   
131   //Geometry  
132   AliEMCALGeometry      *fGeom;                    // EMCAL geometry
133   TString                fGeomName;                // Name of geometry to use.
134   TGeoHMatrix           *fGeomMatrix[12];          // Geometry matrices with alignments
135   Bool_t                 fGeomMatrixSet;           // Set geometry matrices only once, for the first event.         
136   Bool_t                 fLoadGeomMatrices;        // Matrices set from configuration, not get from geometry.root or from ESDs/AODs
137
138   //OCDB
139   AliEMCALCalibData     *fCalibData;               // EMCAL calib data
140   AliCaloCalibPedestal  *fPedestalData;            // EMCAL pedestal
141   TString                fOCDBpath;                // Path with OCDB location
142   Bool_t                 fAccessOCDB;              // Need to access info from OCDB (not really)   
143
144   //Temporal arrays
145   TClonesArray          *fDigitsArr;               //! Digits array
146   TObjArray             *fClusterArr;              //! Recpoints array
147   TObjArray             *fCaloClusterArr;          //! CaloClusters array
148
149   //Clusterizers 
150   AliEMCALRecParam      *fRecParam;                // Reconstruction parameters container
151   AliEMCALClusterizer   *fClusterizer;             //! EMCAL clusterizer
152   AliEMCALAfterBurnerUF *fUnfolder;                //! Unfolding procedure
153   Bool_t                 fJustUnfold;              // Just unfold, do not recluster
154   
155   //AOD
156   TClonesArray          *fOutputAODBranch;         //! AOD Branch with output clusters  
157   TString                fOutputAODBranchName;     // New of output AOD branch
158   Bool_t                 fOutputAODBranchSet ;     // Set the AOD clusters branch in the input event once
159   Bool_t                 fFillAODFile;             // Fill the output AOD file with the new clusters, 
160                                                    // if not they will be only available for the event they were generated
161   Bool_t                 fFillAODHeader;           // Copy header to standard branch
162   Bool_t                 fFillAODCaloCells;        // Copy calocells to standard branch
163
164   Int_t                  fRun;                     // run number
165   
166   AliEMCALRecoUtils*     fRecoUtils;               // Access to factorized reconstruction algorithms
167   TString                fConfigName;              // Name of analysis configuration file
168   
169   Int_t                  fCellLabels[12672];       // Array with MC label to be passed to digit. 
170   Int_t                  fCellSecondLabels[12672]; // Array with Second MC label to be passed to digit. 
171   Double_t               fCellTime[12672];         // Array with cluster time to be passed to digit in case of AODs 
172   Float_t                fCellMatchdEta[12672];    // Array with cluster-track dPhi 
173   Float_t                fCellMatchdPhi[12672];    // Array with cluster-track dEta 
174
175   Int_t                  fMaxEvent;                // Set a maximum event
176   
177   Bool_t                 fDoTrackMatching;         // On/Off the matching recalulation to speed up analysis in PbPb
178   Bool_t                 fSelectCell;              // Reject cells from cluster if energy is too low and recalculate position/energy and other
179   Float_t                fSelectCellMinE;          // Min energy cell threshold, after unfolding
180   Float_t                fSelectCellMinFrac;       // Min fraction of cell energy after unfolding cut
181   Bool_t                 fRemoveLEDEvents;         // Remove LED events, use only for LHC11a 
182   Bool_t                 fRemoveExoticEvents;      // Remove exotic events
183   
184   Bool_t                 fImportGeometryFromFile;  // Import geometry settings in geometry.root file
185   TString                fImportGeometryFilePath;  // path fo geometry.root file
186
187   Bool_t                 fOADBSet ;                // AODB parameters already set
188   Bool_t                 fAccessOADB ;             // Get calibration from OADB for EMCAL
189   TString                fOADBFilePath ;           // Default path $ALICE_ROOT/OADB/EMCAL, if needed change
190     
191   //Centrality
192   TString                fCentralityClass;         // Name of selected centrality class     
193   Int_t                  fCentralityBin[2];        // Minimum and maximum value of the centrality for the analysis
194   
195   
196   AliAnalysisTaskEMCALClusterize(           const AliAnalysisTaskEMCALClusterize&); // not implemented
197   AliAnalysisTaskEMCALClusterize& operator=(const AliAnalysisTaskEMCALClusterize&); // not implemented
198
199   ClassDef(AliAnalysisTaskEMCALClusterize, 22);
200
201 };
202
203 #endif //ALIANALYSISTASKEMCALCLUSTERIZE_H