AliPhysics  a9863a5 (a9863a5)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskEMCALTimeCalib.h
Go to the documentation of this file.
1 #ifndef AliAnalysisTaskEMCALTimeCalib_h
2 #define AliAnalysisTaskEMCALTimeCalib_h
3 
4 //_________________________________________________________________________
48 //_________________________________________________________________________
49 
50 class TH1F;
51 class TH1D;
52 class TH2D;
53 class TH1C;
54 
55 //class AliESDEvent;
56 //class AliESDCaloCluster;
57 //class AliAODCaloCluster;
58 class AliVCluster;
59 //class AliAODEvent;
60 class AliVEvent;
61 class AliTOFT0maker;
62 
63 #include "AliAnalysisTaskSE.h"
64 
65 class AliAnalysisTaskEMCALTimeCalib : public AliAnalysisTaskSE
66 {
67  public:
68 
69  enum { kNSM = 20, kNBCmask = 4 };
70 
71  AliAnalysisTaskEMCALTimeCalib() : AliAnalysisTaskSE(),
72  fRunNumber(-1),
73  fTOFmaker(0),
74  fOutputList(0),
75  fgeom(0),
76  fGeometryName(0),
79  fMinNcells(0),
80  fMaxNcells(0),
81  fMinLambda0(0),
82  fMaxLambda0(0),
83  fMinLambda0LG(0),
84  fMaxLambda0LG(0),
85  fMaxRtrack(0),
86  fMinCellEnergy(0),
89  fPileupFromSPD(kFALSE),
90  fMinTime(0),
91  fMaxTime(0),
92  fRawTimeNbins (0),
93  fRawTimeMin (0),
94  fRawTimeMax (0),
95  fPassTimeNbins(0),
96  fPassTimeMin (0),
97  fPassTimeMax (0),
98  fEnergyNbins (0),
99  fEnergyMin(0),
100  fEnergyMax(0),
101  fEnergyLGNbins (0),
102  fEnergyLGMin(0),
103  fEnergyLGMax(0),
104  fFineNbins(0),
105  fFineTmin(0),
106  fFineTmax(0),
107  fL1PhaseList(0),
108  fBadReco(kFALSE),
109  fFillHeavyHisto(kFALSE),
111  fBadChannelMapSet(kFALSE),
114  fhcalcEvtTime(0),
115  fhEvtTimeHeader(0),
116  fhEvtTimeDiff(0),
117  fhEventType(0),
119  fhTcellvsTOFT0(0),
120  fhTcellvsTOFT0HD(0),
121  fhTcellvsSM(0),
122  fhEneVsAbsIdHG(0),
123  fhEneVsAbsIdLG(0),
124  fhTimeVsBC(0),
125  fhTimeSumSq(),
126  fhTimeEnt(),
127  fhTimeSum(),
128  fhTimeLGSumSq(),
129  fhTimeLGEnt(),
130  fhTimeLGSum(),
131  fhAllAverageBC(),
133  fhRefRuns(0),
134  fhTimeDsup(),
135  fhTimeDsupBC(),
136  fhTimeDsupLG(),
137  fhTimeDsupLGBC(),
138  fhRawTimeVsIdBC(),
139  fhRawTimeSumBC(),
148  fhTimeVsIdBC(),
150  { ; }
151 
152  AliAnalysisTaskEMCALTimeCalib(const char *name);
154 
155  // virtual void LocalInit();
156  //virtual Bool_t Notify();
157  virtual void NotifyRun();
158  virtual void UserCreateOutputObjects();
159  virtual void UserExec(Option_t *option);
160  virtual void Terminate(Option_t *);
161 
162  // Getters and setters
163  Int_t GetRunNumber() { return fRunNumber ; }
164  Double_t GetMinClusterEnergy() { return fMinClusterEnergy ; }
165  Double_t GetMaxClusterEnergy() { return fMaxClusterEnergy ; }
166  Int_t GetMinNcells() { return fMinNcells ; }
167  Int_t GetMaxNcells() { return fMaxNcells ; }
168  Double_t GetMinLambda0() { return fMinLambda0 ; }
169  Double_t GetMaxLambda0() { return fMaxLambda0 ; }
170  Double_t GetMinLambda0LG() { return fMinLambda0LG ; }
171  Double_t GetMaxLambda0LG() { return fMaxLambda0LG ; }
172  Double_t GetMaxRtrack() { return fMaxRtrack ; }
173  Double_t GetMinCellEnergy() { return fMinCellEnergy ; }
176  TString GetGeometryName() { return fGeometryName ; }
177  Double_t GetMinTime() { return fMinTime ; }
178  Double_t GetMaxTime() { return fMaxTime ; }
180 
181  void SetRunNumber (Int_t v) { fRunNumber = v ; }
182  void SetMinClusterEnergy (Double_t v) { fMinClusterEnergy = v ; }
183  void SetMaxClusterEnergy (Double_t v) { fMaxClusterEnergy = v ; }
184  void SetMinNcells (Int_t v) { fMinNcells = v ; }
185  void SetMaxNcells (Int_t v) { fMaxNcells = v ; }
186  void SetMinLambda0 (Double_t v) { fMinLambda0 = v ; }
187  void SetMaxLambda0 (Double_t v) { fMaxLambda0 = v ; }
188  void SetMinLambda0LG (Double_t v) { fMinLambda0LG = v ; }
189  void SetMaxLambda0LG (Double_t v) { fMaxLambda0LG = v ; }
190  void SetMaxRtrack (Double_t v) { fMaxRtrack = v ; }
191  void SetMinCellEnergy (Double_t v) { fMinCellEnergy = v ; }
192  void SetReferenceFileName(TString v) { fReferenceFileName= v ; }
194  void SetGeometryName (TString v) { fGeometryName = v ; }
195  void SetMinTime (Double_t v) { fMinTime = v ; }
196  void SetMaxTime (Double_t v) { fMaxTime = v ; }
197  void SetBadChannelFileName(TString v) { fBadChannelFileName = v ; }
198 
199  //histogram settings
200  void SetRawTimeHisto (Int_t nbins,Double_t lower,Double_t upper) {
202  fRawTimeMin = lower ;
203  fRawTimeMax = upper ;
204  }
205  void SetPassTimeHisto (Int_t nbins,Double_t lower,Double_t upper) {
207  fPassTimeMin = lower ;
208  fPassTimeMax = upper ;
209  }
210  void SetEnergyHistoHG (Int_t nbins,Double_t lower,Double_t upper) {
212  fEnergyMin = lower ;
213  fEnergyMax = upper ;
214  }
215  void SetEnergyHistoLG (Int_t nbins,Double_t lower,Double_t upper) {
217  fEnergyLGMin = lower ;
218  fEnergyLGMax = upper ;
219  }
220 
221  void SetFineT0Histo (Int_t nbins,Double_t lower,Double_t upper) {
222  fFineNbins = nbins;
223  fFineTmin = lower ;
224  fFineTmax = upper ;
225  }
226 
227 
228  // Switches
231 
232  void SwitchOnBadReco() { fBadReco = kTRUE ; }
233  void SwitchOffBadReco() { fBadReco = kFALSE ; }
234 
237 
240 
241  void SetDefaultCuts();
242  void LoadReferenceHistos(); //loaded once per period to the memory
243 
244  void LoadReferenceRunByRunHistos(); //loaded once to the memory at the beginning, phases for all runs
245  void SetL1PhaseReferenceForGivenRun();//set refernce L1phase per run
246 
247  void LoadBadChannelMap(); //load bad channel map, main
248  void LoadBadChannelMapFile(); //load bad channel map from file
249  void LoadBadChannelMapOADB();//load bad channel map from OADB
250  Int_t GetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow) const {
251  if(fBadChannelMapArray) return (Int_t) ((TH2I*)fBadChannelMapArray->At(iSM))->GetBinContent(iCol,iRow);
252  else return 0;}//Channel is ok by default
253  Int_t GetEMCALChannelStatus(Int_t absId) const {
254  if(fBadChannelMapArray) return (Int_t) ((TH2I*)fBadChannelMapArray->At(0))->GetBinContent(absId+1);
255  else return 0;}//Channel is ok by default
256 
257  static void ProduceCalibConsts(TString inputFile="time186319testWOL0.root",TString outputFile="Reference.root",Bool_t isFinal=kFALSE);
258  static void ProduceOffsetForSMsV2(Int_t runNumber,TString inputFile="Reference.root",TString outputFile="ReferenceSM.root",Bool_t offset100=kTRUE);
259 
260  private:
261 
262  virtual void PrepareTOFT0maker();
263  Bool_t SetEMCalGeometry();
264  Bool_t AcceptCluster(AliVCluster* clus);
265  Bool_t CheckCellRCU(Int_t nSupMod,Int_t icol,Int_t irow);
266  Bool_t IsLowGainCellInCluster(AliVCluster* clus);
267 
268  // data members
269  Int_t fRunNumber ;
270 
272  AliTOFT0maker *fTOFmaker; //->
273 
275  TList *fOutputList; //->
276 
278  AliEMCALGeometry *fgeom;
279  TString fGeometryName ;
280 
281  // setable variables for cuts
282 
283  Double_t fMinClusterEnergy ;
284  Double_t fMaxClusterEnergy ;
285 
286  Int_t fMinNcells ;
287  Int_t fMaxNcells ;
288 
289  Double_t fMinLambda0 ;
290  Double_t fMaxLambda0 ;
291  Double_t fMinLambda0LG ;
292  Double_t fMaxLambda0LG ;
293 
294  Double_t fMaxRtrack ;
295 
296  Double_t fMinCellEnergy;
297 
300 
301  Bool_t fPileupFromSPD ;
302 
303  Double_t fMinTime ;
304  Double_t fMaxTime ;
305 
306  //histogram settings
307  Int_t fRawTimeNbins ;
308  Double_t fRawTimeMin ;
309  Double_t fRawTimeMax ;
311  Double_t fPassTimeMin ;
312  Double_t fPassTimeMax ;
313  Int_t fEnergyNbins ;
314  Double_t fEnergyMin ;
315  Double_t fEnergyMax ;
317  Double_t fEnergyLGMin ;
318  Double_t fEnergyLGMax ;
319  Int_t fFineNbins ;
320  Double_t fFineTmin ;
321  Double_t fFineTmax ;
322 
323  TObjArray *fL1PhaseList;
324  Bool_t fBadReco;
325 
327 
328  // bad channel map
329  TObjArray *fBadChannelMapArray;
333 
334  // histograms
338  TH1F *fhEventType;
342  TH2F *fhTcellvsSM;
345  TH2F *fhTimeVsBC;
346 
347  // histos for storing the time values per cell for further averaging;
349  TH1F *fhTimeEnt [kNBCmask];
350  TH1F *fhTimeSum [kNBCmask];
354 
355  // histos with reference values after the first iteration
358 
359  // histo with reference values run-by-run after the first iteration
360  TH1C *fhRefRuns;
361 
362  // control histos
363  TH2F *fhTimeDsup [kNSM];
365  TH2F *fhTimeDsupLG [kNSM];
367 
368  //main histos for raw time
377 
378  //histos for raw time after wrong reconstruction correction (100ns and L1 phase)
381 
382  //histos for raw time after wrong reconstruction correction (100ns and L1 phase) and new L1 phase
385 
388 
391 
393  ClassDef(AliAnalysisTaskEMCALTimeCalib, 3) ;
395 };
396 
397 #endif
Bool_t SetEMCalGeometry()
Set the EMCal Geometry.
TH1F * fhRawTimeEntriesLGBC[kNBCmask]
! 4 BCmask LG
TH2F * fhEneVsAbsIdHG
! energy of each cell for high gain cells with strange time
Double_t fPassTimeMax
upper range of histo with time in passX
TH1F * fhRawTimeSumLGBC[kNBCmask]
! 4 BCmask LG
void SetRawTimeHisto(Int_t nbins, Double_t lower, Double_t upper)
Bool_t AcceptCluster(AliVCluster *clus)
Selection criteria of good cluster are set here.
TH2F * fhRawTimeVsIdBC[kNBCmask]
! 4 BCmask HG
Int_t fFineNbins
number of bins of histo with T0 time
TH1F * fhRawTimeSumSqBC[kNBCmask]
! 4 BCmask HG
Double_t fMinLambda0
minimum cluster lambda0
Int_t fEnergyLGNbins
number of bins of histo with energy LG
Int_t GetEMCALChannelStatus(Int_t iSM, Int_t iCol, Int_t iRow) const
TH1F * fhcalcEvtTime
! spectrum calcolot0[0]
Bool_t fBadReco
flag to apply 100ns shift and L1 shift
Double_t fEnergyMin
lower range of histo with energy HG
TString fReferenceRunByRunFileName
name of reference file (run-by-run)
TObjArray * fL1PhaseList
array with phases for set of runs
Double_t fMinTime
minimum cluster time after correction
AliTOFT0maker * fTOFmaker
pointer to get T0 from TOF
Double_t fFineTmax
upper range of histo with T0 time
void SetDefaultCuts()
Set default cuts for calibration.
Int_t fSetBadChannelMapSource
switch to load BC map 0-no BC,1-OADB,2-file
AliAnalysisTaskEMCALTimeCalib & operator=(const AliAnalysisTaskEMCALTimeCalib &)
Assignment operator not implemented.
void LoadBadChannelMap()
Load Bad Channel Map from different source.
Double_t fRawTimeMin
lower range of histo with raw time
TH2F * fhTimeDsupLG[kNSM]
! 20 SM low gain
TH1F * fhRawTimeSumSqLGBC[kNBCmask]
! 4 BCmask LG
void SetEnergyHistoLG(Int_t nbins, Double_t lower, Double_t upper)
static void ProduceOffsetForSMsV2(Int_t runNumber, TString inputFile="Reference.root", TString outputFile="ReferenceSM.root", Bool_t offset100=kTRUE)
Double_t fMaxRtrack
maximum cluster track distance
Double_t fMaxLambda0
maximum cluster lambda0
AliEMCALGeometry * fgeom
pointer to EMCal geometry
Double_t fRawTimeMax
upper range of histo with raw time
TH2F * fhTcellvsTOFT0HD
! time of cell vs TOF T0 time for higher energy threshold
TH2F * fhRawCorrTimeVsIdBC[kNBCmask]
! 4 BCmask HG
TH2F * fhRawCorrTimeVsIdLGBC[kNBCmask]
! 4 BCmask LG
Bool_t IsLowGainCellInCluster(AliVCluster *clus)
Check if low gain cell is in a cluster.
Double_t fMaxTime
maximum cluster time after correction
Double_t fEnergyMax
upper range of histo with energy HG
void SetPassTimeHisto(Int_t nbins, Double_t lower, Double_t upper)
Double_t fMinClusterEnergy
minimum cluster energy
Int_t GetEMCALChannelStatus(Int_t absId) const
TObjArray * fBadChannelMapArray
bad channel map array
Double_t fEnergyLGMax
upper range of histo with energy LG
Double_t fFineTmin
lower range of histo with T0 time
TString fReferenceFileName
! name of reference file (for one period)
Int_t fMaxNcells
maximum number of cells in cluster
virtual void UserExec(Option_t *option)
Main loop executed for each event.
virtual void PrepareTOFT0maker()
Get T0 time from TOF.
TH1F * fhTOFT0vsEventNumber
! TOF T0 evolution as a function of time
Bool_t fPileupFromSPD
flag to set PileupFromSPD
TH1F * fhRawTimeSumBC[kNBCmask]
! 4 BCmask HG
Double_t fMinCellEnergy
minimum cell energy
Int_t fMinNcells
minimum number of cells in cluster
Double_t fEnergyLGMin
lower range of histo with energy LG
Task to work on Time Calibration for EMCal/DCal.
Double_t fMinLambda0LG
minimum cluster lambda0 Low Gain
Double_t fMaxClusterEnergy
maximum cluster energy
Bool_t fBadChannelMapSet
flag whether bad channel map is set
TH1F * fhEvtTimeHeader
! spectrum time from header
TH1F * fhEvtTimeDiff
! spectrum time difference
void SetFineT0Histo(Int_t nbins, Double_t lower, Double_t upper)
TH2F * fhTcellvsTOFT0
! time of cell vs TOF T0 time
Double_t fPassTimeMin
lower range of histo with time in passX
Double_t fMaxLambda0LG
maximum cluster lambda0 Low Gain
static void ProduceCalibConsts(TString inputFile="time186319testWOL0.root", TString outputFile="Reference.root", Bool_t isFinal=kFALSE)
TH2F * fhEneVsAbsIdLG
! energy of each cell for low gain cells with strange time
Int_t fPassTimeNbins
number of bins of histo with time in passX
TList * fOutputList
pointer to output list
TH1F * fhRawTimeEntriesBC[kNBCmask]
! 4 BCmask HG
TH2F * fhTimeVsIdBC[kNBCmask]
! 4 BCmask HG
void SetEnergyHistoHG(Int_t nbins, Double_t lower, Double_t upper)
TH2F * fhTimeVsIdLGBC[kNBCmask]
! 4 BCmask LG
Bool_t CheckCellRCU(Int_t nSupMod, Int_t icol, Int_t irow)
Check RCU for cell given by Super Module, column index, row index.
TH2F * fhRawTimeVsIdLGBC[kNBCmask]
! 4 BCmask LG
void LoadReferenceHistos()
Load reference Histograms (for one period) from file.
const Int_t nbins
TString fBadChannelFileName
! name of file with bad channels
TH1F * fhAllAverageLGBC[kNBCmask]
4 BCmask High gain
Bool_t fFillHeavyHisto
flag to fill heavy histograms
Int_t fEnergyNbins
number of bins of histo with energy HG
Int_t fRawTimeNbins
number of bins of histo with raw time
TH2F * fhTimeDsup[kNSM]
! 20 SM high gain
TH2F * fhTimeDsupBC[kNSM][kNBCmask]
! 20 x 4 high gain
TH2F * fhTimeDsupLGBC[kNSM][kNBCmask]
! 20 x 4 low gain