add fix for MC LHC14a1a, add possibility to switch off the automatic init of the...
[u/mrichter/AliRoot.git] / ANALYSIS / TenderSupplies / AliEMCALTenderSupply.h
CommitLineData
6d67b5a7 1#ifndef ALIEMCALTENDERSUPPLY_H
2#define ALIEMCALTENDERSUPPLY_H
3
4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6
7////////////////////////////////////////////////////////////////////////
8// //
9// EMCAL tender, apply corrections to EMCAl clusters //
766cc9de 10// and do track matching. //
11// Author: Deepa Thomas (Utrecht University) //
c05ffa77 12// Later mods/rewrite: Jiri Kral (University of Jyvaskyla) //
dd8e12d1 13// S. Aiola, C. Loizides : Make it work for AODs //
6d67b5a7 14// //
15////////////////////////////////////////////////////////////////////////
16
766cc9de 17#include "AliTenderSupply.h"
6d67b5a7 18
b20bc239 19class TTree;
20class TClonesArray;
21
6d67b5a7 22class AliVCluster;
23class AliEMCALRecoUtils;
24class AliEMCALGeometry;
25class TGeoHMatrix;
26class TTree;
27class TFile;
28class TString;
b20bc239 29class AliEMCALClusterizer;
b20bc239 30class AliEMCALAfterBurnerUF;
4d3c549c 31class AliEMCALRecParam;
dd8e12d1 32class AliAnalysisTaskSE;
33class AliVEvent;
acf53135 34
6d67b5a7 35class AliEMCALTenderSupply: public AliTenderSupply {
36
37public:
38 AliEMCALTenderSupply();
39 AliEMCALTenderSupply(const char *name, const AliTender *tender=NULL);
dd8e12d1 40 AliEMCALTenderSupply(const char *name, AliAnalysisTaskSE *task);
6d67b5a7 41 virtual ~AliEMCALTenderSupply();
42
ef51b5f7 43 enum NonlinearityFunctions{kPi0MC=0,kPi0GammaGamma=1,kPi0GammaConversion=2,kNoCorrection=3,kBeamTest=4,kBeamTestCorrected=5};
a0beb012 44 enum MisalignSettings{kdefault=0,kSurveybyS=1,kSurveybyM=2};
ef51b5f7 45
766cc9de 46 virtual void Init();
47 virtual void ProcessEvent();
dd8e12d1 48
49 void SetTask(AliAnalysisTaskSE *task) { fTask = task ;}
98e8eede 50 void SetDefaults();
dd8e12d1 51
e768f43c 52 void SetEMCALGeometryName(const char *name) { fEMCALGeoName = name ;}
766cc9de 53 TString EMCALGeometryName() const { return fEMCALGeoName ;}
6d67b5a7 54
766cc9de 55 void SetDebugLevel(Int_t level) { fDebugLevel=level ;}
6d67b5a7 56
766cc9de 57 void SetBasePath(const Char_t *basePath) { fBasePath = basePath ;}
b20bc239 58
e768f43c 59 void SetConfigFileName(const char *name) { fConfigName = name ;}
413a7463 60
766cc9de 61 void SetNonLinearityFunction(Int_t fun) { fNonLinearFunc = fun ;}
62 Int_t GetNonLinearityFunction() const { return fNonLinearFunc ;}
6d67b5a7 63
766cc9de 64 void SetNonLinearityThreshold(Int_t threshold) { fNonLinearThreshold = threshold ;} //only for Alexei's non linearity correction
65 Int_t GetNonLinearityThreshold() const { return fNonLinearThreshold ;}
6d67b5a7 66
50b7a951 67 void SwitchOnNonLinearityCorrection() { fDoNonLinearity = kTRUE ;}
68 void SwitchOffNonLinearityCorrection() { fDoNonLinearity = kFALSE ;}
69
766cc9de 70 void SwitchOnReCalibrateCluster() { fReCalibCluster = kTRUE ;}
71 void SwitchOffReCalibrateCluster() { fReCalibCluster = kFALSE ;}
c958a2f7 72
766cc9de 73 void SwitchOnRecalculateClusPos() { fRecalClusPos = kTRUE ;}
74 void SwitchOffRecalculateClusPos() { fRecalClusPos = kFALSE ;}
6d67b5a7 75
dd8e12d1 76 void SetMisalignmentMatrixSurvey(Int_t misalignSurvey) { fMisalignSurvey = misalignSurvey ;}
77 Int_t GetMisalignmentMatrixSurvey() const { return fMisalignSurvey ;}
acf53135 78
766cc9de 79 void SwitchOnCellFiducialRegion() { fFiducial = kTRUE ;}
80 void SwitchOffCellFiducialRegion() { fFiducial = kFALSE ;}
6d67b5a7 81
50b7a951 82 void SetNumberOfCellsFromEMCALBorder(Int_t n) { fNCellsFromEMCALBorder = n ;}
83 Int_t GetNumberOfCellsFromEMCALBorder() const { return fNCellsFromEMCALBorder ;}
6d67b5a7 84
766cc9de 85 void SwitchOnRecalDistBadChannel() { fRecalDistToBadChannels = kTRUE ;}
86 void SwitchOffRecalDistBadChannel() { fRecalDistToBadChannels = kFALSE ;}
6d67b5a7 87
50b7a951 88 void SwitchOnRecalShowerShape() { fRecalShowerShape = kTRUE ;}
89 void SwitchOffRecalShowerShape() { fRecalShowerShape = kFALSE ;}
90
766cc9de 91 Float_t GetRCut() const { return fRcut ;}
92 void SetRCut(Float_t rcut) { fRcut = rcut ;}
6d67b5a7 93
766cc9de 94 Double_t GetMass() const { return fMass ;}
95 void SetMass(Double_t mass) { fMass = mass ;}
6d67b5a7 96
766cc9de 97 Double_t GetStep() const { return fStep ;}
98 void SetStep(Double_t step) { fStep = step ;}
6d67b5a7 99
6b7df55d 100 Double_t GetEtaCut() const { return fEtacut ;}
50b7a951 101 void SetEtaCut(Double_t eta) { fEtacut = eta ;}
102
103 Double_t GetPhiCut() const { return fPhicut ;}
104 void SetPhiCut(Double_t phi) { fPhicut = phi ;}
105
106 Float_t GetExoticCellFraction() const { return fExoticCellFraction ;}
107 void SetExoticCellFraction(Float_t f) { fExoticCellFraction = f ;}
428f69ce 108
50b7a951 109 Float_t GetExoticCellDiffTime() const { return fExoticCellDiffTime ;}
110 void SetExoticCellDiffTime(Float_t f) { fExoticCellDiffTime = f ;}
111
112 Float_t GetExoticCellMinAmplitude() const { return fExoticCellMinAmplitude ;}
113 void SetExoticCellMinAmplitude(Float_t f) { fExoticCellMinAmplitude = f ;}
428f69ce 114
6b7df55d 115 void SwitchOnReclustering() { fReClusterize = kTRUE ;}
116 void SwitchOffReclustering() { fReClusterize = kFALSE ;}
428f69ce 117
766cc9de 118 void SwitchOnCutEtaPhiSum() { fCutEtaPhiSum=kTRUE; fCutEtaPhiSeparate=kFALSE ;}
119 void SwitchOnCutEtaPhiSeparate() { fCutEtaPhiSeparate=kTRUE; fCutEtaPhiSum=kFALSE ;}
b20bc239 120
766cc9de 121 void SwitchOnLoadOwnGeometryMatrices() { fLoadGeomMatrices = kTRUE ;}
122 void SwitchOffLoadOwnGeometryMatrices() { fLoadGeomMatrices = kFALSE ;}
123 void SetGeometryMatrixInSM(TGeoHMatrix* m, Int_t i) { fEMCALMatrix[i] = m ;}
3b233502 124
8b775c10 125 AliEMCALRecParam *GetRecParam() const { return fRecParam ;}
a0beb012 126 void SetRecParam(AliEMCALRecParam *p) { fRecParam = p ;}
8b775c10 127
acf53135 128 AliEMCALRecoUtils *GetRecoUtils() const { return fEMCALRecoUtils ;}
5b6de4be 129 void SetRecoUtils(AliEMCALRecoUtils *r) { fEMCALRecoUtils = r ;}
130
8b775c10 131 void SwitchOnUpdateCell() { fUpdateCell = kTRUE ;}
50b7a951 132 void SwitchOffUpdateCell() { fUpdateCell = kFALSE ;}
133
134 void SwitchOnBadCellRemove() { fBadCellRemove = kTRUE ;}
135 void SwitchOffBadCellRemove() { fBadCellRemove = kFALSE ;}
136
137 void SwitchOnClusterBadChannelCheck() { fClusterBadChannelCheck = kTRUE ;}
138 void SwitchOffClusterBadChannelCheck() { fClusterBadChannelCheck = kFALSE ;}
139
140 void SwitchOnExoticCellRemove() { fRejectExoticCells = kTRUE ;}
141 void SwitchOffExoticCellRemove() { fRejectExoticCells = kFALSE ;}
142
143 void SwitchOnClusterExoticChannelCheck() { fRejectExoticClusters = kTRUE ;}
144 void SwitchOffClusterExoticChannelCheck() { fRejectExoticClusters = kFALSE ;}
145
146 void SwitchOnCalibrateEnergy() { fCalibrateEnergy = kTRUE ;}
147 void SwitchOffCalibrateEnergy() { fCalibrateEnergy = kFALSE ;}
148
149 void SwitchOnCalibrateTime() { fCalibrateTime = kTRUE ;}
150 void SwitchOffCalibrateTime() { fCalibrateTime = kFALSE ;}
a0beb012 151
152 void SwitchOnUpdateCellOnly() { fDoUpdateOnly = kTRUE ;}
50b7a951 153 void SwitchOffUpdateCellOnly() { fDoUpdateOnly = kFALSE ;}
6d67b5a7 154
6e6de0c3 155 void SwitchOnTrackMatch() { fDoTrackMatch = kTRUE ;}
156 void SwitchOffTrackMatch() { fDoTrackMatch = kFALSE ;}
157
2b0653b9 158 void SetPass(const char* p) { fFilepass = p; fGetPassFromFileName = kFALSE; }
159 void UnsetPass() { fFilepass = ""; fGetPassFromFileName = kTRUE; }
d2744cb4 160
161 //MC label methods
162
163 void RemapMCLabelForAODs(Int_t &label);
164 void SwitchOnRemapMCLabelForAODs() { fRemapMCLabelForAODs = kTRUE ; }
165 void SwitchOffRemapMCLabelForAODs() { fRemapMCLabelForAODs = kFALSE ; }
166
167 void SetClustersMCLabelFromOriginalClusters() ;
168 void SwitchOnUseClusterMCLabelForCell(Int_t opt = 2) { fSetCellMCLabelFromCluster = opt ; }
169 void SwitchOffUseClusterMCLabelForCell() { fSetCellMCLabelFromCluster = 0 ; }
170
27dfca64 171 // Switch on/off the automatic setting of different calibrations, only experts
172 void SwitchOnUseAutomaticRecalibParam() { fUseAutomaticRecalib = kTRUE ; }
173 void SwitchOnUseAutomaticRunDepRecalibParam() { fUseAutomaticRunDepRecalib = kTRUE ; }
174 void SwitchOnUseAutomaticTimeCalibParam() { fUseAutomaticTimeCalib = kTRUE ; }
175 void SwitchOnUseAutomaticRecParam() { fUseAutomaticRecParam = kTRUE ; }
176
177 void SwitchOffUseAutomaticRecalibParam() { fUseAutomaticRecalib = kFALSE ; }
178 void SwitchOffUseAutomaticRunDepRecalibParam() { fUseAutomaticRunDepRecalib = kFALSE ; }
179 void SwitchOffUseAutomaticTimeCalibParam() { fUseAutomaticTimeCalib = kFALSE ; }
180 void SwitchOffUseAutomaticRecParam() { fUseAutomaticRecParam = kFALSE ; }
d2744cb4 181
6d67b5a7 182private:
183
dd8e12d1 184 AliVEvent* GetEvent();
dd8e12d1 185 TString GetBeamType();
dd8e12d1 186 Bool_t RunChanged() const;
dd8e12d1 187 Int_t InitBadChannels();
dd8e12d1 188 Bool_t InitClusterization();
dd8e12d1 189 Int_t InitRecParam();
dd8e12d1 190 Bool_t InitMisalignMatrix();
dd8e12d1 191 Int_t InitRecalib();
7bf608c9 192 Int_t InitRunDepRecalib();
dd8e12d1 193 Int_t InitTimeCalibration();
dd8e12d1 194 void Clusterize();
dd8e12d1 195 void FillDigitsArray();
dd8e12d1 196 void GetPass();
dd8e12d1 197 void RecPoints2Clusters(TClonesArray *clus);
dd8e12d1 198 void RecalibrateCells();
dd8e12d1 199 void UpdateCells();
dd8e12d1 200 void UpdateClusters();
766cc9de 201
98e8eede 202 AliAnalysisTaskSE *fTask; // analysis task
203 Int_t fRun; // current run number
6931af96 204 AliEMCALGeometry *fEMCALGeo; // EMCAL geometry
98e8eede 205 TString fEMCALGeoName; // name of geometry to use.
206 AliEMCALRecoUtils *fEMCALRecoUtils; // pointer to EMCAL utilities for clusterization
207 TString fConfigName; // name of analysis configuration file
208 Int_t fDebugLevel; // debug level
209 Int_t fNonLinearFunc; // non linearity function
210 Int_t fNonLinearThreshold; // non linearity threshold value for kBeamTesh non linearity function
211 Bool_t fReCalibCluster; // switch for Recalibrate clusters
212 Bool_t fUpdateCell; // flag cell update
6a764914 213 Bool_t fCalibrateEnergy; // flag cell energy calibration
214 Bool_t fCalibrateTime; // flag cell time calibration
215 Bool_t fCalibrateTimeParamAvailable; // Check if time calib param are available to set properly time cuts
98e8eede 216 Bool_t fDoNonLinearity; // nNon linearity correction flag
217 Bool_t fBadCellRemove; // zero bad cells
50b7a951 218 Bool_t fRejectExoticCells; // reject exotic cells
219 Bool_t fRejectExoticClusters; // recect clusters with exotic cells
98e8eede 220 Bool_t fClusterBadChannelCheck; // check clusters for bad channels
221 TGeoHMatrix *fEMCALMatrix[12]; // geometry matrices with misalignments
222 Bool_t fRecalClusPos; // switch for applying missalignment
223 Bool_t fFiducial; // switch for checking cells in the fiducial region
224 Int_t fNCellsFromEMCALBorder; // number os cells from EMCAL border
225 Bool_t fRecalDistToBadChannels; // switch for recalculation cluster position from bad channel
226 Bool_t fRecalShowerShape; // switch for recalculation of the shower shape
227 TTree *fInputTree; //!input data tree
228 TFile *fInputFile; //!input data file
2b0653b9 229 Bool_t fGetPassFromFileName; // get fFilepass from file name
230 TString fFilepass; // input data pass number
98e8eede 231 Double_t fMass; // mass for track matching
232 Double_t fStep; // step size during track matching
233 Bool_t fCutEtaPhiSum; // swicth to apply residual cut together
234 Bool_t fCutEtaPhiSeparate; // swicth to apply residual cut separately
235 Float_t fRcut; // residual cut for track matching
236 Float_t fEtacut; // eta cut for track matching
237 Float_t fPhicut; // phi cut for track matching
238 TString fBasePath; // base folder path to get root files
239 Bool_t fReClusterize; // switch for reclustering
240 AliEMCALClusterizer *fClusterizer; //!clusterizer
241 Bool_t fGeomMatrixSet; // set geometry matrices only once, for the first event.
242 Bool_t fLoadGeomMatrices; // matrices set from configuration, not get from geometry.root or from ESDs/AODs
243 AliEMCALRecParam *fRecParam; // reconstruction parameters container
244 Bool_t fDoTrackMatch; // do track matching
245 Bool_t fDoUpdateOnly; // do only update of cells
246 AliEMCALAfterBurnerUF *fUnfolder; //!unfolding procedure
247 TClonesArray *fDigitsArr; //!digits array
248 TObjArray *fClusterArr; //!recpoints array
6931af96 249 Int_t fMisalignSurvey; // misalignment matrix survey
98e8eede 250 Float_t fExoticCellFraction; // good cell if fraction < 1-ecross/ecell
251 Float_t fExoticCellDiffTime; // if time of candidate to exotic and close cell is too different (in ns), it must be noisy, set amp to 0
252 Float_t fExoticCellMinAmplitude; // check for exotic only if amplitud is larger than this value
8b775c10 253
d2744cb4 254 // MC labels
255 Int_t fOrgClusterCellId[12672]; // Array ID of cluster to wich the cell belongs in unmodified clusters
256
257 Int_t fSetCellMCLabelFromCluster; // Use cluster MC label as cell label:
258 // 0 - get the MC label stored in cells
259 // 1 - assign to the cell the MC lable of the cluster
260 // 2 - get the original clusters id, add all the MC labels
261 TClonesArray * fTempClusterArr ; //! Temporal clusters array to recover the MC of original cluster if fSetCellMCLabelFromCluster=2
262 Bool_t fRemapMCLabelForAODs ; // Remap AOD cells MC label
6e6de0c3 263
27dfca64 264 // Change to false if experts
265 Bool_t fUseAutomaticRecalib; // On by default the check in the OADB of the energy recalibration
266 Bool_t fUseAutomaticRunDepRecalib; // On by default the check in the OADB of the run dependent energy recalibration
267 Bool_t fUseAutomaticTimeCalib; // On by default the check in the OADB of the time recalibration
268 Bool_t fUseAutomaticRecParam; // On the auto setting of the rec param
269
d2744cb4 270 AliEMCALTenderSupply( const AliEMCALTenderSupply&c);
6d67b5a7 271 AliEMCALTenderSupply& operator= (const AliEMCALTenderSupply&c);
272
27dfca64 273 ClassDef(AliEMCALTenderSupply, 17); // EMCAL tender task
6d67b5a7 274};
6d67b5a7 275#endif