ATLAS Offline Software
VMMChannel.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 _MUON_VMM_CHANNEL_H_
5 #define _MUON_VMM_CHANNEL_H_
6 
10 
11 namespace Muon
12 {
13  namespace nsw
14  {
15  class VMMChannel
16  {
17  private:
19 
20  uint16_t m_roc_vmm; // vmm capture on the ROC
21  uint16_t m_chan; // vmm channel
22  uint16_t m_pdo; // adc amplitude
23  uint16_t m_tdo; // peaking time
24  uint16_t m_rel; // relative BCID
25  bool m_neighbor; // flag
26  bool m_parity; // parity
27 
29 
30  // Offline helper converts online parameters into channel type and channel number
31 
32  std::unique_ptr <Muon::nsw::helper::NSWOfflineHelper> m_offlineHelper;
33 
34  private:
36 
37  public:
39  virtual ~VMMChannel () {};
40 
41  bool calculate_parity ();
42 
43  // Hit word
44 
46 
47  // Decoded components of hit wors
48 
49  bool neighbor () {return m_neighbor;};
50  bool parity () {return m_parity;};
51  uint16_t pdo () {return m_pdo;};
52  uint16_t tdo () {return m_tdo;};
53  uint16_t rel_bcid () {return m_rel;};
54  uint16_t vmm_channel () {return m_chan;};
55  uint16_t roc_vmm () {return m_roc_vmm;};
56  uint16_t vmm () {return m_offlineHelper->vmm();};
57 
58  // Access to Detector logical ID
59 
60  const Muon::nsw::NSWElink *elink () const {return m_elink;};
61 
62  // Direct access to offline parameters from elinkId
63 
64  bool is_large_station () {return m_elink->elinkId ()->is_large_station ();};
65 
66  int8_t station_eta () {return m_elink->elinkId ()->station_eta ();};
69  uint8_t gas_gap () {return m_elink->elinkId ()->gas_gap ();};
70 
71  // Offline parameters
72 
73  uint8_t channel_type () {return m_offlineHelper->channel_type ();};
74  uint16_t channel_number () {return m_offlineHelper->channel_number ();};
75  };
76  }
77 }
78 
80 {
81  while (w > 0)
82  {
83  p ^= w & 0x1;
84  w = w >> 1;
85  }
86 
87  return p;
88 }
89 
91 {
92  uint8_t p = 0 ^ (m_neighbor ? 1 : 0);
93  uint16_t bcid = m_elink->bcId () + m_rel;
94 
95  p = this->calculate_word_parity (bcid, p);
96  p = this->calculate_word_parity (m_pdo, p);
97  p = this->calculate_word_parity (m_tdo, p);
98 
99  return (p > 0);
100 }
101 
103 : m_vmm_word (vmm_word), m_elink (elink)
104 {
112 
113  // For sTGCs: convert the vmm capture on the ROC (vmm in the fragment) to the nominal vmm number on the FEB
115  constexpr uint16_t vmmRemap[8] = { 2, 3, 0, 1, 5, 4, 6, 7 };
116  if (elink->elinkId()->detId() == eformat::MUON_STGC_ENDCAP_A_SIDE || elink->elinkId()->detId() == eformat::MUON_STGC_ENDCAP_C_SIDE)
117  vmm = vmmRemap [m_roc_vmm];
118 
119  m_offlineHelper = std::make_unique <Muon::nsw::helper::NSWOfflineHelper> (elink->elinkId (), vmm, m_chan);
120 }
121 
122 #endif // _MUON_VMM_CHANNEL_H_
123 
Muon::nsw::bitPosVmmHitCHANNEL
@ bitPosVmmHitCHANNEL
Definition: NSWDecodeBitmaps.h:98
Muon::nsw::NSWResourceId::multi_layer
uint8_t multi_layer() const
Definition: NSWResourceId.h:120
Muon::nsw::VMMChannel::m_roc_vmm
uint16_t m_roc_vmm
Definition: VMMChannel.h:20
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
Muon::nsw::VMMChannel::rel_bcid
uint16_t rel_bcid()
Definition: VMMChannel.h:53
Muon::nsw::VMMChannel::m_neighbor
bool m_neighbor
Definition: VMMChannel.h:25
Muon::nsw::bitPosVmmHitTDC
@ bitPosVmmHitTDC
Definition: NSWDecodeBitmaps.h:96
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
Muon::nsw::VMMChannel::m_offlineHelper
std::unique_ptr< Muon::nsw::helper::NSWOfflineHelper > m_offlineHelper
Definition: VMMChannel.h:32
Muon::nsw::VMMChannel::m_rel
uint16_t m_rel
Definition: VMMChannel.h:24
Muon::nsw::VMMChannel::VMMChannel
VMMChannel(uint32_t vmm_word, Muon::nsw::NSWElink *elink)
Definition: VMMChannel.h:102
Muon::nsw::NSWResourceId::detId
uint8_t detId() const
Definition: NSWResourceId.h:71
Muon::nsw::VMMChannel::calculate_parity
bool calculate_parity()
Definition: VMMChannel.h:90
Muon::nsw::VMMChannel::parity
bool parity()
Definition: VMMChannel.h:50
Muon::nsw::VMMChannel::multi_layer
uint8_t multi_layer()
Definition: VMMChannel.h:68
Muon::nsw::VMMChannel::station_phi
uint8_t station_phi()
Definition: VMMChannel.h:67
Muon::nsw::NSWResourceId::station_eta
int8_t station_eta() const
Definition: NSWResourceId.h:99
Muon::nsw::bitPosVmmHitP
@ bitPosVmmHitP
Definition: NSWDecodeBitmaps.h:102
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition: TrackSystemController.h:45
Muon::nsw::VMMChannel::channel_type
uint8_t channel_type()
Definition: VMMChannel.h:73
Muon::nsw::VMMChannel::m_tdo
uint16_t m_tdo
Definition: VMMChannel.h:23
Muon::nsw::VMMChannel::vmm_word
uint32_t vmm_word()
Definition: VMMChannel.h:45
Muon::nsw::VMMChannel::gas_gap
uint8_t gas_gap()
Definition: VMMChannel.h:69
Muon::nsw::helper::get_bits
uint32_t get_bits(uint32_t word, uint32_t mask, uint8_t position)
Definition: NSWDecodeHelper.h:168
Muon::nsw::VMMChannel::is_large_station
bool is_large_station()
Definition: VMMChannel.h:64
Muon::nsw::bitPosVmmHitRELBCID
@ bitPosVmmHitRELBCID
Definition: NSWDecodeBitmaps.h:100
Muon::nsw::VMMChannel::calculate_word_parity
uint8_t calculate_word_parity(uint32_t w, uint8_t p=0)
Definition: VMMChannel.h:79
Muon::nsw::bitPosVmmHitVMMID
@ bitPosVmmHitVMMID
Definition: NSWDecodeBitmaps.h:99
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
Muon::nsw::VMMChannel::m_vmm_word
uint32_t m_vmm_word
Definition: VMMChannel.h:18
Muon::nsw::VMMChannel::neighbor
bool neighbor()
Definition: VMMChannel.h:49
Muon::nsw::VMMChannel::vmm
uint16_t vmm()
Definition: VMMChannel.h:56
Muon::nsw::NSWResourceId::is_large_station
bool is_large_station() const
Definition: NSWResourceId.h:93
Muon::nsw::NSWResourceId::station_phi
uint8_t station_phi() const
Definition: NSWResourceId.h:114
Muon::nsw::VMMChannel::pdo
uint16_t pdo()
Definition: VMMChannel.h:51
Muon::nsw::VMMChannel
Definition: VMMChannel.h:16
Muon::nsw::bitMaskVmmHitVMMID
@ bitMaskVmmHitVMMID
Definition: NSWDecodeBitmaps.h:65
Muon::nsw::VMMChannel::channel_number
uint16_t channel_number()
Definition: VMMChannel.h:74
Muon::nsw::bitPosVmmHitADC
@ bitPosVmmHitADC
Definition: NSWDecodeBitmaps.h:97
Muon::nsw::bitMaskVmmHitP
@ bitMaskVmmHitP
Definition: NSWDecodeBitmaps.h:68
Muon::nsw::bitMaskVmmHitCHANNEL
@ bitMaskVmmHitCHANNEL
Definition: NSWDecodeBitmaps.h:64
Muon::nsw::VMMChannel::m_chan
uint16_t m_chan
Definition: VMMChannel.h:21
Muon::nsw::VMMChannel::elink
const Muon::nsw::NSWElink * elink() const
Definition: VMMChannel.h:60
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
Muon::nsw::VMMChannel::vmm_channel
uint16_t vmm_channel()
Definition: VMMChannel.h:54
Muon::nsw::VMMChannel::m_parity
bool m_parity
Definition: VMMChannel.h:26
NSWOfflineHelper.h
NSWResourceId.h
Muon::nsw::VMMChannel::~VMMChannel
virtual ~VMMChannel()
Definition: VMMChannel.h:39
Muon::nsw::VMMChannel::roc_vmm
uint16_t roc_vmm()
Definition: VMMChannel.h:55
Muon::nsw::bitMaskVmmHitRELBCID
@ bitMaskVmmHitRELBCID
Definition: NSWDecodeBitmaps.h:66
Muon::nsw::bitMaskVmmHitN
@ bitMaskVmmHitN
Definition: NSWDecodeBitmaps.h:67
Muon::nsw::VMMChannel::m_elink
Muon::nsw::NSWElink * m_elink
Definition: VMMChannel.h:28
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
Muon::nsw::VMMChannel::tdo
uint16_t tdo()
Definition: VMMChannel.h:52
Muon::nsw::bitPosVmmHitN
@ bitPosVmmHitN
Definition: NSWDecodeBitmaps.h:101
Muon::nsw::bitMaskVmmHitTDC
@ bitMaskVmmHitTDC
Definition: NSWDecodeBitmaps.h:62
Muon::nsw::bitMaskVmmHitADC
@ bitMaskVmmHitADC
Definition: NSWDecodeBitmaps.h:63
Muon::nsw::VMMChannel::station_eta
int8_t station_eta()
Definition: VMMChannel.h:66
Muon::nsw::NSWResourceId::gas_gap
uint8_t gas_gap() const
Definition: NSWResourceId.h:126
Muon::nsw::VMMChannel::m_pdo
uint16_t m_pdo
Definition: VMMChannel.h:22