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 20 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 16 of file NSWTriggerCommonDecoder.cxx.

17  : m_has_error (false),
19 {
20 
21  static const uint32_t min_packet_size = 2; //2w felix header
22 
23  robFrag.check ();
24 
25  uint32_t nWords = robFrag.rod_ndata (); //total number of words (32-bit word)
26  const uint32_t *bs = robFrag.rod_data (); //point directly to the first data element
27  const uint32_t *pp = bs; //pointer moving
28  uint32_t remaining = nWords; // data-element (32-bit word) counter; it will decrement according to each elink output
29 
30  while (remaining >= min_packet_size)
31  {
32  try
33  {
34  std::shared_ptr<Muon::nsw::NSWTriggerElink> elink;
35 
36  if ( m_triggerType== "MML1A" ){
37  std::shared_ptr<Muon::nsw::NSWTriggerMML1AElink> tmplink = std::make_shared<Muon::nsw::NSWTriggerMML1AElink>(pp, remaining);
38  elink = tmplink;
39  } else if ( m_triggerType== "MMMon" ) {
40  std::shared_ptr<Muon::nsw::NSWTriggerMMMonElink> tmplink = std::make_shared<Muon::nsw::NSWTriggerMMMonElink>(pp, remaining);
41  elink = tmplink;
42  } else if ( m_triggerType== "PadL1A" ) {
43  std::shared_ptr<Muon::nsw::NSWPadTriggerL1a> tmplink = std::make_shared<Muon::nsw::NSWPadTriggerL1a>(pp, remaining);
44  elink = tmplink;
45  } else if ( m_triggerType== "STGL1A" ) {
46  std::shared_ptr<Muon::nsw::NSWTriggerSTGL1AElink> tmplink = std::make_shared<Muon::nsw::NSWTriggerSTGL1AElink>(pp, remaining);
47  elink = tmplink;
48  } else {
49  std::shared_ptr<Muon::nsw::NSWTriggerElink> tmplink = std::make_shared<Muon::nsw::NSWTriggerElink>(pp, remaining);
50  elink = tmplink;
51  }
52 
53  m_elinks.push_back(elink);
54  pp += elink->nwords();
55  remaining -= elink->nwords();;
56 
57  }
59  //known expections, with ID
60  //could think of an error msg print in case needed
61  m_has_error = true;
62  ERS_DEBUG(1, "Following exception found");
63  ERS_DEBUG(1, e.what());
64  m_error_id = e.id();
65  break;
66  }
67  catch (std::exception &e) {
68  //better to be ready to capture generic ones as well
69  m_has_error = true;
70  ERS_DEBUG(1, "Following exception found");
71  ERS_DEBUG(1, e.what());
72  m_error_id = -1; //negative for unknown exceptions
73  break;
74  }
75  }
76 
77  if ( remaining > 0 ) {
78  m_has_error = true;
79  ERS_DEBUG(1, Muon::nsw::format("There are remaining words ({}) after decoding {} elink(s)", remaining, m_elinks.size()));
80  m_error_id = 0;
81  }
82 
83 }

◆ ~NSWTriggerCommonDecoder()

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

Member Function Documentation

◆ error_id()

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

Definition at line 34 of file NSWTriggerCommonDecoder.h.

34 {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 29 of file NSWTriggerCommonDecoder.h.

29 {return m_elinks;};

◆ has_error()

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

Definition at line 33 of file NSWTriggerCommonDecoder.h.

33 {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 40 of file NSWTriggerCommonDecoder.h.

◆ m_error_id

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

Definition at line 38 of file NSWTriggerCommonDecoder.h.

◆ m_has_error

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

Definition at line 37 of file NSWTriggerCommonDecoder.h.

◆ m_triggerType

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

Definition at line 39 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:39
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
Muon::nsw::NSWTriggerCommonDecoder::m_error_id
int m_error_id
Definition: NSWTriggerCommonDecoder.h:38
Muon::nsw::NSWTriggerCommonDecoder::m_elinks
std::vector< std::shared_ptr< Muon::nsw::NSWTriggerElink > > m_elinks
Definition: NSWTriggerCommonDecoder.h:40
Muon::nsw::NSWTriggerCommonDecoder::m_has_error
bool m_has_error
Definition: NSWTriggerCommonDecoder.h:37
calibdata.exception
exception
Definition: calibdata.py:496
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