30 #include <THashList.h>
33 #include <TLorentzVector.h>
35 #include <TObjArray.h>
36 #include <TParameter.h>
40 #include "AliEMCALGeometry.h"
41 #include "AliEMCALTriggerConstants.h"
42 #include "AliInputEventHandler.h"
44 #include "AliOADBContainer.h"
45 #include "AliVCaloCells.h"
46 #include "AliVCaloTrigger.h"
47 #include "AliVEvent.h"
48 #include "AliVVertex.h"
54 using namespace PWG::EMCAL;
60 fLocalInitialized(false),
62 fRequestTrigger(AliVEvent::kAny),
67 fNameMaskedFastorOADB(),
68 fNameMaskedCellOADB("$ALICE_PHYSICS/OADB/EMCAL/EMCALBadChannels.root"),
69 fMaskedFastorOADB(
nullptr),
70 fMaskedCellOADB(
nullptr)
75 AliEmcalFastOrMonitorTask::AliEmcalFastOrMonitorTask(
const char *name) :
79 fLocalInitialized(false),
81 fRequestTrigger(AliVEvent::kAny),
85 fNameMaskedFastorOADB(),
86 fNameMaskedCellOADB(
"$ALICE_PHYSICS/OADB/EMCAL/EMCALBadChannels.root"),
90 DefineOutput(1, TList::Class());
101 const int kMaxCol = 48, kMaxRow = 104, kMaxFastOr = kMaxRow * kMaxCol;
104 fHistos->
CreateTH1(
"hFastOrFrequencyL0",
"FastOr frequency at Level0", kMaxFastOr, -0.5, kMaxFastOr - 0.5);
105 fHistos->
CreateTH1(
"hFastOrFrequencyL1",
"FastOr frequency at Level1", kMaxFastOr, -0.5, kMaxFastOr - 0.5);
106 fHistos->
CreateTH2(
"hFastOrAmplitude",
"FastOr amplitudes", kMaxFastOr, -0.5, kMaxFastOr - 0.5, 513, -0.5, 512.5);
107 fHistos->
CreateTH2(
"hFastOrTimeSum",
"FastOr time sum", kMaxFastOr, -0.5, kMaxFastOr - 0.5, 2049, -0.5, 2048.5);
108 fHistos->
CreateTH2(
"hFastOrTransverseTimeSum",
"FastOr transverse time sum", kMaxFastOr, -0.5, kMaxFastOr - 0.5, 2049, -0.5, 2048.5);
109 fHistos->
CreateTH2(
"hFastOrNL0Times",
"FastOr Number of L0 times", kMaxFastOr, -0.5, kMaxFastOr - 0.5, 16, -0.5, 15.5);
110 fHistos->
CreateTH2(
"hFastOrColRowFrequencyL0",
"FastOr Frequency (col-row) at Level1", kMaxCol, -0.5, kMaxCol - 0.5, kMaxRow, -0.5, kMaxRow - 0.5);
111 fHistos->
CreateTH2(
"hFastOrColRowFrequencyL1",
"FastOr Frequency (col-row) at Level0", kMaxCol, -0.5, kMaxCol - 0.5, kMaxRow, -0.5, kMaxRow - 0.5);
112 fHistos->
CreateTH2(
"hEnergyFastorCell",
"Sum of cell energy vs. fastor Energy", 1000, 0., 20., 1000 , 0., 20.);
115 fHistos->
CreateTH1(
"hMaskedFastors",
"Index of masked FastOR; FastOR index; Counts", 3001, -0.5, 3000.5);
116 fHistos->
CreateTH1(
"hMaskedCells",
"Index of masked cell; Cell index; Counts", 20001, -0.5, 20000.5);
117 fHistos->
CreateTH1(
"hCellEnergyCount",
"Counts of non-0 cell entries; Cell index; Counts", 20001, -0.5, 20000.5);
120 TAxis fastorIDAxis(4992, -0.5, 4991.5), offlineaxis(200, 0., 20.), onlineaxis(200, 0., 20.), cellmaskaxis(5, -0.5, 4.5);
121 const TAxis *sparseaxis[4] = {&fastorIDAxis, &offlineaxis, &onlineaxis, &cellmaskaxis};
122 fastorIDAxis.SetNameTitle(
"fastorAbsID",
"FastOR abs. ID");
123 offlineaxis.SetNameTitle(
"offlinenergy",
"E_{2x2 cells} (GeV)");
124 onlineaxis.SetNameTitle(
"onlineenergy",
"E_{FastOR} (GeV)");
125 cellmaskaxis.SetNameTitle(
"maskedcells",
"Number of masked cells");
132 fGeom = AliEMCALGeometry::GetInstanceFromRunNumber(InputEvent()->
GetRunNumber());
134 int nrow =
fGeom->GetTriggerMappingVersion() == 2 ? 104 : 64;
151 AliInfoStream() <<
"Loading masked cells for run " << newrun << std::endl;
154 if(maskedfastors && maskedfastors->GetEntries()){
155 for(
auto masked : *maskedfastors){
166 AliInfoStream() <<
"Loading masked cells for run " << newrun << std::endl;
169 if(maskhistos && maskhistos->GetEntries()){
170 for(
auto mod : *maskhistos){
171 TH2 *modhist =
static_cast<TH2 *
>(mod);
172 TString modname = modhist->GetName();
173 AliDebugStream(1) <<
"Reading bad channels from histogram " << modname << std::endl;
174 modname.ReplaceAll(
"EMCALBadChannelMap_Mod",
"");
175 Int_t modid = modname.Atoi();
176 for(
int icol = 0; icol < 48; icol++){
177 for(
int irow = 0; irow < 24; irow++){
178 if(modhist->GetBinContent(icol, irow) > 0.){
179 int cellindex =
fGeom->GetAbsCellIdFromCellIndexes(modid, irow, icol);
200 fOldRun = InputEvent()->GetRunNumber();
209 const AliVVertex *vtx = fInputEvent->GetPrimaryVertex();
217 AliVCaloTrigger *triggerdata = InputEvent()->GetCaloTrigger(
"EMCAL");
218 triggerdata->Reset();
219 Int_t nl0times, l1timesum, fastOrID, globCol, globRow;
221 while(triggerdata->Next()){
222 triggerdata->GetAmplitude(amp);
223 triggerdata->GetNL0Times(nl0times);
224 triggerdata->GetL1TimeSum(l1timesum);
225 triggerdata->GetPosition(globCol, globRow);
226 fGeom->GetTriggerMapping()->GetAbsFastORIndexFromPositionInEMCAL(globCol, globRow, fastOrID);
243 fGeom->GetTriggerMapping()->GetCellIndexFromFastORIndex(fastOrID, fastorCells);
244 for(
int icell = 0; icell < 4; icell++){
247 double energydata[4] = {
248 static_cast<double>(fastOrID),
250 l1timesum * EMCALTrigger::kEMCL1ADCtoGeV,
251 static_cast<double>(ncellmasked)
262 AliVCaloCells *emccells = InputEvent()->GetEMCALCells();
263 for(
int icell = 0; icell < emccells->GetNumberOfCells(); icell++){
264 int position = emccells->GetCellNumber(icell);
265 double amplitude = emccells->GetAmplitude(icell);
269 AliErrorStream() <<
"Non-0 cell energy " << amplitude <<
" found for masked cell " << position << std::endl;
271 int absFastor, col, row;
272 fGeom->GetTriggerMapping()->GetFastORIndexFromCellIndex(position, absFastor);
273 fGeom->GetPositionInEMCALFromAbsFastORIndex(absFastor, col, row);
281 fGeom->GetTriggerMapping()->GetCellIndexFromFastORIndex(fastorAbsID, cellIDs);
282 std::vector<double> eta, phi;
283 for(
int i = 0l; i < 4; i++){
284 double etatmp, phitmp;
285 fGeom->EtaPhiFromIndex(cellIDs[i], etatmp, phitmp);
286 eta.push_back(etatmp);
287 phi.push_back(phitmp);
292 TVector3 fastorPos, vertexPos(vertex[0], vertex[1], vertex[2]);
293 fastorPos.SetPtEtaPhi(
fGeom->GetIPDistance(), TMath::Mean(eta.begin(), eta.end()), TMath::Mean(phi.begin(), phi.end()));
294 fastorPos -= vertexPos;
296 TLorentzVector evec(fastorPos, adc);
Bool_t fLocalInitialized
Switch whether task is initialized (for ExecOnce)
virtual void UserExec(Option_t *)
Event loop.
Double_t GetTransverseTimeSum(Int_t fastorAbsID, Double_t adc, const Double_t *vtx) const
Calculate transverse L1 time sum of a FastOR.
std::vector< int > fMaskedCells
List of masked cells.
Int_t fOldRun
Old Run (for RunChanged())
TString fNameMaskedFastorOADB
Name of the OADB container with masked fastors.
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
Fill a 2D histogram within the container.
virtual ~AliEmcalFastOrMonitorTask()
Destructor.
ULong_t fRequestTrigger
Trigger selection bits.
THistManager * fHistos
! Histogram handler
std::vector< int > fMaskedFastors
List of masked fastors.
void FillTHnSparse(const char *name, const double *x, double weight=1., Option_t *opt="")
TH2 * CreateTH2(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, Option_t *opt="")
Create a new TH2 within the container.
THashList * GetListOfHistograms() const
Get the list of histograms.
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Create a new TH1 within the container.
AliOADBContainer * fMaskedFastorOADB
! OADB container with masked fastors
AliEMCALTriggerDataGrid< double > fCellData
Grid with summed cell data.
AliEMCALGeometry * fGeom
! EMCAL Geometry object
TString fNameMaskedCellOADB
Name of the OADB container with masked cells.
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Fill a 1D histogram within the container.
ClassImp(AliAnalysisTaskDeltaPt) AliAnalysisTaskDeltaPt
virtual void UserCreateOutputObjects()
Creating output objects.
virtual void ExecOnce()
Initialization of the task.
Container class for histograms.
void LoadEventCellData()
Load event-dependent cell data.
Int_t GetRunNumber(TString)
AliOADBContainer * fMaskedCellOADB
! OADB container with masked cells
virtual void RunChanged(Int_t newrun)
Run-dependent setup of the task.
THnSparse * CreateTHnSparse(const char *name, const char *title, int ndim, const int *nbins, const double *min, const double *max, Option_t *opt="")
Create a new THnSparse within the container.
TString fTriggerPattern
Trigger string pattern used in addition to the trigger selection bits.
Simlple monitoring of EMCAL FastOr quantities.