AliPhysics  66e96a0 (66e96a0)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliEmcalCellMonitorTask.cxx
Go to the documentation of this file.
1 #include <THashList.h>
2 #include <THistManager.h>
3 
4 #include "AliEMCALGeometry.h"
6 #include "AliVCaloCells.h"
7 #include "AliVEvent.h"
8 
12 
14  AliAnalysisTaskSE(),
15  fHistManager(nullptr),
16  fGeometry(nullptr)
17 {
18 
19 }
20 
22  AliAnalysisTaskSE(name),
23  fHistManager(nullptr),
24  fGeometry(nullptr)
25 {
26  DefineOutput(1, TList::Class());
27 }
28 
30  if(fGeometry) delete fGeometry;
31 }
32 
34  fHistManager = new THistManager("EMCALCellMonitor");
35 
36  fHistManager->CreateTH2("cellAmplitude", "Energy distribution per cell", 20001, -0.5, 20000.5, 1000, 0., 100);
37  fHistManager->CreateTH2("cellTime", "Time distribution per cell", 20001, -0.5, 20000.5, 1000, -1e-6, 1e-6);
38  for(int ism = 0; ism < 20; ++ism){
39  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);
40  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);
41  }
42 
43  PostData(1, fHistManager->GetListOfHistograms());
44 }
45 
47  if(!fGeometry) fGeometry = AliEMCALGeometry::GetInstanceFromRunNumber(fInputEvent->GetRunNumber());
48 
49  AliVCaloCells *emcalcells = fInputEvent->GetEMCALCells();
50 
51  // input data
52  Short_t cellNumber;
53  Double_t amplitude, celltime, efrac;
54  Int_t mclabel;
55 
56  Int_t sm, mod, meta, mphi, ieta, iphi;
57  for(int icell = 0; icell < emcalcells->GetNumberOfCells(); icell++){
58  emcalcells->GetCell(icell, cellNumber, amplitude, celltime, mclabel, efrac);
59  if(amplitude <= 0) continue; // handle only cells with pos. amp
60  fHistManager->FillTH2("cellAmplitude", cellNumber, amplitude);
61  fHistManager->FillTH2("cellTime", cellNumber, celltime);
62 
63  // Get Cell index in eta-phi of sm
64  fGeometry->GetCellIndex(cellNumber, sm, mod, mphi, meta);
65  fGeometry->GetCellPhiEtaIndexInSModule(sm, mod, mphi, meta, iphi, ieta);
66 
67  fHistManager->FillTH2(Form("cellCountSM%d", sm), ieta, iphi);
68  fHistManager->FillTH2(Form("cellAmpSM%d", sm), ieta, iphi, amplitude);
69  }
70  PostData(1, fHistManager->GetListOfHistograms());
71 }
virtual void UserExec(Option_t *)
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
AliEMCALGeometry * fGeometry
! EMCAL geometry
THistManager * fHistManager
! Histogram handler
Simple monitoring task for cell related quantities.