Project
Loading...
Searching...
No Matches
TriggerMappingV2.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11#ifndef ALICEO2_EMCAL_TRIGGERMAPPINGV2_H_
12#define ALICEO2_EMCAL_TRIGGERMAPPINGV2_H_
13
14#include <array>
15#include <bitset>
16#include <tuple>
18
19namespace o2
20{
21namespace emcal
22{
23
24class Geometry;
25
33{
34 public:
35 //********************************************
36 // static constant
37 //********************************************
38 static constexpr unsigned int SUPERMODULES = 20;
39 static constexpr unsigned int ALLTRUS = 52;
40 static constexpr unsigned int FASTORSETATRU = 8;
41 static constexpr unsigned int FASTORSPHITRU = 12;
42 static constexpr unsigned int FASTORSTRU = FASTORSETATRU * FASTORSPHITRU;
43 static constexpr unsigned int TRUSETASM = 3;
44 static constexpr unsigned int TRUSPHISM = 1;
45 static constexpr unsigned int TRUSSUPERMODULE = TRUSETASM * TRUSPHISM;
46 static constexpr unsigned int FASTORSETASM = FASTORSETATRU * TRUSETASM;
47 static constexpr unsigned int FASTORSPHISM = FASTORSPHITRU * TRUSPHISM;
48 static constexpr unsigned int FASTORSETA = 2 /*Aside,Cside*/ * FASTORSETASM;
49 static constexpr unsigned int FASTORSPHI = (5 * FASTORSPHISM) + (1 * FASTORSPHISM / 3) /*EMCAL*/
50 + (3 * FASTORSPHISM) + (1 * FASTORSPHISM / 3) /*DCAL */;
51 static constexpr unsigned int ALLFASTORS = FASTORSETA * FASTORSPHI;
52 static constexpr unsigned int PATCHESINTRU = 77;
53
54 //********************************************
55 // Index types
56 //********************************************
57 using IndexTRU = unsigned int;
58 using IndexSTU = unsigned int;
59 using IndexSupermodule = unsigned int;
60 using IndexFastOR = unsigned int;
61 using IndexCell = unsigned int;
62 using IndexColumnEta = unsigned int;
63 using IndexRowPhi = unsigned int;
64 using IndexOnline = unsigned int;
65
68 enum class DetType_t {
71 };
72
75
78
80 ~TriggerMappingV2() = default;
81
82 //********************************************
83 // Get FastOR index from TRU/SM/EMCAL Geometry
84 //********************************************
85
97
109
122
134
142 IndexFastOR getAbsFastORIndexFromPHOSSubregion(unsigned int phosRegionID) const;
143
144 //********************************************
145 // Get TRU/SM/EMCAL Geometry from FastOR index
146 //********************************************
154 std::tuple<IndexTRU, IndexFastOR> getTRUFromAbsFastORIndex(IndexFastOR fastOrAbsID) const;
155
163 std::tuple<IndexTRU, IndexColumnEta, IndexRowPhi> getPositionInTRUFromAbsFastORIndex(IndexFastOR fastORAbsID) const;
164
172 std::tuple<IndexSupermodule, IndexColumnEta, IndexRowPhi> getPositionInSupermoduleFromAbsFastORIndex(IndexFastOR fastORAbsID) const;
173
181 std::tuple<IndexColumnEta, IndexRowPhi> getPositionInEMCALFromAbsFastORIndex(IndexFastOR fastORAbsID) const;
182
183 //********************************************
184 // TRU vs. STU
185 //********************************************
186
203 std::tuple<IndexTRU, IndexFastOR> convertFastORIndexSTUtoTRU(IndexTRU truIndexSTU, IndexFastOR fastOrIndexSTU, DetType_t detector) const;
204
220 std::tuple<IndexTRU, IndexFastOR> convertFastORIndexTRUtoSTU(IndexTRU truIndexTRU, IndexFastOR fastorIndexTRU) const;
221
239 std::tuple<IndexTRU, IndexColumnEta, IndexRowPhi> convertFastORPositionSTUtoTRU(IndexTRU truIndexSTU, IndexColumnEta truEtaSTU, IndexRowPhi truPhiSTU, DetType_t detector) const;
240
257 std::tuple<IndexTRU, IndexColumnEta, IndexRowPhi> convertFastORPositionTRUtoSTU(IndexTRU truIndexTRU, IndexColumnEta etaTRU, IndexRowPhi phiTRU) const;
258
259 //********************************************
260 // Cell Index
261 //********************************************
262
269
275 std::array<IndexCell, 4> getCellIndexFromAbsFastORIndex(IndexFastOR fastORAbsID) const;
276
277 //********************************************
278 // TRU index
279 //********************************************
280
291 IndexTRU convertTRUIndexSTUtoTRU(IndexTRU truIndexSTU, DetType_t detector) const;
292
303 IndexTRU convertTRUIndexTRUtoSTU(IndexTRU truIndexTRU) const;
304
307 IndexTRU getTRUIndexFromOnlineIndex(IndexOnline onlineIndex) const noexcept { return onlineIndex; };
308
311 IndexOnline getOnlineIndexFromTRUIndex(IndexTRU truIndex) const { return truIndex; };
312
319 IndexTRU getTRUIndexFromOnlineHardareAddree(int hardwareAddress, unsigned int ddlID, unsigned int supermoduleID) const;
320
321 //********************************************
322 // L0 Index
323 //********************************************
324
331 std::array<unsigned int, 4> getFastORIndexFromL0Index(IndexTRU iTRU, IndexFastOR l0index, int size) const;
332
336 unsigned int mTRUID;
337 unsigned int mFastORIDTRU;
338 unsigned int mColumnEtaTRU;
339 unsigned int mRowPhiTRU;
340 unsigned int mSupermoduleID;
342 unsigned int mRowPhiSupermodule;
343 };
344
346
347 //********************************************
348 // getters arrays (for debugging)
349 //********************************************
350 const std::array<unsigned int, ALLTRUS>& getArrayTRUFastOROffsetX() const { return mTRUFastOROffsetX; }
351 const std::array<unsigned int, ALLTRUS>& getTRUFastOROffsetY() const { return mTRUFastOROffsetY; }
352 const std::array<unsigned int, ALLTRUS>& getNFastORInTRUPhi() const { return mNFastORInTRUPhi; }
353 const std::array<unsigned int, ALLTRUS>& getNFastORInTRUEta() const { return mNFastORInTRUEta; }
354 const std::array<unsigned int, SUPERMODULES>& getArraySMFastOROffsetX() const { return mSMFastOROffsetX; }
355 const std::array<unsigned int, SUPERMODULES>& getArraySMFastOROffsetY() const { return mSMFastOROffsetY; }
356 const std::array<unsigned int, SUPERMODULES>& getArrayNFastORInSMPhi() const { return mNFastORInSMPhi; }
357 const std::array<unsigned int, SUPERMODULES>& getArrayNFastORInSMEta() const { return mNFastORInSMEta; }
358 const std::array<unsigned int, 5>& getArrayNModuleInEMCALPhi() const { return mNModuleInEMCALPhi; }
359
360 private:
361 //********************************************
362 // fastOR offset parameters
363 //********************************************
364 o2::emcal::Geometry* mGeometry;
365 std::array<unsigned int, ALLTRUS> mTRUFastOROffsetX;
366 std::array<unsigned int, ALLTRUS> mTRUFastOROffsetY;
367 std::array<unsigned int, ALLTRUS> mNFastORInTRUPhi;
368 std::array<unsigned int, ALLTRUS> mNFastORInTRUEta;
369 std::bitset<ALLTRUS> mTRUIsCside;
370
371 std::array<unsigned int, SUPERMODULES> mSMFastOROffsetX; // FastOR offset[#of SM ]
372 std::array<unsigned int, SUPERMODULES> mSMFastOROffsetY; //
373 std::array<unsigned int, SUPERMODULES> mNFastORInSMPhi; // SM size
374 std::array<unsigned int, SUPERMODULES> mNFastORInSMEta; //
375
376 std::array<unsigned int, 5> mNModuleInEMCALPhi; //#FastOR/EMCAL in Phi
377
378 //********************************************
379 // Initialization of FastOR index offset of each SM/TRU
380 //********************************************
381
383 void init_TRU_offset();
384 void init_SM_offset();
385
387 void reset_arrays();
388
389 //********************************************
390 // Rotation methods from between eta and phi orientation
391 //********************************************
392
406 IndexFastOR rotateAbsFastOrIndexEtaToPhi(IndexFastOR fastorIndexInEta) const;
407
422 IndexFastOR rotateAbsFastOrIndexPhiToEta(IndexFastOR fastorIndexInPhi) const;
423
428 EMCALSMType getSupermoduleType(IndexSupermodule supermoduleID) const
429 {
430 if (supermoduleID >= SUPERMODULES) {
431 throw SupermoduleIndexException(supermoduleID, SUPERMODULES);
432 }
433 if (supermoduleID < 10) {
434 return EMCAL_STANDARD;
435 }
436 if (supermoduleID < 12) {
437 return EMCAL_THIRD;
438 }
439 if (supermoduleID < 18) {
440 return DCAL_STANDARD;
441 }
442 if (supermoduleID < 20) {
443 return DCAL_EXT;
444 }
445 // silence compiler warning (check already done before in order to avoid unnecessary filter)
446 throw SupermoduleIndexException(supermoduleID, SUPERMODULES);
447 }
448
452 bool isSupermoduleOnCSide(IndexSupermodule supermoduleID) const
453 {
454 return (supermoduleID % 2 == 1) ? true : false;
455 }
456
457 ClassDefNV(TriggerMappingV2, 1);
458};
459
460} // namespace emcal
461} // namespace o2
462
463#endif // ALIEMCALTRIGGERMAPPINGV2_H
EMCAL geometry definition.
Definition Geometry.h:40
Handling error due to invalid supermodule.
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.
const std::array< unsigned int, SUPERMODULES > & getArraySMFastOROffsetY() const
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.
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.
const std::array< unsigned int, ALLTRUS > & getNFastORInTRUPhi() const
IndexFastOR getAbsFastORIndexFromIndexInTRU(IndexTRU truIndex, IndexFastOR fastorIndexTRU) const
Get the absolute index of the FastOr from the index in the TRU.
IndexFastOR getAbsFastORIndexFromPHOSSubregion(unsigned int phosRegionID) const
const std::array< unsigned int, SUPERMODULES > & getArrayNFastORInSMEta() 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.
const std::array< unsigned int, ALLTRUS > & getArrayTRUFastOROffsetX() const
static constexpr unsigned int FASTORSPHI
Number of FastOR/EMCALs in Phi.
IndexTRU getTRUIndexFromOnlineIndex(IndexOnline onlineIndex) const noexcept
Get the TRU index from the online index.
const std::array< unsigned int, 5 > & getArrayNModuleInEMCALPhi() const
const std::array< unsigned int, ALLTRUS > & getTRUFastOROffsetY() const
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.
const std::array< unsigned int, ALLTRUS > & getNFastORInTRUEta() const
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.
const std::array< unsigned int, SUPERMODULES > & getArrayNFastORInSMPhi() const
~TriggerMappingV2()=default
Destructor.
static constexpr unsigned int TRUSSUPERMODULE
Number of TRUs/SM.
IndexOnline getOnlineIndexFromTRUIndex(IndexTRU truIndex) const
Get the online index from the TRU index.
const std::array< unsigned int, SUPERMODULES > & getArraySMFastOROffsetX() const
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.
static constexpr unsigned int PATCHESINTRU
GLsizeiptr size
Definition glcorearb.h:659
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
unsigned int mRowPhiSupermodule
Row in the supermodule.
unsigned int mColumnEtaSupermodule
Column in the supermodule.
unsigned int mFastORIDTRU
Online FastOR index in TRU.