ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CTP_Decoder Class Reference

#include <CTP_Decoder.h>

Inheritance diagram for CTP_Decoder:
Collaboration diagram for CTP_Decoder:

Public Member Functions

 CTP_Decoder ()
 Helper class to decode the CTP data fragment. More...
 
void setRDO (const CTP_RDO *rdo)
 Set RDO and fill internal variables from the data object. More...
 
const CTP_RDOgetRDO () const
 Accessor function to retrieve pointer to RDO object. More...
 
const std::vector< CTP_BC > & getBunchCrossings ()
 Get vector reference of bunch-crossing data of the current event. More...
 
const CTP_BCgetBunchCrossing (unsigned int pos)
 Get data of a single bunch-crossing. More...
 
bool checkTrigger (unsigned int itemNo, unsigned int bcPos)
 Test the LVL1 trigger result for a certain trigger item. More...
 
bool checkTriggerAfterPrescale (unsigned int itemNo, unsigned int bcPos)
 Test the LVL1 trigger result after pre-scale factors are applied, before the final trigger decision, which includes the trigger masks, is taken. More...
 
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. More...
 
void dumpData () const
 Helper to dump data for debugging. More...
 
bool msgLvl (const MSG::Level lvl) const
 Test the output level. More...
 
MsgStream & msg () const
 The standard message stream. More...
 
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream. More...
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Private Member Functions

void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

const CTP_RDOm_rdo
 The RDO member. More...
 
std::vector< CTP_BCm_BCs
 Vector of BCs for the current event. More...
 
std::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

Detailed Description

Definition at line 142 of file CTP_Decoder.h.

Constructor & Destructor Documentation

◆ CTP_Decoder()

CTP_Decoder::CTP_Decoder ( )

Helper class to decode the CTP data fragment.

Date
2007-07-10 14:58:38
   The CTP ROD data fragment contains the LVL1 trigger
   inputs (160 PITs), and the final trigger result in three
   stages, before pre-scale factors, after pre-scale
   factors, and after veto (dead-time, busy). All of these
   trigger bits can be stored for a number of
   bunch-crossings (BCs), up to 63, where the L1A can be
   almost anywhere within this window. 

   In addition, the GPS time-stamp of the LVL1 trigger
   decision is stored as part of the data fragment.
See also
CTP_RDO
Author
David Berge berge.nosp@m.@cer.nosp@m.n.ch
Eleanor Dobson elean.nosp@m.or.d.nosp@m.obson.nosp@m.@cer.nosp@m.n.ch
Version
$ $ Default constructor

Definition at line 15 of file CTP_Decoder.cxx.

15  :
16  AthMessaging(Athena::getMessageSvc(), "CTP_Decoder")
17 {
18 }

Member Function Documentation

◆ checkTrigger()

bool CTP_Decoder::checkTrigger ( unsigned int  itemNo,
unsigned int  bcPos 
)

Test the LVL1 trigger result for a certain trigger item.

Parameters
itemNoThe trigger item that shall be tested
bcPosThe bunch-crossing in the readout window that is to be checked
Returns
A boolean value is returned indicating whether or not the trigger item has fired for a given event

Definition at line 143 of file CTP_Decoder.cxx.

144 {
145  if(pos >= m_BCs.size()) {
146  ATH_MSG_WARNING("Trying to access bunch crossing no "
147  << pos << ", but in the event are only " << m_BCs.size());
148  }
149  if(itemNo >= getBunchCrossing(pos).getTAV().size()) {
150  ATH_MSG_WARNING("Checking item no " << itemNo
151  << ", which is more than the maximum : "
152  << getBunchCrossing(pos).getTAV().size());
153  }
154  return getBunchCrossing(pos).getTAV().test(itemNo);
155 }

◆ checkTriggerAfterPrescale()

bool CTP_Decoder::checkTriggerAfterPrescale ( unsigned int  itemNo,
unsigned int  bcPos 
)

Test the LVL1 trigger result after pre-scale factors are applied, before the final trigger decision, which includes the trigger masks, is taken.

Here one sees all triggers of an event, irrespective of the trigger mask.

Parameters
itemNoThe trigger item that shall be tested
bcPosThe bunch-crossing in the readout window that is to be checked
Returns
A boolean value is returned indicating whether or not the trigger item is on before the veto step for a given event

