ATLAS Offline Software
Classes | Enumerations | Functions | Variables
LVL1::MuCTPIBits Namespace Reference

Classes

struct  Candidate
 
struct  Multiplicity
 
struct  Slice
 
struct  TimesliceHeader
 
struct  TopoTOB
 

Enumerations

enum  WordType : uint8_t {
  WordType::Undefined =0, WordType::Timeslice, WordType::Multiplicity, WordType::Candidate,
  WordType::Topo, WordType::Status, WordType::MAX
}
 
enum  SubsysID : uint8_t {
  SubsysID::Undefined =0, SubsysID::Barrel, SubsysID::Forward, SubsysID::Endcap,
  SubsysID::MAX
}
 

Functions

constexpr uint32_t maskedWord (uint32_t word, uint32_t shift, uint32_t mask)
 Extract sub-word from 32-bit word by applying a shift and a mask. More...
 
constexpr uint32_t maskedWord (uint64_t word, uint32_t shift, uint32_t mask)
 Extract sub-word from 64-bit word by applying a shift and a mask. More...
 
constexpr uint32_t buildWord (uint32_t value, uint32_t shift, uint32_t mask)
 Extract sub-word from 32-bit word by applying a shift and a mask. More...
 
constexpr bool wordEquals (uint32_t word, uint32_t shift, uint32_t mask, uint32_t value)
 Compare a sub-word of a 32-bit word to an expected value. More...
 
constexpr WordType getWordType (uint32_t word)
 Determine the type of a MUCTPI ROD word. More...
 
constexpr auto timesliceHeader (uint32_t word)
 Decode timeslice word. More...
 
constexpr uint32_t timesliceHeader (uint32_t bcid, uint32_t tobCount, uint32_t candCount)
 Encode timeslice word. More...
 
constexpr auto topoHeader (uint32_t word)
 Decode topo word : More...
 
constexpr uint32_t multiplicityWordNumber (uint32_t word)
 Decode the index of the multitpicity word, which is 1, 2, or 3. More...
 
constexpr std::array< uint32_t, 3 > multiplicityWords (uint64_t multiplicity, uint32_t triggerBits, bool overflow)
 Encode the multiplicity words. More...
 
constexpr SubsysID getSubsysID (uint32_t word)
 Decode the subsys ID from RoI candidate word. More...
 
std::vector< size_t > getDataStatusWordErrors (uint32_t word)
 Decode the data status word (returns a vector of bit indices for the errors set - empty if no errors) More...
 
constexpr uint32_t dataStatusWord (uint16_t status)
 Encode the data status word. More...
 

Variables

const uint32_t RPCtoTGC_pt_map [6] = {2, 4, 6, 8, 10, 12}
 

Enumeration Type Documentation

◆ SubsysID

enum LVL1::MuCTPIBits::SubsysID : uint8_t
strong
Enumerator
Undefined 
Barrel 
Forward 
Endcap 
MAX 

Definition at line 17 of file HelpersPhase1.h.

◆ WordType

enum LVL1::MuCTPIBits::WordType : uint8_t
strong
Enumerator
Undefined 
Timeslice 
Multiplicity 
Candidate 
Topo 
Status 
MAX 

Definition at line 16 of file HelpersPhase1.h.

Function Documentation

◆ buildWord()

constexpr uint32_t LVL1::MuCTPIBits::buildWord ( uint32_t  value,
uint32_t  shift,
uint32_t  mask 
)
inlineconstexpr

Extract sub-word from 32-bit word by applying a shift and a mask.

Definition at line 54 of file HelpersPhase1.h.

54  {
55  return ((value & mask) << shift);
56  }

◆ dataStatusWord()

constexpr uint32_t LVL1::MuCTPIBits::dataStatusWord ( uint16_t  status)
inlineconstexpr

Encode the data status word.

Definition at line 199 of file HelpersPhase1.h.

199  {
200  uint32_t word = buildWord(RUN3_STATUS_WORD_ID_VAL, RUN3_STATUS_WORD_ID_SHIFT, RUN3_STATUS_WORD_ID_MASK);
201  word |= status;
202  return word;
203  }

◆ getDataStatusWordErrors()

std::vector<size_t> LVL1::MuCTPIBits::getDataStatusWordErrors ( uint32_t  word)
inline

Decode the data status word (returns a vector of bit indices for the errors set - empty if no errors)

Definition at line 186 of file HelpersPhase1.h.

186  {
187  uint16_t status = maskedWord(word, RUN3_STATUS_WORD_SHIFT, RUN3_STATUS_WORD_MASK);
188  if (status==0) return {};
189  std::vector<size_t> errors;
190  for (size_t bit=0; bit<DataStatusWordErrors.size(); ++bit) {
191  if (wordEquals(status, bit, 1u, 1u)) {
192  errors.push_back(bit);
193  }
194  }
195  return errors;
196  }

