AliPhysics  abafffd (abafffd)
AliAnalysisTaskEMCALTimeCalib.h
Go to the documentation of this file.
1 #ifndef AliAnalysisTaskEMCALTimeCalib_h
2 #define AliAnalysisTaskEMCALTimeCalib_h
3 
4 //_________________________________________________________________________
50 //_________________________________________________________________________
51 
52 class TH1F;
53 class TH1D;
54 class TH2D;
55 class TH1C;
56 
57 //class AliESDEvent;
58 //class AliESDCaloCluster;
59 //class AliAODCaloCluster;
60 class AliVCluster;
61 //class AliAODEvent;
62 class AliVEvent;
63 //class AliTOFT0maker;
64 
65 #include "AliAnalysisTaskSE.h"
66 #include <fstream>
67 
69 {
70  public:
71 
72  enum { kNSM = 20, kNBCmask = 4 };
73 
75  fRunNumber(-1),
76  // fTOFmaker(0),
77  fOutputList(0),
78  fgeom(0),
79  fGeometryName(0),
82  fMinNcells(0),
83  fMaxNcells(0),
84  fMinLambda0(0),
85  fMaxLambda0(0),
86  fMinLambda0LG(0),
87  fMaxLambda0LG(0),
88  fMaxRtrack(0),
89  fMinCellEnergy(0),
92  fPileupFromSPD(kFALSE),
93  fMinTime(0),
94  fMaxTime(0),
95  fMostEneCellOnly(kFALSE),
96  fRawTimeNbins (0),
97  fRawTimeMin (0),
98  fRawTimeMax (0),
99  fPassTimeNbins(0),
100  fPassTimeMin (0),
101  fPassTimeMax (0),
102  fEnergyNbins (0),
103  fEnergyMin(0),
104  fEnergyMax(0),
105  fEnergyLGNbins (0),
106  fEnergyLGMin(0),
107  fEnergyLGMax(0),
108  fFineNbins(0),
109  fFineTmin(0),
110  fFineTmax(0),
111  fL1PhaseList(0),
112  fBadReco(kFALSE),
113  fFillHeavyHisto(kFALSE),
115  fBadChannelMapSet(kFALSE),
118  fhcalcEvtTime(0),
119  fhEvtTimeHeader(0),
120  fhEvtTimeDiff(0),
121  fhEventType(0),
123  fhTcellvsTOFT0(0),
124  fhTcellvsTOFT0HD(0),
125  fhTcellvsSM(0),
126  fhEneVsAbsIdHG(0),
127  fhEneVsAbsIdLG(0),
128  fhTimeVsBC(0),
129  fhTimeSumSq(),
130  fhTimeEnt(),
131  fhTimeSum(),
132  fhTimeLGSumSq(),
133  fhTimeLGEnt(),
134  fhTimeLGSum(),
135  fhAllAverageBC(),
137  fhRefRuns(0),
138  fhTimeDsup(),
139  fhTimeDsupBC(),
140  fhTimeDsupLG(),
141  fhTimeDsupLGBC(),
142  fhRawTimeVsIdBC(),
143  fhRawTimeSumBC(),
152  fhTimeVsIdBC(),
154  { ; }
155 
156  AliAnalysisTaskEMCALTimeCalib(const char *name);
158 
159  // struct for storing PAR info
160  struct PARInfo {
163  std::vector<ULong64_t> PARGlobalBCs;
164  };
165 
166  // virtual void LocalInit();
167  //virtual Bool_t Notify();
168  virtual void NotifyRun();
169  virtual void UserCreateOutputObjects();
170  virtual void UserExec(Option_t *option);
171  virtual void Terminate(Option_t *);
172 
173  // Getters and setters
188  Double_t GetMinTime() { return fMinTime ; }
189  Double_t GetMaxTime() { return fMaxTime ; }
191 
192  void SetRunNumber (Int_t v) { fRunNumber = v ; }
195  void SetMinNcells (Int_t v) { fMinNcells = v ; }
196  void SetMaxNcells (Int_t v) { fMaxNcells = v ; }
197  void SetMinLambda0 (Double_t v) { fMinLambda0 = v ; }
198  void SetMaxLambda0 (Double_t v) { fMaxLambda0 = v ; }
201  void SetMaxRtrack (Double_t v) { fMaxRtrack = v ; }
206  void SetMinTime (Double_t v) { fMinTime = v ; }
207  void SetMaxTime (Double_t v) { fMaxTime = v ; }
209 
210  //histogram settings
213  fRawTimeMin = lower ;
214  fRawTimeMax = upper ;
215  }
218  fPassTimeMin = lower ;
219  fPassTimeMax = upper ;
220  }
223  fEnergyMin = lower ;
224  fEnergyMax = upper ;
225  }
228  fEnergyLGMin = lower ;
229  fEnergyLGMax = upper ;
230  }
231 
233  fFineNbins = nbins;
234  fFineTmin = lower ;
235  fFineTmax = upper ;
236  }
237 
238 
239  // Switches
242 
245 
246  void SwitchOnBadReco() { fBadReco = kTRUE ; }
247  void SwitchOffBadReco() { fBadReco = kFALSE ; }
248 
251 
254 
255  void SetDefaultCuts();
256  void LoadReferenceHistos(); //loaded once per period to the memory
257 
258  void LoadReferenceRunByRunHistos(); //loaded once to the memory at the beginning, phases for all runs
259  void SetL1PhaseReferenceForGivenRun();//set refernce L1phase per run
260 
261  void SetL1PhaseReferencePAR();//set reference L1phase for specific PAR in run
262  void SetPARInfo(TString PARfilename);//for given run, load in PAR info from file
263 
264  void LoadBadChannelMap(); //load bad channel map, main
265  void LoadBadChannelMapFile(); //load bad channel map from file
266  void LoadBadChannelMapOADB();//load bad channel map from OADB
267  Int_t GetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow) const {
268  if(fBadChannelMapArray) return (Int_t) ((TH2I*)fBadChannelMapArray->At(iSM))->GetBinContent(iCol,iRow);
269  else return 0;}//Channel is ok by default
271  if(fBadChannelMapArray) return (Int_t) ((TH2I*)fBadChannelMapArray->At(0))->GetBinContent(absId+1);
272  else return 0;}//Channel is ok by default
273 
274  static void ProduceCalibConsts(TString inputFile="time186319testWOL0.root",TString outputFile="Reference.root",Bool_t isFinal=kFALSE, Bool_t isPAR=kFALSE);
275  static void ProduceOffsetForSMsV2(Int_t runNumber,TString inputFile="Reference.root",TString outputFile="ReferenceSM.root",Bool_t offset100=kTRUE, Bool_t justL1phase=kTRUE,TString PARfilename="");
276 
277  private:
278 
279  // variables and functions needed for PAR handling
280  std::vector<PARInfo> fPARvec;
283  Bool_t fIsPARRun = kFALSE;
284  void GetPARInfoForRunNumber(Int_t runnum);
285 
286 
287  virtual void PrepareTOFT0maker();
289  Bool_t AcceptCluster(AliVCluster* clus);
290  Bool_t CheckCellRCU(Int_t nSupMod,Int_t icol,Int_t irow);
291  Bool_t IsLowGainCellInCluster(AliVCluster* clus);
292 
293  // data members
295 
296 // /// pointer to get T0 from TOF
297 // AliTOFT0maker *fTOFmaker; //->
298 
301 
303  AliEMCALGeometry *fgeom;
305 
306  // setable variables for cuts
307 
310 
313 
318 
320 
322 
325 
327 
330 
332 
333  //histogram settings
349 
352 
354 
355  // bad channel map
360 
361  // histograms
365  TH1F *fhEventType;
373 
374  // histos for storing the time values per cell for further averaging;
376  TH1F *fhTimeEnt [kNBCmask];
377  TH1F *fhTimeSum [kNBCmask];
381 
382  // histos with reference values after the first iteration
385 
386  // histo with reference values run-by-run after the first iteration
387  TH1C *fhRefRuns;
388 
389  // control histos
394 
395  //main histos for raw time
404 
405  //histos for correction of Raw Time with PAR
406  std::vector<std::vector<TH2F*>> fhRawTimePARs;
407  std::vector<std::vector<TH2F*>> fhRawTimeLGPARs;
408 
409  //histos for raw time after wrong reconstruction correction (100ns and L1 phase)
412 
413  //histos for raw time after wrong reconstruction correction (100ns and L1 phase) and new L1 phase
416 
419 
422 
424  ClassDef(AliAnalysisTaskEMCALTimeCalib, 5) ;
426 };
427 
428 #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
double Double_t
Definition: External.C:58
Int_t fFineNbins
number of bins of histo with T0 time
Definition: External.C:236
TH1F * fhRawTimeSumSqBC[kNBCmask]
! 4 BCmask HG
Double_t fMinLambda0
minimum cluster lambda0
Int_t fCurrentPARIndex
Par Info for current Run Number.
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
std::vector< std::vector< TH2F * > > fhRawTimeLGPARs
!
Double_t fMinTime
minimum cluster time after correction
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)
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
Bool_t fMostEneCellOnly
flag to use calibration on most energetic cell in cluster only
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
int Int_t
Definition: External.C:63
std::vector< std::vector< TH2F * > > fhRawTimePARs
!
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
static void ProduceCalibConsts(TString inputFile="time186319testWOL0.root", TString outputFile="Reference.root", Bool_t isFinal=kFALSE, Bool_t isPAR=kFALSE)
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
std::vector< PARInfo > fPARvec
vector of PAR info for all runs
Definition: External.C:228
Definition: External.C:212
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 ProduceOffsetForSMsV2(Int_t runNumber, TString inputFile="Reference.root", TString outputFile="ReferenceSM.root", Bool_t offset100=kTRUE, Bool_t justL1phase=kTRUE, TString PARfilename="")
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
Bool_t fIsPARRun
Which PAR the currnt event is after.
TH2F * fhTimeVsIdBC[kNBCmask]
! 4 BCmask HG
void SetEnergyHistoHG(Int_t nbins, Double_t lower, Double_t upper)
TH2F * fhTimeVsIdLGBC[kNBCmask]
! 4 BCmask LG
const char Option_t
Definition: External.C:48
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
bool Bool_t
Definition: External.C:53
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
void GetPARInfoForRunNumber(Int_t runnum)
Does current run have PAR info?
TH2F * fhTimeDsupBC[kNSM][kNBCmask]
! 20 x 4 high gain
TH2F * fhTimeDsupLGBC[kNSM][kNBCmask]
! 20 x 4 low gain