ATLAS Offline Software
NSWElink.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 #ifndef MUONNSWCOMMONDECODE_NSWELINK_H
5 #define MUONNSWCOMMONDECODE_NSWELINK_H
6 
7 #include <stdint.h>
8 #include <vector>
9 
12 
13 namespace Muon
14 {
15  namespace nsw
16  {
17  class VMMChannel;
18  class NSWResourceId;
19 
20  class NSWElink
21  {
22  public:
23  //NSWElink (); to be implemented for simulation
24  NSWElink (const uint32_t *bs, uint32_t remaining);
25  virtual ~NSWElink ();
26 
27  NSWElink (const NSWElink&) = delete;
28  NSWElink& operator= (const NSWElink&) = delete;
29 
30  const std::vector <Muon::nsw::VMMChannel *> &get_channels () const {return m_channels;};
31 
32  unsigned int nwords () const {return m_wordCount;};
33  unsigned int nhits () const {return m_nhits;};
34  unsigned int status () const {return m_packet_status;};
35 
36  // Detector Logical ID and components
37  uint32_t elinkWord () const {return m_elinkWord;};
38  const Muon::nsw::NSWResourceId *elinkId () const {return m_elinkId;};
40 
41  // ROC header
42  bool isNull () const {return m_isNull;};
43  bool noTdc () const {return m_noTdc;};
44 
45  uint16_t l1Id () const {return m_l1Id;};
46  uint16_t rocId () const {return m_rocId;};
47  uint16_t bcId () const {return m_bcId;};
48  uint16_t orbit () const {return m_orbit;};
49 
50  // ROC trailer
51  bool tout () const {return m_tout;};
52  bool extended () const {return m_extended;};
53 
54  uint8_t checksum () const {return m_checksum;};
55 
56  uint16_t nhitsTrail () const {return m_nhitsTrail;};
57  uint16_t l0Id () const {return m_l0Id;};
58  uint16_t flagMiss () const {return m_flagMiss;};
59 
60  private:
61  unsigned int test_checksum (const uint8_t *buffer, unsigned int buflen);
62 
63  private:
64  unsigned int m_wordCount;
65  unsigned int m_nhits;
66  unsigned int m_running_checksum;
67  unsigned int m_packet_status;
68 
69  bool m_isNull;
70  bool m_noTdc;
71  bool m_tout;
72  bool m_extended;
73 
75 
83 
86  std::vector <Muon::nsw::VMMChannel *> m_channels;
87 
88  static const unsigned int s_null_packet_length = 10;
89  };
90  }
91 }
92 
93 inline unsigned int Muon::nsw::NSWElink::test_checksum (const uint8_t *buffer, unsigned int buflen)
94 {
95  const uint8_t *p = buffer;
96  unsigned int running_checksum = 0;
97 
98  for (unsigned int i = 0; i < buflen; ++i, ++p)
99  running_checksum += *p;
100 
101  running_checksum = (running_checksum & 0xff) + (running_checksum >> 8); // add carry bits
102  running_checksum = (running_checksum & 0xff) + (running_checksum >> 8); // do it twice
103  running_checksum = (~running_checksum) & 0xff;
104 
105  return running_checksum;
106 }
107 
108 #endif // MUONNSWCOMMONDECODE_NSWELINK_H
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:575
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:49
NSWDecodeBitmaps.h
createCoolChannelIdFile.buffer
buffer
Definition: createCoolChannelIdFile.py:12
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
lumiFormat.i
int i
Definition: lumiFormat.py:92
Muon::nsw::NSWResourceId
Definition: NSWResourceId.h:42
NSWDecodeHelper.h
python.web.remaining
remaining
Definition: web.py:132