ATLAS Offline Software
NSWTriggerElink.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 #include <vector>
5 #include <sstream>
6 
7 #include "ers/ers.h"
9 
11 
13 
14  // Felix header (2 words) - remember that main decoder interface is already checking that remaining>2 (so preventing a crash)
15  // redoing it here since this class is supposed to be independent
16 
17  static const uint32_t min_packet_size = 2;
18  if ( remaining < min_packet_size ) {
19  Muon::nsw::NSWTriggerException e ( Muon::nsw::format("Bytestream shorter than minimum size: provided {}, expected {}", remaining, min_packet_size) , 1);
20  throw e;
21  }
22 
23  std::span<const std::uint32_t> data{bs, 2};
24  m_packet_status = Muon::nsw::bit_slice<uint64_t>(data,0,15);
25  m_wordCountFlx = Muon::nsw::bit_slice<uint64_t>(data,16,31);
26 
27  if ( m_packet_status != 0 ) {
28  //later in commissioning, will decide if one can also accept statuses !=0 and can delegate to user checks (or maybe to the decoder upper level)
29  Muon::nsw::NSWTriggerException e ( Muon::nsw::format("Packet status in FELIX header {}", m_packet_status), 2);
30  throw e;
31  }
32 
33  if ( remaining < m_wordCountFlx ) {
34  Muon::nsw::NSWTriggerException e ( Muon::nsw::format("Packet length in FELIX header ({}) is larger than available data ({})", m_wordCountFlx, remaining), 3);
35  throw e;
36  }
37 
38  m_elinkWord = data[1];
40 
42  //just trusting felix/swrod (TP packets have variables size in general; there's no expected size or prediction that can be done)
43 
44  ERS_DEBUG(2, Muon::nsw::format("\n FELIX header: \n"
45  " status {}\n"
46  " size {}\n"
47  " id {}",
49 
50 }
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
Muon::nsw::NSWResourceId
Definition: NSWResourceId.h:42
Muon::nsw::format
std::string format(const std::string &str, const T &arg)
Definition: NSWDecodeHelper.h:40
NSWDecodeHelper.h
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
python.web.remaining
remaining
Definition: web.py:132
Muon::nsw::NSWTriggerException
Definition: NSWTriggerElink.h:20