ATLAS Offline Software
CTP_Decoder.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRIGT1_CTP_DECODER_H
6 #define TRIGT1_CTP_DECODER_H
7 
8 #include <cstdint>
9 #include <bitset>
10 #include <vector>
11 
13 #include "TrigT1Result/CTP_RDO.h"
14 
15 class MsgStream;
16 
17 class CTP_BC {
18 
35 public:
37  void dumpData(MsgStream&) const;
38 
40  void setCTPVersion(unsigned int ctpVersionNumber) {
41  m_ctpVersion = CTPdataformatVersion(ctpVersionNumber);
42  }
43 
44 
46  // identifier (BCID)
47  std::bitset<32> getBCIDBitSet() const;
49  uint32_t getBCID() const;
51  std::string printBCID() const;
52 
54  std::bitset<32> getRandomTrigBitSet() const;
56  uint32_t getRandomTrig() const;
58  std::string printRandomTrig() const;
59 
61  std::bitset<32> getPrescaledClockBitSet() const;
65  std::string printPrescaledClock() const;
66 
68  //0..11), the random trigger (bit 12,13) and prescaled clock (bit
69  //14,15)
70  void setPITWordAux( uint32_t word ) { m_pitAux = word; }
72  const std::bitset<32> & getPITWordAux() const {
73  return m_pitAux;
74  }
76  std::string printPITWordAux() const;
77 
79  void setTIP(const std::vector<uint32_t>& words);
81  const std::bitset<512> & getTIP() const {
82  return m_tip;
83  }
85  void setTIPWord( uint32_t word, uint32_t pos = 0);
87  std::string printTIP() const;
88 
89 
91  void setTBP(const std::vector<uint32_t>& words);
93  const std::bitset<512> & getTBP() const {
94  return m_tbp;
95  }
97  void setTBPWord( uint32_t word, uint32_t pos = 0);
99  std::string printTBP() const;
100 
102  void setTAP(const std::vector<uint32_t>& words);
104  void setTAPWord( uint32_t word, uint32_t pos = 0);
106  const std::bitset<512> & getTAP() const {
107  return m_tap;
108  }
110  std::string printTAP() const;
111 
113  void setTAV(const std::vector<uint32_t>& words);
115  const std::bitset<512> & getTAV() const {
116  return m_tav;
117  }
119  void setTAVWord( uint32_t word, uint32_t pos = 0);
121  std::string printTAV() const;
122 
123 private:
125  //items
126  //std::bitset<320> m_pit;
127  //std::bitset<192> m_fpi;
128  std::bitset<512> m_tip;
129  std::bitset<512> m_tbp;
130  std::bitset<512> m_tap;
131  std::bitset<512> m_tav;
133  std::bitset<32> m_pitAux;
134 
135  CTPdataformatVersion m_ctpVersion{0};
136 };
137 
138 
139 
140 
141 
142 class CTP_Decoder : public AthMessaging {
143 
170 public:
172  CTP_Decoder();
173 
175  void setRDO(const CTP_RDO* rdo);
177  const CTP_RDO* getRDO() const {
178  return m_rdo;
179  }
181  const std::vector<CTP_BC>& getBunchCrossings() {
182  return m_BCs;
183  }
185  const CTP_BC& getBunchCrossing(unsigned int pos) {
186  return m_BCs[pos];
187  }
188 
196  bool checkTrigger(unsigned int itemNo,unsigned int bcPos);
197 
208  bool checkTriggerAfterPrescale(unsigned int itemNo,unsigned int bcPos);
209 
217  std::vector<unsigned int> getAllTriggers(unsigned int bcPos);
218 
220  void dumpData() const;
221 
222 private:
224  const CTP_RDO* m_rdo;
226  std::vector<CTP_BC> m_BCs;
227 };
228 
229 #endif
CTP_BC::dumpData
void dumpData(MsgStream &) const
Helper class to decode the CTP data for one bunch-crossing.
Definition: CTP_Decoder.cxx:199
CTP_BC::setTAPWord
void setTAPWord(uint32_t word, uint32_t pos=0)
Set TAP word number 'pos'.
Definition: CTP_Decoder.cxx:407
CTP_Decoder::checkTriggerAfterPrescale
bool checkTriggerAfterPrescale(unsigned int itemNo, unsigned int bcPos)
Test the LVL1 trigger result after pre-scale factors are applied, before the final trigger decision,...
Definition: CTP_Decoder.cxx:157
CTP_Decoder::getRDO
const CTP_RDO * getRDO() const
Accessor function to retrieve pointer to RDO object.
Definition: CTP_Decoder.h:177
CTP_BC::setTAVWord
void setTAVWord(uint32_t word, uint32_t pos=0)
Set TAV word number 'pos'.
Definition: CTP_Decoder.cxx:431
CTP_BC::getPITWordAux
const std::bitset< 32 > & getPITWordAux() const
Get PIT word 5 bitset.
Definition: CTP_Decoder.h:72
CTP_BC::getRandomTrigBitSet
std::bitset< 32 > getRandomTrigBitSet() const
Accessor to obtain random-trigger input bits.
Definition: CTP_Decoder.cxx:304
CTP_BC::setTBP
void setTBP(const std::vector< uint32_t > &words)
Set TBP (Trigger Before Prescales) words.
Definition: CTP_Decoder.cxx:396
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
CTP_BC::getTAV
const std::bitset< 512 > & getTAV() const
get bitset of TAV words
Definition: CTP_Decoder.h:115
CTP_BC::setCTPVersion
void setCTPVersion(unsigned int ctpVersionNumber)
Set the CTP data format version (needed before extracting any information)
Definition: CTP_Decoder.h:40
CTP_BC::m_tbp
std::bitset< 512 > m_tbp
Definition: CTP_Decoder.h:129
CTP_BC::m_tav
std::bitset< 512 > m_tav
Definition: CTP_Decoder.h:131
CTP_BC::setTBPWord
void setTBPWord(uint32_t word, uint32_t pos=0)
Set TBP word number 'pos'.
Definition: CTP_Decoder.cxx:383
CTP_Decoder::dumpData
void dumpData() const
Helper to dump data for debugging.
Definition: CTP_Decoder.cxx:107
CTP_Decoder::CTP_Decoder
CTP_Decoder()
Helper class to decode the CTP data fragment.
Definition: CTP_Decoder.cxx:15
CTP_BC::printTBP
std::string printTBP() const
Obtain TBP bitpattern string (binary format)
Definition: CTP_Decoder.cxx:401
CTP_BC::setTIPWord
void setTIPWord(uint32_t word, uint32_t pos=0)
Set TIP word number 'pos'.
Definition: CTP_Decoder.cxx:354
CTP_BC::printBCID
std::string printBCID() const
Return string with BCID in binary format.
Definition: CTP_Decoder.cxx:297
CTP_Decoder
Definition: CTP_Decoder.h:142
CTP_BC::printTIP
std::string printTIP() const
Obtain TIP bitpattern string (binary format)
Definition: CTP_Decoder.cxx:375
CTP_BC::getTIP
const std::bitset< 512 > & getTIP() const
get bitset of TIP words
Definition: CTP_Decoder.h:81
CTP_BC::printPrescaledClock
std::string printPrescaledClock() const
Return string with prescaled clock in binary format.
Definition: CTP_Decoder.cxx:341
CTP_Decoder::getAllTriggers
std::vector< unsigned int > getAllTriggers(unsigned int bcPos)
Function to obtain a vector with the numbers of the trigger items that fired for the current event.
Definition: CTP_Decoder.cxx:172
CTP_Decoder::checkTrigger
bool checkTrigger(unsigned int itemNo, unsigned int bcPos)
Test the LVL1 trigger result for a certain trigger item.
Definition: CTP_Decoder.cxx:143
CTP_BC::printRandomTrig
std::string printRandomTrig() const
Return string with random trigger in binary format.
Definition: CTP_Decoder.cxx:316
CTP_BC::m_tip
std::bitset< 512 > m_tip
Bitsets containing bit-patterns of trigger inputs and trigger.
Definition: CTP_Decoder.h:128
CTP_BC
Definition: CTP_Decoder.h:17
CTP_Decoder::setRDO
void setRDO(const CTP_RDO *rdo)
Set RDO and fill internal variables from the data object.
Definition: CTP_Decoder.cxx:20
CTP_BC::setTAP
void setTAP(const std::vector< uint32_t > &words)
Set TAP (Trigger After Prescales) words.
Definition: CTP_Decoder.cxx:419
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
CTP_BC::setPITWordAux
void setPITWordAux(uint32_t word)
Set auxiliary PIT word, which is the one containing the 12-bit BCID (bit.
Definition: CTP_Decoder.h:70
CTP_BC::setTIP
void setTIP(const std::vector< uint32_t > &words)
Set TIP words.
Definition: CTP_Decoder.cxx:370
CTP_BC::getTAP
const std::bitset< 512 > & getTAP() const
get bitset of TAP words
Definition: CTP_Decoder.h:106
CTP_Decoder::m_BCs
std::vector< CTP_BC > m_BCs
Vector of BCs for the current event.
Definition: CTP_Decoder.h:226
CTP_BC::getTBP
const std::bitset< 512 > & getTBP() const
get bitset of TBP words
Definition: CTP_Decoder.h:93
CTP_BC::getBCID
uint32_t getBCID() const
Get BCID as unsigned integer.
Definition: CTP_Decoder.cxx:292
CTP_Decoder::m_rdo
const CTP_RDO * m_rdo
The RDO member.
Definition: CTP_Decoder.h:224
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
CTP_BC::getPrescaledClockBitSet
std::bitset< 32 > getPrescaledClockBitSet() const
Accessor to obtain prescaled-clock input bits.
Definition: CTP_Decoder.cxx:323
CTP_RDO.h
CTP_RDO
Definition: CTP_RDO.h:20
CTP_BC::setTAV
void setTAV(const std::vector< uint32_t > &words)
Set TAV (Trigger After Veto) words.
Definition: CTP_Decoder.cxx:443
CTP_BC::getPrescaledClock
uint32_t getPrescaledClock() const
Prescaled-clock inputs as uint32_t.
Definition: CTP_Decoder.cxx:336
CTP_BC::m_tap
std::bitset< 512 > m_tap
Definition: CTP_Decoder.h:130
CTP_BC::getBCIDBitSet
std::bitset< 32 > getBCIDBitSet() const
Accessor to obtain std::bitset containing the bunch-crossing.
Definition: CTP_Decoder.cxx:277
CTP_BC::printPITWordAux
std::string printPITWordAux() const
Get auxiliary PIT word as string in binary format.
Definition: CTP_Decoder.cxx:348
CTP_BC::m_pitAux
std::bitset< 32 > m_pitAux
Contains BCID, random trigger and prescaled clock.
Definition: CTP_Decoder.h:133
AthMessaging.h
CTP_BC::printTAP
std::string printTAP() const
Obtain TAP bitpattern string (binary format)
Definition: CTP_Decoder.cxx:425
CTP_Decoder::getBunchCrossing
const CTP_BC & getBunchCrossing(unsigned int pos)
Get data of a single bunch-crossing.
Definition: CTP_Decoder.h:185
CTP_BC::printTAV
std::string printTAV() const
Obtain TAV bitpattern string (binary format)
Definition: CTP_Decoder.cxx:449
CTP_BC::m_ctpVersion
CTPdataformatVersion m_ctpVersion
Definition: CTP_Decoder.h:135
checkFileSG.words
words
Definition: checkFileSG.py:76
CTP_BC::getRandomTrig
uint32_t getRandomTrig() const
Random-trigger inputs as uint32_t.
Definition: CTP_Decoder.cxx:311
CTP_Decoder::getBunchCrossings
const std::vector< CTP_BC > & getBunchCrossings()
Get vector reference of bunch-crossing data of the current event.
Definition: CTP_Decoder.h:181