21 #include <TObjArray.h>
23 #include "AliAODCaloTrigger.h"
24 #include "AliEMCALGeometry.h"
25 #include "AliEMCALTriggerConstants.h"
26 #include "AliEMCALTriggerDataGrid.h"
27 #include "AliEMCALTriggerPatchInfo.h"
28 #include "AliEMCALTriggerPatchFinder.h"
29 #include "AliEMCALTriggerAlgorithm.h"
30 #include "AliEMCALTriggerRawPatch.h"
34 #include "AliVCaloCells.h"
35 #include "AliVCaloTrigger.h"
36 #include "AliVEvent.h"
37 #include "AliVVZERO.h"
46 fOfflineBadChannels(),
47 fFastORPedestal(5000),
48 fTriggerBitConfig(NULL),
50 fLevel0PatchFinder(NULL),
61 fPatchAmplitudes(NULL),
62 fPatchADCSimple(NULL),
68 memset(fThresholdConstants, 0,
sizeof(Int_t) * 12);
69 memset(fL1ThresholdsOffline, 0,
sizeof(ULong64_t) * 4);
85 AliWarning(
"Trigger bit configuration was not provided! Assuming new bit configuration (>= 2013).");
86 AliEMCALTriggerBitConfig* triggerBitConfig =
new AliEMCALTriggerBitConfigNew();
97 int nrows =
fGeometry->GetNTotalTRU() * 2;
98 std::cout <<
"Allocating channel grid with 48 columns in eta and " << nrows <<
" rows in phi" << std::endl;
110 trigger->SetPatchSize(patchSize);
111 trigger->SetSubregionSize(subregionSize);
125 AliEMCALTriggerBitConfig* triggerBitConfig =
new AliEMCALTriggerBitConfigNew();
141 AliEMCALTriggerBitConfig* triggerBitConfig =
new AliEMCALTriggerBitConfigNew();
157 AliEMCALTriggerBitConfig* triggerBitConfig =
new AliEMCALTriggerBitConfigNew();
171 AliEMCALTriggerBitConfig* triggerBitConfig =
new AliEMCALTriggerBitConfigOld();
185 AliEMCALTriggerBitConfig* triggerBitConfig =
new AliEMCALTriggerBitConfigOld();
199 AliEMCALTriggerBitConfig* triggerBitConfig =
new AliEMCALTriggerBitConfigOld();
213 while (stream.good()) {
221 std::ifstream
file(fname);
229 while (stream.good()) {
237 std::ifstream
file(fname);
244 AliWarning(Form(
"Abs. ID %d out of range (0,5000)", absId));
254 while (stream.good()) {
263 std::ifstream
file(fname);
278 Int_t globCol=-1, globRow=-1;
279 Int_t adcAmp=-1, bitmap = 0;
280 while(trigger->Next()){
283 trigger->GetPosition(globCol, globRow);
285 fGeometry->GetAbsFastORIndexFromPositionInEMCAL(globCol, globRow, absId);
290 trigger->GetL1TimeSum(adcAmp);
291 if (adcAmp < 0) adcAmp = 0;
292 trigger->GetTriggerBits(bitmap);
296 (*fPatchADC)(globCol,globRow) = adcAmp;
301 (*fTriggerBitMap)(globCol, globRow) = bitmap;
313 Float_t amplitude(0);
314 trigger->GetAmplitude(amplitude);
317 if(amplitude < 0) amplitude = 0;
319 (*fPatchAmplitudes)(globCol,globRow) = amplitude;
321 trigger->GetNL0Times(nl0times);
323 TArrayI l0times(nl0times);
324 trigger->GetL0Times(l0times.GetArray());
325 for(
int itime = 0; itime < nl0times; itime++){
326 (*fLevel0TimeMap)(globCol,globRow) = static_cast<Char_t>(l0times[itime]);
336 Int_t nCell = cells->GetNumberOfCells();
337 for(Int_t iCell = 0; iCell < nCell; ++iCell) {
339 Short_t cellId = cells->GetCellNumber(iCell);
343 AliDebug(10, Form(
"%hd is a bad channel, skipped.", cellId));
347 Double_t amp = cells->GetAmplitude(iCell);
350 fGeometry->GetFastORIndexFromCellIndex(cellId, absId);
351 Int_t globCol=-1, globRow=-1;
352 fGeometry->GetPositionInEMCALFromAbsFastORIndex(absId, globCol, globRow);
356 if (amp >=
fMinCellAmp) (*fPatchADCSimple)(globCol,globRow) += amp;
366 ULong64_t v0S = vzerodata->GetTriggerChargeA() + vzerodata->GetTriggerChargeC();
367 for (Int_t i = 0; i < 4; ++i) {
384 fADCtoGeV = EMCALTrigger::kEMCL1ADCtoGeV;
387 Double_t vertexpos[3];
388 inputevent->GetPrimaryVertex()->GetXYZ(vertexpos);
389 TVector3 vertexvec(vertexpos);
407 std::vector<AliEMCALTriggerRawPatch> patches;
416 TObjArray *result =
new TObjArray(1000);
417 result->SetOwner(kTRUE);
418 for(std::vector<AliEMCALTriggerRawPatch>::iterator patchit = patches.begin(); patchit != patches.end(); ++patchit){
421 Int_t offlinebits = 0, onlinebits = (*fTriggerBitMap)(patchit->GetColStart(), patchit->GetRowStart());
428 onlinebits &= gammaPatchMask;
435 onlinebits &= jetPatchMask;
440 onlinebits &= bkgPatchMask;
443 AliEMCALTriggerPatchInfo *fullpatch = AliEMCALTriggerPatchInfo::CreateAndInitialize(patchit->GetColStart(), patchit->GetRowStart(),
444 patchit->GetPatchSize(), patchit->GetADC(), patchit->GetOfflineADC(), patchit->GetOfflineADC() *
fADCtoGeV,
445 onlinebits | offlinebits, vertexvec,
fGeometry);
447 fullpatch->SetOffSet(offset);
448 result->Add(fullpatch);
452 std::vector<AliEMCALTriggerRawPatch> l0patches;
454 for(std::vector<AliEMCALTriggerRawPatch>::iterator patchit = l0patches.begin(); patchit != l0patches.end(); ++patchit){
455 Int_t offlinebits = 0, onlinebits = 0;
461 if (patchit->GetOfflineADC() >
fL0Threshold) SETBIT(offlinebits, AliEMCALTriggerPatchInfo::kOfflineOffset +
fTriggerBitConfig->GetLevel0Bit());
463 AliEMCALTriggerPatchInfo *fullpatch = AliEMCALTriggerPatchInfo::CreateAndInitialize(patchit->GetColStart(), patchit->GetRowStart(),
464 patchit->GetPatchSize(), patchit->GetADC(), patchit->GetOfflineADC(), patchit->GetOfflineADC() *
fADCtoGeV,
465 onlinebits | offlinebits, vertexvec,
fGeometry);
467 result->Add(fullpatch);
476 if(col < 0 || row < 0){
477 AliError(Form(
"Patch outside range [col %d, row %d]", col, row));
480 Int_t truref(-1), trumod(-1), absFastor(-1), adc(-1);
481 fGeometry->GetAbsFastORIndexFromPositionInEMCAL(col, row, absFastor);
482 fGeometry->GetTRUFromAbsFastORIndex(absFastor, truref, adc);
484 const int kNRowsPhi =
fGeometry->GetNTotalTRU() * 2;
485 for(
int ipos = 0; ipos < 2; ipos++){
486 if(row + ipos >= kNRowsPhi)
continue;
487 for(
int jpos = 0; jpos < 2; jpos++){
488 if(col + jpos >=
kColsEta)
continue;
491 fGeometry->GetAbsFastORIndexFromPositionInEMCAL(col+jpos, row+ipos, absFastor);
492 fGeometry->GetTRUFromAbsFastORIndex(absFastor, trumod, adc);
493 if(trumod != truref) {
497 if(col + jpos >=
kColsEta) AliError(Form(
"Boundary error in col [%d, %d + %d]", col + jpos, col, jpos));
498 if(row + ipos >= kNRowsPhi) AliError(Form(
"Boundary error in row [%d, %d + %d]", row + ipos, row, ipos));
499 Char_t l0times = (*fLevel0TimeMap)(col + jpos,row + ipos);
509 return bitmask & testmask;
514 return bitmask & testmask;
518 ULong_t bitmask = patch.GetBitmask(), testmask = 1 <<
fTriggerBitConfig->GetBkgBit();
519 return bitmask & testmask;
529 const int kEtaMinPhos = 16, kEtaMaxPhos = 31, kPhiMinPhos = 64, kPhiMaxPhos = 99;
530 if(patch.GetRowStart() + patch.GetPatchSize() -1 < kPhiMinPhos)
return false;
531 if(patch.GetRowStart() > kPhiMaxPhos)
return false;
532 if(patch.GetColStart() + patch.GetPatchSize() -1 < kEtaMinPhos)
return false;
533 if(patch.GetColStart() > kEtaMaxPhos)
return false;
Int_t fBkgThreshold
threshold for the background patches (8x8)
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
ELevel0TriggerStatus_t CheckForL0(Int_t col, Int_t row) const
Bool_t IsGammaPatch(const AliEMCALTriggerRawPatch &patch) const
void ConfigureForPbPb2015()
void ConfigureForPP2015()
Bool_t IsBkgPatch(const AliEMCALTriggerRawPatch &patch) const
TObjArray * CreateTriggerPatches(const AliVEvent *inputevent, Bool_t useL0amp=kFALSE)
bool HasPHOSOverlap(const AliEMCALTriggerRawPatch &patch) const
AliEMCALTriggerDataGrid< int > * fTriggerBitMap
! Map of trigger bits
void ReadFastORBadChannelFromStream(std::istream &stream)
TArrayF fFastORPedestal
FastOR pedestal.
void AddFastORBadChannel(Short_t absId)
void SetTriggerBitConfig(const AliEMCALTriggerBitConfig *const config)
void ConfigureForPbPb2011()
Int_t fMinCellAmp
Minimum offline amplitude of the cells used to generate the patches.
void ConfigureForPP2011()
void ReadFastORBadChannelFromFile(const char *fname)
void ReadTriggerData(AliVCaloTrigger *trigger)
Int_t fMinL1FastORAmp
Minimum L1 amplitude of the FastORs used to generate the patches.
const AliEMCALTriggerBitConfig * fTriggerBitConfig
Trigger bit configuration, aliroot-dependent.
const AliEMCALGeometry * fGeometry
! Underlying EMCAL geometry
Bool_t fIsMC
Set MC offset.
ULong64_t fL1ThresholdsOffline[4]
container for V0-dependent offline thresholds
void ReadOfflineBadChannelFromFile(const char *fname)
void ConfigureForPP2012()
Int_t fThresholdConstants[4][3]
simple offline trigger thresholds constants
virtual ~AliEmcalTriggerMakerKernel()
Double_t fADCtoGeV
! Conversion factor from ADC to GeV
void AddL1TriggerAlgorithm(Int_t rowmin, Int_t rowmax, UInt_t bitmask, Int_t patchSize, Int_t subregionSize)
void SetL0TriggerAlgorithm(Int_t rowmin, Int_t rowmax, UInt_t bitmask, Int_t patchSize, Int_t subregionSize)
void ReadOfflineBadChannelFromStream(std::istream &stream)
void SetFastORPedestal(Short_t absId, Float_t ped)
void AddOfflineBadChannel(Short_t absId)
std::set< Short_t > fBadChannels
Container of bad channels.
Int_t fL0Threshold
threshold for the L0 patches (2x2)
AliEMCALTriggerDataGrid< double > * fPatchAmplitudes
! TRU Amplitudes (for L0)
Manager for constants used in the trigger maker.
void BuildL1ThresholdsOffline(const AliVVZERO *vzdata)
AliEMCALTriggerDataGrid< double > * fPatchADC
! ADC values map
Int_t fMinL0FastORAmp
Minimum L0 amplitude of the FastORs used to generate the patches.
std::set< Short_t > fOfflineBadChannels
Abd ID of offline bad channels.
AliEMCALTriggerPatchFinder< double > * fPatchFinder
The actual patch finder.
AliEMCALTriggerDataGrid< double > * fPatchADCSimple
! patch map for simple offline trigger
Kernel of the EMCAL trigger patch makerThe trigger maker kernel contains the core functionality of th...
void ReadFastORPedestalFromFile(const char *fname)
AliEMCALTriggerDataGrid< char > * fLevel0TimeMap
! Map needed to store the level0 times
AliEMCALTriggerAlgorithm< double > * fLevel0PatchFinder
Patch finder for Level0 patches.
Bool_t IsJetPatch(const AliEMCALTriggerRawPatch &patch) const
Int_t fL0MinTime
Minimum L0 time.
Int_t fL0MaxTime
Maximum L0 time.
void ReadFastORPedestalFromStream(std::istream &stream)
void ReadCellData(AliVCaloCells *cells)
void ConfigureForPPb2013()
const Double_t kEMCL0ADCtoGeV_AP