41 {
44
45
46 const std::vector<std::shared_ptr<TrigConf::L1Threshold> > & thresholds =
m_l1menu->thresholds(
"MU");
47 int nThresholds = thresholds.size();
49
50
51
53 {
54
57 {
58
59 for (size_t isub=0;isub<2;isub++)
60 {
61 std::shared_ptr<LVL1MUONIF::Lvl1MuSectorLogicDataPhase1> sectorData = mergedInputs.
getSectorLogicDataPtr(isys, isub, isec, bcid);
62 if (!sectorData) continue;
63
65 for (unsigned int icand=0;icand<ncand_max;icand++)
66 {
67 int thresh = sectorData->pt(icand);
68 if (thresh == -1) continue;
69 int roiID = sectorData->roi(icand);
70 if (roiID < 0) continue;
71
72
74
75
80 if (isys == 0)
81 {
84 }
85 else if (isys == 1)
86 {
89 SUBSYS_ID = 2;
90 }
91 else if (isys == 2)
92 {
95 SUBSYS_ID = 1;
96 }
97
98
99
100
101
103
104
106
107
108 if (isys == 0)
109 {
112 }
113 else
114 {
119 }
120
121
123
124
126
127
131
132
133
134 daq_word |= 1u << 31;
135
136
139 results.daq_data.push_back(DAQData(daq_word, decisions));
140
141
142
143
144
145
146 if (sectorData->veto(icand)) continue;
147
148
149 if (
decisions.size() != thresholds.size())
return "Threshold vector different size than decision vector";
150
151
152
153 for (
unsigned ithresh=0;ithresh<
decisions.size();ithresh++)
154 {
155
156 if (decisions[ithresh].first != thresholds[ithresh]) return "Invalid threshold ordering";
157 if (decisions[ithresh].second)
158 {
160 }
161 }
162 }
163 }
164 }
165 }
166
167
168
169 const TrigConf::L1Connector & optConn =
m_l1menu->connector(
"MuCTPiOpt0");
170
171 std::bitset<256> full_ctp_word = 0;
172 unsigned int lastPos = 0;
173 for (
int i=0;
i<nThresholds;
i++)
174 {
175 if(!optConn.
hasLine(thresholds[i]->name())) {
176 continue;
177 }
179 unsigned nbits = triggerline.
endbit() - triggerline.startbit() + 1;
180 lastPos = std::max(lastPos,triggerline.endbit());
181
182 unsigned int maxMult =
pow2.at(nbits)-1;
184
185 full_ctp_word |= (mult << triggerline.startbit());
186 }
187
188
189 const std::bitset<256> u32i_mask = 0xffffffff;
190 unsigned n32_ints = lastPos/32 + 1;
191
192 for (
unsigned i=0;
i<n32_ints;
i++)
193 {
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;
197 }
198
199 return "";
200 }
static const std::map< unsigned int, unsigned int > pow2
const TrigConf::L1Menu * m_l1menu
LVL1::TrigThresholdDecisionTool * m_trigThresholdDecisionTool
bool hasLine(const std::string &lineName) const
const TrigConf::TriggerLine & triggerLine(const std::string &lineName) const
unsigned int endbit() const
std::vector< int > multiplicities(const std::string &chain)
static const size_t NCAND[3]
static constexpr uint32_t FORWARD_SECTORID_MASK
Mask for extracting the sector ID for forward candidates from the data word.
static constexpr uint32_t RUN3_ROI_SHIFT
Position of the RoI bits in the data word.
static constexpr uint32_t RUN3_CAND_VETO_SHIFT
Position of the bit specifying if a candidate was vetoed in the multiplicity sum.
static constexpr uint32_t RUN3_SUBSYS_ADDRESS_SHIFT
Position in the data word of the subsystem bits.
static constexpr uint32_t SECTOR_HEMISPHERE_MASK
Mask for the bit showing which hemisphere the candidate came from.(1: positive; 0: negative)
static constexpr uint32_t RUN3_CAND_PT_MASK
Mask for extracting the pT threshold passed by the candidate from the data word.
static constexpr uint32_t BARREL_SECTORID_MASK
Mask for extracting the sector ID for barrel candidates from the data word.
static constexpr uint32_t ENDCAP_ROI_MASK
Mask for extracting the RoI for endcap candidates from the data words.
static constexpr uint32_t RUN3_CAND_TGC_GOODMF_SHIFT
Position of the bit specifying if RoI is in a good b-field region (1=good, 0=bad)
static constexpr uint32_t BARREL_ROI_MASK
new in v2
static constexpr uint32_t RUN3_CAND_SECTOR_ADDRESS_SHIFT
Position of the muon candidate's address in the data word.
static constexpr uint32_t ROI_OVERFLOW_MASK
Mask for the bit showing if more than one muon candidates were in the sector RoI.
static constexpr uint32_t RUN3_CAND_TGC_INNERCOIN_SHIFT
Position of the bit specifying coincidence with inner detectors.
static constexpr uint32_t RUN3_CAND_PT_SHIFT
Position of the pT threshold bits in the data words.
static constexpr uint32_t RUN3_CAND_WORD_CANDFLAGS_BA_PHIOVERLAP_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_CAND_WORD_CANDFLAGS_BA_PHIOVERLAP_MASK
static constexpr uint32_t RUN3_CAND_TGC_CHARGE_SIGN_SHIFT
Position of the bit specifying the candidate's sign.
static constexpr uint32_t RUN3_CAND_SECTORID_SHIFT
static constexpr uint32_t RUN3_ROI_OVERFLOW_SHIFT
Position of the RoI overflow mask.
static constexpr uint32_t RUN3_CAND_TGC_BW2OR3_SHIFT
Position of the bit specifying 3-station coincidence from the big wheel.
static constexpr uint32_t RUN3_CAND_OVERFLOW_SHIFT
Position of the candidate overflow mask.
static constexpr uint32_t FORWARD_ROI_MASK
Mask for extracting the RoI for forward candidates from the data words.
static constexpr uint32_t CAND_OVERFLOW_MASK
Mask for the bit showing if more than two muon candidates were in the trigger sector.