ATLAS Offline Software
Loading...
Searching...
No Matches
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
14
15class MsgStream;
16
17class CTP_BC {
18
33
34public:
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;
62 uint32_t getPrescaledClock() 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 }
74
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 }
83
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 }
95
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 }
108
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 }
117
118 void setTAVWord( uint32_t word, uint32_t pos = 0);
120 std::string printTAV() const;
121
122private:
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
141class CTP_Decoder : public AthMessaging {
142
168
169public:
171 CTP_Decoder();
172
174 void setRDO(const CTP_RDO* rdo);
176 const CTP_RDO* getRDO() const {
177 return m_rdo;
178 }
179
180 const std::vector<CTP_BC>& getBunchCrossings() {
181 return m_BCs;
182 }
183
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
221private:
223 const CTP_RDO* m_rdo{nullptr};
225 std::vector<CTP_BC> m_BCs;
226};
227
228#endif
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
void setTIPWord(uint32_t word, uint32_t pos=0)
Set TIP word number 'pos'.
std::string printTBP() const
Obtain TBP bitpattern string (binary format)
const std::bitset< 32 > & getPITWordAux() const
Get PIT word 5 bitset.
Definition CTP_Decoder.h:71
void setTAP(const std::vector< uint32_t > &words)
Set TAP (Trigger After Prescales) words.
void setTBPWord(uint32_t word, uint32_t pos=0)
Set TBP word number 'pos'.
uint32_t getBCID() const
Get BCID as unsigned integer.
void dumpData(MsgStream &) const
Helper class to decode the CTP data for one bunch-crossing.
std::string printBCID() const
Return string with BCID in binary format.
std::bitset< 32 > getPrescaledClockBitSet() const
Accessor to obtain prescaled-clock input bits.
const std::bitset< 512 > & getTBP() const
get bitset of TBP words
Definition CTP_Decoder.h:92
void setTAVWord(uint32_t word, uint32_t pos=0)
Set TAV word number 'pos'.
void setTAV(const std::vector< uint32_t > &words)
Set TAV (Trigger After Veto) words.
std::bitset< 512 > m_tip
Bitsets containing bit-patterns of trigger inputs and trigger.
void setTIP(const std::vector< uint32_t > &words)
Set TIP words.
const std::bitset< 512 > & getTAV() const
get bitset of TAV words
std::bitset< 512 > m_tav
std::bitset< 512 > m_tbp
void setTAPWord(uint32_t word, uint32_t pos=0)
Set TAP word number 'pos'.
const std::bitset< 512 > & getTIP() const
get bitset of TIP words
Definition CTP_Decoder.h:80
std::bitset< 32 > getBCIDBitSet() const
Accessor to obtain std::bitset containing the bunch-crossing.
std::string printPITWordAux() const
Get auxiliary PIT word as string in binary format.
std::string printTIP() const
Obtain TIP bitpattern string (binary format)
void setPITWordAux(uint32_t word)
Set auxiliary PIT word, which is the one containing the 12-bit BCID (bit.
Definition CTP_Decoder.h:69
std::string printTAP() const
Obtain TAP bitpattern string (binary format)
std::string printRandomTrig() const
Return string with random trigger in binary format.
std::bitset< 32 > getRandomTrigBitSet() const
Accessor to obtain random-trigger input bits.
void setCTPVersion(unsigned int ctpVersionNumber)
Set the CTP data format version (needed before extracting any information)
Definition CTP_Decoder.h:39
std::string printTAV() const
Obtain TAV bitpattern string (binary format)
uint32_t getPrescaledClock() const
Prescaled-clock inputs as uint32_t.
const std::bitset< 512 > & getTAP() const
get bitset of TAP words
CTPdataformatVersion m_ctpVersion
std::bitset< 512 > m_tap
void setTBP(const std::vector< uint32_t > &words)
Set TBP (Trigger Before Prescales) words.
uint32_t getRandomTrig() const
Random-trigger inputs as uint32_t.
std::bitset< 32 > m_pitAux
Contains BCID, random trigger and prescaled clock.
std::string printPrescaledClock() const
Return string with prescaled clock in binary format.
CTP_Decoder()
Helper class to decode the CTP data fragment.
void dumpData() const
Helper to dump data for debugging.
const std::vector< CTP_BC > & getBunchCrossings()
Get vector reference of bunch-crossing data of the current event.
bool checkTrigger(unsigned int itemNo, unsigned int bcPos)
Test the LVL1 trigger result for a certain trigger item.
const CTP_RDO * getRDO() const
Accessor function to retrieve pointer to RDO object.
bool checkTriggerAfterPrescale(unsigned int itemNo, unsigned int bcPos)
Test the LVL1 trigger result after pre-scale factors are applied, before the final trigger decision,...
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.
void setRDO(const CTP_RDO *rdo)
Set RDO and fill internal variables from the data object.
const CTP_RDO * m_rdo
The RDO member.
std::vector< CTP_BC > m_BCs
Vector of BCs for the current event.
const CTP_BC & getBunchCrossing(unsigned int pos)
Get data of a single bunch-crossing.