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);
182 AliEMCALTriggerPatchInfo *recpatch = NULL;
183 Int_t patchcounter = 0;
185 AliDebug(2,Form(
"Trigger maker - Found %d patches\n", patches->GetEntries()));
186 for(TIter patchIter = TIter(patches).Begin(); patchIter != TIter::End(); ++patchIter){
187 recpatch =
dynamic_cast<AliEMCALTriggerPatchInfo *
>(*patchIter);
190 std::stringstream triggerbitstring;
191 AliDebug(1, Form(
"Trigger maker - next patch: size %d, trigger bits %s", recpatch->GetPatchSize(), triggerbitstring.str().c_str()));
193 if(recpatch->IsJetHigh() || recpatch->IsJetLow())
FillQAHistos(
"EJEOnline", *recpatch);
194 if(recpatch->IsGammaHigh() || recpatch->IsGammaLow())
FillQAHistos(
"EGAOnline", *recpatch);
195 if(recpatch->IsJetHighSimple() || recpatch->IsJetLowSimple())
FillQAHistos(
"EJEOffline", *recpatch);
196 if(recpatch->IsGammaHighSimple() || recpatch->IsGammaLowSimple())
FillQAHistos(
"EGAOffline", *recpatch);
197 if(recpatch->IsLevel0())
FillQAHistos(
"EL0Online", *recpatch);
198 if(recpatch->IsRecalcJet())
FillQAHistos(
"EJERecalc", *recpatch);
199 if(recpatch->IsRecalcGamma())
FillQAHistos(
"EGARecalc", *recpatch);
201 int tBits = recpatch->GetTriggerBits();
202 for(
unsigned int ibit = 0; ibit <
sizeof(tBits)*8; ibit++) {
203 if(tBits & (1 << ibit)){
208 new((*fCaloTriggersOut)[patchcounter++]) AliEMCALTriggerPatchInfo(*recpatch);
210 if(patches)
delete patches;
222 AliOADBContainer badchannelDB(
"EmcalBadChannelsAdditional");
225 if(!badchannelmap || !badchannelmap->GetEntries())
return;
226 for(TIter citer = TIter(badchannelmap).Begin(); citer != TIter::End(); ++citer){
234 AliCDBManager *cdb = AliCDBManager::Instance();
236 AliCDBEntry *en = cdb->Get(
"EMCAL/Calib/Trigger");
238 AliErrorStream() << GetName() <<
": FastOR masking from CDB required, but OCDB entry is not available. No masking will be applied." << std::endl;
242 AliEMCALTriggerDCSConfig *trgconf =
dynamic_cast<AliEMCALTriggerDCSConfig *
>(en->GetObject());
244 AliErrorStream() << GetName() <<
": Failed decoding OCDB entry: Object is not of type AliEMCALTriggerDCSConfig." << std::endl;
252 Int_t fastOrAbsID(-1), ic(-1);
253 for(
int itru = 0; itru < trgconf->GetTRUArr()->GetEntries(); itru++){
254 AliEMCALTriggerTRUDCSConfig *truconf = trgconf->GetTRUDCSConfig(itru);
263 for(
unsigned int ifield = 0; ifield < 6; ifield++){
264 for(
unsigned int ibit = 0; ibit < 16; ibit ++){
265 if((truconf->GetMaskReg(ifield) >> ibit) & 0x1){
267 fGeom->GetTriggerMapping()->GetAbsFastORIndexFromTRU(itru, (ic =
GetMaskHandler()(ifield, ibit)), fastOrAbsID);
268 AliDebugStream(1) << GetName() <<
"Channel " << ic <<
" in TRU " << itru <<
" ( abs fastor " << fastOrAbsID <<
") masked." << std::endl;
271 AliErrorStream() << GetName() <<
"Invalid mask: (" << ifield <<
"|" << ibit <<
"), exception " << exept <<
" thrown. Mask will not be recognized" << std::endl;
279 Int_t globCol(-1), globRow(-1) ;
281 fGeom->GetTriggerMapping()->GetPositionInEMCALFromAbsFastORIndex(ifastOrID, globCol, globRow);
288 if(
fGeom->GetTriggerMappingVersion() == 2){
290 return [] (
unsigned int ifield,
unsigned int ibit) ->
int {
292 const int kChannelMap[6][16] = {{ 8, 9,10,11,20,21,22,23,32,33,34,35,44,45,46,47},
293 {56,57,58,59,68,69,70,71,80,81,82,83,92,93,94,95},
294 { 4, 5, 6, 7,16,17,18,19,28,29,30,31,40,41,42,43},
295 {52,53,54,55,64,65,66,67,76,77,78,79,88,89,90,91},
296 { 0, 1, 2, 3,12,13,14,15,24,25,26,27,36,37,38,39},
297 {48,49,50,51,60,61,62,63,72,73,74,75,84,85,86,87}};
298 return kChannelMap[ifield][ibit];
302 return [] (
int ifield,
int ibit) ->
int {
304 return ifield * 16 + ibit;
310 fQAHistos->
FillTH2(Form(
"RCPos%s", patchtype.Data()), recpatch.GetColStart(), recpatch.GetRowStart());
311 fQAHistos->
FillTH2(Form(
"EPCentPos%s", patchtype.Data()), recpatch.GetEtaGeo(), recpatch.GetPhiGeo());
312 fQAHistos->
FillTH2(Form(
"PatchADCvsE%s", patchtype.Data()), recpatch.GetADCAmp(), recpatch.GetPatchE());
313 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()
Base task in the EMCAL framework.
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)
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)
Bool_t fLoadFastORMaskingFromOCDB
Load FastOR masking from the OCDB.
virtual void RunChanged()
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.
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)
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 fInitialized
whether or not the task has been already initialized
THistManager * fQAHistos
! Histograms for QA
Bool_t fDoQA
Fill QA histograms.
void ReadCellData(AliVCaloCells *cells)