86 : bxFirst_(iConfig.getParameter<
int>(
"bxFirst")),
87 bxLast_(iConfig.getParameter<
int>(
"bxLast")),
88 setBptxAND_(iConfig.getParameter<
bool>(
"setBptxAND")),
89 setBptxPlus_(iConfig.getParameter<
bool>(
"setBptxPlus")),
90 setBptxMinus_(iConfig.getParameter<
bool>(
"setBptxMinus")),
91 setBptxOR_(iConfig.getParameter<
bool>(
"setBptxOR")),
92 tcdsInputTag_(iConfig.getParameter<
edm::
InputTag>(
"tcdsRecordLabel")) {
108 produces<GlobalExtBlkBxCollection>();
122 LogDebug(
"L1TExtCondProducer") <<
"L1TExtCondProducer::produce function called...\n";
128 if (m_l1GtMenuCacheID != l1GtMenuCacheID) {
136 std::map<std::string, unsigned int> extBitMap = gtParser.
getExternalSignals(utml1GtMenu);
138 m_l1GtMenuCacheID = l1GtMenuCacheID;
139 m_extBitMap = extBitMap;
142 bool TriggerRulePrefireVetoBit(
false);
143 if (makeTriggerRulePrefireVetoBit_) {
147 iEvent.getByToken(tcdsRecordToken_, tcdsRecordH);
148 const auto& tcdsRecord = *tcdsRecordH.
product();
150 uint64_t thisEvent = (tcdsRecord.getBXID() - 1) + tcdsRecord.getOrbitNr() * 3564ull;
152 std::vector<uint64_t> eventHistory;
153 for (
auto&& l1a : tcdsRecord.getFullL1aHistory()) {
154 eventHistory.push_back(thisEvent - ((l1a.getBXID() - 1) + l1a.getOrbitNr() * 3564ull));
158 if (eventHistory.size() < 4) {
159 edm::LogError(
"L1TExtCondProducer") <<
"Unexpectedly small L1A history from TCDSRecord";
163 if (eventHistory[0] < 3ull) {
164 edm::LogError(
"L1TExtCondProducer") <<
"Found an L1A in an impossible location?! (1 in 3)";
167 if (eventHistory[0] == 3ull)
168 TriggerRulePrefireVetoBit =
true;
171 if (eventHistory[0] < 25ull and eventHistory[1] < 25ull) {
172 edm::LogError(
"L1TExtCondProducer") <<
"Found an L1A in an impossible location?! (2 in 25)";
174 if (eventHistory[0] < 25ull and eventHistory[1] == 25ull)
175 TriggerRulePrefireVetoBit =
true;
178 if (eventHistory[0] < 100ull and eventHistory[1] < 100ull and eventHistory[2] < 100ull) {
179 edm::LogError(
"L1TExtCondProducer") <<
"Found an L1A in an impossible location?! (3 in 100)";
181 if (eventHistory[0] < 100ull and eventHistory[1] < 100ull and eventHistory[2] == 100ull)
182 TriggerRulePrefireVetoBit =
true;
185 if (eventHistory[0] < 240ull and eventHistory[1] < 240ull and eventHistory[2] < 240ull and
186 eventHistory[3] < 240ull) {
187 edm::LogError(
"L1TExtCondProducer") <<
"Found an L1A in an impossible location?! (4 in 240)";
189 if (eventHistory[0] < 240ull and eventHistory[1] < 240ull and eventHistory[2] < 240ull and
190 eventHistory[3] == 240ull)
191 TriggerRulePrefireVetoBit =
true;
200 bool foundBptxAND = (m_extBitMap.find(
"BPTX_plus_AND_minus.v0") != m_extBitMap.end());
201 bool foundBptxPlus = (m_extBitMap.find(
"BPTX_plus.v0") != m_extBitMap.end());
202 bool foundBptxMinus = (m_extBitMap.find(
"BPTX_minus.v0") != m_extBitMap.end());
203 bool foundBptxOR = (m_extBitMap.find(
"BPTX_plus_OR_minus.v0") != m_extBitMap.end());
206 if (setBptxAND_ && foundBptxAND)
208 if (setBptxPlus_ && foundBptxPlus)
210 if (setBptxMinus_ && foundBptxMinus)
212 if (setBptxOR_ && foundBptxOR)
216 foundBptxAND = (m_extBitMap.find(
"ZeroBias_BPTX_AND_VME") != m_extBitMap.end());
217 foundBptxPlus = (m_extBitMap.find(
"BPTX_B1_VME") != m_extBitMap.end());
218 foundBptxMinus = (m_extBitMap.find(
"BPTX_B2_VME") != m_extBitMap.end());
219 foundBptxOR = (m_extBitMap.find(
"BPTX_OR_VME") != m_extBitMap.end());
222 if (setBptxAND_ && foundBptxAND)
224 if (setBptxPlus_ && foundBptxPlus)
226 if (setBptxMinus_ && foundBptxMinus)
228 if (setBptxOR_ && foundBptxOR)
232 if (TriggerRulePrefireVetoBit)
236 for (
int iBx = bxFirst_; iBx <= bxLast_; iBx++) {
237 extCond->push_back(iBx, extCond_bx);
247 desc.
add<
bool>(
"setBptxMinus",
true);
248 desc.
add<
bool>(
"setBptxAND",
true);
249 desc.
add<
int>(
"bxFirst", -2);
250 desc.
add<
bool>(
"setBptxOR",
true);
251 desc.
add<
int>(
"bxLast", 2);
252 desc.
add<
bool>(
"setBptxPlus",
true);
254 descriptions.
add(
"simGtExtFakeProd", desc);