34void TriggerMappingV2::reset_arrays()
36 std::fill(mTRUFastOROffsetX.begin(), mTRUFastOROffsetX.end(), 0);
37 std::fill(mTRUFastOROffsetY.begin(), mTRUFastOROffsetY.end(), 0);
38 std::fill(mNFastORInTRUPhi.begin(), mNFastORInTRUPhi.end(), 0);
39 std::fill(mNFastORInTRUEta.begin(), mNFastORInTRUEta.end(), 0);
41 std::fill(mSMFastOROffsetX.begin(), mSMFastOROffsetX.end(), 0);
42 std::fill(mSMFastOROffsetY.begin(), mSMFastOROffsetY.end(), 0);
43 std::fill(mNFastORInSMPhi.begin(), mNFastORInSMPhi.end(), 0);
44 std::fill(mNFastORInSMEta.begin(), mNFastORInSMEta.end(), 0);
46 std::fill(mNModuleInEMCALPhi.begin(), mNModuleInEMCALPhi.end(), 0);
49void TriggerMappingV2::init_TRU_offset()
51 mTRUFastOROffsetX[0] = 0;
52 mTRUFastOROffsetY[0] = 0;
55 enum class TRUType_t {
61 auto smtype = getSupermoduleType(supermoduleID);
62 auto isCside = isSupermoduleOnCSide(supermoduleID);
63 TRUType_t trutype = TRUType_t::STANDARD_TRU;
73 nTRU_inSM =
static_cast<unsigned int>(
static_cast<float>(nTRU_inSM) / 3.);
74 nTRU_inSM_eta =
static_cast<unsigned int>(
static_cast<float>(nTRU_inSM_eta) / 3.);
75 nModule_inTRU_phi =
static_cast<unsigned int>(
static_cast<float>(nModule_inTRU_phi) / 3.);
76 nModule_inTRU_eta = nModule_inTRU_eta * 3;
81 for (
IndexTRU truInSupermodule = 0; truInSupermodule < nTRU_inSM; truInSupermodule++) {
82 mNFastORInTRUPhi[currentTRU] = nModule_inTRU_phi;
83 mNFastORInTRUEta[currentTRU] = nModule_inTRU_eta;
85 mTRUIsCside.set(currentTRU,
true);
87 mTRUIsCside.set(currentTRU,
false);
90 if ((currentTRU + 1) >=
ALLTRUS) {
94 trutype = TRUType_t::STANDARD_TRU;
95 if (truInSupermodule == nTRU_inSM - 1 && isCside) {
96 trutype = TRUType_t::EXT_TRU;
101 case TRUType_t::STANDARD_TRU:
102 mTRUFastOROffsetX[currentTRU + 1] = mTRUFastOROffsetX[currentTRU] + nModule_inTRU_eta;
103 mTRUFastOROffsetY[currentTRU + 1] = mTRUFastOROffsetY[currentTRU];
105 case TRUType_t::EXT_TRU:
106 mTRUFastOROffsetX[currentTRU + 1] = 0;
107 mTRUFastOROffsetY[currentTRU + 1] = mTRUFastOROffsetY[currentTRU] + nModule_inTRU_phi;
116void TriggerMappingV2::init_SM_offset()
118 mSMFastOROffsetX[0] = 0;
119 mSMFastOROffsetY[0] = 0;
120 mNModuleInEMCALPhi[0] = 0;
125 auto smtype = getSupermoduleType(supermoduleID);
126 auto isCside = isSupermoduleOnCSide(supermoduleID);
132 nModule_inSM_phi =
static_cast<IndexRowPhi>(
static_cast<float>(nModule_inSM_phi) / 3.);
135 mNFastORInSMPhi[supermoduleID] = nModule_inSM_phi;
136 mNFastORInSMEta[supermoduleID] = nModule_inSM_eta;
139 if (currentSMtype == smtype) {
140 mNModuleInEMCALPhi[iB] += nModule_inSM_phi;
142 mNModuleInEMCALPhi[iB + 1] = mNModuleInEMCALPhi[iB] + nModule_inSM_phi;
145 currentSMtype = smtype;
154 mSMFastOROffsetX[supermoduleID + 1] = 0;
155 mSMFastOROffsetY[supermoduleID + 1] = mSMFastOROffsetY[supermoduleID] + nModule_inSM_phi;
157 mSMFastOROffsetX[supermoduleID + 1] = mSMFastOROffsetX[supermoduleID] + nModule_inSM_eta;
158 mSMFastOROffsetY[supermoduleID + 1] = mSMFastOROffsetY[supermoduleID];
173 IndexFastOR fastorIndexInverted = (mTRUIsCside.test(truIndex)) ? (
FASTORSTRU - positionInTRU - 1) : positionInTRU;
174 IndexColumnEta columnInTRU = mTRUFastOROffsetX[truIndex] +
IndexFastOR(fastorIndexInverted / mNFastORInTRUPhi[truIndex]);
175 IndexRowPhi rowInTRU = mTRUFastOROffsetY[truIndex] + mNFastORInTRUPhi[truIndex] - 1 -
IndexFastOR(fastorIndexInverted % mNFastORInTRUPhi[truIndex]);
178 id = rotateAbsFastOrIndexEtaToPhi(
id);
188 if (etaColumn > mNFastORInTRUEta[truIndex] - 1 ||
189 phiRow > mNFastORInTRUPhi[truIndex] - 1) {
203 id = rotateAbsFastOrIndexEtaToPhi(
id);
213 etaColumn >= mNFastORInSMEta[supermoduleID] ||
214 phiRow >= mNFastORInSMPhi[supermoduleID]) {
222 IndexRowPhi y = mSMFastOROffsetY[supermoduleID] + phiRow;
225 id = rotateAbsFastOrIndexEtaToPhi(
id);
238 id = rotateAbsFastOrIndexEtaToPhi(
id);
244 if (phosRegionID > 35) {
256 IndexFastOR convertedFastorIndex = rotateAbsFastOrIndexPhiToEta(fastOrAbsID);
259 return std::make_tuple(fastorInfo.mTRUID, fastorInfo.mFastORIDTRU);
265 IndexFastOR convertedFastorIndex = rotateAbsFastOrIndexPhiToEta(fastOrAbsID);
268 return std::make_tuple(fastorInfo.mTRUID, fastorInfo.mColumnEtaTRU, fastorInfo.mRowPhiTRU);
273 IndexFastOR convertedFastorIndex = rotateAbsFastOrIndexPhiToEta(fastOrAbsID);
276 return std::make_tuple(fastorInfo.mSupermoduleID, fastorInfo.mColumnEtaSupermodule, fastorInfo.mRowPhiSupermodule);
285 IndexFastOR convertedFastorIndex = rotateAbsFastOrIndexPhiToEta(fastorAbsID);
288 return std::make_tuple(column,
row);
296 auto [supermoduleID, moduleId, cellPhiModule, cellEtaModule] = mGeometry->
GetCellIndex(cellindex);
298 auto [cellPhiSupermodule, cellEtaSupermodule] = mGeometry->
GetCellPhiEtaIndexInSModule(supermoduleID, moduleId, cellPhiModule, cellEtaModule);
301 auto cellEta = cellEtaSupermodule, cellPhi = cellPhiSupermodule;
302 if (getSupermoduleType(supermoduleID) ==
DCAL_STANDARD && (supermoduleID % 2) == 1) {
304 cellEta = cellEtaShifted;
305 cellPhi = cellPhiShifted;
325 if (supermoduleID % 2 == 1) {
326 auto [cellPhiRowShifted, cellEtaColumnShifted] = mGeometry->
ShiftOnlineToOfflineCellIndexes(supermoduleID, cellPhiRowSupermodule, cellEtaColumnSupermodule);
327 cellEtaColumnSupermodule = cellEtaColumnShifted;
328 cellPhiRowSupermodule = cellPhiRowShifted;
347 return 32 + ((
int)(truIndexSTU / 4) * 6) + ((truIndexSTU % 4 < 2) ? (truIndexSTU % 4) : (truIndexSTU % 4 + 2));
353 if (truIndexTRU < 32) {
357 if (truIndexSTU >= 48) {
360 if (truIndexSTU >= 42) {
363 if (truIndexSTU >= 36) {
376 if (supermoduleID == 10) {
379 if (supermoduleID == 11) {
382 if (supermoduleID == 18) {
385 if (supermoduleID == 19) {
391 unsigned short branch = (hardwareAddress >> 11) & 0x1;
393 IndexTRU truIndex = (((ddlID % 2) << 1) | branch) - 1;
395 truIndex = (supermoduleID % 2) ? 2 - truIndex : truIndex;
397 if (supermoduleID < 10) {
398 truIndex += 3 * supermoduleID;
400 truIndex += (3 * supermoduleID - 4);
412 if (l0size <= 0 || l0size > 4) {
419 motif[1] = mNFastORInTRUPhi[truIndex];
420 motif[3] = mNFastORInTRUPhi[truIndex] + 1;
422 std::array<unsigned int, 4> fastorIndex;
423 std::fill(fastorIndex.begin(), fastorIndex.end(), 0);
430 IndexFastOR fastorInTRU = mNFastORInTRUPhi[truIndex] *
int(l0index / (mNFastORInTRUPhi[truIndex] - 1)) + (l0index % (mNFastORInTRUPhi[truIndex] - 1)) + motif[
index];
446 unsigned int fastorIndexTRU;
448 IndexFastOR convertedFastorIndex = rotateAbsFastOrIndexEtaToPhi(fastOrAbsID);
451 fastorIndexTRU = convertedFastorIndex %
FASTORSTRU;
456 IndexColumnEta etaColumnTRU = fastorIndexTRU / mNFastORInTRUPhi[truIndex];
457 IndexRowPhi phiRowTRU = fastorIndexTRU % mNFastORInTRUPhi[truIndex];
458 fastorIndexTRU = mNFastORInTRUPhi[truIndex] * ((mTRUIsCside[truIndex]) ? (mNFastORInTRUEta[truIndex] - 1 - etaColumnTRU) : etaColumnTRU) + ((!mTRUIsCside[truIndex]) ? (mNFastORInTRUPhi[truIndex] - 1 - phiRowTRU) : phiRowTRU);
463 Int_t idtmp = (rowPhiGlobal < mNModuleInEMCALPhi[2]) ? fastOrAbsID : (fastOrAbsID +
FASTORSTRU * 4);
470 IndexColumnEta etaColumnSupermodule = etaColumnGlobal % mNFastORInSMEta[supermoduleID];
471 IndexRowPhi phiRowSupermodule = convertedFastorIndex % mNFastORInSMPhi[supermoduleID];
478 etaColumnSupermodule,
486 Int_t fastOrIndexInPhi = 0;
488 for (
int i = 1;
i < 5;
i++) {
489 if (det_phi < mNModuleInEMCALPhi[
i]) {
490 fastOrIndexInPhi =
FASTORSETA * mNModuleInEMCALPhi[
i - 1];
491 if (
i == 2 ||
i == 4) {
492 nModule_inSM_phi /= 3;
499 Int_t fastorInSMType = fastorIndexInEta - fastOrIndexInPhi;
500 Int_t sectorInSMType = (
int)(fastorInSMType / (
FASTORSETA * nModule_inSM_phi));
501 Int_t fastOrInSector = (
int)(fastorInSMType % (
FASTORSETA * nModule_inSM_phi));
503 fastOrIndexInPhi += sectorInSMType * (
FASTORSETA * nModule_inSM_phi);
505 fastOrIndexInPhi += (
int)(fastOrInSector %
FASTORSETA) * nModule_inSM_phi;
508 return fastOrIndexInPhi;
514 Int_t fastorIndexInEta = 0;
517 for (
int i = 1;
i < 5;
i++) {
518 if (det_phi < mNModuleInEMCALPhi[
i]) {
519 fastorIndexInEta =
FASTORSETA * mNModuleInEMCALPhi[
i - 1];
520 if (
i == 2 ||
i == 4) {
521 nModule_inSM_phi /= 3;
528 Int_t fastorInSMType = fastOrIndexInPhi - fastorIndexInEta;
529 Int_t sectorInSMType = (
int)(fastorInSMType / (
FASTORSETA * nModule_inSM_phi));
530 Int_t fastOrInSector = (
int)(fastorInSMType % (
FASTORSETA * nModule_inSM_phi));
532 Int_t columnInSector = fastOrInSector / nModule_inSM_phi;
533 Int_t rowInSector = fastOrInSector % nModule_inSM_phi;
535 fastorIndexInEta += sectorInSMType * (
FASTORSETA * nModule_inSM_phi);
537 fastorIndexInEta += rowInSector *
FASTORSETA + columnInSector;
539 return fastorIndexInEta;
548 IndexColumnEta etaSTU = fastOrIndexSTU % mNFastORInTRUEta[truIndexTRU];
549 IndexRowPhi phiSTU = fastOrIndexSTU / mNFastORInTRUEta[truIndexTRU];
552 IndexColumnEta etaTRU = (mTRUIsCside[truIndexTRU]) ? (mNFastORInTRUEta[truIndexTRU] - etaSTU - 1) : etaSTU;
553 IndexRowPhi phiTRU = (mTRUIsCside[truIndexTRU]) ? phiSTU : (mNFastORInTRUPhi[truIndexTRU] - phiSTU - 1);
554 IndexFastOR fastorIndexTRU = etaTRU * mNFastORInTRUPhi[truIndexTRU] + phiTRU;
556 return std::make_tuple(truIndexTRU, fastorIndexTRU);
562 if (truEtaSTU >= mNFastORInTRUEta[truIndexTRU] || truPhiSTU >= mNFastORInTRUPhi[truIndexTRU]) {
566 IndexColumnEta truEtaTRU = (mTRUIsCside[truIndexTRU]) ? (mNFastORInTRUEta[truIndexTRU] - truEtaSTU - 1) : truEtaSTU;
567 IndexRowPhi truPhiTRU = (mTRUIsCside[truIndexTRU]) ? truPhiSTU : (mNFastORInTRUPhi[truIndexTRU] - truPhiSTU - 1);
569 return std::make_tuple(truIndexTRU, truEtaTRU, truPhiTRU);
577 IndexColumnEta etaTRU = fastorIndexTRU / mNFastORInTRUPhi[truIndexTRU];
578 IndexRowPhi phiTRU = fastorIndexTRU % mNFastORInTRUPhi[truIndexTRU];
580 IndexColumnEta etaSTU = (mTRUIsCside[truIndexTRU]) ? (mNFastORInTRUEta[truIndexTRU] - etaTRU - 1) : etaTRU;
581 IndexRowPhi phiSTU = (mTRUIsCside[truIndexTRU]) ? phiTRU : (mNFastORInTRUPhi[truIndexTRU] - phiTRU - 1);
584 IndexFastOR fastorIndexSTU = phiSTU * mNFastORInTRUEta[truIndexTRU] + etaSTU;
586 return std::tuple(truIndexSTU, fastorIndexSTU);
592 if (truEtaTRU >= mNFastORInTRUEta[truIndexTRU] || truPhiTRU >= mNFastORInTRUPhi[truIndexTRU]) {
596 IndexColumnEta truEtaSTU = (mTRUIsCside[truIndexTRU]) ? (mNFastORInTRUEta[truIndexTRU] - truEtaTRU - 1) : truEtaTRU;
597 IndexRowPhi truPhiSTU = (mTRUIsCside[truIndexTRU]) ? truPhiTRU : (mNFastORInTRUPhi[truIndexTRU] - truPhiTRU - 1);
598 return std::make_tuple(truIndexSTU, truEtaSTU, truPhiSTU);
ClassImp(o2::emcal::TriggerMappingV2)
Error handling of faulty FastOR indices.
Handling of invalid positions of a FastOR in the detector.
Handling of invalid positions of a FastOR within a supermodule.
Handling of invalid positions of a FastOR within a TRU.
Handling cases where the geometry is required but not defined.
EMCAL geometry definition.
std::tuple< int, int > GetCellPhiEtaIndexInSModule(int supermoduleID, int moduleID, int phiInModule, int etaInModule) const
Get eta-phi indexes of cell in SM.
std::tuple< int, int, int, int > GetCellIndex(Int_t absId) const
Get cell SM, module numbers from absolute ID number.
std::tuple< int, int > ShiftOnlineToOfflineCellIndexes(Int_t supermoduleID, Int_t iphi, Int_t ieta) const
Adapt cell indices in supermodule to online indexing.
Int_t GetAbsCellIdFromCellIndexes(Int_t nSupMod, Int_t iphi, Int_t ieta) const
Transition from super module number (nSupMod) and cell indexes (ieta,iphi) to cell absolute ID number...
std::tuple< int, int > ShiftOfflineToOnlineCellIndexes(Int_t supermoduleID, Int_t iphi, Int_t ieta) const
Adapt cell indices in supermodule to offline indexing.
Handlig access of L0 index mapping with invalid patch size.
Handling of invalid PHOS regions.
Handling error due to invalid supermodule.
Error handling of faulty TRU indices.
Trigger mapping starting from Run2.
static constexpr unsigned int FASTORSPHITRU
Number of FastOR/TRU in Phi.
static constexpr unsigned int FASTORSTRU
Number of FastOR/TRU.
std::tuple< IndexColumnEta, IndexRowPhi > getPositionInEMCALFromAbsFastORIndex(IndexFastOR fastORAbsID) const
Get the position in the Detector from the absolute FastOR ID.
IndexTRU convertTRUIndexSTUtoTRU(IndexTRU truIndexSTU, DetType_t detector) const
Convert the TRU index from the STU numbering scheme into the TRU numbering scheme.
std::tuple< IndexTRU, IndexColumnEta, IndexRowPhi > convertFastORPositionSTUtoTRU(IndexTRU truIndexSTU, IndexColumnEta truEtaSTU, IndexRowPhi truPhiSTU, DetType_t detector) const
Convert TRU and FastOR position in TRU from STU number scheme to TRU number scheme.
DetType_t
Calorimeter type.
IndexFastOR getAbsFastORIndexFromPositionInEMCAL(IndexColumnEta etaColumn, IndexRowPhi phiRow) const
Get the absolute index of the FastOR from the geometric position in EMCAL.
std::tuple< IndexTRU, IndexColumnEta, IndexRowPhi > getPositionInTRUFromAbsFastORIndex(IndexFastOR fastORAbsID) const
Get the position of a FastOR inside the TRU from the absolute FastOR ID.
unsigned int IndexColumnEta
IndexFastOR getAbsFastORIndexFromIndexInTRU(IndexTRU truIndex, IndexFastOR fastorIndexTRU) const
Get the absolute index of the FastOr from the index in the TRU.
unsigned int IndexSupermodule
IndexFastOR getAbsFastORIndexFromPHOSSubregion(unsigned int phosRegionID) const
std::tuple< IndexTRU, IndexColumnEta, IndexRowPhi > convertFastORPositionTRUtoSTU(IndexTRU truIndexTRU, IndexColumnEta etaTRU, IndexRowPhi phiTRU) const
Convert TRU and FastOR position in TRU from TRU number scheme to STU number scheme.
IndexTRU convertTRUIndexTRUtoSTU(IndexTRU truIndexTRU) const
static constexpr unsigned int TRUSETASM
Number of TRUs/SM in Eta.
TriggerMappingV2()
Default constructor.
static constexpr unsigned int TRUSPHISM
Number of TRUs/SM in Phi.
IndexFastOR getAbsFastORIndexFromPositionInTRU(IndexTRU truIndex, IndexColumnEta etaColumn, IndexRowPhi phiRow) const
Get the absolute index of the FastOr from geometric position in TRU.
std::tuple< IndexSupermodule, IndexColumnEta, IndexRowPhi > getPositionInSupermoduleFromAbsFastORIndex(IndexFastOR fastORAbsID) const
Get the position inside the supermodule from the absolute FastOR ID.
IndexFastOR getAbsFastORIndexFromPositionInSupermodule(IndexSupermodule supermoduleID, IndexColumnEta etaColumn, IndexRowPhi phiRow) const
Get the absolute index of the FastOr from the geometric position in the supermodule.
static constexpr unsigned int FASTORSPHI
Number of FastOR/EMCALs in Phi.
static constexpr unsigned int FASTORSETATRU
Number of FastOR/TRU in Eta.
static constexpr unsigned int FASTORSETA
EMCAL+DCAL region eta size.
static constexpr unsigned int SUPERMODULES
Total number of supermodules in EMCAL.
static constexpr unsigned int FASTORSPHISM
Number of FastOR/SM in Phi.
static constexpr unsigned int FASTORSETASM
Number of FastOR/SM in Eta.
std::tuple< IndexTRU, IndexFastOR > convertFastORIndexTRUtoSTU(IndexTRU truIndexTRU, IndexFastOR fastorIndexTRU) const
Convert TRU and FastOR index in TRU from TRU number scheme to STU number scheme.
static constexpr unsigned int TRUSSUPERMODULE
Number of TRUs/SM.
std::array< IndexCell, 4 > getCellIndexFromAbsFastORIndex(IndexFastOR fastORAbsID) const
Get the indices of the cells in the module of a given FastOR.
IndexTRU getTRUIndexFromOnlineHardareAddree(int hardwareAddress, unsigned int ddlID, unsigned int supermoduleID) const
Get the TRU Index from the hardware address of the ALTRO channel (TRU rawdata)
std::tuple< IndexTRU, IndexFastOR > convertFastORIndexSTUtoTRU(IndexTRU truIndexSTU, IndexFastOR fastOrIndexSTU, DetType_t detector) const
Convert TRU and FastOR index in TRU from STU number scheme to TRU number scheme.
FastORInformation getInfoFromAbsFastORIndex(IndexFastOR absFastORID) const
IndexFastOR getAbsFastORIndexFromCellIndex(IndexCell cellIndex) const
Get the absolute FastOR index of the module containing a given cell.
std::array< unsigned int, 4 > getFastORIndexFromL0Index(IndexTRU iTRU, IndexFastOR l0index, int size) const
static constexpr unsigned int ALLFASTORS
Number of FastOR/EMCALs.
std::tuple< IndexTRU, IndexFastOR > getTRUFromAbsFastORIndex(IndexFastOR fastOrAbsID) const
Get the TRU index and FastOR index in TRU from the absolute FastOR ID.
static constexpr unsigned int ALLTRUS
Total number of TRUs in EMCAL.
std::vector< Cell > cells