AliPhysics  c66ce6c (c66ce6c)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliEmcalCellMonitorTask.cxx
Go to the documentation of this file.
1 #include <map>
2 #include <vector>
3 #include <TArrayD.h>
4 #include <THashList.h>
5 #include <TLinearBinning.h>
6 #include <THistManager.h>
7 
8 #include "AliEMCALGeometry.h"
10 #include "AliInputEventHandler.h"
11 #include "AliVCaloCells.h"
12 #include "AliVEvent.h"
13 
17 
19  AliAnalysisTaskSE(),
20  fHistManager(nullptr),
21  fGeometry(nullptr),
22  fMinCellAmplitude(0),
23  fRequestTrigger(AliVEvent::kAnyINT),
24  fTriggerString(""),
25  fNumberOfCells(12288)
26 {
27 
28 }
29 
31  AliAnalysisTaskSE(name),
32  fHistManager(nullptr),
33  fGeometry(nullptr),
34  fMinCellAmplitude(0),
35  fRequestTrigger(AliVEvent::kAnyINT),
36  fTriggerString(""),
37  fNumberOfCells(12288)
38 {
39  DefineOutput(1, TList::Class());
40 }
41 
43  if(fGeometry) delete fGeometry;
44 }
45 
47  fHistManager = new THistManager("EMCALCellMonitor");
48 
49  fHistManager->CreateTH2("cellAmplitude", "Energy distribution per cell", TLinearBinning(fNumberOfCells, -0.5, fNumberOfCells - 0.5), AliEmcalCellMonitorAmplitudeBinning());
50  fHistManager->CreateTH2("cellTime", "Time distribution per cell", fNumberOfCells, -0.5, fNumberOfCells - 0.5, 200, -1e-6, 1e-6);
51  fHistManager->CreateTH2("cellTimeOutlier", "Outlier time distribution per cell", fNumberOfCells, -0.5, fNumberOfCells - 0.5, 100, 1e-6, 5e-5);
52  for(int ism = 0; ism < 20; ++ism){
53  fHistManager->CreateTH2(Form("cellAmpSM%d", ism), Form("Integrated cell amplitudes for SM %d; col; row", ism), 48, -0.5, 47.5, 24, -0.5, 23.5);
54  fHistManager->CreateTH2(Form("cellCountSM%d", ism), Form("Count rate per cell for SM %d; col; row", ism), 48, -0.5, 47.5, 24, -0.5, 23.5);
55  }
56 
57  for(int ism = 0; ism < 20; ++ism){
58  fHistManager->CreateTH2(Form("cellAmpTimeCorrSM%d", ism), Form("Correlation between cell amplitude and time in Supermodule %d", ism), 1000, -5e-7, 5e-7, 1000, 0., 100.);
59  }
60 
61  PostData(1, fHistManager->GetListOfHistograms());
62 }
63 
65  if(!fGeometry) fGeometry = AliEMCALGeometry::GetInstanceFromRunNumber(fInputEvent->GetRunNumber());
66 
67  // Check trigger
68  if(!(fInputHandler->IsEventSelected() & fRequestTrigger)) return;
69  if(fTriggerString.Length()){
70  if(!TString(InputEvent()->GetFiredTriggerClasses()).Contains(fTriggerString)) return;
71  }
72 
73  AliVCaloCells *emcalcells = fInputEvent->GetEMCALCells();
74 
75  // input data
76  Short_t cellNumber;
77  Double_t amplitude, celltime, efrac;
78  Int_t mclabel;
79 
80  Int_t sm, mod, meta, mphi, ieta, iphi;
81  for(int icell = 0; icell < emcalcells->GetNumberOfCells(); icell++){
82  emcalcells->GetCell(icell, cellNumber, amplitude, celltime, mclabel, efrac);
83  if(amplitude <= 0) continue; // handle only cells with pos. amp
84  fHistManager->FillTH2("cellAmplitude", cellNumber, amplitude);
85  if(amplitude > fMinCellAmplitude){
86  fHistManager->FillTH2("cellTime", cellNumber, celltime);
87  if(celltime >= 1e-6) fHistManager->FillTH2("cellTimeOutlier", cellNumber, celltime);
88  }
89 
90  // Get Cell index in eta-phi of sm
91  fGeometry->GetCellIndex(cellNumber, sm, mod, mphi, meta);
92  fGeometry->GetCellPhiEtaIndexInSModule(sm, mod, mphi, meta, iphi, ieta);
93 
94  fHistManager->FillTH2(Form("cellCountSM%d", sm), ieta, iphi);
95  fHistManager->FillTH2(Form("cellAmpSM%d", sm), ieta, iphi, amplitude);
96  fHistManager->FillTH2(Form("cellAmpTimeCorrSM%d", sm), celltime, amplitude);
97  }
98  PostData(1, fHistManager->GetListOfHistograms());
99 }
100 
103 {
104  SetMinimum(0);
105  AddStep(1., 0.1);
106  AddStep(10., 0.5);
107  AddStep(20., 1.);
108  AddStep(50., 2.);
109  AddStep(100., 5.);
110  AddStep(200., 10.);
111 }
Class creating a linear binning, used in the histogram manager.
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
ULong_t fRequestTrigger
Trigger selection.
void AddStep(Double_t max, Double_t binwidth)
TH2 * CreateTH2(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, Option_t *opt="")
THashList * GetListOfHistograms() const
Definition: THistManager.h:504
Helper class creating user defined custom binning.
Int_t fNumberOfCells
Number of cells.
virtual void UserExec(Option_t *)
TString fTriggerString
Trigger string in addition to trigger selection.
Double_t fMinCellAmplitude
Min. cell amplitude requested for cell time.
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
Container class for histograms for the high- charged particle analysis.
Definition: THistManager.h:43
AliEMCALGeometry * fGeometry
! EMCAL geometry
THistManager * fHistManager
! Histogram handler
void SetMinimum(Double_t min)
Simple monitoring task for cell related quantities.