ATLAS Offline Software
Loading...
Searching...
No Matches
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
11namespace Muon
12{
13 namespace nsw
14 {
16 {
17 private:
18 uint32_t m_vmm_word;
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:
35 uint8_t calculate_word_parity (uint32_t w, uint8_t p = 0);
36
37 public:
39 virtual ~VMMChannel () {};
40
41 bool calculate_parity ();
42
43 // Hit word
44
45 uint32_t vmm_word () {return m_vmm_word;};
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 ();};
67 uint8_t station_phi () {return m_elink->elinkId ()->station_phi ();};
68 uint8_t multi_layer () {return m_elink->elinkId ()->multi_layer ();};
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
79inline uint8_t Muon::nsw::VMMChannel::calculate_word_parity (uint32_t w, uint8_t p)
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
104{
112
113 // For sTGCs: convert the vmm capture on the ROC (vmm in the fragment) to the nominal vmm number on the FEB
114 uint16_t vmm{m_roc_vmm};
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
const Muon::nsw::NSWElink * elink() const
Definition VMMChannel.h:60
uint16_t channel_number()
Definition VMMChannel.h:74
std::unique_ptr< Muon::nsw::helper::NSWOfflineHelper > m_offlineHelper
Definition VMMChannel.h:32
VMMChannel(uint32_t vmm_word, Muon::nsw::NSWElink *elink)
Definition VMMChannel.h:102
Muon::nsw::NSWElink * m_elink
Definition VMMChannel.h:28
uint16_t vmm_channel()
Definition VMMChannel.h:54
uint8_t calculate_word_parity(uint32_t w, uint8_t p=0)
Definition VMMChannel.h:79
uint32_t get_bits(uint32_t word, uint32_t mask, uint8_t position)
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.