5#ifndef TRIGT1MUCTPIBITS_HELPERSPHASE1_H
6#define TRIGT1MUCTPIBITS_HELPERSPHASE1_H
24 "Event number mismatch between MSPA and TRP in the central time slice",
25 "Event number mismatch between MSPC and TRP in the central time slice",
26 "Event number mismatch between MSPA and MSPC in any time slice",
27 "BCID mismatch between TRP and MSPA in the central time slice",
28 "BCID mismatch between TRP and MSPC in the central time slice",
29 "BCID mismatch between MSPA and MSPC in any time slice",
30 "MSPA multiplicity LVDS link CRC error in any time slice",
31 "MSPC multiplicity LVDS link CRC error in any time slice",
32 "Sector logic error flag set on any of the 104 MSPA sectors",
33 "Sector logic error flag set on any of the 104 MSPC sectors",
34 "Error flag set in any of the muon candidates in the event after zero-supression",
35 "CRC error on the MSPA DAQ link (in any time slice)",
36 "CRC error on the MSPC DAQ link (in any time slice)",
37 "TriggerType reception timeout error",
38 "MSPA DAQ link input FIFO full flag (cleared at EOF)",
39 "MSPC DAQ link input FIFO full flag (cleared at EOF)"
44 inline constexpr uint32_t
maskedWord(uint32_t word, uint32_t shift, uint32_t mask) {
45 return ((word >> shift) & mask);
49 inline constexpr uint32_t
maskedWord(uint64_t word, uint32_t shift, uint32_t mask) {
50 return ((word >> shift) & mask);
54 inline constexpr uint32_t
buildWord(uint32_t value, uint32_t shift, uint32_t mask) {
55 return ((value & mask) << shift);
59 inline constexpr bool wordEquals(uint32_t word, uint32_t shift, uint32_t mask, uint32_t value) {
85 uint32_t candCount{0};
94 inline constexpr uint32_t
timesliceHeader(uint32_t bcid, uint32_t tobCount, uint32_t candCount) {
114 uint32_t barrel_eta_lookup{0};
115 uint32_t barrel_phi_lookup{0};
141 else if (
header.det == 1){
146 else if (
header.det == 2){
159 inline constexpr std::array<uint32_t,3>
multiplicityWords(uint64_t multiplicity, uint32_t triggerBits,
bool overflow) {
160 std::array<uint32_t,3> words{};
161 for (uint32_t iWord=0; iWord<words.size(); ++iWord) {
188 if (status==0)
return {};
189 std::vector<size_t> errors;
192 errors.push_back(bit);
212 std::vector<uint32_t>
cnt = {};
274 std::cout <<
"Muon word content (cand): ";
275 std::cout << (
side?
"Side A, ":
"Side C, ");
277 std::cout <<
"BA" <<
num <<
" ";
280 std::cout <<
"Eta = " <<
eta <<
" ";
281 std::cout <<
"Phi = " <<
phi <<
" ";
282 std::cout <<
"pT = " <<
pt <<
" ";
283 std::cout <<
"mappedPt = " <<
mappedPt <<
" ";
295 std::cout <<
" SF: " << std::endl;
303 std::cout <<
" Veto = " << (
vetoFlag?
"1":
"0") <<
" ";
304 std::cout << std::endl;
364 std::cout <<
"Muon word content (TOB) : ";
365 std::cout << (
side?
"Side A, ":
"Side C, ");
367 std::cout <<
"BA" <<
sec <<
" ";
369 std::cout << (
det==1?
"FW":
"EC") <<
sec <<
" ";
372 std::cout <<
"pT = " <<
pt << std::endl;
374 if(
det == 1 ||
det == 2) {
380 std::cout << std::endl;
387 std::vector<Candidate>
cand = {};
388 std::vector<TopoTOB>
tob = {};
static constexpr uint32_t RUN3_CAND_WORD_SECTORFLAGS_GTN_SHIFT
static constexpr uint32_t RUN3_TIMESLICE_MULT_WORD_ID_VAL
static constexpr uint32_t RUN3_CAND_WORD_ID_MASK
static constexpr uint32_t RUN3_MULTIPLICITY_TRIGBITS_SHIFT
static constexpr uint32_t RUN3_STATUS_WORD_SHIFT
static constexpr uint32_t RUN3_TIMESLICE_NTOB_MASK
static constexpr uint32_t RUN3_TOPO_WORD_ETA_MASK
static constexpr uint32_t RUN3_SUBSYS_HEMISPHERE_MASK
constexpr uint32_t maskedWord(uint32_t word, uint32_t shift, uint32_t mask)
Extract sub-word from 32-bit word by applying a shift and a mask.
static constexpr uint32_t RUN3_TIMESLICE_WORD_NUM_VAL
constexpr uint32_t multiplicityWordNumber(uint32_t word)
Decode the index of the multitpicity word, which is 1, 2, or 3.
static constexpr uint32_t RUN3_CAND_WORD_CANDFLAGS_BA_GT1ROI_MASK
static constexpr uint32_t RUN3_TIMESLICE_MULT_WORD_ID_MASK
static constexpr uint32_t RUN3_CAND_WORD_PT_SHIFT
static constexpr uint32_t RUN3_TOPO_WORD_CANDFLAGS_ECFW_CHARGE_SHIFT
static constexpr uint32_t RUN3_TOPO_WORD_ETA_SHIFT
static constexpr uint32_t RUN3_CAND_WORD_VETO_MASK
static constexpr uint32_t RUN3_CAND_WORD_CANDFLAGS_ECFW_GOODMF_MASK
static constexpr uint32_t RUN3_CAND_WORD_ID_VAL
static constexpr uint32_t BARREL_SECTORID_MASK
Mask for extracting the sector ID for barrel candidates from the data word.
static constexpr uint32_t RUN3_CAND_WORD_CANDFLAGS_ECFW_GOODMF_SHIFT
static constexpr uint32_t RUN3_TOPO_WORD_ID_SHIFT
static constexpr uint32_t RUN3_TOPO_WORD_PHI_SHIFT
static constexpr uint32_t RUN3_SUBSYS_ADDRESS_EC_VAL
static constexpr uint32_t RUN3_TOPO_WORD_DET_SHIFT
static constexpr uint32_t RUN3_MULTIPLICITY_PART1_MASK
static constexpr uint32_t RUN3_TOPO_WORD_CANDFLAGS_ECFW_INNERCOIN_SHIFT
static constexpr uint32_t RUN3_TOPO_WORD_CANDFLAGS_ECFW_BW23_SHIFT
static constexpr uint32_t RUN3_CAND_WORD_ROI_SHIFT
static constexpr uint32_t RUN3_CAND_WORD_ROI_MASK
static constexpr uint32_t RUN3_CAND_WORD_CANDFLAGS_BA_GT1ROI_SHIFT
static constexpr uint32_t RUN3_SUBSYS_ADDRESS_BAFW_SHIFT
Run-3 subsystem identifier bits location and values.
static constexpr std::array< std::string_view, 16 > DataStatusWordErrors
static constexpr uint32_t RUN3_SUBSYS_ADDRESS_BAFW_MASK
static constexpr uint32_t RUN3_TOPO_WORD_FLAGS_SHIFT
static constexpr uint32_t RUN3_CAND_WORD_CANDFLAGS_ECFW_BW23_MASK
static constexpr uint32_t RUN3_CAND_WORD_CANDFLAGS_ECFW_INNERCOIN_MASK
static constexpr uint32_t RUN3_TIMESLICE_NTOB_SHIFT
static constexpr uint32_t RUN3_TOPO_WORD_ID_MASK
static constexpr uint32_t RUN3_TIMESLICE_MULT_WORD_NUM_MASK
static constexpr uint32_t RUN3_CAND_WORD_CANDFLAGS_ECFW_CHARGE_MASK
static constexpr uint32_t RUN3_SUBSYS_ADDRESS_FW_VAL
constexpr bool wordEquals(uint32_t word, uint32_t shift, uint32_t mask, uint32_t value)
Compare a sub-word of a 32-bit word to an expected value.
constexpr auto timesliceHeader(uint32_t word)
Decode timeslice word.
static constexpr uint32_t RUN3_STATUS_WORD_ID_MASK
static constexpr uint32_t RUN3_TIMESLICE_BCID_SHIFT
static constexpr uint32_t RUN3_CAND_WORD_ID_SHIFT
static constexpr uint32_t RUN3_SUBSYS_ADDRESS_EC_MASK
static constexpr uint32_t RUN3_STATUS_WORD_MASK
static constexpr uint32_t RUN3_TOPO_WORD_HEMI_SHIFT
static constexpr uint32_t RUN3_TOPO_WORD_PT_MASK
static constexpr uint32_t RUN3_TIMESLICE_BCID_MASK
static constexpr uint32_t RUN3_SUBSYS_ADDRESS_EC_SHIFT
static constexpr uint32_t RUN3_TOPO_WORD_CANDFLAGS_ECFW_GOODMF_MASK
static constexpr uint32_t RUN3_CAND_WORD_CANDFLAGS_BA_PHIOVERLAP_SHIFT
static constexpr uint32_t RUN3_TOPO_WORD_CANDFLAGS_ECFW_BW23_MASK
static constexpr uint32_t RUN3_TOPO_WORD_PHI_MASK
static constexpr uint32_t RUN3_STATUS_WORD_ID_SHIFT
static constexpr uint32_t RUN3_TIMESLICE_NCAND_SHIFT
static constexpr uint32_t RUN3_SUBSYS_ADDRESS_BA_VAL
static constexpr uint32_t RUN3_TIMESLICE_NCAND_MASK
static constexpr uint32_t RUN3_TOPO_WORD_ID_VAL
static constexpr uint32_t RUN3_CAND_WORD_CANDFLAGS_ECFW_CHARGE_SHIFT
static constexpr uint32_t RUN3_CAND_WORD_CANDFLAGS_NSWMON_SHIFT
static constexpr uint32_t RUN3_CAND_WORD_VETO_SHIFT
static constexpr uint32_t RUN3_TIMESLICE_MULT_WORD_NUM_SHIFT
static constexpr uint32_t RUN3_CAND_WORD_SECTORERRORFLAG_MASK
static constexpr uint32_t RUN3_CAND_WORD_CANDFLAGS_ECFW_BW23_SHIFT
static constexpr uint32_t ENDCAP_SECTORID_MASK
Mask for extracting the sector ID for endcap candidates from the data word.
static constexpr uint32_t RUN3_TOPO_WORD_CANDFLAGS_ECFW_INNERCOIN_MASK
static constexpr uint32_t RUN3_CAND_WORD_CANDFLAGS_BA_PHIOVERLAP_MASK
static constexpr uint32_t RUN3_MULTIPLICITY_PART1_SHIFT
static constexpr uint32_t RUN3_TOPO_WORD_CANDFLAGS_ECFW_GOODMF_SHIFT
constexpr WordType getWordType(uint32_t word)
Determine the type of a MUCTPI ROD word.
static constexpr uint32_t RUN3_TOPO_WORD_HEMI_MASK
static constexpr uint32_t RUN3_CAND_WORD_SECTORERRORFLAG_SHIFT
static constexpr uint32_t RUN3_CAND_WORD_SECTORFLAGS_GTN_MASK
constexpr uint32_t dataStatusWord(uint16_t status)
Encode the data status word.
constexpr uint32_t buildWord(uint32_t value, uint32_t shift, uint32_t mask)
Extract sub-word from 32-bit word by applying a shift and a mask.
static constexpr uint32_t RUN3_MULTIPLICITY_OVERFLOW_MASK
static constexpr uint32_t RUN3_MULTIPLICITY_PART2_MASK
static constexpr uint32_t RUN3_TOPO_WORD_DET_MASK
static constexpr uint32_t RUN3_CAND_WORD_CANDFLAGS_ECFW_INNERCOIN_SHIFT
static constexpr uint32_t RUN3_MULTIPLICITY_TRIGBITS_MASK
std::vector< size_t > getDataStatusWordErrors(uint32_t word)
Decode the data status word (returns a vector of bit indices for the errors set - empty if no errors)
static constexpr uint32_t RUN3_CAND_SECTORID_SHIFT
constexpr std::array< uint32_t, 3 > multiplicityWords(uint64_t multiplicity, uint32_t triggerBits, bool overflow)
Encode the multiplicity words.
static constexpr uint32_t RUN3_MULTIPLICITY_PART3_SHIFT
static constexpr uint32_t RUN3_STATUS_WORD_ID_VAL
static constexpr uint32_t RUN3_TIMESLICE_MULT_WORD_ID_SHIFT
const uint32_t RPCtoTGC_pt_map[7]
static constexpr uint32_t RUN3_TOPO_WORD_CANDFLAGS_ECFW_CHARGE_MASK
constexpr auto topoHeader(uint32_t word)
Decode topo word :
static constexpr uint32_t RUN3_SUBSYS_HEMISPHERE_SHIFT
static constexpr uint32_t RUN3_CAND_WORD_PT_MASK
constexpr SubsysID getSubsysID(uint32_t word)
Decode the subsys ID from RoI candidate word.
static constexpr uint32_t RUN3_TOPO_WORD_PT_SHIFT
static constexpr uint32_t RUN3_MULTIPLICITY_PART3_MASK
static constexpr uint32_t RUN3_MULTIPLICITY_PART2_SHIFT
static constexpr uint32_t RUN3_MULTIPLICITY_OVERFLOW_SHIFT
static constexpr uint32_t RUN3_CAND_WORD_CANDFLAGS_NSWMON_MASK
std::vector< uint32_t > cnt
std::vector< TopoTOB > tob
std::vector< Candidate > cand
uint32_t barrel_eta_lookup
uint32_t barrel_phi_lookup