ATLAS Offline Software
L1CaloCTPMon.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // ********************************************************************
6 //
7 // NAME: L1CaloCTPMon.cxx
8 // PACKAGE: TrigT1CaloMonitoring
9 //
10 // AUTHOR: Johanna Fleckner (Johanna.Fleckner@uni-mainz.de)
11 // Kate Whalen (Run 2 version) <kate.whalen@cern.ch>
12 //
13 // DESCRIPTION: Monitoring of L1Calo --> CTP transmission
14 //
15 // ********************************************************************
16 
17 #include <map>
18 #include <utility>
19 
20 #include "GaudiKernel/MsgStream.h"
21 #include "GaudiKernel/StatusCode.h"
22 
23 #include "LWHists/LWHist.h"
24 #include "LWHists/TH1F_LW.h"
25 #include "LWHists/TH2I_LW.h"
26 
33 #include "TrigConfL1Data/Menu.h"
34 #include "TrigConfL1Data/TIP.h"
36 
37 #include "TrigT1Result/CTP_RDO.h"
39 
43 
45 
46 #include "L1CaloCTPMon.h"
47 // ============================================================================
48 namespace LVL1 {
49 // ============================================================================
50 
51 // Number of jet thresholds
54 
55 
56 // *********************************************************************
57 // Public Methods
58 // *********************************************************************
59 
60 /*---------------------------------------------------------*/
61 L1CaloCTPMon::L1CaloCTPMon( const std::string & type, const std::string & name,
62  const IInterface* parent )
64  m_configSvc("TrigConf::TrigConfigSvc/TrigConfigSvc", name),
65  m_errorTool("LVL1::TrigT1CaloMonErrorTool/TrigT1CaloMonErrorTool"),
66  m_histTool("LVL1::TrigT1CaloLWHistogramTool/TrigT1CaloLWHistogramTool"),
67  m_debug(false), m_histBooked(false),
68  m_tipMap(0),
69  m_h_ctp_1d_L1CaloNeCTPSummary(0),
70  m_h_ctp_1d_L1CaloEqCTPSummary(0),
71  m_h_ctp_1d_TIPMatches(0),
72  m_h_ctp_1d_HitNoTIPMismatch(0),
73  m_h_ctp_1d_TIPNoHitMismatch(0),
74  m_h_ctp_2d_MismatchEvents(0)
75  //m_h_ctp_1d_EM_HitNoTIPMismatch(0),
76  //m_h_ctp_1d_TAU_HitNoTIPMismatch(0),
77  //m_h_ctp_1d_JET_HitNoTIPMismatch(0),
78  //m_h_ctp_1d_TE_HitNoTIPMismatch(0),
79  //m_h_ctp_1d_XE_HitNoTIPMismatch(0),
80  //m_h_ctp_1d_XS_HitNoTIPMismatch(0)
81 /*---------------------------------------------------------*/
82 {
83  // This is how you declare the parameters to Gaudi so that
84  // they can be over-written via the job options file
85 
86  declareProperty( "LVL1ConfigSvc", m_configSvc, "LVL1 Config Service");
87  declareProperty( "CMXJetHitsLocation",
89  declareProperty( "CMXEtSumsLocation",
91  declareProperty("CMXCPHitsLocation",
93  declareProperty( "CTP_RDOLocation", m_CTPRDOLocation = "CTP_RDO");
94  declareProperty( "PathInRootFile", m_PathInRootFile = "LVL1_Interfaces/CTP");
95 }
96 
97 
98 /*---------------------------------------------------------*/
100 /*---------------------------------------------------------*/
101 {
102 }
103 
104 /*---------------------------------------------------------*/
106 /*---------------------------------------------------------*/
107 {
108  msg(MSG::INFO) << "Initializing " << name() << endmsg;
110 
112  if (sc.isFailure()) return sc;
113 
114  // Connect to the TrigConfigSvc for the trigger configuration:
115 
116  sc = m_configSvc.retrieve();
117  if ( sc.isFailure() ) {
118  msg(MSG::ERROR) << "Couldn't connect to " << m_configSvc.typeAndName()
119  << endmsg;
120  return sc;
121  } else {
122  msg(MSG::INFO) << "Connected to " << m_configSvc.typeAndName() << endmsg;
123  }
124 
125  sc = m_errorTool.retrieve();
126  if( sc.isFailure() ) {
127  msg(MSG::ERROR) << "Unable to locate Tool TrigT1CaloMonErrorTool"
128  << endmsg;
129  return sc;
130  }
131 
132  sc = m_histTool.retrieve();
133  if( sc.isFailure() ) {
134  msg(MSG::ERROR) << "Unable to locate Tool TrigT1CaloLWHistogramTool"
135  << endmsg;
136  return sc;
137  }
138 
139  return StatusCode::SUCCESS;
140 }
141 
142 /*---------------------------------------------------------*/
144 /*---------------------------------------------------------*/
145 {
146  msg(MSG::DEBUG) << "in L1CaloCTPMon::bookHistograms" << endmsg;
147 
149  // book histograms that are only made in the online environment...
150  }
151 
153  // book histograms that are only relevant for cosmics data...
154  }
155 
156  //if( newLumiBlockFlag() ) {}
157 
158  if( newRunFlag() ) {
159 
161  MonGroup L1CaloCTP( this, m_PathInRootFile, run, attr );
162  MonGroup L1CaloCTPEvents( this, m_PathInRootFile, run, attr,
163  "", "eventSample" );
164 
165  //-------------- transmission checks L1Calo <-> CTP ----------------------
166 
167  m_histTool->setMonGroup(&L1CaloCTP);
168 
169  m_h_ctp_1d_L1CaloNeCTPSummary = m_histTool->book1F("ctp_1d_L1CaloNeCTPSummary",
170  "Transmission Errors between L1Calo and CTP",
173  m_h_ctp_1d_L1CaloEqCTPSummary = m_histTool->book1F("ctp_1d_L1CaloEqCTPSummary",
174  "Transmission Matches between L1Calo and CTP",
177 
178  m_h_ctp_1d_TIPMatches = m_histTool->book1F("ctp_1d_TIPMatches",
179  "CTP/L1Calo TIP Matches;TIP", m_nTIP, 0., m_nTIP);
180  m_h_ctp_1d_HitNoTIPMismatch = m_histTool->book1F("ctp_1d_HitNoTIPMismatch",
181  "L1Calo Hit but no CTP TIP Mismatches;TIP", m_nTIP, 0., m_nTIP);
182  m_h_ctp_1d_TIPNoHitMismatch = m_histTool->book1F("ctp_1d_TIPNoHitMismatch",
183  "CTP TIP but no L1Calo Hit Mismatches;TIP", m_nTIP, 0., m_nTIP);
184 
185  m_histTool->setMonGroup(&L1CaloCTPEvents);
186 
187  m_h_ctp_2d_MismatchEvents = m_histTool->bookEventNumbers("ctp_2d_MismatchEvents",
188  "Transmission Errors between L1Calo and CTP Event Numbers",
191 
192  m_histTool->unsetMonGroup();
193  m_histBooked = true;
194 
195  //---------------------- get TIP mappings from COOL ----------------------
196 
198 
199  const int l1caloBits =
200  3*(def.max_EM_Threshold_Number() + def.max_TAU_Threshold_Number() + max_JET_3bit_Threshold_Number) +
202  def.max_XE_Threshold_Number() + def.max_TE_Threshold_Number() + def.max_XS_Threshold_Number();
203 
204  msg(MSG::DEBUG) << "Max threshold number = EM: " << def.max_EM_Threshold_Number() << " JET (3-bit): " << max_JET_3bit_Threshold_Number
205  << " JET (2-bit): " << max_JET_2bit_Threshold_Number << " TE: " << def.max_TE_Threshold_Number()
206  << " XE: " << def.max_XE_Threshold_Number() << " XS: " << def.max_XS_Threshold_Number() << endmsg;
207 
208  m_tipMap.clear();
209  msg(MSG::DEBUG) << "Number of l1calo bits: " << l1caloBits << endmsg;
210  m_tipMap.assign(l1caloBits, std::make_pair(" ", -1));
211 
212  if (m_configSvc->ctpConfig()) {
213  std::map<std::string, int> threshMap;
214  const std::vector<TrigConf::TriggerThreshold*>&
215  thresholds(m_configSvc->ctpConfig()->menu().thresholdVector());
216  std::vector<TrigConf::TriggerThreshold*>::const_iterator it;
217  msg(MSG::DEBUG) << "Size of thresholds vector: " << thresholds.size() << endmsg;
218 
219  for (it = thresholds.begin(); it != thresholds.end(); ++it) {
220  int offset = 0;
221  int nbits = 3;
222  const int threshNumber = (*it)->thresholdNumber();
223  int fixedThreshNumber = threshNumber;
224 
225  while (true) {
226  if ( (*it)->type() == def.emType() ) {
227  if (threshNumber >= (int)def.max_EM_Threshold_Number()/2) { // Cable EM2; else cable EM1
228  offset += nbits*def.max_EM_Threshold_Number()/2;
229  fixedThreshNumber -= def.max_EM_Threshold_Number()/2;
230  }
231  break;
232  }
233  offset += nbits*def.max_EM_Threshold_Number();
234  if ( (*it)->type() == def.tauType() ) {
235  if (threshNumber >= (int)def.max_TAU_Threshold_Number()/2) { // Cable TAU2; else cable TAU1
236  offset += nbits*def.max_TAU_Threshold_Number()/2;
237  fixedThreshNumber -= def.max_TAU_Threshold_Number()/2;
238  }
239  break;
240  }
241  offset += nbits*def.max_TAU_Threshold_Number();
242  if ( (*it)->type() == def.jetType() ) {
243  if (threshNumber >= (int)max_JET_3bit_Threshold_Number) { // Cable JET2 (2-bit thresholds); else JET1 (3-bit)
245  fixedThreshNumber -= max_JET_3bit_Threshold_Number;
246  nbits--;
247  }
248  break;
249  }
251  nbits--;
253  nbits--;
254  if ( (*it)->type() == def.teType()) {
255  if (threshNumber >= (int)def.max_TE_Threshold_Number()/2) { // Restricted eta TE threshold: jump to cable EN2
256  offset += nbits*def.max_TE_Threshold_Number()/2 + nbits*def.max_XE_Threshold_Number()/2 + nbits*def.max_XS_Threshold_Number(); // 8+8+8 bits on cable EN1
257  fixedThreshNumber -= def.max_TE_Threshold_Number()/2;
258  }
259  break; // Full eta & restricted eta thresholds separated on two cables
260  }
261  offset += nbits*def.max_TE_Threshold_Number()/2;
262  if ( (*it)->type() == def.xeType() ) {
263  if (threshNumber >= (int)def.max_XE_Threshold_Number()/2) { // Restricted eta XE threshold: jump to cable EN2
264  offset += nbits*def.max_TE_Threshold_Number()/2 + nbits*def.max_XE_Threshold_Number()/2 + nbits*def.max_XS_Threshold_Number();
265  fixedThreshNumber -= def.max_XE_Threshold_Number()/2;
266  }
267  break;
268  }
269  offset += nbits*def.max_XE_Threshold_Number()/2;
270  if ( (*it)->type() == def.xsType() ) break;
271  offset += nbits*def.max_XS_Threshold_Number();
272  nbits--;
273  break;
274  }
275  if (nbits == 0) continue;
276  if (threshNumber < 0) continue;
277  threshMap.insert(std::make_pair((*it)->name(),
278  offset + fixedThreshNumber*nbits));
279  msg(MSG::DEBUG) << "threshMap: name, offset, threshNumber, nbits "
280  << (*it)->name() << " " << offset << " "
281  << fixedThreshNumber << " " << nbits << endmsg;
282  } // End loop over thresholds vector
283  msg(MSG::DEBUG) << "Size of threshMap = " << threshMap.size() << endmsg;
284  msg(MSG::DEBUG) << "Size of tipMap = " << m_tipMap.size() << endmsg;
285 
286  const std::vector<TrigConf::TIP*>&
287  tips(m_configSvc->ctpConfig()->menu().tipVector());
288  msg(MSG::DEBUG) << "Size of tipVector = " << tips.size() << endmsg;
289 
290  int count = 0;
291  std::vector<TrigConf::TIP*>::const_iterator itp;
292 
293  for (itp = tips.begin(); itp != tips.end(); ++itp) {
294  std::map<std::string, int>::const_iterator miter =
295  threshMap.find((*itp)->thresholdName());
296  if (miter != threshMap.end()) {
297  const int pos = miter->second + (*itp)->thresholdBit();
298  if (pos < l1caloBits) {
299  m_tipMap[pos] = std::make_pair((*itp)->thresholdName(), (*itp)->tipNumber());
300  count++;
301  } else msg(MSG::WARNING) << "Error setting up TIP map" << endmsg;
302  } else msg(MSG::DEBUG) << "TIP name " << (*itp)->thresholdName()
303  << " not found in threshMap" << endmsg;
304  } // End loop over tips
305  msg(MSG::DEBUG) << "Entries in tipMap = " << count << endmsg;
306 
307  if (m_debug) {
308  int icount = 0;
309  for ( auto it = m_tipMap.begin(); it != m_tipMap.end(); ++it) {
310  msg(MSG::DEBUG) << "tipmap[" << icount << "] " << (*it).first << " TIP number: " << (*it).second << endmsg;
311  icount++;
312  }
313  }
314  } else msg(MSG::WARNING) << "No ctpConfig found" << endmsg; // End if ctpConfig
315  }
316  return StatusCode::SUCCESS;
317 }
318 
319 
320 /*---------------------------------------------------------*/
322 /*---------------------------------------------------------*/
323 {
324  if (m_debug) msg(MSG::DEBUG) << "in L1CaloCTPMon::fillHistograms" << endmsg;
325 
326  if (!m_histBooked) {
327  if (m_debug) msg(MSG::DEBUG) << "Histogram(s) not booked" << endmsg;
328  return StatusCode::SUCCESS;
329  }
330 
331  // Skip events believed to be corrupt or with ROB errors
332 
333  if (m_errorTool->corrupt() || m_errorTool->robOrUnpackingError()) {
334  if (m_debug) msg(MSG::DEBUG) << "Skipping corrupt event" << endmsg;
335  return StatusCode::SUCCESS;
336  }
337 
338  //--------------------------------------------------------------------------
339  //---------------- get information sent from CP CMXs to CTP ----------------
340  //--------------------------------------------------------------------------
341 
342  // Retrieve CMX CP hits from StoreGate
343  const xAOD::CMXCPHitsContainer* cmxCpHitsTES = 0;
344  StatusCode sc = evtStore()->retrieve(cmxCpHitsTES, m_cmxCpHitsLocation);
345  if (sc == StatusCode::FAILURE || !cmxCpHitsTES) {
346  msg(MSG::INFO) << "No CMX CP Hits found in TES at " << m_cmxCpHitsLocation
347  << endmsg;
348  return StatusCode::SUCCESS;
349  }
350 
351  uint32_t EMHits0 = 0;
352  uint32_t EMHits1 = 0;
353  uint32_t TauHits0 = 0;
354  uint32_t TauHits1 = 0;
355 
356  // CMX information for transmission check: System CMX -> CTP
357  if (cmxCpHitsTES) {
358  xAOD::CMXCPHitsContainer::const_iterator cmxIterator = cmxCpHitsTES->begin();
359  xAOD::CMXCPHitsContainer::const_iterator cmxIteratorEnd = cmxCpHitsTES->end();
360 
361  for (; cmxIterator != cmxIteratorEnd; ++cmxIterator) {
362 
363  const uint8_t source = (*cmxIterator)->sourceComponent();
364  const uint8_t crate = (*cmxIterator)->crate();
365  const uint8_t cmx = (*cmxIterator)->cmx();
366 
367  if (source == xAOD::CMXCPHits::TOTAL && crate == 3) {
368  if (cmx == 1) {
369  EMHits0 = (*cmxIterator)->hits0();
370  EMHits1 = (*cmxIterator)->hits1();
371  }
372  else {
373  TauHits0 = (*cmxIterator)->hits0();
374  TauHits1 = (*cmxIterator)->hits1();
375  }
376  }
377  }
378  }
379 
380  //--------------------------------------------------------------------------
381  //----------------- get information sent from JEP CMXs to CTP --------------
382  //--------------------------------------------------------------------------
383 
384  // Retrieve CMX Jet Hits from Storegate
385  const xAOD::CMXJetHitsContainer* cmxJetHitsTES = 0;
386  sc = evtStore()->retrieve(cmxJetHitsTES, m_cmxJetHitsLocation);
387  if (sc == StatusCode::FAILURE || !cmxJetHitsTES) {
388  msg(MSG::INFO) << "No CMX Jet Hits found in TES at " << m_cmxJetHitsLocation
389  << endmsg;
390  return StatusCode::SUCCESS;
391  }
392 
393  int Jet3BitHits = 0; // 3-bit multiplicities, thresholds 0-9, cable JET1
394  int Jet2BitHits = 0; // 2-bit multiplicities, thresholds 10-24, cable JET2
395 
396  int Jet3BitHits0 = 0; // 3-bit multiplicities, thresholds 0-4, cable JET1
397  int Jet3BitHits1 = 0; // 3-bit multiplicities, thresholds 5-9, cable JET1
398  int Jet2BitHits0 = 0; // 2-bit multiplicities, thresholds 10-17, cable JET2
399  int Jet2BitHits1 = 0; // 2-bit multiplicities, thresholds 18-24, cable JET2
400 
401  xAOD::CMXJetHitsContainer::const_iterator cmxJetIterator = cmxJetHitsTES->begin();
402  xAOD::CMXJetHitsContainer::const_iterator cmxJetIteratorEnd = cmxJetHitsTES->end();
403 
404  // Transmission check: system CMX -> CTP
405  for (; cmxJetIterator != cmxJetIteratorEnd; ++cmxJetIterator) {
406  const uint32_t source = (*cmxJetIterator)->sourceComponent();
407  const uint32_t crate = (*cmxJetIterator)->crate();
408 
409  if (source == xAOD::CMXJetHits::TOTAL_MAIN && crate == 1) {
410  Jet3BitHits0 = (*cmxJetIterator)->hits0();
411  Jet3BitHits1 = (*cmxJetIterator)->hits1();
412  Jet3BitHits = Jet3BitHits0 + (Jet3BitHits1<<15);
413  }
414  if (source == xAOD::CMXJetHits::TOTAL_FORWARD && crate == 1) {
415  Jet2BitHits0 = (*cmxJetIterator)->hits0();
416  Jet2BitHits1 = (*cmxJetIterator)->hits1();
417  Jet2BitHits = Jet2BitHits0 + (Jet2BitHits1<<16);
418  }
419  }
420 
421  // Retrieve CMX Et sums from Storegate
422  const xAOD::CMXEtSumsContainer* cmxEtSumsTES = 0;
423  sc = evtStore()->retrieve(cmxEtSumsTES, m_cmxEtSumsLocation);
424  if (sc == StatusCode::FAILURE || !cmxEtSumsTES) {
425  msg(MSG::INFO) << "No CMXEtSums found in TES at " << m_cmxEtSumsLocation
426  << endmsg;
427  return StatusCode::SUCCESS;
428  }
429 
430  int TEHits = 0; // Cable EN1 (full eta)
431  int XEHits = 0;
432  int XSHits = 0;
433  int TERestHits = 0; // Cable EN2 (restricted eta)
434  int XERestHits = 0;
435 
436  xAOD::CMXEtSumsContainer::const_iterator cmxEtSumsIterator = cmxEtSumsTES->begin();
437  xAOD::CMXEtSumsContainer::const_iterator cmxEtSumsIteratorEnd = cmxEtSumsTES->end();
438 
439  for (; cmxEtSumsIterator != cmxEtSumsIteratorEnd; ++ cmxEtSumsIterator) {
440  const uint32_t source = (*cmxEtSumsIterator)->sourceComponent();
441  const uint32_t crate = (*cmxEtSumsIterator)->crate();
442 
443  // Sum Et hits
444  if (source == xAOD::CMXEtSums::SUM_ET_STANDARD && crate == 1) { // KW crate check might not be needed here...
445  TEHits = (*cmxEtSumsIterator)->et();
446  }
447 
448  // Missing Et hits
449  if (source == xAOD::CMXEtSums::MISSING_ET_STANDARD && crate == 1) {
450  XEHits = (*cmxEtSumsIterator)->et();
451  }
452 
453  // Missing Et significance hits
454  if (source == xAOD::CMXEtSums::MISSING_ET_SIG_STANDARD && crate == 1) {
455  XSHits = (*cmxEtSumsIterator)->et();
456  }
457 
458  // Sum Et hits (restricted eta)
459  if (source == xAOD::CMXEtSums::SUM_ET_RESTRICTED && crate == 1) {
460  TERestHits = (*cmxEtSumsIterator)->et();
461  }
462 
463  // Missing Et hits (restricted eta)
464  if (source == xAOD::CMXEtSums::MISSING_ET_RESTRICTED && crate == 1) {
465  XERestHits = (*cmxEtSumsIterator)->et();
466  }
467  }
468 
469  //--------------------------------------------------------------------------
470  //----------------------- get the TIPs (input for CTP) ---------------------
471  //--------------------------------------------------------------------------
472 
473  const CTP_RDO* ctpRDO = 0;
474  sc = evtStore()->retrieve(ctpRDO, m_CTPRDOLocation);
475  if (sc == StatusCode::FAILURE || !ctpRDO) {
476  msg(MSG::INFO) << "No CTP_RDO found in TES at " << m_CTPRDOLocation
477  << endmsg;
478  return StatusCode::SUCCESS;
479  }
480 
482  ctp.setRDO(ctpRDO);
483 
484  const uint16_t l1aPos = ctpRDO->getL1AcceptBunchPosition();
485  if (l1aPos >= ctp.getBunchCrossings().size()) {
486  msg(MSG::WARNING) << "Invalid l1aPos" << endmsg;
487  return StatusCode::SUCCESS;
488  }
489  if (m_debug) msg(MSG::DEBUG) << "l1aPos, size : " << l1aPos << ", "
490  << ctp.getBunchCrossings().size() << endmsg;
491  const CTP_BC& bunch = ctp.getBunchCrossings().at(l1aPos);
492 
493 
494  //--------------------------------------------------------------------------
495  //---------------------- compare L1Calo data with CTP ----------------------
496  //--------------------------------------------------------------------------
497 
499 
500  //------------------------ EM Hits (3 bits / thresh) -----------------------
501  int offset = 0;
502  int threshBits = 3;
503  int totalBits = threshBits*def.max_EM_Threshold_Number()/2;
504  msg(MSG::DEBUG) << "totalBits = " << totalBits << endmsg;
505 
506  compare(bunch, EMHits0, totalBits, offset, EM1Type); // Cable EM1
507 
508  offset += totalBits;
509  compare(bunch, EMHits1, totalBits, offset, EM2Type); // Cable EM2
510 
511  //----------------------- Tau Hits (3 bits / thresh) ---------------------
512  offset += totalBits;
513  compare(bunch, TauHits0, totalBits, offset, Tau1Type); // Cable TAU1
514 
515  offset += totalBits;
516  compare(bunch, TauHits1, totalBits, offset, Tau2Type); // Cable TAU2
517 
518  //------------------------ Jet Hits (3 bits / thresh) ---------------------
519  offset += totalBits;
521  compare(bunch, Jet3BitHits, totalBits, offset, Jet3BitType); // Cable JET1
522 
523  //----------------------- Jet Hits (2 bits / thresh) -------------------
524  offset += totalBits;
525  threshBits--;
527  compare(bunch, Jet2BitHits, totalBits, offset, Jet2BitType); // Cable JET2
528 
529  //---------------------- TE Hits (1 bit / thresh) ------------------
530  offset += totalBits;
531  threshBits--;
532  totalBits = threshBits*def.max_TE_Threshold_Number()/2; // Cable EN1
533  compare(bunch, TEHits, totalBits, offset, TEFullEtaType);
534 
535  //------------------------ XE Hits (1 bit / thresh) --------------------
536  offset += totalBits;
537  totalBits = threshBits*def.max_XE_Threshold_Number()/2;
538  compare(bunch, XEHits, totalBits, offset, XEFullEtaType);
539 
540  //---------------------- XS Hits (1 bit / thresh) ------------------
541  offset += totalBits;
542  totalBits = threshBits*def.max_XS_Threshold_Number();
543  compare(bunch, XSHits, totalBits, offset, XSType);
544 
545  //------------------------ Restricted Eta TE Hits (1 bit / thresh) --------------------
546  offset += totalBits;
547  totalBits = threshBits*def.max_TE_Threshold_Number()/2; // Cable EN2
548  compare(bunch, TERestHits, totalBits, offset, TERestrictedEtaType);
549 
550  //---------------------- Restricted Eta XE Hits (1 bit / thresh) ------------------
551  offset += totalBits;
552  totalBits = threshBits*def.max_XE_Threshold_Number()/2;
553  compare(bunch, XERestHits, totalBits, offset, XERestrictedEtaType);
554 
555  return StatusCode::SUCCESS;
556  }
557 
558 /*---------------------------------------------------------*/
560 /*---------------------------------------------------------*/
561 {
562  //if( endOfLumiBlockFlag() ) { }
563 
564  //if( endOfRunFlag() ) { }
565 
566  return StatusCode::SUCCESS;
567 }
568 
569 // *********************************************************************
570 // Private Methods
571 // *********************************************************************
572 
573 void L1CaloCTPMon::compare(const CTP_BC& bunch, int hits, int totalBits,
575 {
576  if (m_debug) {
577  msg(MSG::DEBUG) << "offset: " << offset << " totalBits: " << totalBits << endmsg;
579  std::string subdet((type == EM1Type || type == EM2Type ||
580  type == Tau1Type || type == Tau2Type) ? " CP: "
581  : " JEP: ");
582  msg(MSG::DEBUG) << name << subdet
583  << m_histTool->thresholdString(hits, totalBits)
584  << endmsg;
585  msg(MSG::DEBUG) << name << " CTP: ";
586  }
587 
588  int mask = 0;
589  int tipHits = 0;
590 
591  for (int bit = 0; bit < totalBits; ++bit) {
592  const int TIPid = (m_tipMap[offset + bit]).second;
593  if (TIPid < 0) {
594  if (m_debug) msg(MSG::DEBUG) << "X ";
595  continue;
596  }
597  const int HITbit= ((hits >> bit) & 0x1);
598  const int TIPbit = bunch.getTIP().test( TIPid );
599 
600  if (m_debug) msg(MSG::DEBUG) << TIPbit << " ";
601  tipHits |= (TIPbit << bit);
602  mask |= (1 << bit);
603 
604  if (HITbit && HITbit == TIPbit) m_h_ctp_1d_TIPMatches->Fill(TIPid);
605  else if (HITbit != TIPbit) {
606  if (HITbit) m_h_ctp_1d_HitNoTIPMismatch->Fill(TIPid);
607  else m_h_ctp_1d_TIPNoHitMismatch->Fill(TIPid);
608  }
609  }
610  if (m_debug) msg(MSG::DEBUG) << endmsg;
611 
612  if (tipHits != (hits&mask)) {
614  m_histTool->fillEventNumber(m_h_ctp_2d_MismatchEvents, type);
615  }
616  else if (tipHits) m_h_ctp_1d_L1CaloEqCTPSummary->Fill(type);
617 
618 }
619 
620 
622 {
623  LWHist::LWHistAxis* axis = (xAxis) ? hist->GetXaxis() : hist->GetYaxis();
624  axis->SetBinLabel(1+EM1Type, "EM1");
625  axis->SetBinLabel(1+EM2Type, "EM2");
626  axis->SetBinLabel(1+Tau1Type, "Tau1");
627  axis->SetBinLabel(1+Tau2Type, "Tau2");
628  axis->SetBinLabel(1+Jet3BitType, "Jet1 (3-bit)");
629  axis->SetBinLabel(1+Jet2BitType, "Jet2 (2-bit)");
630  axis->SetBinLabel(1+TEFullEtaType, "TE (full eta)");
631  axis->SetBinLabel(1+XEFullEtaType, "XE (full eta)");
632  axis->SetBinLabel(1+XSType, "XS");
633  axis->SetBinLabel(1+TERestrictedEtaType, "TE (restr. eta)");
634  axis->SetBinLabel(1+XERestrictedEtaType, "XE (restr. eta)");
635 }
636 // ============================================================================
637 } // end namespace
638 // ============================================================================
LWHist
Definition: LWHist.h:26
LVL1::L1CaloCTPMon::Jet3BitType
@ Jet3BitType
Definition: L1CaloCTPMon.h:138
LVL1::L1CaloCTPMon::m_CTPRDOLocation
std::string m_CTPRDOLocation
CTP_RDO StoreGate key.
Definition: L1CaloCTPMon.h:162
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
CTPConfig.h
CTP_Decoder.h
TruthTest.itp
itp
Definition: TruthTest.py:46
LVL1::L1CaloCTPMon::TERestrictedEtaType
@ TERestrictedEtaType
Definition: L1CaloCTPMon.h:140
TH1F_LW.h
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
xAOD::CMXEtSums_v1::MISSING_ET_RESTRICTED
@ MISSING_ET_RESTRICTED
Definition: CMXEtSums_v1.h:34
LVL1::L1CaloCTPMon::TEFullEtaType
@ TEFullEtaType
Definition: L1CaloCTPMon.h:139
TH1F_LW::Fill
virtual void Fill(const double &x) override
Definition: TH1F_LW.cxx:246
LVL1::L1CaloCTPMon::m_h_ctp_1d_HitNoTIPMismatch
TH1F_LW * m_h_ctp_1d_HitNoTIPMismatch
L1Calo Hit but no CTP TIP Mismatches.
Definition: L1CaloCTPMon.h:182
LVL1::L1CaloCTPMon::m_cmxCpHitsLocation
std::string m_cmxCpHitsLocation
CMX-CP hits container StoreGate key.
Definition: L1CaloCTPMon.h:160
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:575
LVL1::L1CaloCTPMon::m_histTool
ToolHandle< TrigT1CaloLWHistogramTool > m_histTool
Histogram utilities tool.
Definition: L1CaloCTPMon.h:153
ManagedMonitorToolBase::MgmtAttr_t
MgmtAttr_t
An enumeration describing how the class handles the histogram.
Definition: ManagedMonitorToolBase.h:131
ManagedMonitorToolBase
Provides functionality for users to implement and save histograms, ntuples, and summary data,...
Definition: ManagedMonitorToolBase.h:74
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
xAOD::CMXJetHits_v1::TOTAL_MAIN
@ TOTAL_MAIN
Definition: CMXJetHits_v1.h:35
plotmaker.hist
hist
Definition: plotmaker.py:148
LVL1::L1CaloCTPMon::m_h_ctp_1d_L1CaloEqCTPSummary
TH1F_LW * m_h_ctp_1d_L1CaloEqCTPSummary
Transmission Matches between L1Calo and CTP.
Definition: L1CaloCTPMon.h:180
AthenaMonManager::cosmics
@ cosmics
Definition: AthenaMonManager.h:58
LVL1::L1CaloCTPMon::m_cmxJetHitsLocation
std::string m_cmxJetHitsLocation
Definition: L1CaloCTPMon.h:156
yodamerge_tmp.axis
list axis
Definition: yodamerge_tmp.py:241
skel.it
it
Definition: skel.GENtoEVGEN.py:423
LVL1::L1CaloCTPMon::EM2Type
@ EM2Type
Definition: L1CaloCTPMon.h:136
LVL1::TrigT1CaloDefs::CMXJetHitsLocation
static const std::string CMXJetHitsLocation
Definition: TrigT1CaloDefs.h:55
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
LVL1::L1CaloCTPMon::setLabels
void setLabels(LWHist *hist, bool xAxis=true)
Bin labels for summary plots.
Definition: L1CaloCTPMon.cxx:621
ManagedMonitorToolBase::m_dataType
AthenaMonManager::DataType_t m_dataType
Definition: ManagedMonitorToolBase.h:901
LVL1::L1CaloCTPMon::XERestrictedEtaType
@ XERestrictedEtaType
Definition: L1CaloCTPMon.h:140
Menu.h
L1CaloCTPMon.h
LVL1::L1CaloCTPMon::m_h_ctp_2d_MismatchEvents
TH2I_LW * m_h_ctp_2d_MismatchEvents
Transmission Errors between L1Calo and CTP Event Numbers.
Definition: L1CaloCTPMon.h:184
ITrigT1CaloMonErrorTool.h
LVL1::L1CaloCTPMon::XSType
@ XSType
Definition: L1CaloCTPMon.h:139
TrigT1CaloLWHistogramTool.h
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
LVL1::L1CaloCTPMon::L1CaloCTPHitTypes
L1CaloCTPHitTypes
Hit types for binning.
Definition: L1CaloCTPMon.h:136
LVL1::L1CaloCTPMon::m_errorTool
ToolHandle< ITrigT1CaloMonErrorTool > m_errorTool
Corrupt events tool.
Definition: L1CaloCTPMon.h:151
LVL1::L1CaloCTPMon::m_h_ctp_1d_TIPMatches
TH1F_LW * m_h_ctp_1d_TIPMatches
CTP/L1Calo TIP Matches.
Definition: L1CaloCTPMon.h:181
CMXJetHitsContainer.h
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
CTP_Decoder
Definition: CTP_Decoder.h:142
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
CMXCPHitsContainer.h
CTP_BC::getTIP
const std::bitset< 512 > & getTIP() const
get bitset of TIP words
Definition: CTP_Decoder.h:81
LWHist::GetXaxis
LWHistAxis * GetXaxis()
Definition: LWHist.cxx:309
MCTruthPartClassifier::totalBits
@ totalBits
Definition: TruthClassifiers.h:148
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
ILVL1ConfigSvc.h
ManagedMonitorToolBase::MonGroup
A container of information describing a monitoring object.
Definition: ManagedMonitorToolBase.h:138
LVL1::L1CaloCTPMon::Jet2BitType
@ Jet2BitType
Definition: L1CaloCTPMon.h:138
TrigConf::L1DataDef
Definition: L1DataDef.h:27
ManagedMonitorToolBase::initialize
virtual StatusCode initialize()
Definition: ManagedMonitorToolBase.cxx:669
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
LVL1::L1CaloCTPMon::L1CaloCTPMon
L1CaloCTPMon(const std::string &type, const std::string &name, const IInterface *parent)
Definition: L1CaloCTPMon.cxx:61
LVL1::L1CaloCTPMon::m_tipMap
std::vector< std::pair< std::string, int > > m_tipMap
TIP map.
Definition: L1CaloCTPMon.h:172
LVL1::TrigT1CaloDefs::CMXEtSumsLocation
static const std::string CMXEtSumsLocation
Definition: TrigT1CaloDefs.h:56
LVL1::L1CaloCTPMon::m_configSvc
ServiceHandle< TrigConf::ILVL1ConfigSvc > m_configSvc
Trigger configuration service.
Definition: L1CaloCTPMon.h:149
LVL1::L1CaloCTPMon::fillHistograms
virtual StatusCode fillHistograms()
An inheriting class should either override this function or fillHists().
Definition: L1CaloCTPMon.cxx:321
xAOD::CMXCPHits_v1::TOTAL
@ TOTAL
Definition: CMXCPHits_v1.h:29
LVL1::L1CaloCTPMon::Tau1Type
@ Tau1Type
Definition: L1CaloCTPMon.h:137
LVL1::L1CaloCTPMon::NumberOfHitTypes
@ NumberOfHitTypes
Definition: L1CaloCTPMon.h:140
xAOD::CMXEtSums_v1::MISSING_ET_STANDARD
@ MISSING_ET_STANDARD
Definition: CMXEtSums_v1.h:34
LVL1::L1CaloCTPMon::m_histBooked
bool m_histBooked
Histograms booked flag.
Definition: L1CaloCTPMon.h:169
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthenaMonManager::online
@ online
Definition: AthenaMonManager.h:49
LArG4ShowerLibProcessing.hits
hits
Definition: LArG4ShowerLibProcessing.py:136
CTP_BC
Definition: CTP_Decoder.h:17
TH2I_LW.h
LVL1::L1CaloCTPMon::compare
void compare(const CTP_BC &bunch, int hits, int totalBits, int offset, L1CaloCTPHitTypes type)
Compare L1Calo hits with corresponding TIP hits.
Definition: L1CaloCTPMon.cxx:573
LVL1::L1CaloCTPMon::XEFullEtaType
@ XEFullEtaType
Definition: L1CaloCTPMon.h:139
ManagedMonitorToolBase::ATTRIB_UNMANAGED
@ ATTRIB_UNMANAGED
Definition: ManagedMonitorToolBase.h:131
test_pyathena.parent
parent
Definition: test_pyathena.py:15
AthenaMonManager.h
CMXEtSumsContainer.h
run
Definition: run.py:1
TriggerThreshold.h
xAOD::CMXEtSums_v1::MISSING_ET_SIG_STANDARD
@ MISSING_ET_SIG_STANDARD
Definition: CMXEtSums_v1.h:35
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
LVL1::L1CaloCTPMon::m_h_ctp_1d_TIPNoHitMismatch
TH1F_LW * m_h_ctp_1d_TIPNoHitMismatch
CTP TIP but no L1Calo Hit Mismatches.
Definition: L1CaloCTPMon.h:183
ManagedMonitorToolBase::m_environment
AthenaMonManager::Environment_t m_environment
Definition: ManagedMonitorToolBase.h:902
TrigConf::name
Definition: HLTChainList.h:35
LWHist::LWHistAxis
Definition: LWHist.h:109
LVL1::max_JET_3bit_Threshold_Number
const int max_JET_3bit_Threshold_Number
Definition: L1CaloCTPMon.cxx:53
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
xAOD::CMXEtSums_v1::SUM_ET_STANDARD
@ SUM_ET_STANDARD
Definition: CMXEtSums_v1.h:33
TIP.h
TrigT1CaloDefs.h
CTP_RDO::getL1AcceptBunchPosition
uint32_t getL1AcceptBunchPosition() const
Definition: CTP_RDO.cxx:94
TriggerTest.ctp
ctp
Retrieve trigger EDM objects.
Definition: TriggerTest.py:14
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
L1DataDef.h
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
CTP_RDO.h
CTP_RDO
Definition: CTP_RDO.h:20
LVL1::L1CaloCTPMon::m_nTIP
const int m_nTIP
Number of TIP bits (CTP input)
Definition: L1CaloCTPMon.h:175
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DEBUG
#define DEBUG
Definition: page_access.h:11
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
xAOD::CMXJetHits_v1::TOTAL_FORWARD
@ TOTAL_FORWARD
Definition: CMXJetHits_v1.h:38
LVL1::L1CaloCTPMon::~L1CaloCTPMon
virtual ~L1CaloCTPMon()
Definition: L1CaloCTPMon.cxx:99
LVL1::L1CaloCTPMon::m_cmxEtSumsLocation
std::string m_cmxEtSumsLocation
CMXEtSums container StoreGate key.
Definition: L1CaloCTPMon.h:158
xAOD::CMXEtSums_v1::SUM_ET_RESTRICTED
@ SUM_ET_RESTRICTED
Definition: CMXEtSums_v1.h:33
LVL1::L1CaloCTPMon::m_debug
bool m_debug
Debug printout flag.
Definition: L1CaloCTPMon.h:167
LVL1::L1CaloCTPMon::procHistograms
virtual StatusCode procHistograms()
An inheriting class should either override this function or finalHists().
Definition: L1CaloCTPMon.cxx:559
LVL1::max_JET_2bit_Threshold_Number
const int max_JET_2bit_Threshold_Number
Definition: L1CaloCTPMon.cxx:52
LWHist::LWHistAxis::GetBinLabel
const char * GetBinLabel(unsigned bin) const
Definition: LWHist.cxx:401
LWHist.h
LVL1::TrigT1CaloDefs::CMXCPHitsLocation
static const std::string CMXCPHitsLocation
Definition: TrigT1CaloDefs.h:58
LVL1::L1CaloCTPMon::m_PathInRootFile
std::string m_PathInRootFile
Root directory.
Definition: L1CaloCTPMon.h:165
LVL1::L1CaloCTPMon::m_h_ctp_1d_L1CaloNeCTPSummary
TH1F_LW * m_h_ctp_1d_L1CaloNeCTPSummary
Histos.
Definition: L1CaloCTPMon.h:179
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
LVL1::L1CaloCTPMon::initialize
virtual StatusCode initialize()
Definition: L1CaloCTPMon.cxx:105
LVL1::L1CaloCTPMon::EM1Type
@ EM1Type
Definition: L1CaloCTPMon.h:136
ManagedMonitorToolBase::newRunFlag
bool newRunFlag() const
Definition: ManagedMonitorToolBase.h:854
LVL1::L1CaloCTPMon::bookHistogramsRecurrent
virtual StatusCode bookHistogramsRecurrent()
An inheriting class should either override this function, bookHists() or bookHistograms().
Definition: L1CaloCTPMon.cxx:143
LVL1::L1CaloCTPMon::Tau2Type
@ Tau2Type
Definition: L1CaloCTPMon.h:137