Definition at line 157 of file CTP_Decoder.cxx.

157  {
158  if(pos >= m_BCs.size()) {
159  ATH_MSG_WARNING("Trying to access bunch crossing no "
160  << pos << ", but in the event are only " << m_BCs.size());
161  }
162  if(itemNo >= getBunchCrossing(pos).getTAP().size()) {
163  ATH_MSG_WARNING("Checking item no " << itemNo
164  << ", which is more than the maximum : "
165  << getBunchCrossing(pos).getTAP().size());
166  }
167  return getBunchCrossing(pos).getTAP().test(itemNo);
168 }

◆ dumpData()

void CTP_Decoder::dumpData ( ) const

Helper to dump data for debugging.

Definition at line 107 of file CTP_Decoder.cxx.

108 {
109  unsigned int nBunches = m_rdo->getNumberOfBunches();
110  unsigned int vecSize = m_BCs.size();
111 
112  if(nBunches == 0) {
113  ATH_MSG_DEBUG("CTP_RDO empty");
114  return;
115  }
116 
117  if(nBunches != vecSize) {
118  ATH_MSG_ERROR("mismatch: " << nBunches << " bunches, but vector size is " << vecSize);
119  }
120 
121  if( msgLvl(MSG::DEBUG) ){
122  msg() << MSG::DEBUG << "=================================================" << endmsg;
123  msg() << MSG::DEBUG << "Event dump" << endmsg;
124  msg() << MSG::DEBUG << "Time " << m_rdo->getTimeSec() << "s "
125  << std::setw(10) << std::setiosflags(std::ios_base::right) << std::setfill(' ')
126  << m_rdo->getTimeNanoSec() << std::resetiosflags(std::ios_base::right)
127  << "ns" << endmsg;
128  msg() << MSG::DEBUG << "Number of bunches: " << nBunches
129  << " (BC vector size " << vecSize << ")" << endmsg;
130  msg() << MSG::DEBUG << "L1A position: " << m_rdo->getL1AcceptBunchPosition() << endmsg;
131  }
132 
133  for(unsigned int i = 0; i<vecSize; ++i) {
134  ATH_MSG_DEBUG("Now dumping BC " << i);
135  m_BCs[i].dumpData(msg());
136  }
137 
138  ATH_MSG_DEBUG("=================================================");
139 }

◆ getAllTriggers()

std::vector< unsigned int > CTP_Decoder::getAllTriggers ( unsigned int  bcPos)

Function to obtain a vector with the numbers of the trigger items that fired for the current event.

Parameters
bcPosThe bunch-crossing in the readout window that is to be used
Returns
A vector<unsigned int> with the list of trigger items that fired in the event (trigger-item numbers run from 1 to 256 for run-I and from 1 to 512 for run-II).

Definition at line 172 of file CTP_Decoder.cxx.

172  {
173  if(pos >= m_BCs.size()) {
174  ATH_MSG_WARNING("Trying to access bunch crossing no "
175  << pos << ", but in the event are only " << m_BCs.size());
176  return std::vector<unsigned int>();
177  }
178  std::vector<unsigned int> triggers;
179  const CTP_BC& bc = getBunchCrossing(pos);
180  if(bc.getTAV().any()) {
181  for(unsigned int i = 0; i < bc.getTAV().size() ; ++i) {
182  if(bc.getTAV().test(i)) {
183  triggers.push_back(i+1);
184  }
185  }
186  }
187  return triggers;
188 }

◆ getBunchCrossing()

const CTP_BC& CTP_Decoder::getBunchCrossing ( unsigned int  pos)
inline

Get data of a single bunch-crossing.

Definition at line 185 of file CTP_Decoder.h.

185  {
186  return m_BCs[pos];
187  }

◆ getBunchCrossings()

const std::vector<CTP_BC>& CTP_Decoder::getBunchCrossings ( )
inline

Get vector reference of bunch-crossing data of the current event.

Definition at line 181 of file CTP_Decoder.h.

181  {
182  return m_BCs;
183  }

◆ getRDO()

const CTP_RDO* CTP_Decoder::getRDO ( ) const
inline

Accessor function to retrieve pointer to RDO object.

