ATLAS Offline Software
NSWTriggerCommonDecoder.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
11 
12 
14  : m_has_error (false),
15  m_triggerType (triggerType)
16 {
17 
18  static const uint32_t min_packet_size = 2; //2w felix header
19 
20  robFrag.check ();
21 
22  uint32_t nWords = robFrag.rod_ndata (); //total number of words (32-bit word)
23  const uint32_t *bs = robFrag.rod_data (); //point directly to the first data element
24  const uint32_t *pp = bs; //pointer moving
25  uint32_t remaining = nWords; // data-element (32-bit word) counter; it will decrement according to each elink output
26 
27  while (remaining >= min_packet_size)
28  {
29  try
30  {
31  std::shared_ptr<Muon::nsw::NSWTriggerElink> elink;
32 
33  if ( m_triggerType== "MML1A" ){
34  std::shared_ptr<Muon::nsw::NSWTriggerMML1AElink> tmplink = std::make_shared<Muon::nsw::NSWTriggerMML1AElink>(pp, remaining);
35  elink = tmplink;
36  } else if ( m_triggerType== "MMMon" ) {
37  std::shared_ptr<Muon::nsw::NSWTriggerMMMonElink> tmplink = std::make_shared<Muon::nsw::NSWTriggerMMMonElink>(pp, remaining);
38  elink = tmplink;
39  } else if ( m_triggerType== "PadL1A" ) {
40  std::shared_ptr<Muon::nsw::NSWPadTriggerL1a> tmplink = std::make_shared<Muon::nsw::NSWPadTriggerL1a>(pp, remaining);
41  elink = tmplink;
42  } else if ( m_triggerType== "STGL1A" ) {
43  std::shared_ptr<Muon::nsw::NSWTriggerSTGL1AElink> tmplink = std::make_shared<Muon::nsw::NSWTriggerSTGL1AElink>(pp, remaining);
44  elink = tmplink;
45  } else {
46  std::shared_ptr<Muon::nsw::NSWTriggerElink> tmplink = std::make_shared<Muon::nsw::NSWTriggerElink>(pp, remaining);
47  elink = std::move(tmplink);
48  }
49 
50  m_elinks.push_back(elink);
51  pp += elink->nwords();
52  remaining -= elink->nwords();;
53 
54  }
56  //known expections, with ID
57  //could think of an error msg print in case needed
58  m_has_error = true;
59  ERS_DEBUG(1, "Following exception found");
60  ERS_DEBUG(1, e.what());
61  m_error_id = e.id();
62  break;
63  }
64  catch (std::exception &e) {
65  //better to be ready to capture generic ones as well
66  m_has_error = true;
67  ERS_DEBUG(1, "Following exception found");
68  ERS_DEBUG(1, e.what());
69  m_error_id = -1; //negative for unknown exceptions
70  break;
71  }
72  }
73 
74  if ( remaining > 0 ) {
75  m_has_error = true;
76  ERS_DEBUG(1, Muon::nsw::format("There are remaining words ({}) after decoding {} elink(s)", remaining, m_elinks.size()));
77  m_error_id = 0;
78  }
79 
80 }
81 
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
NSWTriggerCommonDecoder.h
Muon::nsw::NSWTriggerCommonDecoder::m_triggerType
std::string m_triggerType
Definition: NSWTriggerCommonDecoder.h:37
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
Muon::nsw::NSWTriggerCommonDecoder::m_error_id
int m_error_id
Definition: NSWTriggerCommonDecoder.h:36
OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment
eformat::ROBFragment< PointerType > ROBFragment
Definition: RawEvent.h:27
NSWPadTriggerL1a.h
Muon::nsw::NSWTriggerCommonDecoder::NSWTriggerCommonDecoder
NSWTriggerCommonDecoder(const eformat::read::ROBFragment &rob, const std::string &triggerType)
Definition: NSWTriggerCommonDecoder.cxx:13
Muon::nsw::NSWTriggerCommonDecoder::m_elinks
std::vector< std::shared_ptr< Muon::nsw::NSWTriggerElink > > m_elinks
Definition: NSWTriggerCommonDecoder.h:38
Muon::nsw::NSWTriggerCommonDecoder::m_has_error
bool m_has_error
Definition: NSWTriggerCommonDecoder.h:35
calibdata.exception
exception
Definition: calibdata.py:495
Muon::nsw::format
std::string format(const std::string &str, const T &arg)
Definition: NSWDecodeHelper.h:43
RunTileMonitoring.triggerType
triggerType
Definition: RunTileMonitoring.py:162
Muon::nsw::NSWTriggerException
Definition: NSWTriggerElink.h:20