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