◆ getSubsysID()

constexpr SubsysID LVL1::MuCTPIBits::getSubsysID ( uint32_t  word)
inlineconstexpr

Decode the subsys ID from RoI candidate word.

Definition at line 174 of file HelpersPhase1.h.

174  {
175  if (wordEquals(word, RUN3_SUBSYS_ADDRESS_EC_SHIFT, RUN3_SUBSYS_ADDRESS_EC_MASK, RUN3_SUBSYS_ADDRESS_EC_VAL)) {
176  return SubsysID::Endcap;
177  } else if (wordEquals(word, RUN3_SUBSYS_ADDRESS_BAFW_SHIFT, RUN3_SUBSYS_ADDRESS_BAFW_MASK, RUN3_SUBSYS_ADDRESS_FW_VAL)) {
178  return SubsysID::Forward;
179  } else if (wordEquals(word, RUN3_SUBSYS_ADDRESS_BAFW_SHIFT, RUN3_SUBSYS_ADDRESS_BAFW_MASK, RUN3_SUBSYS_ADDRESS_BA_VAL)) {
180  return SubsysID::Barrel;
181  }
182  return SubsysID::Undefined;
183  }

◆ getWordType()

constexpr WordType LVL1::MuCTPIBits::getWordType ( uint32_t  word)
inlineconstexpr

Determine the type of a MUCTPI ROD word.

Definition at line 64 of file HelpersPhase1.h.

64  {
65  if (wordEquals(word, RUN3_TIMESLICE_MULT_WORD_ID_SHIFT, RUN3_TIMESLICE_MULT_WORD_ID_MASK, RUN3_TIMESLICE_MULT_WORD_ID_VAL)) {
66  if (wordEquals(word, RUN3_TIMESLICE_MULT_WORD_NUM_SHIFT, RUN3_TIMESLICE_MULT_WORD_NUM_MASK, RUN3_TIMESLICE_WORD_NUM_VAL)) {
67  return WordType::Timeslice;
68  }
69  return WordType::Multiplicity;
70  } else if (wordEquals(word, RUN3_CAND_WORD_ID_SHIFT, RUN3_CAND_WORD_ID_MASK, RUN3_CAND_WORD_ID_VAL)) {
71  return WordType::Candidate;
72  } else if (wordEquals(word, RUN3_TOPO_WORD_ID_SHIFT, RUN3_TOPO_WORD_ID_MASK, RUN3_TOPO_WORD_ID_VAL)) {
73  return WordType::Topo;
74  } else if (wordEquals(word, RUN3_STATUS_WORD_ID_SHIFT, RUN3_STATUS_WORD_ID_MASK, RUN3_STATUS_WORD_ID_VAL)) {
75  return WordType::Status;
76  }
77  return WordType::Undefined;
78  }

◆ maskedWord() [1/2]

constexpr uint32_t LVL1::MuCTPIBits::maskedWord ( uint32_t  word,
uint32_t  shift,
uint32_t  mask 
)
inlineconstexpr

Extract sub-word from 32-bit word by applying a shift and a mask.

Definition at line 44 of file HelpersPhase1.h.

44  {
45  return ((word >> shift) & mask);
46  }

◆ maskedWord() [2/2]

constexpr uint32_t LVL1::MuCTPIBits::maskedWord ( uint64_t  word,
uint32_t  shift,
uint32_t  mask 
)
inlineconstexpr

Extract sub-word from 64-bit word by applying a shift and a mask.

Definition at line 49 of file HelpersPhase1.h.

49  {
50  return ((word >> shift) & mask);
51  }

◆ multiplicityWordNumber()

constexpr uint32_t LVL1::MuCTPIBits::multiplicityWordNumber ( uint32_t  word)
inlineconstexpr

Decode the index of the multitpicity word, which is 1, 2, or 3.

Definition at line 154 of file HelpersPhase1.h.

154  {
155  return maskedWord(word, RUN3_TIMESLICE_MULT_WORD_NUM_SHIFT, RUN3_TIMESLICE_MULT_WORD_NUM_MASK);
156  }

◆ multiplicityWords()

constexpr std::array<uint32_t,3> LVL1::MuCTPIBits::multiplicityWords ( uint64_t  multiplicity,
uint32_t  triggerBits,
bool  overflow 
)
inlineconstexpr

Encode the multiplicity words.

Definition at line 159 of file HelpersPhase1.h.

