88 : bxFirst_(iConfig.getParameter<
int>(
"bxFirst")),
89 bxLast_(iConfig.getParameter<
int>(
"bxLast")),
90 setBptxAND_(iConfig.getParameter<
bool>(
"setBptxAND")),
91 setBptxPlus_(iConfig.getParameter<
bool>(
"setBptxPlus")),
92 setBptxMinus_(iConfig.getParameter<
bool>(
"setBptxMinus")),
93 setBptxOR_(iConfig.getParameter<
bool>(
"setBptxOR")),
94 tcdsInputTag_(iConfig.getParameter<
edm::
InputTag>(
"tcdsRecordLabel")),
111 produces<GlobalExtBlkBxCollection>();
125 LogDebug(
"L1TExtCondProducer") <<
"L1TExtCondProducer::produce function called...\n";
131 if (m_l1GtMenuCacheID != l1GtMenuCacheID) {
138 std::map<std::string, unsigned int> extBitMap = gtParser.
getExternalSignals(utml1GtMenu);
140 m_l1GtMenuCacheID = l1GtMenuCacheID;
141 m_extBitMap = extBitMap;
144 bool TriggerRulePrefireVetoBit(
false);
145 if (makeTriggerRulePrefireVetoBit_) {
149 iEvent.getByToken(tcdsRecordToken_, tcdsRecordH);
150 const auto& tcdsRecord = *tcdsRecordH.
product();
152 uint64_t thisEvent = (tcdsRecord.getBXID() - 1) + tcdsRecord.getOrbitNr() * 3564ull;
154 std::vector<uint64_t> eventHistory;
155 for (
auto&& l1a : tcdsRecord.getFullL1aHistory()) {
156 eventHistory.push_back(thisEvent - ((l1a.getBXID() - 1) + l1a.getOrbitNr() * 3564ull));
160 if (eventHistory.size() < 4) {
161 edm::LogError(
"L1TExtCondProducer") <<
"Unexpectedly small L1A history from TCDSRecord";
165 if (eventHistory[0] < 3ull) {
166 edm::LogError(
"L1TExtCondProducer") <<
"Found an L1A in an impossible location?! (1 in 3)";
169 if (eventHistory[0] == 3ull)
170 TriggerRulePrefireVetoBit =
true;
173 if (eventHistory[0] < 25ull and eventHistory[1] < 25ull) {
174 edm::LogError(
"L1TExtCondProducer") <<
"Found an L1A in an impossible location?! (2 in 25)";
176 if (eventHistory[0] < 25ull and eventHistory[1] == 25ull)
177 TriggerRulePrefireVetoBit =
true;
180 if (eventHistory[0] < 100ull and eventHistory[1] < 100ull and eventHistory[2] < 100ull) {
181 edm::LogError(
"L1TExtCondProducer") <<
"Found an L1A in an impossible location?! (3 in 100)";
183 if (eventHistory[0] < 100ull and eventHistory[1] < 100ull and eventHistory[2] == 100ull)
184 TriggerRulePrefireVetoBit =
true;
187 if (eventHistory[0] < 240ull and eventHistory[1] < 240ull and eventHistory[2] < 240ull and
188 eventHistory[3] < 240ull) {
189 edm::LogError(
"L1TExtCondProducer") <<
"Found an L1A in an impossible location?! (4 in 240)";
191 if (eventHistory[0] < 240ull and eventHistory[1] < 240ull and eventHistory[2] < 240ull and
192 eventHistory[3] == 240ull)
193 TriggerRulePrefireVetoBit =
true;
202 bool foundBptxAND = (m_extBitMap.find(
"BPTX_plus_AND_minus.v0") != m_extBitMap.end());
203 bool foundBptxPlus = (m_extBitMap.find(
"BPTX_plus.v0") != m_extBitMap.end());
204 bool foundBptxMinus = (m_extBitMap.find(
"BPTX_minus.v0") != m_extBitMap.end());
205 bool foundBptxOR = (m_extBitMap.find(
"BPTX_plus_OR_minus.v0") != m_extBitMap.end());
208 if (setBptxAND_ && foundBptxAND)
210 if (setBptxPlus_ && foundBptxPlus)
212 if (setBptxMinus_ && foundBptxMinus)
214 if (setBptxOR_ && foundBptxOR)
218 foundBptxAND = (m_extBitMap.find(
"ZeroBias_BPTX_AND_VME") != m_extBitMap.end());
219 foundBptxPlus = (m_extBitMap.find(
"BPTX_B1_VME") != m_extBitMap.end());
220 foundBptxMinus = (m_extBitMap.find(
"BPTX_B2_VME") != m_extBitMap.end());
221 foundBptxOR = (m_extBitMap.find(
"BPTX_OR_VME") != m_extBitMap.end());
224 if (setBptxAND_ && foundBptxAND)
226 if (setBptxPlus_ && foundBptxPlus)
228 if (setBptxMinus_ && foundBptxMinus)
230 if (setBptxOR_ && foundBptxOR)
234 if (TriggerRulePrefireVetoBit)
238 for (
int iBx = bxFirst_; iBx <= bxLast_; iBx++) {
239 extCond->push_back(iBx, extCond_bx);
249 desc.add<
bool>(
"setBptxMinus",
true);
250 desc.add<
bool>(
"setBptxAND",
true);
251 desc.add<
int>(
"bxFirst", -2);
252 desc.add<
bool>(
"setBptxOR",
true);
253 desc.add<
int>(
"bxLast", 2);
254 desc.add<
bool>(
"setBptxPlus",
true);
256 descriptions.
add(
"simGtExtFakeProd",
desc);