ATLAS Offline Software
CTP_Decoder.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 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 
34 public:
36  void dumpData(MsgStream&) const;
37 
39  void setCTPVersion(unsigned int ctpVersionNumber) {
40  m_ctpVersion = CTPdataformatVersion(ctpVersionNumber);
41  }
42 
43 
45  // identifier (BCID)
46  std::bitset<32> getBCIDBitSet() const;
48  uint32_t getBCID() const;
50  std::string printBCID() const;
51 
53  std::bitset<32> getRandomTrigBitSet() const;
55  uint32_t getRandomTrig() const;
57  std::string printRandomTrig() const;
58 
60  std::bitset<32> getPrescaledClockBitSet() const;
64  std::string printPrescaledClock() const;
65 
67  //0..11), the random trigger (bit 12,13) and prescaled clock (bit
68  //14,15)
69  void setPITWordAux( uint32_t word ) { m_pitAux = word; }
71  const std::bitset<32> & getPITWordAux() const {
72  return m_pitAux;
73  }
75  std::string printPITWordAux() const;
76 
78  void setTIP(const std::vector<uint32_t>& words);
80  const std::bitset<512> & getTIP() const {
81  return m_tip;
82  }
84  void setTIPWord( uint32_t word, uint32_t pos = 0);
86  std::string printTIP() const;
87 
88 
90  void setTBP(const std::vector<uint32_t>& words);
92  const std::bitset<512> & getTBP() const {
93  return m_tbp;
94  }
96  void setTBPWord( uint32_t word, uint32_t pos = 0);
98  std::string printTBP() const;
99 
101  void setTAP(const std::vector<uint32_t>& words);
103  void setTAPWord( uint32_t word, uint32_t pos = 0);
105  const std::bitset<512> & getTAP() const {
106  return m_tap;
107  }
109  std::string printTAP() const;
110 
112  void setTAV(const std::vector<uint32_t>& words);
114  const std::bitset<512> & getTAV() const {
115  return m_tav;
116  }
118  void setTAVWord( uint32_t word, uint32_t pos = 0);
120  std::string printTAV() const;
121 
122 private:
124  //items
125  //std::bitset<320> m_pit;
126  //std::bitset<192> m_fpi;
127  std::bitset<512> m_tip;
128  std::bitset<512> m_tbp;
129  std::bitset<512> m_tap;
130  std::bitset<512> m_tav;
132  std::bitset<32> m_pitAux;
133 
134  CTPdataformatVersion m_ctpVersion{0};
135 };
136 
137 
138 
139 
140 
141 class CTP_Decoder : public AthMessaging {
142 
169 public:
171  CTP_Decoder();
172 
174  void setRDO(const CTP_RDO* rdo);
176  const CTP_RDO* getRDO() const {
177  return m_rdo;
178  }
180  const std::vector<CTP_BC>& getBunchCrossings() {
181  return m_BCs;
182  }
184  const CTP_BC& getBunchCrossing(unsigned int pos) {
185  return m_BCs[pos];
186  }
187 
195  bool checkTrigger(unsigned int itemNo,unsigned int bcPos);
196 
207  bool checkTriggerAfterPrescale(unsigned int itemNo,unsigned int bcPos);
208 
216  std::vector<unsigned int> getAllTriggers(unsigned int bcPos);
217 
219  void dumpData() const;
220 
221 private:
223  const CTP_RDO* m_rdo{nullptr};
225  std::vector<CTP_BC> m_BCs;
226 };
227 
228 #endif
CTP_BC::dumpData
void dumpData(MsgStream &) const
Helper class to decode the CTP data for one bunch-crossing.
Definition: CTP_Decoder.cxx:201
CTP_BC::setTAPWord
void setTAPWord(uint32_t word, uint32_t pos=0)
Set TAP word number 'pos'.
Definition: CTP_Decoder.cxx:409
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:158
CTP_Decoder::getRDO
const CTP_RDO * getRDO() const
Accessor function to retrieve pointer to RDO object.
Definition: CTP_Decoder.h:176
CTP_BC::setTAVWord
void setTAVWord(uint32_t word, uint32_t pos=0)
Set TAV word number 'pos'.
Definition: CTP_Decoder.cxx:433
CTP_BC::getPITWordAux
const std::bitset< 32 > & getPITWordAux() const
Get PIT word 5 bitset.
Definition: CTP_Decoder.h:71
CTP_BC::getRandomTrigBitSet
std::bitset< 32 > getRandomTrigBitSet() const
Accessor to obtain random-trigger input bits.
Definition: CTP_Decoder.cxx:306
CTP_BC::setTBP
void setTBP(const std::vector< uint32_t > &words)
Set TBP (Trigger Before Prescales) words.
Definition: CTP_Decoder.cxx:398
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:114
CTP_BC::setCTPVersion
void setCTPVersion(unsigned int ctpVersionNumber)
Set the CTP data format version (needed before extracting any information)
Definition: CTP_Decoder.h:39
CTP_BC::m_tbp
std::bitset< 512 > m_tbp
Definition: CTP_Decoder.h:128
CTP_BC::m_tav
std::bitset< 512 > m_tav
Definition: CTP_Decoder.h:130
CTP_BC::setTBPWord
void setTBPWord(uint32_t word, uint32_t pos=0)
Set TBP word number 'pos'.
Definition: CTP_Decoder.cxx:385
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:403
CTP_BC::setTIPWord
void setTIPWord(uint32_t word, uint32_t pos=0)
Set TIP word number 'pos'.
Definition: CTP_Decoder.cxx:356
CTP_BC::printBCID
std::string printBCID() const
Return string with BCID in binary format.
Definition: CTP_Decoder.cxx:299
CTP_Decoder
Definition: CTP_Decoder.h:141
CTP_BC::printTIP
std::string printTIP() const
Obtain TIP bitpattern string (binary format)
Definition: CTP_Decoder.cxx:377
CTP_BC::getTIP
const std::bitset< 512 > & getTIP() const
get bitset of TIP words
Definition: CTP_Decoder.h:80
CTP_BC::printPrescaledClock
std::string printPrescaledClock() const
Return string with prescaled clock in binary format.
Definition: CTP_Decoder.cxx:343
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:174
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:318
CTP_BC::m_tip
std::bitset< 512 > m_tip
Bitsets containing bit-patterns of trigger inputs and trigger.
Definition: CTP_Decoder.h:127
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:421
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:69
CTP_BC::setTIP
void setTIP(const std::vector< uint32_t > &words)
Set TIP words.
Definition: CTP_Decoder.cxx:372
CTP_BC::getTAP
const std::bitset< 512 > & getTAP() const
get bitset of TAP words
Definition: CTP_Decoder.h:105
CTP_Decoder::m_BCs
std::vector< CTP_BC > m_BCs
Vector of BCs for the current event.
Definition: CTP_Decoder.h:225
CTP_BC::getTBP
const std::bitset< 512 > & getTBP() const
get bitset of TBP words
Definition: CTP_Decoder.h:92
CTP_BC::getBCID
uint32_t getBCID() const
Get BCID as unsigned integer.
Definition: CTP_Decoder.cxx:294
CTP_Decoder::m_rdo
const CTP_RDO * m_rdo
The RDO member.
Definition: CTP_Decoder.h:223
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:325
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:445
CTP_BC::getPrescaledClock
uint32_t getPrescaledClock() const
Prescaled-clock inputs as uint32_t.
Definition: CTP_Decoder.cxx:338
CTP_BC::m_tap
std::bitset< 512 > m_tap
Definition: CTP_Decoder.h:129
CTP_BC::getBCIDBitSet
std::bitset< 32 > getBCIDBitSet() const
Accessor to obtain std::bitset containing the bunch-crossing.
Definition: CTP_Decoder.cxx:279
CTP_BC::printPITWordAux
std::string printPITWordAux() const
Get auxiliary PIT word as string in binary format.
Definition: CTP_Decoder.cxx:350
CTP_BC::m_pitAux
std::bitset< 32 > m_pitAux
Contains BCID, random trigger and prescaled clock.
Definition: CTP_Decoder.h:132
AthMessaging.h
CTP_BC::printTAP
std::string printTAP() const
Obtain TAP bitpattern string (binary format)
Definition: CTP_Decoder.cxx:427
CTP_Decoder::getBunchCrossing
const CTP_BC & getBunchCrossing(unsigned int pos)
Get data of a single bunch-crossing.
Definition: CTP_Decoder.h:184
CTP_BC::printTAV
std::string printTAV() const
Obtain TAV bitpattern string (binary format)
Definition: CTP_Decoder.cxx:451
CTP_BC::m_ctpVersion
CTPdataformatVersion m_ctpVersion
Definition: CTP_Decoder.h:134
checkFileSG.words
words
Definition: checkFileSG.py:76
CTP_BC::getRandomTrig
uint32_t getRandomTrig() const
Random-trigger inputs as uint32_t.
Definition: CTP_Decoder.cxx:313
CTP_Decoder::getBunchCrossings
const std::vector< CTP_BC > & getBunchCrossings()
Get vector reference of bunch-crossing data of the current event.
Definition: CTP_Decoder.h:180