159  {
160  std::array<uint32_t,3> words{}; // zero-initialised
161  for (uint32_t iWord=0; iWord<words.size(); ++iWord) {
162  words[iWord] |= buildWord(RUN3_TIMESLICE_MULT_WORD_ID_VAL, RUN3_TIMESLICE_MULT_WORD_ID_SHIFT, RUN3_TIMESLICE_MULT_WORD_ID_MASK);
163  words[iWord] |= buildWord(iWord+1, RUN3_TIMESLICE_MULT_WORD_NUM_SHIFT, RUN3_TIMESLICE_MULT_WORD_NUM_MASK);
164  }
165  words[0] |= maskedWord(multiplicity, RUN3_MULTIPLICITY_PART1_SHIFT, RUN3_MULTIPLICITY_PART1_MASK);
166  words[1] |= maskedWord(multiplicity, RUN3_MULTIPLICITY_PART2_SHIFT, RUN3_MULTIPLICITY_PART2_MASK);
167  words[2] |= maskedWord(multiplicity, RUN3_MULTIPLICITY_PART3_SHIFT, RUN3_MULTIPLICITY_PART3_MASK);
168  words[2] |= maskedWord(triggerBits, RUN3_MULTIPLICITY_TRIGBITS_SHIFT, RUN3_MULTIPLICITY_TRIGBITS_MASK);
169  words[2] |= maskedWord(static_cast<uint32_t>(overflow), RUN3_MULTIPLICITY_OVERFLOW_SHIFT, RUN3_MULTIPLICITY_OVERFLOW_MASK);
170  return words;
171  }

◆ timesliceHeader() [1/2]

constexpr uint32_t LVL1::MuCTPIBits::timesliceHeader ( uint32_t  bcid,
uint32_t  tobCount,
uint32_t  candCount 
)
inlineconstexpr

Encode timeslice word.

Definition at line 94 of file HelpersPhase1.h.

94  {
95  uint32_t word{0};
96  word |= buildWord(RUN3_TIMESLICE_MULT_WORD_ID_VAL, RUN3_TIMESLICE_MULT_WORD_ID_SHIFT, RUN3_TIMESLICE_MULT_WORD_ID_MASK);
97  word |= buildWord(RUN3_TIMESLICE_WORD_NUM_VAL, RUN3_TIMESLICE_MULT_WORD_NUM_SHIFT, RUN3_TIMESLICE_MULT_WORD_NUM_MASK);
98  word |= buildWord(bcid, RUN3_TIMESLICE_BCID_SHIFT, RUN3_TIMESLICE_BCID_MASK);
99  word |= buildWord(tobCount, RUN3_TIMESLICE_NTOB_SHIFT, RUN3_TIMESLICE_NTOB_MASK);
100  word |= buildWord(candCount, RUN3_TIMESLICE_NCAND_SHIFT, RUN3_TIMESLICE_NCAND_MASK);
101  return word;
102  }

◆ timesliceHeader() [2/2]

constexpr auto LVL1::MuCTPIBits::timesliceHeader ( uint32_t  word)
inlineconstexpr

Decode timeslice word.

Definition at line 81 of file HelpersPhase1.h.

81  {
82  struct {
83  uint32_t bcid{0};
84  uint32_t tobCount{0};
85  uint32_t candCount{0};
86  } header;
87  header.bcid = maskedWord(word, RUN3_TIMESLICE_BCID_SHIFT, RUN3_TIMESLICE_BCID_MASK);
88  header.tobCount = maskedWord(word, RUN3_TIMESLICE_NTOB_SHIFT, RUN3_TIMESLICE_NTOB_MASK);
89  header.candCount = maskedWord(word, RUN3_TIMESLICE_NCAND_SHIFT, RUN3_TIMESLICE_NCAND_MASK);
90  return header;
91  }

◆ topoHeader()

constexpr auto LVL1::MuCTPIBits::topoHeader ( uint32_t  word)
inlineconstexpr

Decode topo word :

Definition at line 105 of file HelpersPhase1.h.

