19 #include "AliEMCALGeometry.h"
20 #include "AliEMCALTriggerMapping.h"
21 #include "AliEMCALTriggerPatchInfo.h"
23 #include "AliInputEventHandler.h"
25 #include "AliVCaloTrigger.h"
26 #include "AliVEvent.h"
32 namespace EMCalTriggerPtAnalysis {
34 const TString AliAnalysisTaskEmcalNoiseTriggers::fgkPatchNames[2] = {
"Online",
"Recalc"};
36 AliAnalysisTaskEmcalNoiseTriggers::AliAnalysisTaskEmcalNoiseTriggers():
53 const int kMaxCol = 48, kMaxRow = 104, kMaxFastOr = kMaxRow * kMaxCol;
54 const TString kMaxTypes[2] = {
"All",
"Max"};
61 fHistos->
CreateTH2(
"hFastorL1TimeSums",
"FastOR L1 time sum distribution", kMaxFastOr, -0.5, kMaxFastOr - 0.5, 2049, -0.5, 2048.5);
64 for(
int itype = 0; itype < 2; itype++){
66 fHistos->
CreateTH1(Form(
"hEventSelPatch%s", mypatchtype.Data()), Form(
"Number of firing %s patches", mypatchtype.Data()), 1001, -0.5, 1000.5);
67 for(
int imax = 0; imax < 2; imax++){
68 fHistos->
CreateTH2(Form(
"hPatchMaxFastorADCvsSumADC%s%s", kMaxTypes[imax].
Data(), mypatchtype.Data()), Form(
"Max FastOR ADC vs. ADC sum for %s %s patches; Sum ADC; Max FastOR ADC", kMaxTypes[imax].
Data(), mypatchtype.Data()), 2048, 0., 2048, 2500, 0., 2500);
69 fHistos->
CreateTH2(Form(
"hSumADCvsPatchADC%s%s", kMaxTypes[imax].
Data(), mypatchtype.Data()), Form(
"Sum all ADC vs. Patch ADC for %s %s patches; sum ADC; patch ADC", kMaxTypes[imax].
Data(), mypatchtype.Data()), 2048, 0., 2048, 2500, 0., 2500);
70 fHistos->
CreateTH2(Form(
"hNfastorVsFracMaxFastor%s%s", kMaxTypes[imax].
Data(), mypatchtype.Data()), Form(
"Number of non-zero FastORs vs. ADC fraction of the highest FastOR for %s %s patches; Number of FastORs; Fraction ADC highest Fastor", kMaxTypes[imax].
Data(), mypatchtype.Data()), 257, -0.5, 256.5, 100, 0., 1);
76 if(!(fInputHandler->IsEventSelected() &
fTriggerBits))
return false;
78 return fInputEvent->GetFiredTriggerClasses().Contains(
fTriggerString);
86 if(
fGeom->GetTriggerMappingVersion() == 2) nrows = 104;
87 fL1ADC.Allocate(48, nrows);
97 AliEMCALTriggerPatchInfo *maxonline(
nullptr), *maxrecalc(
nullptr);
98 Int_t nselOnline(0), nselRecalc(0), ngoodOnline(0), ngoodRecalc(0);
100 AliEMCALTriggerPatchInfo *recpatch =
static_cast<AliEMCALTriggerPatchInfo *
>(patchit);
103 if(recpatch->IsGammaHigh()){
106 if(!maxonline || recpatch->GetADCAmp() > maxonline->GetADCAmp()) maxonline = recpatch;
108 if(recpatch->IsGammaLowRecalc()){
111 if(!maxrecalc || recpatch->GetADCAmp() > maxrecalc->GetADCAmp()) maxrecalc = recpatch;
115 if(recpatch->IsGammaLow()){
118 if(!maxonline || recpatch->GetADCAmp() > maxonline->GetADCAmp()) maxonline = recpatch;
120 if(recpatch->IsGammaLowRecalc()){
123 if(!maxrecalc || recpatch->GetADCAmp() > maxrecalc->GetADCAmp()) maxrecalc = recpatch;
128 if(recpatch->IsJetHigh()){
131 if(!maxonline || recpatch->GetADCAmp() > maxonline->GetADCAmp()) maxonline = recpatch;
133 if(recpatch->IsJetLowRecalc()){
136 if(!maxrecalc || recpatch->GetADCAmp() > maxrecalc->GetADCAmp()) maxrecalc = recpatch;
140 if(recpatch->IsJetLow()){
143 if(!maxonline || recpatch->GetADCAmp() > maxonline->GetADCAmp()) maxonline = recpatch;
145 if(recpatch->IsJetLowRecalc()){
148 if(!maxrecalc || recpatch->GetADCAmp() > maxrecalc->GetADCAmp()) maxrecalc = recpatch;
168 AliVCaloTrigger *emctrigger = fInputEvent->GetCaloTrigger(
"EMCAL");
171 Int_t globCol=-1, globRow=-1, adcAmp=-1;
172 while(emctrigger->Next()){
175 emctrigger->GetPosition(globCol, globRow);
176 emctrigger->GetL1TimeSum(adcAmp);
177 AliDebugStream(1) << GetName() <<
"Fastor at (" << globCol <<
"," << globRow <<
") with ADC " << adcAmp << std::endl;
178 if (adcAmp < 0) adcAmp = 0;
181 (
fL1ADC)(globCol,globRow) = adcAmp;
185 AliErrorStream() <<
"Trigger maker task - filling trigger bit grid - index out-of-bounds in " << dirstring <<
": " << e.GetIndex() << std::endl;
192 for(
unsigned char icol = 0; icol < patch.GetPatchSize(); icol++){
193 for(
unsigned char irow = 0; irow < patch.GetPatchSize(); irow++){
196 adc =
fL1ADC(icol + patch.GetColStart(), irow + patch.GetRowStart());
200 adcpatch->
SetADC(adc, icol, irow);
212 AliVCaloTrigger *emctrigger = fInputEvent->GetCaloTrigger(
"EMCAL");
215 Int_t globCol=-1, globRow=-1, adcAmp=-1, absFastor = -1;
216 while(emctrigger->Next()){
217 emctrigger->GetPosition(globCol, globRow);
218 emctrigger->GetL1TimeSum(adcAmp);
219 if(adcAmp < 0) adcAmp = 0;
220 fGeom->GetTriggerMapping()->GetAbsFastORIndexFromPositionInEMCAL(globCol, globRow, absFastor);
229 Int_t sumADC = adcvalues->GetSumADC();
235 Int_t maxADC = adcvalues->GetMaxADC(), ncontrib = adcvalues->GetNFastorsContrib();
236 Float_t fracMaxFastor =
static_cast<Float_t>(maxADC)/static_cast<Float_t>(sumADC);
237 fHistos->
FillTH2(Form(
"hPatchMaxFastorADCvsSumADC%s%s", maxname.Data(), mypatchtype.Data()), sumADC, maxADC);
238 fHistos->
FillTH2(Form(
"hSumADCvsPatchADC%s%s", maxname.Data(), mypatchtype.Data()), sumADC, recpatch.GetADCAmp());
239 fHistos->
FillTH2(Form(
"hNfastorVsFracMaxFastor%s%s", maxname.Data(), mypatchtype.Data()), ncontrib, fracMaxFastor);
Analysis of trigger quantities in rejected (noise) events.
AliEMCALTriggerPatchADCInfoAP * MakeFastorADCValuesForPatch(const AliEMCALTriggerPatchInfo &patch) const
virtual void UserFillHistosAfterEventSelection()
THistManager * fHistos
Task Histogram container.
TString fTriggerString
Trigger string for event selection.
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
Fill a 2D histogram within the container.
AliEMCALTriggerDataGrid< Int_t > fL1ADC
! Level1 fastor ADCs
void SetADC(Int_t adc, UChar_t col, UChar_t row)
void PrepareL1FastorADC()
Base class for analyses using EMCAL triggers.
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.
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.
Bool_t AnalyseTriggerPatch(const AliEMCALTriggerPatchInfo &recpatch, SelectPatchType_t pt, Bool_t maxpatch)
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Fill a 1D histogram within the container.
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
void SetSelectNoiseEvents(Bool_t doSelect=true)
If true then noise events (events without recalc trigger patch above threshold) are explicitly select...
virtual void CreateUserHistos()
static const TString fgkPatchNames[2]
Names of the trigger patch types (for histograms)
Double_t fVertex[3]
!event vertex
TClonesArray * fTriggerPatchInfo
!trigger patch info array
ULong_t fTriggerBits
Trigger bits for the event selection.
virtual bool IsUserEventSelected()
Bool_t SelectFiredPatch(const TString &triggerclass, Int_t adc) const
AliAnalysisTaskEmcalNoiseTriggers()