CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GlobalBoard.cc
Go to the documentation of this file.
1 
28 // this class header
30 
31 // user include files
49 
50 // Conditions for uGT
60 
63 
64 // Constructor
66  : m_candL1Mu(new BXVector<const l1t::Muon*>),
67  m_candL1MuShower(new BXVector<std::shared_ptr<l1t::MuonShower>>),
68  m_candL1EG(new BXVector<const l1t::L1Candidate*>),
69  m_candL1Tau(new BXVector<const l1t::L1Candidate*>),
70  m_candL1Jet(new BXVector<const l1t::L1Candidate*>),
71  m_candL1EtSum(new BXVector<const l1t::EtSum*>),
72  m_candL1EtSumZdc(new BXVector<const l1t::EtSum*>),
73  m_candL1External(new BXVector<const GlobalExtBlk*>),
74  m_currentLumi(0),
75  m_isDebugEnabled(edm::isDebugEnabled()) {
77 
78  m_gtlAlgorithmOR.reset();
79  m_gtlDecisionWord.reset();
80 
82 
83  // Initialize cached IDs
84  m_l1GtMenuCacheID = 0ULL;
87 
88  // Counter for number of events board sees
90 
91  // A single uGT GlobalBoard is taken into account in the emulator
92  m_uGtBoardNumber = 0;
93  m_uGtFinalBoard = true;
94 }
95 
96 // Destructor
98  delete m_candL1Mu;
99  delete m_candL1MuShower;
100  delete m_candL1EG;
101  delete m_candL1Tau;
102  delete m_candL1Jet;
103  delete m_candL1EtSum;
104  delete m_candL1EtSumZdc;
105  delete m_candL1External;
106 }
107 
108 // Operations
109 void l1t::GlobalBoard::setBxFirst(int bx) { m_bxFirst_ = bx; }
110 
111 void l1t::GlobalBoard::setBxLast(int bx) { m_bxLast_ = bx; }
112 
113 void l1t::GlobalBoard::init(const int numberPhysTriggers,
114  const int nrL1Mu,
115  const int nrL1MuShower,
116  const int nrL1EG,
117  const int nrL1Tau,
118  const int nrL1Jet,
119  int bxFirst,
120  int bxLast) {
121  setBxFirst(bxFirst);
122  setBxLast(bxLast);
123 
124  m_candL1Mu->setBXRange(m_bxFirst_, m_bxLast_);
125  m_candL1MuShower->setBXRange(m_bxFirst_, m_bxLast_);
126  m_candL1EG->setBXRange(m_bxFirst_, m_bxLast_);
127  m_candL1Tau->setBXRange(m_bxFirst_, m_bxLast_);
128  m_candL1Jet->setBXRange(m_bxFirst_, m_bxLast_);
129  m_candL1EtSum->setBXRange(m_bxFirst_, m_bxLast_);
130  m_candL1EtSumZdc->setBXRange(m_bxFirst_, m_bxLast_);
131  m_candL1External->setBXRange(m_bxFirst_, m_bxLast_);
132 
133  m_uGtAlgBlk.reset();
134 
135  LogDebug("L1TGlobal") << "\t Initializing Board with bxFirst = " << m_bxFirst_ << ", bxLast = " << m_bxLast_;
136 }
137 
138 // receive data from Calorimeter
140  const edm::EDGetTokenT<BXVector<l1t::EGamma>>& egInputToken,
141  const edm::EDGetTokenT<BXVector<l1t::Tau>>& tauInputToken,
142  const edm::EDGetTokenT<BXVector<l1t::Jet>>& jetInputToken,
143  const edm::EDGetTokenT<BXVector<l1t::EtSum>>& sumInputToken,
144  const edm::EDGetTokenT<BXVector<l1t::EtSum>>& sumZdcInputToken,
145  const bool receiveEG,
146  const int nrL1EG,
147  const bool receiveTau,
148  const int nrL1Tau,
149  const bool receiveJet,
150  const int nrL1Jet,
151  const bool receiveEtSums,
152  const bool receiveEtSumsZdc) {
153  if (m_verbosity) {
154  LogDebug("L1TGlobal") << "\n**** Board receiving Calo Data ";
155  }
156 
157  resetCalo();
158 
159  // get data from Calorimeter
160  if (receiveEG) {
162  iEvent.getByToken(egInputToken, egData);
163 
164  if (!egData.isValid()) {
165  if (m_verbosity) {
166  edm::LogWarning("L1TGlobal") << "\nWarning: Input tag for the BXVector<l1t::EGamma> collection"
167  << "\nrequested in configuration, but not found in the event.\n";
168  }
169  } else {
170  // bx in EG data
171  for (int i = egData->getFirstBX(); i <= egData->getLastBX(); ++i) {
172  // Prevent from pushing back bx that is outside of allowed range
173  if (i < m_bxFirst_ || i > m_bxLast_)
174  continue;
175 
176  //Loop over EG in this bx
177  int nObj = 0;
178  for (std::vector<l1t::EGamma>::const_iterator eg = egData->begin(i); eg != egData->end(i); ++eg) {
179  if (nObj < nrL1EG) {
180  (*m_candL1EG).push_back(i, &(*eg));
181  } else {
182  edm::LogWarning("L1TGlobal") << " Too many EG (" << nObj << ") for uGT Configuration maxEG =" << nrL1EG;
183  }
184  LogDebug("L1TGlobal") << "EG Pt " << eg->hwPt() << " Eta " << eg->hwEta() << " Phi " << eg->hwPhi()
185  << " Qual " << eg->hwQual() << " Iso " << eg->hwIso();
186 
187  nObj++;
188  } //end loop over EG in bx
189  } //end loop over bx
190  } //end if over valid EG data
191  } //end if ReceiveEG data
192 
193  if (receiveTau) {
195  iEvent.getByToken(tauInputToken, tauData);
196 
197  if (!tauData.isValid()) {
198  if (m_verbosity) {
199  edm::LogWarning("L1TGlobal") << "\nWarning: Input tag for the BXVector<l1t::Tau> collection"
200  << "\nrequested in configuration, but not found in the event.\n";
201  }
202  } else {
203  // bx in tau data
204  for (int i = tauData->getFirstBX(); i <= tauData->getLastBX(); ++i) {
205  // Prevent from pushing back bx that is outside of allowed range
206  if (i < m_bxFirst_ || i > m_bxLast_)
207  continue;
208 
209  //Loop over tau in this bx
210  int nObj = 0;
211  for (std::vector<l1t::Tau>::const_iterator tau = tauData->begin(i); tau != tauData->end(i); ++tau) {
212  if (nObj < nrL1Tau) {
213  (*m_candL1Tau).push_back(i, &(*tau));
214  } else {
215  LogTrace("L1TGlobal") << " Too many Tau (" << nObj << ") for uGT Configuration maxTau =" << nrL1Tau;
216  }
217 
218  LogDebug("L1TGlobal") << "tau Pt " << tau->hwPt() << " Eta " << tau->hwEta() << " Phi " << tau->hwPhi()
219  << " Qual " << tau->hwQual() << " Iso " << tau->hwIso();
220  nObj++;
221 
222  } //end loop over tau in bx
223  } //end loop over bx
224  } //end if over valid tau data
225  } //end if ReceiveTau data
226 
227  if (receiveJet) {
229  iEvent.getByToken(jetInputToken, jetData);
230 
231  if (!jetData.isValid()) {
232  if (m_verbosity) {
233  edm::LogWarning("L1TGlobal") << "\nWarning: Input tag for the BXVector<l1t::Jet> collection"
234  << "\nrequested in configuration, but not found in the event.\n";
235  }
236  } else {
237  // bx in jet data
238  for (int i = jetData->getFirstBX(); i <= jetData->getLastBX(); ++i) {
239  // Prevent from pushing back bx that is outside of allowed range
240  if (i < m_bxFirst_ || i > m_bxLast_)
241  continue;
242 
243  //Loop over jet in this bx
244  int nObj = 0;
245  for (std::vector<l1t::Jet>::const_iterator jet = jetData->begin(i); jet != jetData->end(i); ++jet) {
246  if (nObj < nrL1Jet) {
247  (*m_candL1Jet).push_back(i, &(*jet));
248  } else {
249  edm::LogWarning("L1TGlobal") << " Too many Jets (" << nObj << ") for uGT Configuration maxJet =" << nrL1Jet;
250  }
251 
252  LogDebug("L1TGlobal") << "Jet Pt " << jet->hwPt() << " Eta " << jet->hwEta() << " Phi " << jet->hwPhi()
253  << " Qual " << jet->hwQual() << " Iso " << jet->hwIso();
254  nObj++;
255  } //end loop over jet in bx
256  } //end loop over bx
257  } //end if over valid jet data
258  } //end if ReceiveJet data
259 
260  if (receiveEtSums) {
262  iEvent.getByToken(sumInputToken, etSumData);
263 
264  if (!etSumData.isValid()) {
265  if (m_verbosity) {
266  edm::LogWarning("L1TGlobal") << "\nWarning: Input tag for the BXVector<l1t::EtSum> collection"
267  << "\nrequested in configuration, but not found in the event.\n";
268  }
269  } else {
270  for (int i = etSumData->getFirstBX(); i <= etSumData->getLastBX(); ++i) {
271  // Prevent from pushing back bx that is outside of allowed range
272  if (i < m_bxFirst_ || i > m_bxLast_)
273  continue;
274 
275  //Loop over EtSum objects in this bx
276  for (std::vector<l1t::EtSum>::const_iterator etsum = etSumData->begin(i); etsum != etSumData->end(i); ++etsum) {
277  (*m_candL1EtSum).push_back(i, &(*etsum));
278 
279  /* In case we need to split these out
280  switch ( etsum->getType() ) {
281  case l1t::EtSum::EtSumType::kMissingEt:
282  {
283  //(*m_candETM).push_back(i,&(*etsum));
284  LogDebug("L1TGlobal") << "ETM: Pt " << etsum->hwPt() << " Phi " << etsum->hwPhi();
285  }
286  break;
287  case l1t::EtSum::EtSumType::kMissingHt:
288  {
289  //(*m_candHTM).push_back(i,&(*etsum));
290  LogDebug("L1TGlobal") << "HTM: Pt " << etsum->hwPt() << " Phi " << etsum->hwPhi();
291  }
292  break;
293  case l1t::EtSum::EtSumType::kTotalEt:
294  {
295  //(*m_candETT).push_back(i,&(*etsum));
296  LogDebug("L1TGlobal") << "ETT: Pt " << etsum->hwPt();
297  }
298  break;
299  case l1t::EtSum::EtSumType::kTotalHt:
300  {
301  //(*m_candHTT).push_back(i,&(*etsum));
302  LogDebug("L1TGlobal") << "HTT: Pt " << etsum->hwPt();
303  }
304  break;
305  case l1t::EtSum::EtSumType::kTowerCount:
306  {
307  //(*m_candTowerCount).push_back(i,&(*etsum));
308  LogDebug("L1TGlobal") << "TowerCount: " << etsum->hwPt();
309  }
310  break;
311  default:
312  LogDebug("L1TGlobal") << "Default encounted ";
313  break;
314  }
315 */
316 
317  } //end loop over EtSum objects in bx
318  } //end loop over Bx
319  }
320  }
321 
322  if (receiveEtSumsZdc) {
324  iEvent.getByToken(sumZdcInputToken, etSumData);
325 
326  if (!etSumData.isValid()) {
327  if (m_verbosity) {
328  edm::LogWarning("L1TGlobal") << "\nWarning: Input tag for the ZDC Energy Sums collection"
329  << "\nrequested in configuration, but not found in the event.\n";
330  }
331  } else {
332  for (int i = etSumData->getFirstBX(); i <= etSumData->getLastBX(); ++i) {
333  // Prevent from pushing back bx that is outside of allowed range
334  if (i < m_bxFirst_ || i > m_bxLast_)
335  continue;
336 
337  for (std::vector<l1t::EtSum>::const_iterator etsum = etSumData->begin(i); etsum != etSumData->end(i); ++etsum) {
338  (*m_candL1EtSumZdc).push_back(i, &(*etsum));
339  }
340  } //end loop over Bx
341  }
342  }
343 }
344 
345 // receive data from Global Muon Trigger
347  const edm::EDGetTokenT<BXVector<l1t::Muon>>& muInputToken,
348  const bool receiveMu,
349  const int nrL1Mu) {
350  if (m_verbosity) {
351  LogDebug("L1TGlobal") << "\n**** GlobalBoard receiving muon data = ";
352  //<< "\n from input tag " << muInputTag << "\n"
353  }
354 
355  resetMu();
356 
357  // get data from Global Muon Trigger
358  if (receiveMu) {
360  iEvent.getByToken(muInputToken, muonData);
361 
362  if (!muonData.isValid()) {
363  if (m_verbosity) {
364  edm::LogWarning("L1TGlobal") << "\nWarning: Input tag for the BXVector<l1t::Muon> collection"
365  << "\nrequested in configuration, but not found in the event.\n";
366  }
367  } else {
368  // bx in muon data
369  for (int i = muonData->getFirstBX(); i <= muonData->getLastBX(); ++i) {
370  // Prevent from pushing back bx that is outside of allowed range
371  if (i < m_bxFirst_ || i > m_bxLast_)
372  continue;
373 
374  //Loop over Muons in this bx
375  int nObj = 0;
376  for (std::vector<l1t::Muon>::const_iterator mu = muonData->begin(i); mu != muonData->end(i); ++mu) {
377  if (nObj < nrL1Mu) {
378  (*m_candL1Mu).push_back(i, &(*mu));
379  } else {
380  edm::LogWarning("L1TGlobal") << " Too many Muons (" << nObj << ") for uGT Configuration maxMu =" << nrL1Mu;
381  }
382 
383  LogDebug("L1TGlobal") << "Muon Pt " << mu->hwPt() << " EtaAtVtx " << mu->hwEtaAtVtx() << " PhiAtVtx "
384  << mu->hwPhiAtVtx() << " Qual " << mu->hwQual() << " Iso " << mu->hwIso();
385  nObj++;
386  } //end loop over muons in bx
387  } //end loop over bx
388  } //end if over valid muon data
389  } //end if ReceiveMuon data
390 }
391 
392 // receive muon shower data from Global Muon Trigger
394  const edm::EDGetTokenT<BXVector<l1t::MuonShower>>& muShowerInputToken,
395  const bool receiveMuShower,
396  const int nrL1MuShower) {
397  // get data from Global Muon Trigger
398  if (receiveMuShower) {
400  iEvent.getByToken(muShowerInputToken, muonData);
401 
402  if (!muonData.isValid()) {
403  if (m_verbosity) {
404  edm::LogWarning("L1TGlobal") << "\nWarning: Input tag for the BXVector<l1t::MuonShower> collection"
405  << "\nrequested in configuration, but not found in the event.\n";
406  }
407  } else {
408  // Loop over bx in muon data
409  for (int i = muonData->getFirstBX(); i <= muonData->getLastBX(); ++i) {
410  // Prevent from pushing back bx that is outside of allowed range
411  if (i < m_bxFirst_ || i > m_bxLast_)
412  continue;
413 
414  // Loop over Muon Showers in this bx
415  int nObj = 0;
416  for (std::vector<l1t::MuonShower>::const_iterator mu = muonData->begin(i); mu != muonData->end(i); ++mu) {
417  if (nObj < nrL1MuShower) {
418  /* NOTE: here the single object is split up into 5 separate MuonShower objects
419  similarly to the description in the UTM library, where the conditions are four different objects.
420  */
421 
422  std::shared_ptr<l1t::MuonShower> musOneNominalInTime =
423  std::make_shared<l1t::MuonShower>(false, false, false, false, false, false);
424  std::shared_ptr<l1t::MuonShower> musOneTightInTime =
425  std::make_shared<l1t::MuonShower>(false, false, false, false, false, false);
426  std::shared_ptr<l1t::MuonShower> musTwoLooseDiffSectorsInTime =
427  std::make_shared<l1t::MuonShower>(false, false, false, false, false, false);
428  std::shared_ptr<l1t::MuonShower> musOutOfTime0 =
429  std::make_shared<l1t::MuonShower>(false, false, false, false, false, false);
430  std::shared_ptr<l1t::MuonShower> musOutOfTime1 =
431  std::make_shared<l1t::MuonShower>(false, false, false, false, false, false);
432 
433  musOneNominalInTime->setOneNominalInTime(mu->isOneNominalInTime());
434  musOneTightInTime->setOneTightInTime(mu->isOneTightInTime());
435  musTwoLooseDiffSectorsInTime->setTwoLooseDiffSectorsInTime(mu->isTwoLooseDiffSectorsInTime());
436  musOutOfTime0->setMusOutOfTime0(mu->musOutOfTime0());
437  musOutOfTime1->setMusOutOfTime1(mu->musOutOfTime1());
438 
439  (*m_candL1MuShower).push_back(i, musOneNominalInTime);
440  (*m_candL1MuShower).push_back(i, musOneTightInTime);
441  (*m_candL1MuShower).push_back(i, musTwoLooseDiffSectorsInTime);
442  (*m_candL1MuShower).push_back(i, musOutOfTime0);
443  (*m_candL1MuShower).push_back(i, musOutOfTime1);
444 
445  } else {
446  edm::LogWarning("L1TGlobal") << " Too many Muon Showers (" << nObj
447  << ") for uGT Configuration maxMuShower =" << nrL1MuShower;
448  }
449  nObj++;
450  } //end loop over muon showers in bx
451  } //end loop over bx
452  } //end if over valid muon shower data
453  } //end if ReceiveMuonShower data
454 }
455 
456 // receive data from Global External Conditions
458  const edm::EDGetTokenT<BXVector<GlobalExtBlk>>& extInputToken,
459  const bool receiveExt) {
460  if (m_verbosity) {
461  LogDebug("L1TGlobal") << "\n**** GlobalBoard receiving external data = ";
462  //<< "\n from input tag " << muInputTag << "\n"
463  }
464 
465  resetExternal();
466 
467  // get data from Global Muon Trigger
468  if (receiveExt) {
470  iEvent.getByToken(extInputToken, extData);
471 
472  if (!extData.isValid()) {
473  if (m_verbosity) {
474  edm::LogWarning("L1TGlobal") << "\nWarning: Input tag for the BXVector<GlobalExtBlk> collection"
475  << "\nrequested in configuration, but not found in the event.\n";
476  }
477  } else {
478  // bx in muon data
479  for (int i = extData->getFirstBX(); i <= extData->getLastBX(); ++i) {
480  // Prevent from pushing back bx that is outside of allowed range
481  if (i < m_bxFirst_ || i > m_bxLast_)
482  continue;
483 
484  //Loop over ext in this bx
485  for (std::vector<GlobalExtBlk>::const_iterator ext = extData->begin(i); ext != extData->end(i); ++ext) {
486  (*m_candL1External).push_back(i, &(*ext));
487  } //end loop over ext in bx
488  } //end loop over bx
489  } //end if over valid ext data
490  } //end if ReceiveExt data
491 }
492 
493 // run GTL
495  const edm::EventSetup& evSetup,
496  const TriggerMenu* m_l1GtMenu,
497  const bool produceL1GtObjectMapRecord,
498  const int iBxInEvent,
499  std::unique_ptr<GlobalObjectMapRecord>& gtObjectMapRecord,
500  const unsigned int numberPhysTriggers,
501  const int nrL1Mu,
502  const int nrL1MuShower,
503  const int nrL1EG,
504  const int nrL1Tau,
505  const int nrL1Jet) {
506  const std::vector<ConditionMap>& conditionMap = m_l1GtMenu->gtConditionMap();
507  const AlgorithmMap& algorithmMap = m_l1GtMenu->gtAlgorithmMap();
508  const GlobalScales& gtScales = m_l1GtMenu->gtScales();
509  const std::string scaleSetName = gtScales.getScalesName();
510  LogDebug("L1TGlobal") << " L1 Menu Scales -- Set Name: " << scaleSetName;
511 
512  // Reset AlgBlk for this bx
513  m_uGtAlgBlk.reset();
514  m_algInitialOr = false;
515  m_algPrescaledOr = false;
516  m_algIntermOr = false;
517  m_algFinalOr = false;
518  m_algFinalOrVeto = false;
519 
520  const std::vector<std::vector<MuonTemplate>>& corrMuon = m_l1GtMenu->corMuonTemplate();
521 
522  const std::vector<std::vector<CaloTemplate>>& corrCalo = m_l1GtMenu->corCaloTemplate();
523 
524  const std::vector<std::vector<EnergySumTemplate>>& corrEnergySum = m_l1GtMenu->corEnergySumTemplate();
525 
526  LogDebug("L1TGlobal") << "Size corrMuon " << corrMuon.size() << "\nSize corrCalo " << corrCalo.size()
527  << "\nSize corrSums " << corrEnergySum.size();
528 
529  // -----------------------------------------------------
530  // Loop over condition maps (one map per condition chip),
531  // then loop over conditions in the map and
532  // save the results in temporary maps
533  // -----------------------------------------------------
534  // never happens in production but at first event...
535  if (m_conditionResultMaps.size() != conditionMap.size()) {
536  m_conditionResultMaps.clear();
537  m_conditionResultMaps.resize(conditionMap.size());
538  }
539 
540  int iChip = -1;
541 
542  for (std::vector<ConditionMap>::const_iterator itCondOnChip = conditionMap.begin();
543  itCondOnChip != conditionMap.end();
544  itCondOnChip++) {
545  iChip++;
546 
547  AlgorithmEvaluation::ConditionEvaluationMap& cMapResults = m_conditionResultMaps[iChip];
548 
549  for (CItCond itCond = itCondOnChip->begin(); itCond != itCondOnChip->end(); itCond++) {
550  // evaluate condition
551  switch ((itCond->second)->condCategory()) {
552  case CondMuon: {
553  // BLW Not sure what to do with this for now
554  const int ifMuEtaNumberBits = 0;
555 
556  MuCondition* muCondition = new MuCondition(itCond->second, this, nrL1Mu, ifMuEtaNumberBits);
557 
558  muCondition->setVerbosity(m_verbosity);
559 
560  muCondition->evaluateConditionStoreResult(iBxInEvent);
561 
562  cMapResults[itCond->first] = muCondition;
563 
564  if (m_verbosity && m_isDebugEnabled) {
565  std::ostringstream myCout;
566  muCondition->print(myCout);
567 
568  LogTrace("L1TGlobal") << myCout.str();
569  }
570  //delete muCondition;
571 
572  } break;
573  case CondMuonShower: {
574  MuonShowerCondition* muShowerCondition = new MuonShowerCondition(itCond->second, this, nrL1MuShower);
575 
576  muShowerCondition->setVerbosity(m_verbosity);
577 
578  muShowerCondition->evaluateConditionStoreResult(iBxInEvent);
579 
580  cMapResults[itCond->first] = muShowerCondition;
581 
582  if (m_verbosity && m_isDebugEnabled) {
583  std::ostringstream myCout;
584  muShowerCondition->print(myCout);
585 
586  edm::LogWarning("L1TGlobal") << "MuonShowerCondition " << myCout.str();
587  }
588  //delete muShowerCondition;
589 
590  } break;
591  case CondCalo: {
592  // BLW Not sure w hat to do with this for now
593  const int ifCaloEtaNumberBits = 0;
594 
595  CaloCondition* caloCondition =
596  new CaloCondition(itCond->second, this, nrL1EG, nrL1Jet, nrL1Tau, ifCaloEtaNumberBits);
597 
598  caloCondition->setVerbosity(m_verbosity);
599 
600  caloCondition->evaluateConditionStoreResult(iBxInEvent);
601 
602  cMapResults[itCond->first] = caloCondition;
603 
604  if (m_verbosity && m_isDebugEnabled) {
605  std::ostringstream myCout;
606  caloCondition->print(myCout);
607 
608  LogTrace("L1TGlobal") << myCout.str();
609  }
610  // delete caloCondition;
611 
612  } break;
613  case CondEnergySum: {
614  EnergySumCondition* eSumCondition = new EnergySumCondition(itCond->second, this);
615 
616  eSumCondition->setVerbosity(m_verbosity);
617  eSumCondition->evaluateConditionStoreResult(iBxInEvent);
618 
619  cMapResults[itCond->first] = eSumCondition;
620 
621  if (m_verbosity && m_isDebugEnabled) {
622  std::ostringstream myCout;
623  eSumCondition->print(myCout);
624 
625  LogTrace("L1TGlobal") << myCout.str();
626  }
627  // delete eSumCondition;
628 
629  } break;
630  case CondEnergySumZdc: {
631  EnergySumZdcCondition* eSumZdcCondition = new EnergySumZdcCondition(itCond->second, this);
632 
633  eSumZdcCondition->setVerbosity(m_verbosity);
634  eSumZdcCondition->evaluateConditionStoreResult(iBxInEvent);
635 
636  cMapResults[itCond->first] = eSumZdcCondition;
637 
638  if (m_verbosity && m_isDebugEnabled) {
639  std::ostringstream myCout;
640  eSumZdcCondition->print(myCout);
641 
642  LogTrace("L1TGlobal") << myCout.str();
643  }
644  // delete eSumZdcCondition;
645 
646  } break;
647 
648  case CondExternal: {
649  ExternalCondition* extCondition = new ExternalCondition(itCond->second, this);
650 
651  extCondition->setVerbosity(m_verbosity);
652  extCondition->evaluateConditionStoreResult(iBxInEvent);
653 
654  cMapResults[itCond->first] = extCondition;
655 
656  if (m_verbosity && m_isDebugEnabled) {
657  std::ostringstream myCout;
658  extCondition->print(myCout);
659 
660  LogTrace("L1TGlobal") << myCout.str();
661  }
662  // delete extCondition;
663 
664  } break;
665  case CondCorrelation: {
666  // get first the subconditions
667  const CorrelationTemplate* corrTemplate = static_cast<const CorrelationTemplate*>(itCond->second);
668  const GtConditionCategory cond0Categ = corrTemplate->cond0Category();
669  const GtConditionCategory cond1Categ = corrTemplate->cond1Category();
670  const int cond0Ind = corrTemplate->cond0Index();
671  const int cond1Ind = corrTemplate->cond1Index();
672 
673  const GlobalCondition* cond0Condition = nullptr;
674  const GlobalCondition* cond1Condition = nullptr;
675 
676  // maximum number of objects received for evaluation of l1t::Type1s condition
677  int cond0NrL1Objects = 0;
678  int cond1NrL1Objects = 0;
679  LogDebug("L1TGlobal") << " cond0NrL1Objects" << cond0NrL1Objects << " cond1NrL1Objects "
680  << cond1NrL1Objects;
681 
682  switch (cond0Categ) {
683  case CondMuon: {
684  cond0Condition = &((corrMuon[iChip])[cond0Ind]);
685  } break;
686  case CondCalo: {
687  cond0Condition = &((corrCalo[iChip])[cond0Ind]);
688  } break;
689  case CondEnergySum: {
690  cond0Condition = &((corrEnergySum[iChip])[cond0Ind]);
691  } break;
692  default: {
693  // do nothing, should not arrive here
694  } break;
695  }
696 
697  switch (cond1Categ) {
698  case CondMuon: {
699  cond1Condition = &((corrMuon[iChip])[cond1Ind]);
700  } break;
701  case CondCalo: {
702  cond1Condition = &((corrCalo[iChip])[cond1Ind]);
703  } break;
704  case CondEnergySum: {
705  cond1Condition = &((corrEnergySum[iChip])[cond1Ind]);
706  } break;
707  default: {
708  // do nothing, should not arrive here
709  } break;
710  }
711 
712  CorrCondition* correlationCond = new CorrCondition(itCond->second, cond0Condition, cond1Condition, this);
713 
714  correlationCond->setVerbosity(m_verbosity);
715  correlationCond->setScales(&gtScales);
716  correlationCond->evaluateConditionStoreResult(iBxInEvent);
717 
718  cMapResults[itCond->first] = correlationCond;
719 
720  if (m_verbosity && m_isDebugEnabled) {
721  std::ostringstream myCout;
722  correlationCond->print(myCout);
723 
724  LogTrace("L1TGlobal") << myCout.str();
725  }
726 
727  // delete correlationCond;
728 
729  } break;
731  // get first the subconditions
732  const CorrelationThreeBodyTemplate* corrTemplate =
733  static_cast<const CorrelationThreeBodyTemplate*>(itCond->second);
734  const GtConditionCategory cond0Categ = corrTemplate->cond0Category();
735  const GtConditionCategory cond1Categ = corrTemplate->cond1Category();
736  const GtConditionCategory cond2Categ = corrTemplate->cond2Category();
737  const int cond0Ind = corrTemplate->cond0Index();
738  const int cond1Ind = corrTemplate->cond1Index();
739  const int cond2Ind = corrTemplate->cond2Index();
740 
741  const GlobalCondition* cond0Condition = nullptr;
742  const GlobalCondition* cond1Condition = nullptr;
743  const GlobalCondition* cond2Condition = nullptr;
744 
745  // maximum number of objects received for evaluation of l1t::Type1s condition
746  int cond0NrL1Objects = 0;
747  int cond1NrL1Objects = 0;
748  int cond2NrL1Objects = 0;
749  LogDebug("L1TGlobal") << " cond0NrL1Objects " << cond0NrL1Objects << " cond1NrL1Objects "
750  << cond1NrL1Objects << " cond2NrL1Objects " << cond2NrL1Objects;
751  if (cond0Categ == CondMuon) {
752  cond0Condition = &((corrMuon[iChip])[cond0Ind]);
753  } else {
754  LogDebug("L1TGlobal") << "No muon0 to evaluate three-body correlation condition";
755  }
756  if (cond1Categ == CondMuon) {
757  cond1Condition = &((corrMuon[iChip])[cond1Ind]);
758  } else {
759  LogDebug("L1TGlobal") << "No muon1 to evaluate three-body correlation condition";
760  }
761  if (cond2Categ == CondMuon) {
762  cond2Condition = &((corrMuon[iChip])[cond2Ind]);
763  } else {
764  LogDebug("L1TGlobal") << "No muon2 to evaluate three-body correlation condition";
765  }
766 
767  CorrThreeBodyCondition* correlationThreeBodyCond =
768  new CorrThreeBodyCondition(itCond->second, cond0Condition, cond1Condition, cond2Condition, this);
769 
770  correlationThreeBodyCond->setVerbosity(m_verbosity);
771  correlationThreeBodyCond->setScales(&gtScales);
772  correlationThreeBodyCond->evaluateConditionStoreResult(iBxInEvent);
773  cMapResults[itCond->first] = correlationThreeBodyCond;
774 
775  if (m_verbosity && m_isDebugEnabled) {
776  std::ostringstream myCout;
777  correlationThreeBodyCond->print(myCout);
778 
779  LogTrace("L1TGlobal") << myCout.str();
780  }
781  // delete correlationThreeBodyCond;
782  } break;
783 
785  // get first the subconditions
786  const CorrelationWithOverlapRemovalTemplate* corrTemplate =
787  static_cast<const CorrelationWithOverlapRemovalTemplate*>(itCond->second);
788  const GtConditionCategory cond0Categ = corrTemplate->cond0Category();
789  const GtConditionCategory cond1Categ = corrTemplate->cond1Category();
790  const GtConditionCategory cond2Categ = corrTemplate->cond2Category();
791  const int cond0Ind = corrTemplate->cond0Index();
792  const int cond1Ind = corrTemplate->cond1Index();
793  const int cond2Ind = corrTemplate->cond2Index();
794 
795  const GlobalCondition* cond0Condition = nullptr;
796  const GlobalCondition* cond1Condition = nullptr;
797  const GlobalCondition* cond2Condition = nullptr;
798 
799  // maximum number of objects received for evaluation of l1t::Type1s condition
800  int cond0NrL1Objects = 0;
801  int cond1NrL1Objects = 0;
802  int cond2NrL1Objects = 0;
803  LogDebug("L1TGlobal") << " cond0NrL1Objects" << cond0NrL1Objects << " cond1NrL1Objects " << cond1NrL1Objects
804  << " cond2NrL1Objects " << cond2NrL1Objects;
805 
806  switch (cond0Categ) {
807  case CondMuon: {
808  cond0Condition = &((corrMuon[iChip])[cond0Ind]);
809  } break;
810  case CondCalo: {
811  cond0Condition = &((corrCalo[iChip])[cond0Ind]);
812  } break;
813  case CondEnergySum: {
814  cond0Condition = &((corrEnergySum[iChip])[cond0Ind]);
815  } break;
816  default: {
817  // do nothing, should not arrive here
818  } break;
819  }
820 
821  switch (cond1Categ) {
822  case CondMuon: {
823  cond1Condition = &((corrMuon[iChip])[cond1Ind]);
824  } break;
825  case CondCalo: {
826  cond1Condition = &((corrCalo[iChip])[cond1Ind]);
827  } break;
828  case CondEnergySum: {
829  cond1Condition = &((corrEnergySum[iChip])[cond1Ind]);
830  } break;
831  default: {
832  // do nothing, should not arrive here
833  } break;
834  }
835 
836  switch (cond2Categ) {
837  case CondMuon: {
838  cond2Condition = &((corrMuon[iChip])[cond2Ind]);
839  } break;
840  case CondCalo: {
841  cond2Condition = &((corrCalo[iChip])[cond2Ind]);
842  } break;
843  case CondEnergySum: {
844  cond2Condition = &((corrEnergySum[iChip])[cond2Ind]);
845  } break;
846  default: {
847  // do nothing, should not arrive here
848  } break;
849  }
850 
851  CorrWithOverlapRemovalCondition* correlationCondWOR =
852  new CorrWithOverlapRemovalCondition(itCond->second, cond0Condition, cond1Condition, cond2Condition, this);
853 
854  correlationCondWOR->setVerbosity(m_verbosity);
855  correlationCondWOR->setScales(&gtScales);
856  correlationCondWOR->evaluateConditionStoreResult(iBxInEvent);
857 
858  cMapResults[itCond->first] = correlationCondWOR;
859 
860  if (m_verbosity && m_isDebugEnabled) {
861  std::ostringstream myCout;
862  correlationCondWOR->print(myCout);
863 
864  LogTrace("L1TGlobal") << myCout.str();
865  }
866 
867  // delete correlationCondWOR;
868 
869  } break;
870  case CondNull: {
871  // do nothing
872 
873  } break;
874  default: {
875  // do nothing
876 
877  } break;
878  }
879  }
880  }
881 
882  // -----------------------
883  // Loop over algorithm map
884  // -----------------------
885  // Empty vector for object maps - filled during loop
886  std::vector<GlobalObjectMap> objMapVec;
887  if (produceL1GtObjectMapRecord && (iBxInEvent == 0))
888  objMapVec.reserve(numberPhysTriggers);
889 
890  for (CItAlgo itAlgo = algorithmMap.begin(); itAlgo != algorithmMap.end(); itAlgo++) {
891  AlgorithmEvaluation gtAlg(itAlgo->second);
892  gtAlg.evaluateAlgorithm((itAlgo->second).algoChipNumber(), m_conditionResultMaps);
893 
894  int algBitNumber = (itAlgo->second).algoBitNumber();
895  bool algResult = gtAlg.gtAlgoResult();
896 
897  LogDebug("L1TGlobal") << " ===> for iBxInEvent = " << iBxInEvent << ":\t algBitName = " << itAlgo->first
898  << ",\t algBitNumber = " << algBitNumber << ",\t algResult = " << algResult;
899 
900  if (algResult) {
901  // m_gtlAlgorithmOR.set(algBitNumber);
902  m_uGtAlgBlk.setAlgoDecisionInitial(algBitNumber, algResult);
903  m_algInitialOr = true;
904  }
905 
906  if (m_verbosity && m_isDebugEnabled) {
907  std::ostringstream myCout;
908  (itAlgo->second).print(myCout);
909  gtAlg.print(myCout);
910 
911  LogTrace("L1TGlobal") << myCout.str();
912  }
913 
914  // object maps only for BxInEvent = 0
915  if (produceL1GtObjectMapRecord && (iBxInEvent == 0)) {
916  std::vector<L1TObjectTypeInCond> otypes;
917  for (auto iop = gtAlg.operandTokenVector().begin(); iop != gtAlg.operandTokenVector().end(); ++iop) {
918  //cout << "INFO: operand name: " << iop->tokenName << "\n";
919  int found = 0;
921  for (auto imap = conditionMap.begin(); imap != conditionMap.end(); imap++) {
922  auto match = imap->find(iop->tokenName);
923 
924  if (match != imap->end()) {
925  found = 1;
926  //cout << "DEBUG: found match for " << iop->tokenName << " at " << match->first << "\n";
927 
928  otype = match->second->objectType();
929 
930  for (auto itype = otype.begin(); itype != otype.end(); itype++) {
931  //cout << "type: " << *itype << "\n";
932  }
933  }
934  }
935  if (!found) {
936  edm::LogWarning("L1TGlobal") << "\n Failed to find match for operand token " << iop->tokenName << "\n";
937  } else {
938  otypes.push_back(otype);
939  }
940  }
941 
942  // set object map
943  GlobalObjectMap objMap;
944 
945  objMap.setAlgoName(itAlgo->first);
946  objMap.setAlgoBitNumber(algBitNumber);
947  objMap.setAlgoGtlResult(algResult);
950  // gtAlg is empty now...
951  objMap.swapObjectTypeVector(otypes);
952 
953  if (m_verbosity && m_isDebugEnabled) {
954  std::ostringstream myCout1;
955  objMap.print(myCout1);
956 
957  LogTrace("L1TGlobal") << myCout1.str();
958  }
959 
960  objMapVec.push_back(objMap);
961  }
962  }
963 
964  // object maps only for BxInEvent = 0
965  if (produceL1GtObjectMapRecord && (iBxInEvent == 0)) {
966  gtObjectMapRecord->swapGtObjectMap(objMapVec);
967  }
968 
969  // loop over condition maps (one map per condition chip)
970  // then loop over conditions in the map
971  // delete the conditions created with new, zero pointer, do not clear map, keep the vector as is...
972  for (std::vector<AlgorithmEvaluation::ConditionEvaluationMap>::iterator itCondOnChip = m_conditionResultMaps.begin();
973  itCondOnChip != m_conditionResultMaps.end();
974  itCondOnChip++) {
975  for (AlgorithmEvaluation::ItEvalMap itCond = itCondOnChip->begin(); itCond != itCondOnChip->end(); itCond++) {
976  delete itCond->second;
977  itCond->second = nullptr;
978  }
979  }
980 }
981 
982 // -------
983 // Run GTL
984 // -------
986  const int iBxInEvent,
987  const int totalBxInEvent,
988  const unsigned int numberPhysTriggers,
989  const std::vector<double>& prescaleFactorsAlgoTrig,
990  const std::vector<unsigned int>& triggerMaskAlgoTrig,
991  const std::vector<int>& triggerMaskVetoAlgoTrig,
992  const bool algorithmTriggersUnprescaled,
993  const bool algorithmTriggersUnmasked) {
994  if (m_verbosity) {
995  LogDebug("L1TGlobal") << "\n**** GlobalBoard apply Final Decision Logic ";
996  }
997 
998  // update and clear prescales at the beginning of the luminosity segment
999  if (m_prescaleCounterAlgoTrig.empty() or
1000  (m_currentLumi != iEvent.luminosityBlock() and m_resetPSCountersEachLumiSec)) {
1001  m_prescaleCounterAlgoTrig.clear();
1002  m_prescaleCounterAlgoTrig.reserve(totalBxInEvent);
1003  auto const& prescaleCountersAlgoTrig =
1004  m_semiRandomInitialPSCounters ? prescaleCountersWithSemirandomInitialCounter(prescaleFactorsAlgoTrig, iEvent)
1005  : prescaleCounters(prescaleFactorsAlgoTrig);
1006  for (int iBxInEvent = 0; iBxInEvent < totalBxInEvent; ++iBxInEvent) {
1007  m_prescaleCounterAlgoTrig.push_back(prescaleCountersAlgoTrig);
1008  }
1009 
1010  m_currentLumi = iEvent.luminosityBlock();
1011  }
1012 
1013  // Copy Algorithm bits to Prescaled word
1014  // Prescaling and Masking done below if requested.
1015  m_uGtAlgBlk.copyInitialToInterm();
1016 
1017  // -------------------------------------------
1018  // Apply Prescales or skip if turned off
1019  // -------------------------------------------
1020  if (!algorithmTriggersUnprescaled) {
1021  // iBxInEvent is ... -2 -1 0 1 2 ... while counters are 0 1 2 3 4 ...
1022  int const inBxInEvent = totalBxInEvent / 2 + iBxInEvent;
1023 
1024  bool temp_algPrescaledOr = false;
1025  bool alreadyReported = false;
1026  for (unsigned int iBit = 0; iBit < numberPhysTriggers; ++iBit) {
1027  bool const bitValue = m_uGtAlgBlk.getAlgoDecisionInitial(iBit);
1028  if (bitValue) {
1029  // Make sure algo bit in range, warn otherwise
1030  if (iBit < prescaleFactorsAlgoTrig.size()) {
1031  if (prescaleFactorsAlgoTrig.at(iBit) != 1) {
1032  bool const triggered = m_prescaleCounterAlgoTrig.at(inBxInEvent).at(iBit).accept();
1033  if (triggered) {
1034  temp_algPrescaledOr = true;
1035  } else {
1036  // change bit to false in prescaled word and final decision word
1037  m_uGtAlgBlk.setAlgoDecisionInterm(iBit, false);
1038  } //if Prescale counter reached zero
1039  } //if prescale factor is not 1 (ie. no prescale)
1040  else {
1041  temp_algPrescaledOr = true;
1042  }
1043  } // require bit in range
1044  else if (!alreadyReported) {
1045  alreadyReported = true;
1046  edm::LogWarning("L1TGlobal") << "\nWarning: algoBit >= prescaleFactorsAlgoTrig.size() in bx " << iBxInEvent;
1047  }
1048  } //if algo bit is set true
1049  } //loop over alg bits
1050 
1051  m_algPrescaledOr = temp_algPrescaledOr; //temp
1052 
1053  } else {
1054  // Since not Prescaling just take OR of Initial Work
1055  m_algPrescaledOr = m_algInitialOr;
1056 
1057  } //if we are going to apply prescales.
1058 
1059  // Copy Algorithm bits fron Prescaled word to Final Word
1060  // Masking done below if requested.
1061  m_uGtAlgBlk.copyIntermToFinal();
1062 
1063  if (!algorithmTriggersUnmasked) {
1064  bool temp_algFinalOr = false;
1065  bool alreadyReported = false;
1066  for (unsigned int iBit = 0; iBit < numberPhysTriggers; ++iBit) {
1067  const bool bitValue = m_uGtAlgBlk.getAlgoDecisionInterm(iBit);
1068 
1069  if (bitValue) {
1070  //bool isMasked = ( triggerMaskAlgoTrig.at(iBit) == 0 );
1071  bool isMasked = false;
1072  if (iBit < triggerMaskAlgoTrig.size())
1073  isMasked = (triggerMaskAlgoTrig.at(iBit) == 0);
1074  else if (!alreadyReported) {
1075  alreadyReported = true;
1076  edm::LogWarning("L1TGlobal") << "\nWarning: algoBit >= triggerMaskAlgoTrig.size() in bx " << iBxInEvent;
1077  }
1078 
1079  bool const passMask = (bitValue && !isMasked);
1080 
1081  if (passMask)
1082  temp_algFinalOr = true;
1083  else
1084  m_uGtAlgBlk.setAlgoDecisionFinal(iBit, false);
1085 
1086  // Check if veto mask is true, if it is, set the event veto flag.
1087  if (triggerMaskVetoAlgoTrig.at(iBit) == 1)
1088  m_algFinalOrVeto = true;
1089  }
1090  }
1091 
1092  m_algIntermOr = temp_algFinalOr;
1093 
1094  } else {
1095  m_algIntermOr = m_algPrescaledOr;
1096 
1097  }
1098 
1099  // --------------------------
1100  // Set FinalOR for this board
1101  // --------------------------
1102  m_algFinalOr = (m_algIntermOr & !m_algFinalOrVeto);
1103 }
1104 
1105 // Fill DAQ Record
1107  std::unique_ptr<GlobalAlgBlkBxCollection>& uGtAlgRecord,
1108  int prescaleSet,
1109  int menuUUID,
1110  int firmwareUUID) {
1111  if (m_verbosity) {
1112  LogDebug("L1TGlobal") << "\n**** GlobalBoard fill DAQ Records for bx= " << iBxInEvent;
1113  }
1114 
1115  // Set header information
1116  m_uGtAlgBlk.setbxInEventNr((iBxInEvent & 0xF));
1117  m_uGtAlgBlk.setPreScColumn(prescaleSet);
1118  m_uGtAlgBlk.setL1MenuUUID(menuUUID);
1119  m_uGtAlgBlk.setL1FirmwareUUID(firmwareUUID);
1120 
1121  m_uGtAlgBlk.setFinalORVeto(m_algFinalOrVeto);
1122  m_uGtAlgBlk.setFinalORPreVeto(m_algIntermOr);
1123  m_uGtAlgBlk.setFinalOR(m_algFinalOr);
1124 
1125  uGtAlgRecord->push_back(iBxInEvent, m_uGtAlgBlk);
1126 }
1127 
1128 // clear GTL
1130  resetMu();
1131  resetMuonShower();
1132  resetCalo();
1133  resetExternal();
1134 
1135  m_uGtAlgBlk.reset();
1136 
1137  m_gtlDecisionWord.reset();
1138  m_gtlAlgorithmOR.reset();
1139 }
1140 
1141 // clear muon
1143  m_candL1Mu->clear();
1144  m_candL1Mu->setBXRange(m_bxFirst_, m_bxLast_);
1145 }
1146 
1147 // clear muon shower
1149  m_candL1MuShower->clear();
1150  m_candL1MuShower->setBXRange(m_bxFirst_, m_bxLast_);
1151 }
1152 
1153 // clear calo
1155  m_candL1EG->clear();
1156  m_candL1Tau->clear();
1157  m_candL1Jet->clear();
1158  m_candL1EtSum->clear();
1159  m_candL1EtSumZdc->clear();
1160 
1161  m_candL1EG->setBXRange(m_bxFirst_, m_bxLast_);
1162  m_candL1Tau->setBXRange(m_bxFirst_, m_bxLast_);
1163  m_candL1Jet->setBXRange(m_bxFirst_, m_bxLast_);
1164  m_candL1EtSum->setBXRange(m_bxFirst_, m_bxLast_);
1165  m_candL1EtSumZdc->setBXRange(m_bxFirst_, m_bxLast_);
1166 }
1167 
1169  m_candL1External->clear();
1170  m_candL1External->setBXRange(m_bxFirst_, m_bxLast_);
1171 }
1172 
1173 // print Global Muon Trigger data received
1174 void l1t::GlobalBoard::printGmtData(const int iBxInEvent) const {
1175  LogTrace("L1TGlobal") << "\nl1t::L1GlobalTrigger: uGMT data received for BxInEvent = " << iBxInEvent;
1176 
1177  int nrL1Mu = m_candL1Mu->size(iBxInEvent);
1178  LogTrace("L1TGlobal") << "Number of GMT muons = " << nrL1Mu << "\n";
1179 }
1180 
1181 // initialize prescale counters to zero
1182 std::vector<l1t::GlobalBoard::PrescaleCounter> l1t::GlobalBoard::prescaleCounters(
1183  std::vector<double> const& prescaleFactorsAlgoTrig) {
1184  std::vector<PrescaleCounter> out;
1185  out.reserve(prescaleFactorsAlgoTrig.size());
1186  for (size_t iAlgo = 0; iAlgo < prescaleFactorsAlgoTrig.size(); ++iAlgo) {
1187  out.emplace_back(prescaleFactorsAlgoTrig[iAlgo]);
1188  }
1189  return out;
1190 }
1191 
1192 // initialises prescale counters with a semi-random value in the range [0, prescale*10^precision - 1]
1193 std::vector<l1t::GlobalBoard::PrescaleCounter> l1t::GlobalBoard::prescaleCountersWithSemirandomInitialCounter(
1194  std::vector<double> const& prescaleFactorsAlgoTrig, edm::Event const& iEvent) {
1195  // pick a (semi)random number seeding based on run, lumi, event numbers,
1196  // this leads to different (semi)random numbers for different streams,
1197  // reminder: different streams have different initial event number
1198  std::srand(iEvent.id().run());
1199  std::srand(std::rand() + iEvent.id().luminosityBlock());
1200  std::srand(std::rand() + iEvent.id().event());
1201  int const semirandom = std::rand();
1202 
1203  std::vector<PrescaleCounter> out;
1204  out.reserve(prescaleFactorsAlgoTrig.size());
1205 
1206  for (size_t iAlgo = 0; iAlgo < prescaleFactorsAlgoTrig.size(); ++iAlgo) {
1207  out.emplace_back(prescaleFactorsAlgoTrig[iAlgo]);
1208  // initialise trigger_counter to a (semi)random integer
1209  // between 0 and prescale_count - 1 (both inclusive)
1210  // (this only changes the behaviour of triggers with PS > 1)
1211  auto& prescaleCounter = out.back();
1212  if (prescaleCounter.prescale_count > 0) {
1213  prescaleCounter.trigger_counter = semirandom % prescaleCounter.prescale_count;
1214  }
1215  }
1216 
1217  return out;
1218 }
1219 
1220 // return decision of PrescalCounter, and update its internal counter
1222  trigger_counter += m_singlestep;
1223 
1224  if (prescale_count == 0 or trigger_counter < prescale_count)
1225  return false;
1226 
1227  trigger_counter -= prescale_count;
1228 
1229  return true;
1230 }
bool isDebugEnabled()
void setAlgoBitNumber(int algoBitNumberValue)
const int cond0Index() const
get / set the index of the two sub-conditions in the cor* vector from menu
const l1t::GlobalScales & gtScales() const
get the scales
Definition: TriggerMenu.h:201
void evaluateConditionStoreResult(const int bxEval)
call evaluateCondition and save last result
std::vector< l1t::GlobalObject > L1TObjectTypeInCond
void swapOperandTokenVector(std::vector< GlobalLogicParser::OperandToken > &operandTokenVectorValue)
const std::vector< std::vector< CaloTemplate > > & corCaloTemplate() const
Definition: TriggerMenu.h:178
void print(std::ostream &myCout) const override
print condition
Definition: MuCondition.cc:516
void print(std::ostream &myCout) const override
print condition
void print(std::ostream &myCout) const override
print condition
const l1t::AlgorithmMap & gtAlgorithmMap() const
get / set the algorithm map (by name)
Definition: TriggerMenu.h:191
static std::vector< PrescaleCounter > prescaleCountersWithSemirandomInitialCounter(std::vector< double > const &prescaleFactorsAlgoTrig, edm::Event const &iEvent)
void setVerbosity(const int verbosity)
const int cond1Index() const
virtual std::string getScalesName() const
Definition: GlobalScales.cc:27
void fillAlgRecord(int iBxInEvent, std::unique_ptr< GlobalAlgBlkBxCollection > &uGtAlgRecord, int prescaleSet, int menuUUID, int firmwareUUID)
Fill the Daq Records.
const std::vector< std::vector< MuonTemplate > > & corMuonTemplate() const
Definition: TriggerMenu.h:173
unsigned long long m_l1MuTriggerScalesCacheID
Definition: GlobalBoard.h:222
delete x;
Definition: CaloConfig.h:22
void setBxLast(int bx)
Definition: GlobalBoard.cc:111
const l1t::GtConditionCategory cond1Category() const
void runFDL(const edm::Event &iEvent, const int iBxInEvent, const int totalBxInEvent, const unsigned int numberPhysTriggers, const std::vector< double > &prescaleFactorsAlgoTrig, const std::vector< unsigned int > &triggerMaskAlgoTrig, const std::vector< int > &triggerMaskVetoAlgoTrig, const bool algorithmTriggersUnprescaled, const bool algorithmTriggersUnmasked)
run the uGT FDL (Apply Prescales and Veto)
Definition: GlobalBoard.cc:985
const int cond0Index() const
get / set the index of the two sub-conditions in the cor* vector from menu
void print(std::ostream &myCout) const
print the full object map
const l1t::GtConditionCategory cond1Category() const
void swapObjectTypeVector(std::vector< L1TObjectTypeInCond > &objectTypeVectorValue)
void swapCombinationVector(std::vector< CombinationsInCond > &combinationVectorValue)
ConditionEvaluationMap::iterator ItEvalMap
void printGmtData(const int iBxInEvent) const
print received Muon dataWord
void print(std::ostream &myCout) const
unsigned long long m_l1GtMenuCacheID
Definition: GlobalBoard.h:215
void print(std::ostream &myCout) const override
print condition
#define LogTrace(id)
static std::vector< PrescaleCounter > prescaleCounters(std::vector< double > const &prescaleFactorsAlgoTrig)
const l1t::GtConditionCategory cond2Category() const
std::bitset< GlobalAlgBlk::maxPhysicsTriggers > m_gtlDecisionWord
Definition: GlobalBoard.h:246
ConditionMap::const_iterator CItCond
iterators through map containing the conditions
GtConditionCategory
condition categories
const l1t::GtConditionCategory cond0Category() const
get / set the category of the thre sub-conditions
int iEvent
Definition: GenABIO.cc:224
const l1t::GtConditionCategory cond0Category() const
get / set the category of the two sub-conditions
unsigned int m_boardEventCount
Definition: GlobalBoard.h:268
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
Definition: Muon.py:1
void print(std::ostream &myCout) const override
print condition
void reset()
reset the content of a GlobalAlgBlk
void print(std::ostream &myCout) const override
print condition
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
void runGTL(const edm::Event &iEvent, const edm::EventSetup &evSetup, const TriggerMenu *m_l1GtMenu, const bool produceL1GtObjectMapRecord, const int iBxInEvent, std::unique_ptr< GlobalObjectMapRecord > &gtObjectMapRecord, const unsigned int numberPhysTriggers, const int nrL1Mu, const int nrL1MuShower, const int nrL1EG, const int nrL1Tau, const int nrL1Jet)
run the uGT GTL (Conditions and Algorithms)
Definition: GlobalBoard.cc:494
void reset()
clear uGT
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
unsigned long long m_l1CaloGeometryCacheID
Definition: GlobalBoard.h:219
const l1t::GtConditionCategory cond1Category() const
void setAlgoGtlResult(bool algoGtlResultValue)
std::vector< CombinationsInCond > & gtAlgoCombinationVector()
std::vector< std::vector< PrescaleCounter > > m_prescaleCounterAlgoTrig
Definition: GlobalBoard.h:304
void setScales(const GlobalScales *)
void evaluateAlgorithm(const int chipNumber, const std::vector< ConditionEvaluationMap > &)
evaluate an algorithm
void receiveExternalData(const edm::Event &, const edm::EDGetTokenT< BXVector< GlobalExtBlk >> &, const bool receiveExt)
Definition: GlobalBoard.cc:457
bool gtAlgoResult() const
get / set the result of the algorithm
GlobalAlgBlk m_uGtAlgBlk
Definition: GlobalBoard.h:248
void setBxFirst(int bx)
Definition: GlobalBoard.cc:109
void setAlgoName(const std::string &algoNameValue)
const std::vector< l1t::ConditionMap > & gtConditionMap() const
get / set / build the condition maps
Definition: TriggerMenu.h:81
bool isValid() const
Definition: HandleBase.h:70
void receiveCaloObjectData(const edm::Event &, const edm::EDGetTokenT< BXVector< l1t::EGamma >> &, const edm::EDGetTokenT< BXVector< l1t::Tau >> &, const edm::EDGetTokenT< BXVector< l1t::Jet >> &, const edm::EDGetTokenT< BXVector< l1t::EtSum >> &, const edm::EDGetTokenT< BXVector< l1t::EtSum >> &, const bool receiveEG, const int nrL1EG, const bool receiveTau, const int nrL1Tau, const bool receiveJet, const int nrL1Jet, const bool receiveEtSums, const bool receiveEtSumsZdc)
receive data from Global Muon Trigger
Definition: GlobalBoard.cc:139
const std::vector< std::vector< EnergySumTemplate > > & corEnergySumTemplate() const
Definition: TriggerMenu.h:184
HLT enums.
void print(std::ostream &myCout) const override
print condition
virtual ~GlobalBoard()
Definition: GlobalBoard.cc:97
std::vector< GlobalLogicParser::OperandToken > & operandTokenVector()
void setScales(const GlobalScales *)
const int cond0Index() const
get / set the index of the three subconditions in the cor* vector from menu
void init(const int numberPhysTriggers, const int nrL1Mu, const int nrL1MuShower, const int nrL1EG, const int nrL1Tau, const int nrL1Jet, int bxFirst, int bxLast)
initialize the class (mainly reserve)
Definition: GlobalBoard.cc:113
void print(std::ostream &myCout) const override
print condition
std::unordered_map< std::string, ConditionEvaluation * > ConditionEvaluationMap
copy constructor
const l1t::GtConditionCategory cond0Category() const
get / set the category of the three subconditions
Log< level::Warning, false > LogWarning
Definition: memstream.h:15
std::bitset< GlobalAlgBlk::maxPhysicsTriggers > m_gtlAlgorithmOR
Definition: GlobalBoard.h:245
std::map< std::string, GlobalAlgorithm > AlgorithmMap
map containing the algorithms
const l1t::GtConditionCategory cond2Category() const
void receiveMuonShowerObjectData(const edm::Event &, const edm::EDGetTokenT< BXVector< l1t::MuonShower >> &, const bool receiveMuShower, const int nrL1MuShower)
Definition: GlobalBoard.cc:393
void receiveMuonObjectData(const edm::Event &, const edm::EDGetTokenT< BXVector< l1t::Muon >> &, const bool receiveMu, const int nrL1Mu)
Definition: GlobalBoard.cc:346
void print(std::ostream &myCout) const override
print condition
#define LogDebug(id)