46 const std::vector<std::shared_ptr<TrigConf::L1Threshold> > & thresholds =
m_l1menu->
thresholds(
"MU");
47 int nThresholds = thresholds.size();
59 for (
size_t isub=0;isub<2;isub++)
61 std::shared_ptr<LVL1MUONIF::Lvl1MuSectorLogicDataPhase1> sectorData = mergedInputs.
getSectorLogicDataPtr(isys, isub, isec,
bcid);
62 if (!sectorData)
continue;
64 const unsigned int& ncand_max = LVL1MUONIF::NCAND[isys];
65 for (
unsigned int icand=0;icand<ncand_max;icand++)
68 if (
thresh == -1)
continue;
69 int roiID = sectorData->
roi(icand);
70 if (roiID < 0)
continue;
82 ROI_MASK = LVL1::MuCTPIBits::BARREL_ROI_MASK;
83 SECTOR_MASK = LVL1::MuCTPIBits::BARREL_SECTORID_MASK;
87 ROI_MASK = LVL1::MuCTPIBits::ENDCAP_ROI_MASK;
88 SECTOR_MASK = LVL1::MuCTPIBits::ENDCAP_SECTORID_MASK;
93 ROI_MASK = LVL1::MuCTPIBits::FORWARD_ROI_MASK;
94 SECTOR_MASK = LVL1::MuCTPIBits::FORWARD_SECTORID_MASK;
102 daq_word |= (sectorData->
roi(icand) & ROI_MASK) << LVL1::MuCTPIBits::RUN3_ROI_SHIFT;
105 daq_word |= (
thresh & LVL1::MuCTPIBits::RUN3_CAND_PT_MASK) << LVL1::MuCTPIBits::RUN3_CAND_PT_SHIFT;
110 daq_word |= (sectorData->
ovl(icand) & LVL1::MuCTPIBits::RUN3_CAND_WORD_CANDFLAGS_BA_PHIOVERLAP_MASK) << LVL1::MuCTPIBits::RUN3_CAND_WORD_CANDFLAGS_BA_PHIOVERLAP_SHIFT;
111 daq_word |= (sectorData->
is2candidates(icand) & LVL1::MuCTPIBits::ROI_OVERFLOW_MASK) << LVL1::MuCTPIBits::RUN3_ROI_OVERFLOW_SHIFT;
115 daq_word |= (sectorData->
charge(icand) & 0x1) << LVL1::MuCTPIBits::RUN3_CAND_TGC_CHARGE_SIGN_SHIFT;
116 daq_word |= (sectorData->
bw2or3(icand) & 0x1) << LVL1::MuCTPIBits::RUN3_CAND_TGC_BW2OR3_SHIFT;
117 daq_word |= (sectorData->
innercoin(icand) & 0x1) << LVL1::MuCTPIBits::RUN3_CAND_TGC_INNERCOIN_SHIFT;
118 daq_word |= (sectorData->
goodmf(icand) & 0x1) << LVL1::MuCTPIBits::RUN3_CAND_TGC_GOODMF_SHIFT;
122 daq_word |= (sectorData->
veto(icand) & 0x1) << LVL1::MuCTPIBits::RUN3_CAND_VETO_SHIFT;
125 daq_word |= (sectorData->
is2candidatesInSector() & LVL1::MuCTPIBits::CAND_OVERFLOW_MASK) << LVL1::MuCTPIBits::RUN3_CAND_OVERFLOW_SHIFT;
128 daq_word |= (isub & LVL1::MuCTPIBits::SECTOR_HEMISPHERE_MASK) << LVL1::MuCTPIBits::RUN3_CAND_SECTOR_ADDRESS_SHIFT;
129 daq_word |= (isec & SECTOR_MASK) << LVL1::MuCTPIBits::RUN3_CAND_SECTORID_SHIFT;
130 daq_word |= (SUBSYS_ID & SUBSYS_MASK) << LVL1::MuCTPIBits::RUN3_SUBSYS_ADDRESS_SHIFT;
134 daq_word |= 1
u << 31;
146 if (sectorData->
veto(icand))
continue;
149 if (
decisions.size() != thresholds.size())
return "Threshold vector different size than decision vector";
153 for (
unsigned ithresh=0;ithresh<
decisions.size();ithresh++)
156 if (
decisions[ithresh].
first != thresholds[ithresh])
return "Invalid threshold ordering";
171 std::bitset<256> full_ctp_word = 0;
172 unsigned int lastPos = 0;
173 for (
int i=0;
i<nThresholds;
i++)
175 if(!optConn.
hasLine(thresholds[
i]->name())) {
179 unsigned nbits = triggerline.
endbit() - triggerline.startbit() + 1;
180 lastPos =
std::max(lastPos,triggerline.endbit());
182 unsigned int maxMult = pow2.at(nbits)-1;
185 full_ctp_word |= (mult << triggerline.startbit());
189 const std::bitset<256> u32i_mask = 0xffffffff;
190 unsigned n32_ints = lastPos/32 + 1;
192 for (
unsigned i=0;
i<n32_ints;
i++)
194 unsigned int word =
static_cast<unsigned int>((full_ctp_word & u32i_mask).to_ulong());
195 results.ctp_words.push_back(word);
196 full_ctp_word >>= 32;