18 #include <THashList.h>
21 #include <TLorentzVector.h>
23 #include <TObjArray.h>
24 #include <TParameter.h>
28 #include "AliEMCALGeometry.h"
29 #include "AliEMCALTriggerConstants.h"
30 #include "AliInputEventHandler.h"
32 #include "AliOADBContainer.h"
33 #include "AliVCaloCells.h"
34 #include "AliVCaloTrigger.h"
35 #include "AliVEvent.h"
36 #include "AliVVertex.h"
46 fLocalInitialized(false),
48 fRequestTrigger(AliVEvent::kAny),
53 fNameMaskedFastorOADB(),
54 fNameMaskedCellOADB("$ALICE_PHYSICS/OADB/EMCAL/EMCALBadChannels.root"),
55 fMaskedFastorOADB(
nullptr),
56 fMaskedCellOADB(
nullptr)
65 fLocalInitialized(false),
67 fRequestTrigger(AliVEvent::kAny),
71 fNameMaskedFastorOADB(),
72 fNameMaskedCellOADB(
"$ALICE_PHYSICS/OADB/EMCAL/EMCALBadChannels.root"),
76 DefineOutput(1, TList::Class());
87 const int kMaxCol = 48, kMaxRow = 104, kMaxFastOr = kMaxRow * kMaxCol;
90 fHistos->
CreateTH1(
"hFastOrFrequencyL0",
"FastOr frequency at Level0", kMaxFastOr, -0.5, kMaxFastOr - 0.5);
91 fHistos->
CreateTH1(
"hFastOrFrequencyL1",
"FastOr frequency at Level1", kMaxFastOr, -0.5, kMaxFastOr - 0.5);
92 fHistos->
CreateTH2(
"hFastOrAmplitude",
"FastOr amplitudes", kMaxFastOr, -0.5, kMaxFastOr - 0.5, 513, -0.5, 512.5);
93 fHistos->
CreateTH2(
"hFastOrTimeSum",
"FastOr time sum", kMaxFastOr, -0.5, kMaxFastOr - 0.5, 2049, -0.5, 2048.5);
94 fHistos->
CreateTH2(
"hFastOrTransverseTimeSum",
"FastOr transverse time sum", kMaxFastOr, -0.5, kMaxFastOr - 0.5, 2049, -0.5, 2048.5);
95 fHistos->
CreateTH2(
"hFastOrNL0Times",
"FastOr Number of L0 times", kMaxFastOr, -0.5, kMaxFastOr - 0.5, 16, -0.5, 15.5);
96 fHistos->
CreateTH2(
"hFastOrColRowFrequencyL0",
"FastOr Frequency (col-row) at Level1", kMaxCol, -0.5, kMaxCol - 0.5, kMaxRow, -0.5, kMaxRow - 0.5);
97 fHistos->
CreateTH2(
"hFastOrColRowFrequencyL1",
"FastOr Frequency (col-row) at Level0", kMaxCol, -0.5, kMaxCol - 0.5, kMaxRow, -0.5, kMaxRow - 0.5);
98 fHistos->
CreateTH2(
"hEnergyFastorCell",
"Sum of cell energy vs. fastor Energy", 1000, 0., 20., 1000 , 0., 20.);
101 fHistos->
CreateTH1(
"hMaskedFastors",
"Index of masked FastOR; FastOR index; Counts", 3001, -0.5, 3000.5);
102 fHistos->
CreateTH1(
"hMaskedCells",
"Index of masked cell; Cell index; Counts", 20001, -0.5, 20000.5);
103 fHistos->
CreateTH1(
"hCellEnergyCount",
"Counts of non-0 cell entries; Cell index; Counts", 20001, -0.5, 20000.5);
106 TAxis fastorIDAxis(4992, -0.5, 4991.5), offlineaxis(200, 0., 20.), onlineaxis(200, 0., 20.), cellmaskaxis(5, -0.5, 4.5);
107 const TAxis *sparseaxis[4] = {&fastorIDAxis, &offlineaxis, &onlineaxis, &cellmaskaxis};
108 fastorIDAxis.SetNameTitle(
"fastorAbsID",
"FastOR abs. ID");
109 offlineaxis.SetNameTitle(
"offlinenergy",
"E_{2x2 cells} (GeV)");
110 onlineaxis.SetNameTitle(
"onlineenergy",
"E_{FastOR} (GeV)");
111 cellmaskaxis.SetNameTitle(
"maskedcells",
"Number of masked cells");
118 fGeom = AliEMCALGeometry::GetInstanceFromRunNumber(InputEvent()->
GetRunNumber());
120 int nrow =
fGeom->GetTriggerMappingVersion() == 2 ? 104 : 64;
137 AliInfoStream() <<
"Loading masked cells for run " << newrun << std::endl;
140 if(maskedfastors && maskedfastors->GetEntries()){
141 for(
auto masked : *maskedfastors){
152 AliInfoStream() <<
"Loading masked cells for run " << newrun << std::endl;
155 if(maskhistos && maskhistos->GetEntries()){
156 for(
auto mod : *maskhistos){
157 TH2 *modhist =
static_cast<TH2 *
>(mod);
158 TString modname = modhist->GetName();
159 AliDebugStream(1) <<
"Reading bad channels from histogram " << modname << std::endl;
160 modname.ReplaceAll(
"EMCALBadChannelMap_Mod",
"");
161 Int_t modid = modname.Atoi();
162 for(
int icol = 0; icol < 48; icol++){
163 for(
int irow = 0; irow < 24; irow++){
164 if(modhist->GetBinContent(icol, irow) > 0.){
165 int cellindex =
fGeom->GetAbsCellIdFromCellIndexes(modid, irow, icol);
186 fOldRun = InputEvent()->GetRunNumber();
195 const AliVVertex *vtx = fInputEvent->GetPrimaryVertex();
203 AliVCaloTrigger *triggerdata = InputEvent()->GetCaloTrigger(
"EMCAL");
204 triggerdata->Reset();
205 Int_t nl0times, l1timesum, fastOrID, globCol, globRow;
207 while(triggerdata->Next()){
208 triggerdata->GetAmplitude(amp);
209 triggerdata->GetNL0Times(nl0times);
210 triggerdata->GetL1TimeSum(l1timesum);
211 triggerdata->GetPosition(globCol, globRow);
212 fGeom->GetTriggerMapping()->GetAbsFastORIndexFromPositionInEMCAL(globCol, globRow, fastOrID);
229 fGeom->GetTriggerMapping()->GetCellIndexFromFastORIndex(fastOrID, fastorCells);
230 for(
int icell = 0; icell < 4; icell++){
233 double energydata[4] = {
234 static_cast<double>(fastOrID),
236 l1timesum * EMCALTrigger::kEMCL1ADCtoGeV,
237 static_cast<double>(ncellmasked)
248 AliVCaloCells *emccells = InputEvent()->GetEMCALCells();
249 for(
int icell = 0; icell < emccells->GetNumberOfCells(); icell++){
250 int position = emccells->GetCellNumber(icell);
251 double amplitude = emccells->GetAmplitude(icell);
255 AliErrorStream() <<
"Non-0 cell energy " << amplitude <<
" found for masked cell " << position << std::endl;
257 int absFastor, col, row;
258 fGeom->GetTriggerMapping()->GetFastORIndexFromCellIndex(position, absFastor);
259 fGeom->GetPositionInEMCALFromAbsFastORIndex(absFastor, col, row);
267 fGeom->GetTriggerMapping()->GetCellIndexFromFastORIndex(fastorAbsID, cellIDs);
268 std::vector<double> eta, phi;
269 for(
int i = 0l; i < 4; i++){
270 double etatmp, phitmp;
271 fGeom->EtaPhiFromIndex(cellIDs[i], etatmp, phitmp);
272 eta.push_back(etatmp);
273 phi.push_back(phitmp);
278 TVector3 fastorPos, vertexPos(vertex[0], vertex[1], vertex[2]);
279 fastorPos.SetPtEtaPhi(
fGeom->GetIPDistance(), TMath::Mean(eta.begin(), eta.end()), TMath::Mean(phi.begin(), phi.end()));
280 fastorPos -= vertexPos;
282 TLorentzVector evec(fastorPos, adc);
AliEmcalFastOrMonitorTask()
Default constructor.
AliEMCALTriggerDataGrid< double > fCellData
Grid with summed cell data.
Int_t fOldRun
Old Run (for RunChanged())
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
Fill a 2D histogram within the container.
void LoadEventCellData()
Load event-dependent cell data.
TString fNameMaskedFastorOADB
Name of the OADB container with 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.
ULong_t fRequestTrigger
Trigger selection bits.
THashList * GetListOfHistograms() const
Get the list of histograms.
AliOADBContainer * fMaskedFastorOADB
! OADB container with masked fastors
Double_t GetTransverseTimeSum(Int_t fastorAbsID, Double_t adc, const Double_t *vtx) const
Calculate transverse L1 time sum of a FastOR.
virtual void UserCreateOutputObjects()
Creating output objects.
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Create a new TH1 within the container.
AliEMCALGeometry * fGeom
! EMCAL Geometry object
virtual void RunChanged(Int_t newrun)
Run-dependent setup of the task.
std::vector< int > fMaskedCells
List of masked cells.
virtual void ExecOnce()
Initialization of the task.
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Fill a 1D histogram within the container.
Bool_t fLocalInitialized
Switch whether task is initialized (for ExecOnce)
virtual ~AliEmcalFastOrMonitorTask()
Destructor.
std::vector< int > fMaskedFastors
List of masked fastors.
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
TString fTriggerPattern
Trigger string pattern used in addition to the trigger selection bits.
TString fNameMaskedCellOADB
Name of the OADB container with masked cells.
AliOADBContainer * fMaskedCellOADB
! OADB container with masked cells
Container class for histograms.
Int_t GetRunNumber(TString)
virtual void UserExec(Option_t *)
Event loop.
THistManager * fHistos
! Histogram handler
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.
Simlple monitoring of EMCAL FastOr quantities.