15 #include <TClonesArray.h>
17 #include <THashList.h>
19 #include <TObjArray.h>
20 #include <TParameter.h>
22 #include "AliCDBEntry.h"
23 #include "AliCDBManager.h"
24 #include "AliEMCALGeometry.h"
25 #include "AliEMCALTriggerBitConfig.h"
26 #include "AliEMCALTriggerDCSConfig.h"
27 #include "AliEMCALTriggerTRUDCSConfig.h"
28 #include "AliEMCALTriggerPatchInfo.h"
31 #include "AliEMCALTriggerMapping.h"
33 #include "AliOADBContainer.h"
48 fCaloTriggersOutName("EmcalTriggers"),
49 fV0InName("AliAODVZERO"),
50 fBadFEEChannelOADB(""),
51 fUseL0Amplitudes(kFALSE),
52 fLoadFastORMaskingFromOCDB(kFALSE),
64 fCaloTriggersOutName(
"EmcalTriggers"),
65 fV0InName(
"AliAODVZERO"),
66 fBadFEEChannelOADB(
""),
67 fUseL0Amplitudes(kFALSE),
68 fLoadFastORMaskingFromOCDB(kFALSE),
69 fCaloTriggersOut(NULL),
85 const TString kTriggerTypeNames[3] = {
"EJE",
"EGA",
"EL0"},
86 kPatchTypes[3] = {
"Online",
"Offline",
"Recalc"};
91 for(
const TString *triggertype = kTriggerTypeNames; triggertype < kTriggerTypeNames +
sizeof(kTriggerTypeNames)/
sizeof(
TString); triggertype++){
92 for(
const TString *patchtype = kPatchTypes; patchtype < kPatchTypes +
sizeof(kPatchTypes)/
sizeof(
TString); ++patchtype){
94 Form(
"RCPos%s%s", triggertype->Data(), patchtype->Data()),
95 Form(
"Lower edge position of %s %s patches (col-row);iEta;iPhi", patchtype->Data(), triggertype->Data()),
96 48, -0.5, 47.5, 104, -0.5, 103.5
99 Form(
"EPCentPos%s%s", triggertype->Data(), patchtype->Data()),
100 Form(
"Center position of the %s %s trigger patches;#eta;#phi", patchtype->Data(), triggertype->Data()),
101 20, -0.8, 0.8, 700, 0., 7.
104 Form(
"PatchADCvsE%s%s", triggertype->Data(), patchtype->Data()),
105 Form(
"Patch ADC value for trigger type %s %s;Trigger ADC;FEE patch energy (GeV)", patchtype->Data(), triggertype->Data()),
106 2000, 0., 2000, 200, 0., 200
109 Form(
"PatchADCOffvsE%s%s", triggertype->Data(), patchtype->Data()),
110 Form(
"Patch offline ADC value for trigger type %s %s;Trigger ADC;FEE patch energy (GeV)", patchtype->Data(), triggertype->Data()),
111 2000, 0., 2000, 200, 0., 200
115 fQAHistos->
CreateTH1(
"triggerBitsAll",
"Trigger bits for all incoming patches;bit nr", 64, -0.5, 63.5);
116 fQAHistos->
CreateTH1(
"triggerBitsSel",
"Trigger bits for reconstructed patches;bit nr", 64, -0.5, 63.5);
117 fQAHistos->
CreateTH2(
"FastORMaskOnline",
"Masked FastORs at online level; col; row", 48, -0.5, 47.5, 104, -0.5, 103.5);
125 AliEMCALTriggerBitConfig *triggerBitConfig(NULL);
128 triggerBitConfig =
new AliEMCALTriggerBitConfigNew();
131 triggerBitConfig =
new AliEMCALTriggerBitConfigOld();
154 AliFatal(Form(
"%s: Container with same name %s already present. Aborting", GetName(),
fCaloTriggersOutName.Data()));
160 fV0 = (AliVVZERO*)InputEvent()->FindListObject(
fV0InName);
165 AliInfoStream() <<
"Trigger maker not yet configure - automatically configuring ..." << std::endl;
166 int runnumber = InputEvent()->GetRunNumber();
167 std::string dataset =
"";
168 if(runnumber >= 145144 && runnumber <= 165746){
171 }
else if(runnumber >= 167806 && runnumber <= 170593){
173 dataset =
"Pb-Pb 2011";
174 }
else if(runnumber >= 176326 && runnumber <= 193766){
177 }
else if(runnumber >= 195344 && runnumber <= 197692){
180 dataset =
"p-Pb 2013";
181 }
else if((runnumber >= 224891 && runnumber <= 244628) || runnumber >= 253434){
184 dataset =
"pp 2015-2016";
185 }
else if(runnumber >= 244824 && runnumber <= 246994){
187 dataset =
"Pb-Pb 2015";
191 AliInfoStream() <<
"Applying configuration for " << dataset << std::endl;
193 AliErrorStream() <<
"No valid configuration found for the given dataset - trigger maker disabled" << std::endl;
217 AliEMCALTriggerPatchInfo *recpatch = NULL;
218 Int_t patchcounter = 0;
220 AliDebug(2,Form(
"Trigger maker - Found %d patches\n", patches->GetEntries()));
221 for(TIter patchIter = TIter(patches).Begin(); patchIter != TIter::End(); ++patchIter){
222 recpatch =
dynamic_cast<AliEMCALTriggerPatchInfo *
>(*patchIter);
225 std::stringstream triggerbitstring;
226 AliDebug(1, Form(
"Trigger maker - next patch: size %d, trigger bits %s", recpatch->GetPatchSize(), triggerbitstring.str().c_str()));
228 if(recpatch->IsJetHigh() || recpatch->IsJetLow())
FillQAHistos(
"EJEOnline", *recpatch);
229 if(recpatch->IsGammaHigh() || recpatch->IsGammaLow())
FillQAHistos(
"EGAOnline", *recpatch);
230 if(recpatch->IsJetHighSimple() || recpatch->IsJetLowSimple())
FillQAHistos(
"EJEOffline", *recpatch);
231 if(recpatch->IsGammaHighSimple() || recpatch->IsGammaLowSimple())
FillQAHistos(
"EGAOffline", *recpatch);
232 if(recpatch->IsLevel0())
FillQAHistos(
"EL0Online", *recpatch);
233 if(recpatch->IsRecalcJet())
FillQAHistos(
"EJERecalc", *recpatch);
234 if(recpatch->IsRecalcGamma())
FillQAHistos(
"EGARecalc", *recpatch);
236 int tBits = recpatch->GetTriggerBits();
237 for(
unsigned int ibit = 0; ibit <
sizeof(tBits)*8; ibit++) {
238 if(tBits & (1 << ibit)){
243 new((*fCaloTriggersOut)[patchcounter++]) AliEMCALTriggerPatchInfo(*recpatch);
245 if(patches)
delete patches;
257 AliOADBContainer badchannelDB(
"EmcalBadChannelsAdditional");
260 if(!badchannelmap || !badchannelmap->GetEntries())
return;
261 for(TIter citer = TIter(badchannelmap).Begin(); citer != TIter::End(); ++citer){
269 AliCDBManager *cdb = AliCDBManager::Instance();
271 AliCDBEntry *en = cdb->Get(
"EMCAL/Calib/Trigger");
273 AliErrorStream() << GetName() <<
": FastOR masking from CDB required, but OCDB entry is not available. No masking will be applied." << std::endl;
277 AliEMCALTriggerDCSConfig *trgconf =
dynamic_cast<AliEMCALTriggerDCSConfig *
>(en->GetObject());
279 AliErrorStream() << GetName() <<
": Failed decoding OCDB entry: Object is not of type AliEMCALTriggerDCSConfig." << std::endl;
287 Int_t fastOrAbsID(-1), ic(-1);
288 for(
int itru = 0; itru < trgconf->GetTRUArr()->GetEntries(); itru++){
289 AliEMCALTriggerTRUDCSConfig *truconf = trgconf->GetTRUDCSConfig(itru);
298 for(
unsigned int ifield = 0; ifield < 6; ifield++){
299 for(
unsigned int ibit = 0; ibit < 16; ibit ++){
300 if((truconf->GetMaskReg(ifield) >> ibit) & 0x1){
302 fGeom->GetTriggerMapping()->GetAbsFastORIndexFromTRU(itru, (ic =
GetMaskHandler()(ifield, ibit)), fastOrAbsID);
303 AliDebugStream(1) << GetName() <<
"Channel " << ic <<
" in TRU " << itru <<
" ( abs fastor " << fastOrAbsID <<
") masked." << std::endl;
306 AliErrorStream() << GetName() <<
"Invalid mask: (" << ifield <<
"|" << ibit <<
"), exception " << exept <<
" thrown. Mask will not be recognized" << std::endl;
314 Int_t globCol(-1), globRow(-1) ;
316 fGeom->GetTriggerMapping()->GetPositionInEMCALFromAbsFastORIndex(ifastOrID, globCol, globRow);
323 if(
fGeom->GetTriggerMappingVersion() == 2){
325 return [] (
unsigned int ifield,
unsigned int ibit) ->
int {
327 const int kChannelMap[6][16] = {{ 8, 9,10,11,20,21,22,23,32,33,34,35,44,45,46,47},
328 {56,57,58,59,68,69,70,71,80,81,82,83,92,93,94,95},
329 { 4, 5, 6, 7,16,17,18,19,28,29,30,31,40,41,42,43},
330 {52,53,54,55,64,65,66,67,76,77,78,79,88,89,90,91},
331 { 0, 1, 2, 3,12,13,14,15,24,25,26,27,36,37,38,39},
332 {48,49,50,51,60,61,62,63,72,73,74,75,84,85,86,87}};
333 return kChannelMap[ifield][ibit];
337 return [] (
int ifield,
int ibit) ->
int {
339 return ifield * 16 + ibit;
345 fQAHistos->
FillTH2(Form(
"RCPos%s", patchtype.Data()), recpatch.GetColStart(), recpatch.GetRowStart());
346 fQAHistos->
FillTH2(Form(
"EPCentPos%s", patchtype.Data()), recpatch.GetEtaGeo(), recpatch.GetPhiGeo());
347 fQAHistos->
FillTH2(Form(
"PatchADCvsE%s", patchtype.Data()), recpatch.GetADCAmp(), recpatch.GetPatchE());
348 fQAHistos->
FillTH2(Form(
"PatchADCOffvsE%s", patchtype.Data()), recpatch.GetADCOfflineAmp(), recpatch.GetPatchE());
AliVVZERO * fV0
! VZERO data
AliEmcalTriggerMakerTask()
New configuration, distinction between high and low threshold.
void InitializeBadFEEChannels()
void ConfigureForPbPb2015()
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="")
TObjArray * CreateTriggerPatches(const AliVEvent *inputevent, Bool_t useL0amp=kFALSE)
void AddFastORBadChannel(Short_t absId)
void SetTriggerBitConfig(const AliEMCALTriggerBitConfig *const config)
void ConfigureForPbPb2011()
Bool_t fUseL0Amplitudes
Use L0 amplitudes instead of L1 time sum (useful for runs where STU was not read) ...
virtual void UserCreateOutputObjects()
void ClearFastORBadChannels()
void SetIsMC(Bool_t isMC)
void ConfigureForPP2011()
Bool_t fLoadFastORMaskingFromOCDB
Load FastOR masking from the OCDB.
void ReadTriggerData(AliVCaloTrigger *trigger)
virtual ~AliEmcalTriggerMakerTask()
TString fV0InName
name of output track array
TH2 * CreateTH2(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, Option_t *opt="")
Old configuration, no distinction between high and low threshold.
void ConfigureForPP2012()
THashList * GetListOfHistograms() const
AliEMCALGeometry * fGeom
!emcal geometry
void SetUseTriggerBitConfig(TriggerMakerBitConfig_t bitConfig)
AliEmcalTriggerMakerKernel * fTriggerMaker
The actual trigger maker kernel.
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
void AddOfflineBadChannel(Short_t absId)
EMCAL trigger maker task.
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
const std::set< Short_t > & GetListOfBadFastORAbsIDs() const
AliVCaloCells * fCaloCells
!cells
void BuildL1ThresholdsOffline(const AliVVZERO *vzdata)
std::function< int(unsigned int, unsigned int)> GetMaskHandler() const
AliEmcalList * fOutput
!output list
void SetGeometry(const AliEMCALGeometry *const geo)
virtual void RunChanged(Int_t newrun)
void FillQAHistos(const TString &patchtype, const AliEMCALTriggerPatchInfo &recpatch)
TString fBadFEEChannelOADB
name of the OADB container containing channels to be masked inside the trigger maker ...
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
TString fCaloTriggersOutName
name of output track array
TClonesArray * fCaloTriggersOut
! trigger array out
void ClearOfflineBadChannels()
Container class for histograms for the high- charged particle analysis.
Kernel of the EMCAL trigger patch maker.
Int_t GetRunNumber(TString)
AliVCaloTrigger * fCaloTriggers
!calo triggers
void UserCreateOutputObjects()
void InitializeFastORMaskingFromOCDB()
Bool_t IsConfigured() const
THistManager * fQAHistos
! Histograms for QA
Bool_t fDoQA
Fill QA histograms.
void ReadCellData(AliVCaloCells *cells)
void ConfigureForPPb2013()