105  {
106  struct {
107  bool flag0{0};
108  bool flag1{0};
109  bool flag2{0};
110  bool flag3{0};
111  uint32_t pt{0};
112  uint32_t etacode{0};
113  uint32_t phicode{0};
114  uint32_t barrel_eta_lookup{0};
115  uint32_t barrel_phi_lookup{0};
116  uint32_t hemi{0};
117  uint32_t det{0};
118  uint32_t sec{0};
119  uint32_t roi{0};
120  } header;
121  header.flag0 = maskedWord(word, RUN3_TOPO_WORD_FLAGS_SHIFT, 0x1); //20
122  header.flag1 = maskedWord(word, RUN3_TOPO_WORD_FLAGS_SHIFT+1, 0x1); //21
123  header.flag2 = maskedWord(word, RUN3_TOPO_WORD_FLAGS_SHIFT+2, 0x1); //22
124  header.flag3 = maskedWord(word, RUN3_TOPO_WORD_FLAGS_SHIFT+3, 0x1); //23
125  header.pt = maskedWord(word, RUN3_TOPO_WORD_PT_SHIFT, RUN3_TOPO_WORD_PT_MASK);
126  header.etacode = maskedWord(word, RUN3_TOPO_WORD_ETA_SHIFT, RUN3_TOPO_WORD_ETA_MASK);
127  header.phicode = maskedWord(word, RUN3_TOPO_WORD_PHI_SHIFT, RUN3_TOPO_WORD_PHI_MASK);
128  // HEMISPHERE 0: C-side (-) / 1: A-side (-)
129  header.hemi = maskedWord(word, RUN3_TOPO_WORD_HEMI_SHIFT, RUN3_TOPO_WORD_HEMI_MASK);
130  // Barrel: 00 - EC: 1X - FW: 01 - see: https://indico.cern.ch/event/864390/contributions/3642129/attachments/1945776/3234220/ctp_topo_encoding.pdf
131  header.det = maskedWord(word, RUN3_TOPO_WORD_DET_SHIFT, RUN3_TOPO_WORD_DET_MASK);
132  // set EC to 2 instead of sometimes 3 - see above why
133  if (header.det > 2) header.det = 2;
134  // Decode Barrel:
135  if (header.det == 0){
136  header.sec = header.phicode >> 3;
137  header.barrel_eta_lookup = (header.etacode >> 1) & 0xf;
138  header.barrel_phi_lookup = header.phicode & 0x7;
139  }
140  // FWD
141  else if (header.det == 1){
142  header.sec = header.phicode >> 3 ;
143  header.roi = ((header.etacode & 0x1f) << 2) | ((header.phicode >> 1) & 0x3) ;
144  }
145  // EC
146  else if (header.det == 2){
147  header.sec = header.phicode >> 2 ;
148  header.roi = ((header.etacode & 0x3f) << 2) | (header.phicode & 0x3) ;
149  }
150  return header;
151  }

◆ wordEquals()

constexpr bool LVL1::MuCTPIBits::wordEquals ( uint32_t  word,
uint32_t  shift,
uint32_t  mask,
uint32_t  value 
)
inlineconstexpr

Compare a sub-word of a 32-bit word to an expected value.

Definition at line 59 of file HelpersPhase1.h.

59  {
60  return maskedWord(word, shift, mask) == value;
61  }

Variable Documentation

◆ RPCtoTGC_pt_map

const uint32_t LVL1::MuCTPIBits::RPCtoTGC_pt_map[6] = {2, 4, 6, 8, 10, 12}

Definition at line 20 of file HelpersPhase1.h.

plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
Undefined
@ Undefined
Definition: MaterialTypes.h:8
header
Definition: hcg.cxx:526
DetType::Endcap
@ Endcap
Definition: DetType.h:14
MAX
#define MAX(x, y)
Definition: ALFA_SvdCalc.h:28
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:575
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
Trk::BoundaryCheckResult::Candidate
@ Candidate
LVL1::MuCTPIBits::buildWord
constexpr uint32_t buildWord(uint32_t value, uint32_t shift, uint32_t mask)
Extract sub-word from 32-bit word by applying a shift and a mask.
Definition: HelpersPhase1.h:54
test_pyathena.pt
pt
Definition: test_pyathena.py:11
athena.value
value
Definition: athena.py:122
LVL1::MuCTPIBits::wordEquals
constexpr bool wordEquals(uint32_t word, uint32_t shift, uint32_t mask, uint32_t value)
Compare a sub-word of a 32-bit word to an expected value.
Definition: HelpersPhase1.h:59
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:83
LVL1::MuCTPIBits::WordType::Topo
@ Topo
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
DetType::Barrel
@ Barrel
Definition: DetType.h:14
LVL1::MuCTPIBits::maskedWord
constexpr uint32_t maskedWord(uint64_t word, uint32_t shift, uint32_t mask)
Extract sub-word from 64-bit word by applying a shift and a mask.
Definition: HelpersPhase1.h:49
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
LVL1::MuCTPIBits::SubsysID::Forward
@ Forward
WritePulseShapeToCool.det
det
Definition: WritePulseShapeToCool.py:204
mergePhysValFiles.errors
list errors
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:43
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
LVL1::MuCTPIBits::WordType::Multiplicity
@ Multiplicity
Athena::Status
Status
Athena specific StatusCode values.
Definition: AthStatusCode.h:22
merge.status
status
Definition: merge.py:17
LVL1::MuCTPIBits::WordType::Timeslice
@ Timeslice
makeTOC.header
header
Definition: makeTOC.py:28
checkFileSG.words
words
Definition: checkFileSG.py:76