]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/EMCALTasks/AliAnalysisTaskEMCALClusterize.h
PWGJE
[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 class AliEMCALRecPoint;
21 class AliAODCaloCluster;
22 #include "AliEMCALRecParam.h"
23 #include "AliEMCALRecoUtils.h"
24
25
26 #include "AliAnalysisTaskSE.h"
27
28 class AliAnalysisTaskEMCALClusterize : public AliAnalysisTaskSE {
29  public:
30   AliAnalysisTaskEMCALClusterize();
31   AliAnalysisTaskEMCALClusterize(const char *name);
32   virtual ~AliAnalysisTaskEMCALClusterize();
33
34   virtual void   UserCreateOutputObjects();
35   virtual void   UserExec(Option_t *option);
36   virtual void   Init();
37   virtual void   LocalInit()                                    { Init()                       ; }
38     
39   // Event methods, settings
40   
41   Bool_t         AcceptEventEMCAL();
42   void           SwitchOnSelectEMCALEvent()                    { fSelectEMCALEvent   = kTRUE   ; }
43   void           SwitchOffSelectEMCALEvent()                   { fSelectEMCALEvent   = kFALSE  ; }
44   void           SetEMCALEnergyCut(Float_t cut)                { fEMCALEnergyCut     = cut     ; }
45   void           SetEMCALNcellsCut(Int_t cut)                  { fEMCALNcellsCut     = cut     ; }
46
47   void           SwitchOnInputAODFilter()                      { fInputFromFilter    = kTRUE   ; }
48   void           SwitchOffInputAODFilter()                     { fInputFromFilter    = kFALSE  ; }
49   
50   void           CheckAndGetEvent();
51   
52   Bool_t         IsExoticEvent();
53   void           SwitchOnExoticEventsRemoval()                  { fRemoveExoticEvents= kTRUE   ; }
54   void           SwitchOffExoticEventsRemoval()                 { fRemoveExoticEvents= kFALSE  ; } 
55   
56   Bool_t         IsLEDEvent(const Int_t run);
57   void           SwitchOnLEDEventsRemoval()                     { fRemoveLEDEvents   = kTRUE   ; }
58   void           SwitchOffLEDEventsRemoval()                    { fRemoveLEDEvents   = kFALSE  ; } 
59   
60   //OCDB
61   Bool_t         AccessOCDB();
62   void           SwitchOnAccessOCDB()                           { fAccessOCDB       = kTRUE    ; }
63   void           SwitchOffAccessOCDB()                          { fAccessOCDB       = kFALSE   ; } 
64   void           SetOCDBPath(const char *path)                  { fOCDBpath         = path     ; }
65   
66   //Geometry methods
67   void           InitGeometry();
68   void           SetGeometryName(TString &name)                 { fGeomName = name             ; }
69   TString        GeometryName()                          const  { return fGeomName             ; }  
70   void           SwitchOnLoadOwnGeometryMatrices()              { fLoadGeomMatrices = kTRUE    ; }
71   void           SwitchOffLoadOwnGeometryMatrices()             { fLoadGeomMatrices = kFALSE   ; } 
72   void           SetGeometryMatrixInSM(TGeoHMatrix* m, Int_t i) { fGeomMatrix[i]    = m        ; }
73
74   void           SetImportGeometryFromFile(Bool_t  im, 
75                                            TString pa = "")     { fImportGeometryFromFile = im ; 
76                                                                   fImportGeometryFilePath = pa ; }    
77   //AOD methods
78   void           SetAODBranchName(TString &name)                { fOutputAODBranchName = name  ; }
79   void           FillAODFile(Bool_t yesno)                      { fFillAODFile         = yesno ; }
80   void           FillAODCaloCells();
81   void           FillAODHeader();
82   void           SwitchOnFillAODHeader()                        { fFillAODHeader     = kTRUE   ; }
83   void           SwitchOffFillAODHeader()                       { fFillAODHeader     = kFALSE  ; } 
84   void           SwitchOnFillAODCaloCells()                     { fFillAODCaloCells  = kTRUE   ; }
85   void           SwitchOffFillAODCaloCells()                    { fFillAODCaloCells  = kFALSE  ; } 
86
87   void           SwitchOnRecalibrateWithClusterTime()           { fRecalibrateWithClusterTime  = kTRUE   ; }
88   void           SwitchOffRecalibrateWithClusterTime()          { fRecalibrateWithClusterTime  = kFALSE  ; }
89   
90
91   
92   //Algorithms settings
93   
94   AliEMCALRecParam * GetRecParam()                              { if(!fRecParam)  fRecParam  = new AliEMCALRecParam  ;
95                                                                   return fRecParam             ; }
96   
97   AliEMCALRecoUtils* GetRecoUtils()                             { if(!fRecoUtils) fRecoUtils = new AliEMCALRecoUtils ;  
98                                                                   return fRecoUtils            ; }
99
100   void           InitClusterization();
101   void           ClusterizeCells();
102   void           ClusterUnfolding();
103   void           JustUnfold(Bool_t yesno)                       { fJustUnfold        = yesno   ; }
104     
105   void           SetConfigFileName(TString name)                { fConfigName        = name    ; }
106   void           SetMaxEvent(Int_t max)                         { fMaxEvent          = max     ; }
107   
108   void           SwitchOnTrackMatching()                        { fDoTrackMatching   = kTRUE   ; }
109   void           SwitchOffTrackMatching()                       { fDoTrackMatching   = kFALSE  ; } 
110
111   // Cell selection after unfolding
112   void           SwitchOnCellEnergySelection()                  { fSelectCell        = kTRUE   ; }
113   void           SwitchOffCellEnergySelection()                 { fSelectCell        = kFALSE  ; } 
114   void           SetCellCuts(Float_t e, Float_t frac)           { fSelectCellMinE    = e       ; 
115                                                                   fSelectCellMinFrac = frac    ; }
116   void           SetRejectBelowThreshold(Bool_t reject)         { fRejectBelowThreshold =reject ; }
117   // OADB options settings
118   
119   void           AccessOADB() ;
120   
121   TString        GetPass()    ;
122   
123   void           SwitchOnEMCALOADB()                            { fAccessOADB        = kTRUE   ; }
124   void           SwitchOffEMCALOADB()                           { fAccessOADB        = kFALSE  ; }
125     
126   void           SetOADBFilePath(TString path)                  { fOADBFilePath      = path    ; }
127   
128   // Centrality selection
129   
130   AliCentrality* GetCentrality()                                { return InputEvent()->GetCentrality() ; } //Look in AOD reader, different there
131   void           SetCentralityClass(TString name)               { fCentralityClass   = name            ; }
132   TString        GetCentralityClass()                     const { return fCentralityClass              ; }
133   Float_t        GetEventCentrality()                           { if(GetCentrality()) return GetCentrality()->GetCentralityPercentile(fCentralityClass) ;
134                                                                   else                return -1.       ; }
135   void           SetCentralityBin(Int_t min, Int_t max) //Set the centrality bin to select the event. If used, then need to get percentile
136                                                                 { fCentralityBin[0]=min ; fCentralityBin[1]=max ; }
137   Float_t        GetCentralityBin(Int_t i)                const { if(i < 0 || i > 1) return -1 ; 
138                                                                   else               return fCentralityBin[i]   ; }
139   
140   //MC label methods
141   
142   void           RemapMCLabelForAODs(Int_t &label);
143   void           SwitchOnRemapMCLabelForAODs()                  { fRemapMCLabelForAODs  = kTRUE   ; }
144   void           SwitchOffRemapMCLabelForAODs()                 { fRemapMCLabelForAODs  = kFALSE  ; }
145
146   void           SetClustersMCLabelFrom2SelectedLabels(AliEMCALRecPoint* recPoint, AliAODCaloCluster *clus) ;
147   void           SetClustersMCLabelFromOriginalClusters(AliAODCaloCluster * clus) ;
148   
149   void           SwitchOnUseClusterMCLabelForCell(Int_t opt = 2) { fSetCellMCLabelFromCluster = opt ; }
150   void           SwitchOffUseClusterMCLabelForCell()             { fSetCellMCLabelFromCluster = 0   ; }
151
152 private:
153     
154   virtual void   FillCaloClusterInEvent();
155   
156   virtual void   RecPoints2Clusters();
157   
158   virtual void   ResetArrays();
159     
160   AliVEvent             *fEvent;                   // Event 
161   
162   //Geometry  
163   AliEMCALGeometry      *fGeom;                    // EMCAL geometry
164   TString                fGeomName;                // Name of geometry to use.
165   TGeoHMatrix           *fGeomMatrix[12];          // Geometry matrices with alignments
166   Bool_t                 fGeomMatrixSet;           // Set geometry matrices only once, for the first event.         
167   Bool_t                 fLoadGeomMatrices;        // Matrices set from configuration, not get from geometry.root or from ESDs/AODs
168
169   //OCDB
170   AliEMCALCalibData     *fCalibData;               // EMCAL calib data
171   AliCaloCalibPedestal  *fPedestalData;            // EMCAL pedestal
172   TString                fOCDBpath;                // Path with OCDB location
173   Bool_t                 fAccessOCDB;              // Need to access info from OCDB (not really)   
174
175   //Temporal arrays
176   TClonesArray          *fDigitsArr;               //! Digits array
177   TObjArray             *fClusterArr;              //! Recpoints array
178   TObjArray             *fCaloClusterArr;          //! CaloClusters array
179
180   //Clusterizers 
181   AliEMCALRecParam      *fRecParam;                // Reconstruction parameters container
182   AliEMCALClusterizer   *fClusterizer;             //! EMCAL clusterizer
183   AliEMCALAfterBurnerUF *fUnfolder;                //! Unfolding procedure
184   Bool_t                 fJustUnfold;              // Just unfold, do not recluster
185   
186   //AOD
187   TClonesArray          *fOutputAODBranch;         //! AOD Branch with output clusters  
188   TString                fOutputAODBranchName;     // New of output AOD branch
189   Bool_t                 fOutputAODBranchSet ;     // Set the AOD clusters branch in the input event once
190   Bool_t                 fFillAODFile;             // Fill the output AOD file with the new clusters, 
191                                                    // if not they will be only available for the event they were generated
192   Bool_t                 fFillAODHeader;           // Copy header to standard branch
193   Bool_t                 fFillAODCaloCells;        // Copy calocells to standard branch
194
195   Int_t                  fRun;                     // run number
196   
197   AliEMCALRecoUtils*     fRecoUtils;               // Access to factorized reconstruction algorithms
198   TString                fConfigName;              // Name of analysis configuration file
199   
200   
201   Int_t                  fOrgClusterCellId[12672]; // Array ID of cluster to wich the cell belongs in unmodified clusters
202   Int_t                  fCellLabels[12672];       // Array with MC label to be passed to digit.
203   Int_t                  fCellSecondLabels[12672]; // Array with Second MC label to be passed to digit. 
204   Double_t               fCellTime[12672];         // Array with cluster time to be passed to digit in case of AODs 
205   Float_t                fCellMatchdEta[12672];    // Array with cluster-track dPhi 
206   Float_t                fCellMatchdPhi[12672];    // Array with cluster-track dEta 
207
208   Bool_t                 fRecalibrateWithClusterTime; // Use fCellTime to store time of cells in cluster
209   
210   Int_t                  fMaxEvent;                // Set a maximum event
211   
212   Bool_t                 fDoTrackMatching;         // On/Off the matching recalulation to speed up analysis in PbPb
213   Bool_t                 fSelectCell;              // Reject cells from cluster if energy is too low and recalculate position/energy and other
214   Float_t                fSelectCellMinE;          // Min energy cell threshold, after unfolding
215   Float_t                fSelectCellMinFrac;       // Min fraction of cell energy after unfolding cut
216   Bool_t                 fRejectBelowThreshold;    // split (false-default) or reject (true) cell energy below threshold after UF
217   Bool_t                 fRemoveLEDEvents;         // Remove LED events, use only for LHC11a 
218   Bool_t                 fRemoveExoticEvents;      // Remove exotic events
219   
220   Bool_t                 fImportGeometryFromFile;  // Import geometry settings in geometry.root file
221   TString                fImportGeometryFilePath;  // path fo geometry.root file
222
223   Bool_t                 fOADBSet ;                // AODB parameters already set
224   Bool_t                 fAccessOADB ;             // Get calibration from OADB for EMCAL
225   TString                fOADBFilePath ;           // Default path $ALICE_ROOT/OADB/EMCAL, if needed change
226     
227   //Centrality
228   TString                fCentralityClass;         // Name of selected centrality class     
229   Float_t                fCentralityBin[2];        // Minimum and maximum value of the centrality for the analysis
230   
231   // Event selection with some signal in EMCAL
232   Bool_t                 fSelectEMCALEvent;       //  Process the event if there is some high energy cluster 
233   Float_t                fEMCALEnergyCut;         //  At least an EMCAL cluster with this energy in the event
234   Int_t                  fEMCALNcellsCut;         //  At least an EMCAL cluster with fNCellsCut cells over fEnergyCut
235
236   Int_t                  fSetCellMCLabelFromCluster; // Use cluster MC label as cell label:
237                                                      // 0 - get the MC label stored in cells
238                                                      // 1 - from old way, select 2 most likely labels
239                                                      // 2 - from new way, get the original clusters, add all the MC labels (useful for any reclusterization with output V1 clusters)
240   Bool_t                 fRemapMCLabelForAODs ;      // Remap AOD cells MC label
241
242   
243   Bool_t                 fInputFromFilter ;          // Get the input from AODs from the filter 
244   
245   AliAnalysisTaskEMCALClusterize(           const AliAnalysisTaskEMCALClusterize&); // not implemented
246   AliAnalysisTaskEMCALClusterize& operator=(const AliAnalysisTaskEMCALClusterize&); // not implemented
247
248   ClassDef(AliAnalysisTaskEMCALClusterize, 28);
249
250 };
251
252 #endif //ALIANALYSISTASKEMCALCLUSTERIZE_H