ATLAS Offline Software
NSWTriggerCommonDecoder.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "eformat/eformat.h"
6 
13 
14 #include <string>
15 
17  : m_has_error (false),
18  m_triggerType (triggerType)
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 }
84 
NSWTriggerCommonDecoder.h
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
NSWPadTriggerL1a.h
Muon::nsw::NSWTriggerCommonDecoder::NSWTriggerCommonDecoder
NSWTriggerCommonDecoder(const eformat::read::ROBFragment &rob, const std::string &triggerType)
Definition: NSWTriggerCommonDecoder.cxx:16
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:40
OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment
eformat::ROBFragment< PointerType > ROBFragment
Definition: RawEvent.h:27
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
RunTileMonitoring.triggerType
triggerType
Definition: RunTileMonitoring.py:162
python.web.remaining
remaining
Definition: web.py:132
Muon::nsw::NSWTriggerException
Definition: NSWTriggerElink.h:20