6 #include <TClonesArray.h> 10 #include <TObjArray.h> 11 #include <TParameter.h> 13 #include "AliAnalysisUtils.h" 15 #include "AliEMCALGeometry.h" 16 #include "AliEMCALTriggerMapping.h" 17 #include "AliEMCALTriggerPatchInfo.h" 18 #include "AliEMCALTriggerTypes.h" 19 #include "AliInputEventHandler.h" 21 #include "AliOADBContainer.h" 22 #include "AliVVertex.h" 23 #include "AliVCaloTrigger.h" 31 AliAnalysisTaskEGAMonitor::AliAnalysisTaskEGAMonitor() :
34 fUseRecalcPatches(false),
37 fNameMaskedFastorOADB(
""),
70 fHistos->
CreateTH1(
"hEventCountEGA",
"Number of EGA triggered events", 1, 0.5, 1.5);
71 fHistos->
CreateTH1(
"hEventCountINT7",
"Number of INT7 triggered events", 1, 0.5, 1.5);
72 std::array<std::string, 5> triggers = {
"EG1",
"EG2",
"DG1",
"DG2",
"MB"};
73 for(
const auto &t : triggers){
74 fHistos->
CreateTH2(Form(
"hColRowG1%s", t.c_str()), Form(
"Col-Row distribution of online G1 patches for trigger %s", t.c_str()), 48, -0.5, 47.5, 104, -0.5, 103.5);
75 fHistos->
CreateTH2(Form(
"hColRowG2%s", t.c_str()), Form(
"Col-Row distribution of online G2 patches for trigger %s", t.c_str()), 48, -0.5, 47.5, 104, -0.5, 103.5);
76 fHistos->
CreateTH2(Form(
"hColRowGall%s", t.c_str()), Form(
"Col-Row distribution of online gamma patches for trigger %s", t.c_str()), 48, -0.5, 47.5, 104, -0.5, 103.5);
77 fHistos->
CreateTH1(Form(
"hADCRecalcGall%s", t.c_str()), Form(
"ADC distribution of gamma recalc patches for trigger %s", t.c_str()), 2049, -0.5, 2048.5);
78 fHistos->
CreateTH1(Form(
"hADCRecalcG1%s", t.c_str()), Form(
"ADC distribution of G1 recalc patches for trigger %s", t.c_str()), 2049, -0.5, 2048.5);
79 fHistos->
CreateTH1(Form(
"hADCRecalcG2%s", t.c_str()), Form(
"ADC distribution of G2 recalc patches for trigger %s", t.c_str()), 2049, -0.5, 2048.5);
89 if(!(fInputHandler->IsEventSelected() & (AliVEvent::kEMCEGA | AliVEvent::kINT7)))
return false;
90 AliDebugStream(1) << GetName() <<
": Event is selected" << std::endl;
95 std::vector<std::string> triggers;
96 if(fInputHandler->IsEventSelected() & AliVEvent::kEMCEGA){
97 if(InputEvent()->GetFiredTriggerClasses().Contains(
"EG1")) triggers.push_back(
"EG1");
98 if(InputEvent()->GetFiredTriggerClasses().Contains(
"EG2")) triggers.push_back(
"EG2");
99 if(InputEvent()->GetFiredTriggerClasses().Contains(
"DG1")) triggers.push_back(
"DG1");
100 if(InputEvent()->GetFiredTriggerClasses().Contains(
"DG2")) triggers.push_back(
"DG2");
102 }
else if(fInputHandler->IsEventSelected() & AliVEvent::kINT7){
103 triggers.push_back(
"MB");
106 if(!triggers.size())
return false;
108 AliDebugStream(1) << GetName() <<
": Finding firing trigger patches" << std::endl;
111 AliEMCALTriggerPatchInfo *patch =
static_cast<AliEMCALTriggerPatchInfo *
>(p);
112 if(!patch->IsGammaLowRecalc())
continue;
115 if(
IsPatchRejected(patch->GetColStart(), patch->GetRowStart()))
continue;
117 for(
const auto &t : triggers){
118 fHistos->
FillTH2(Form(
"hColRowGall%s", t.c_str()), patch->GetColStart(), patch->GetRowStart());
119 fHistos->
FillTH1(Form(
"hADCRecalcGall%s", t.c_str()), patch->GetADCAmp());
122 for(
const auto &t : triggers){
123 fHistos->
FillTH2(Form(
"hColRowG2%s", t.c_str()), patch->GetColStart(), patch->GetRowStart());
124 fHistos->
FillTH1(Form(
"hADCRecalcG2%s", t.c_str()), patch->GetADCAmp());
128 for(
const auto &t : triggers){
129 fHistos->
FillTH2(Form(
"hColRowG1%s", t.c_str()), patch->GetColStart(), patch->GetRowStart());
130 fHistos->
FillTH1(Form(
"hADCRecalcG1%s", t.c_str()), patch->GetADCAmp());
135 AliVCaloTrigger *emctrigraw = InputEvent()->GetCaloTrigger(
"EMCAL");
138 Int_t col(-1), row(-1), triggerbits(0);
139 while(emctrigraw->Next()){
140 emctrigraw->GetTriggerBits(triggerbits);
141 if(triggerbits) AliDebugStream(2) <<
"Trigger bits: " << std::bitset<sizeof(Int_t) * 8>(triggerbits) << std::endl;
142 if(!((triggerbits & (BIT(kL1GammaHigh) | BIT(kL1GammaLow))) || (triggerbits & (BIT(kL1GammaHigh+kTriggerTypeEnd) | BIT(kL1GammaLow+kTriggerTypeEnd)))))
continue;
143 AliDebugStream(2) <<
"Found gamma trigger bits" << std::endl;
145 emctrigraw->GetPosition(col, row);
147 if((triggerbits & BIT(kL1GammaHigh)) || (triggerbits & BIT(kL1GammaHigh+kTriggerTypeEnd))){
148 for(
const auto &t : triggers)
fHistos->
FillTH2(Form(
"hColRowG1%s", t.c_str()), col, row);
150 if((triggerbits & BIT(kL1GammaLow)) || (triggerbits & BIT(kL1GammaLow+kTriggerTypeEnd))){
151 for(
const auto &t : triggers)
fHistos->
FillTH2(Form(
"hColRowG2%s", t.c_str()), col, row);
174 for(
auto p : *(static_cast<TObjArray *>(
fMaskedFastorOADB->GetObject(runnumber)))){
181 bool rejected(
false);
182 for(
int icol = col; icol < col + 2; icol++){
183 for(
int irow = row; irow < row + 2; irow++){
185 fGeom->GetTriggerMapping()->GetAbsFastORIndexFromPositionInEMCAL(icol,irow, fabsID);
Double_t fRecalcHigh
High threshold for recalc gamma trigger.
virtual void UserCreateOutputObjects()
THistManager * fHistos
! Histogram manager
bool IsPatchRejected(int col, int row)
Base task in the EMCAL framework.
Bool_t fLocalInitialized
whether or not the task has been already initialized
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
Fill a 2D histogram within the container.
virtual ~AliAnalysisTaskEGAMonitor()
TString fNameMaskedFastorOADB
Name of the OADB container with the masked fastor information.
void SetCaloTriggerPatchInfoName(const char *n)
Bool_t fUseRecalcPatches
Defined whether to use recalc patches.
Simplistic class, checks distribution of the online EGA trigger patches.
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.
AliEMCALGeometry * fGeom
!emcal geometry
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Create a new TH1 within the container.
AliAnalysisUtils * fAliAnalysisUtils
!vertex selection (optional)
virtual void RunChanged(Int_t newrun)
Process tasks relevant when a file with a different run number is processed.
virtual bool Run()
Run function. This is the core function of the analysis and contains the user code. Therefore users have to implement this function.
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Fill a 1D histogram within the container.
AliOADBContainer * fMaskedFastorOADB
OADB container with masked fastor information.
AliAnalysisTaskEGAMonitor()
AliEmcalList * fOutput
!output list
Analysis of high- tracks in triggered events.
Double_t fRecalcLow
Low threshold for recalc gamma trigger.
TClonesArray * fTriggerPatchInfo
!trigger patch info array
void SetNeedEmcalGeom(Bool_t n)
virtual void ExecOnce()
Perform steps needed to initialize the analysis.
std::vector< int > fMaskedFastors
List of masked fastors.
Container class for histograms.
virtual void ExecOnce()
Perform steps needed to initialize the analysis.
void UserCreateOutputObjects()
Main initialization function on the worker.
virtual bool IsEventSelected()
Performing event selection.