Definition at line 177 of file CTP_Decoder.h.

177  {
178  return m_rdo;
179  }

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40 {
42  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 164 of file AthMessaging.h.

165 {
166  MsgStream* ms = m_msg_tls.get();
167  if (!ms) {
168  if (!m_initialized.test_and_set()) initMessaging();
169  ms = new MsgStream(m_imsg,m_nm);
170  m_msg_tls.reset( ms );
171  }
172 
173  ms->setLevel (m_lvl);
174  return *ms;
175 }

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level  lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 179 of file AthMessaging.h.

180 { return msg() << lvl; }

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152 {
153  if (!m_initialized.test_and_set()) initMessaging();
154  if (m_lvl <= lvl) {
155  msg() << lvl;
156  return true;
157  } else {
158  return false;
159  }
160 }

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level  lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29 {
30  m_lvl = lvl;
31 }

◆ setRDO()

void CTP_Decoder::setRDO ( const CTP_RDO rdo)

Set RDO and fill internal variables from the data object.

Definition at line 20 of file CTP_Decoder.cxx.

21 {
22  m_rdo = rdo;
23  unsigned int ctpVersionNumber = m_rdo->getCTPVersionNumber();
24  CTPdataformatVersion ctpVersion(ctpVersionNumber);
25 
26  unsigned int nBunches = rdo->getNumberOfBunches();
27  ATH_MSG_DEBUG("setRDO> #bunches: " << nBunches << ", ctp version (found in RDO): " << ctpVersionNumber);
28  ATH_MSG_VERBOSE(ctpVersion.dump());
29 
30  m_BCs.clear();
31  m_BCs.resize(nBunches);
32  for (CTP_BC& bc : m_BCs) {
33  bc.setCTPVersion(ctpVersionNumber);
34  }
35 
36  //std::vector<uint32_t> PITs = rdo->getPITWords();
37  //std::vector<uint32_t> FPIs = rdo->getFPIWords();
38  const std::vector<uint32_t> & TIPs = rdo->getTIPWords();
39  const std::vector<uint32_t> & TBPs = rdo->getTBPWords();
40  const std::vector<uint32_t> & TAPs = rdo->getTAPWords();
41  const std::vector<uint32_t> & TAVs = rdo->getTAVWords();
42 
43  if( nBunches * ctpVersion.getTIPwords() != TIPs.size() ) {
44  ATH_MSG_FATAL("Expected " << nBunches * ctpVersion.getTIPwords() << " TIP words, but TIP vector has size " << TIPs.size());
45  } else {
46  ATH_MSG_DEBUG(TIPs.size() << " TIP words as expected");
47  }
48  if( nBunches * ctpVersion.getTBPwords() != TBPs.size() ) {
49  ATH_MSG_FATAL(nBunches * ctpVersion.getTBPwords() << " TBP words, but TBP vector has size " << TBPs.size());
50  } else {
51  ATH_MSG_DEBUG(TBPs.size() << " TBP words as expected");
52  }
53  if( nBunches * ctpVersion.getTAPwords() != TAPs.size() ) {
54  ATH_MSG_FATAL(nBunches * ctpVersion.getTAPwords() << " TAP words, but TAP vector has size " << TAPs.size());
55  } else {
56  ATH_MSG_DEBUG(TAPs.size() << " TAP words as expected");
57  }
58  if( nBunches * ctpVersion.getTAVwords() != TAVs.size() ) {
59  ATH_MSG_FATAL(nBunches * ctpVersion.getTAVwords() << " TAV words, but TAV vector has size " << TAVs.size());
60  } else {
61  ATH_MSG_DEBUG(TAVs.size() << " TAV words as expected");
62  }
63 
64 
65  for(unsigned int i = 0 ; i < nBunches ; ++i) {
66 
67  ATH_MSG_DEBUG(i << " from CTP_RDO to internal bitsets");
68 
69  for(unsigned int tip = 0; tip < ctpVersion.getTIPwords(); ++tip) {
70  unsigned int index = i*ctpVersion.getTIPwords() + tip;
71  if(index >= TIPs.size()) {
72  ATH_MSG_FATAL("Invalid TIP position " << index);
73  return;
74  }
75  m_BCs[i].setTIPWord(TIPs[index],tip); //sets m_tip
76  }
77 
78  for(unsigned int tbp = 0; tbp < ctpVersion.getTBPwords(); ++tbp) {
79  unsigned int index = i * ctpVersion.getTBPwords() + tbp;
80  if(index >= TBPs.size()) {
81  ATH_MSG_FATAL("Invalid TBP position " << index);
82  return;
83  }
84  m_BCs[i].setTBPWord(TBPs[index],tbp); //sets m_tbp
85  }
86 
87  for(unsigned int tap = 0; tap < ctpVersion.getTAPwords(); ++tap) {
88  unsigned int index = i * ctpVersion.getTAPwords() + tap;
89  if(index >= TAPs.size()) {
90  ATH_MSG_FATAL("Invalid TAP position " << index);
91  return;
92  }
93  m_BCs[i].setTAPWord(TAPs[index],tap); //sets m_tap
94  }
95 
96  for(unsigned int tav = 0; tav < ctpVersion.getTAVwords(); ++tav) {
97  unsigned int index = i * ctpVersion.getTAVwords() + tav;
98  if(index >= TAVs.size()) {
99  ATH_MSG_FATAL("Invalid TAV position " << index);
100  return;
101  }
102  m_BCs[i].setTAVWord(TAVs[index],tav); //set m_tav
103  }
104  }
105 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_BCs

std::vector<CTP_BC> CTP_Decoder::m_BCs
private

Vector of BCs for the current event.

Definition at line 226 of file CTP_Decoder.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_rdo

const CTP_RDO* CTP_Decoder::m_rdo
private

The RDO member.

Definition at line 224 of file CTP_Decoder.h.


The documentation for this class was generated from the following files:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
CTP_BC::getTAV
const std::bitset< 512 > & getTAV() const
get bitset of TAV words
Definition: CTP_Decoder.h:115
index
Definition: index.py:1
python.TrigTLAMonitorAlgorithm.triggers
triggers
Definition: TrigTLAMonitorAlgorithm.py:196
CTP_RDO::getCTPVersionNumber
unsigned int getCTPVersionNumber() const
Definition: CTP_RDO.h:64
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
xAOD::tap
setBGCode tap
Definition: TrigDecision_v1.cxx:43
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
CTP_RDO::getNumberOfBunches
uint32_t getNumberOfBunches() const
Definition: CTP_RDO.cxx:89
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
AthMessaging::AthMessaging
AthMessaging()
Default constructor:
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
AthMessaging::msgLvl
bool msgLvl(const MSG::Level lvl) const
Test the output level.
Definition: AthMessaging.h:151
lumiFormat.i
int i
Definition: lumiFormat.py:85
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CTP_BC
Definition: CTP_Decoder.h:17
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
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_Decoder::m_rdo
const CTP_RDO * m_rdo
The RDO member.
Definition: CTP_Decoder.h:224
CTP_RDO::getL1AcceptBunchPosition
uint32_t getL1AcceptBunchPosition() const
Definition: CTP_RDO.cxx:94
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
CTP_RDO::getTAVWords
std::vector< uint32_t > getTAVWords() const
Definition: CTP_RDO.cxx:216
CTP_RDO::getTBPWords
std::vector< uint32_t > getTBPWords() const
Definition: CTP_RDO.cxx:206
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
DEBUG
#define DEBUG
Definition: page_access.h:11
CTP_Decoder::getBunchCrossing
const CTP_BC & getBunchCrossing(unsigned int pos)
Get data of a single bunch-crossing.
Definition: CTP_Decoder.h:185
AthMessaging::initMessaging
void initMessaging() const
Initialize our message level and MessageSvc.
Definition: AthMessaging.cxx:39
AthMessaging::m_msg_tls
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
Definition: AthMessaging.h:132
CTP_RDO::getTIPWords
std::vector< uint32_t > getTIPWords() const
Definition: CTP_RDO.cxx:201
CTP_RDO::getTimeNanoSec
uint32_t getTimeNanoSec() const
Definition: CTP_RDO.cxx:83
CTP_RDO::getTAPWords
std::vector< uint32_t > getTAPWords() const
Definition: CTP_RDO.cxx:211
CTP_RDO::getTimeSec
uint32_t getTimeSec() const
Definition: CTP_RDO.cxx:77