ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
Muon::nsw::NSWTriggerCommonDecoder Class Reference

#include <NSWTriggerCommonDecoder.h>

Collaboration diagram for Muon::nsw::NSWTriggerCommonDecoder:

Public Member Functions

 NSWTriggerCommonDecoder (const eformat::read::ROBFragment &rob, const std::string &triggerType)
 
virtual ~NSWTriggerCommonDecoder ()=default
 
const std::vector< std::shared_ptr< Muon::nsw::NSWTriggerElink > > & get_elinks () const
 
bool has_error () const
 
int error_id () const
 

Private Attributes

bool m_has_error {}
 
int m_error_id {}
 
std::string m_triggerType
 
std::vector< std::shared_ptr< Muon::nsw::NSWTriggerElink > > m_elinks
 

Detailed Description

Definition at line 18 of file NSWTriggerCommonDecoder.h.

Constructor & Destructor Documentation

◆ NSWTriggerCommonDecoder()

Muon::nsw::NSWTriggerCommonDecoder::NSWTriggerCommonDecoder ( const eformat::read::ROBFragment &  rob,
const std::string &  triggerType 
)
explicit

Definition at line 13 of file NSWTriggerCommonDecoder.cxx.

14  : m_has_error (false),
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 }

◆ ~NSWTriggerCommonDecoder()

virtual Muon::nsw::NSWTriggerCommonDecoder::~NSWTriggerCommonDecoder ( )
virtualdefault

Member Function Documentation

◆ error_id()

int Muon::nsw::NSWTriggerCommonDecoder::error_id ( ) const
inline

Definition at line 32 of file NSWTriggerCommonDecoder.h.

32 {return m_error_id;};

◆ get_elinks()

const std::vector<std::shared_ptr<Muon::nsw::NSWTriggerElink> >& Muon::nsw::NSWTriggerCommonDecoder::get_elinks ( ) const
inline

Definition at line 27 of file NSWTriggerCommonDecoder.h.

27 {return m_elinks;};

◆ has_error()

bool Muon::nsw::NSWTriggerCommonDecoder::has_error ( ) const
inline

Definition at line 31 of file NSWTriggerCommonDecoder.h.

31 {return m_has_error;};

Member Data Documentation

◆ m_elinks

std::vector<std::shared_ptr<Muon::nsw::NSWTriggerElink> > Muon::nsw::NSWTriggerCommonDecoder::m_elinks
private

Definition at line 38 of file NSWTriggerCommonDecoder.h.

◆ m_error_id

int Muon::nsw::NSWTriggerCommonDecoder::m_error_id {}
private

Definition at line 36 of file NSWTriggerCommonDecoder.h.

◆ m_has_error

bool Muon::nsw::NSWTriggerCommonDecoder::m_has_error {}
private

Definition at line 35 of file NSWTriggerCommonDecoder.h.

◆ m_triggerType

std::string Muon::nsw::NSWTriggerCommonDecoder::m_triggerType
private

Definition at line 37 of file NSWTriggerCommonDecoder.h.


The documentation for this class was generated from the following files:
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
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
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