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

Summary of single agorithm execution. Algorithm is identified by position within parent sequence. Class stores stop and start time as encoded words from TrigMonTimer class, so timers are constructed on fly and returned by value. Class can also store (uint16_t, float) pairs of variables. More...

#include <TrigMonAlg.h>

Collaboration diagram for TrigMonAlg:

Public Member Functions

 TrigMonAlg ()
 
 TrigMonAlg (unsigned int position, bool is_cached)
 
 ~TrigMonAlg ()
 
void addTimer (const TrigMonTimer &tbeg, const TrigMonTimer &tend)
 
void addRoiId (unsigned int roiId)
 
void addWord (unsigned int word)
 
uint8_t getPosition () const
 
uint8_t getNRoi () const
 
uint8_t getRoiId (unsigned int i=0) const
 
const std::set< uint8_t > getRoiIdSet () const
 
bool isCached () const
 
bool isCalled () const
 
const std::vector< uint8_t > & getByte () const
 
const std::vector< uint32_t > & getWord () const
 
const TrigMonTimer start () const
 
const TrigMonTimer stop () const
 
double getTimer () const
 
double elapsed () const
 

Private Attributes

std::vector< uint8_t > m_byte
 
std::vector< uint32_t > m_word
 

Friends

class TrigMonAlgCnv_p1
 

Detailed Description

Summary of single agorithm execution. Algorithm is identified by position within parent sequence. Class stores stop and start time as encoded words from TrigMonTimer class, so timers are constructed on fly and returned by value. Class can also store (uint16_t, float) pairs of variables.

Author
Rustem Ospanov
Date
July 2009

Definition at line 29 of file TrigMonAlg.h.

Constructor & Destructor Documentation

◆ TrigMonAlg() [1/2]

TrigMonAlg::TrigMonAlg ( )

Definition at line 21 of file TrigMonAlg.cxx.

22  :m_byte(1, 0)
23 {
24 }

◆ TrigMonAlg() [2/2]

TrigMonAlg::TrigMonAlg ( unsigned int  position,
bool  is_cached 
)

Definition at line 27 of file TrigMonAlg.cxx.

28  :m_byte(1, 0)
29 {
30  if(position < 128) {
31  m_byte[0] = position;
32  }
33  else {
34  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "TrigMonAlg")
35  << "ctor error! Position is out of allowed range.";
36  }
37 
38  if(is_cached) {
39  //
40  // Set top bit for caching state
41  //
43  }
44 }

◆ ~TrigMonAlg()

TrigMonAlg::~TrigMonAlg ( )
inline

Definition at line 35 of file TrigMonAlg.h.

35 {}

Member Function Documentation

◆ addRoiId()

void TrigMonAlg::addRoiId ( unsigned int  roiId)

Definition at line 68 of file TrigMonAlg.cxx.

69 {
70  //
71  // Add roid id, check that id is less than 256
72  //
73  if(roi_id < 256) {
74  m_byte.push_back(static_cast<uint8_t>(roi_id));
75  }
76  else if (roi_id == 256) {
77  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "TrigMonAlg")
78  << "addRoiId error! RoiId value is out of range! (only reported for ID=256)";
79  }
80 }

◆ addTimer()

void TrigMonAlg::addTimer ( const TrigMonTimer tbeg,
const TrigMonTimer tend 
)

Definition at line 47 of file TrigMonAlg.cxx.

48 {
49  //
50  // Save start and stop time for one algorithm call
51  //
52  if(isCached()) {
53  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "TrigMonAlg")
54  << "addTimers error! Cached algorithm has no timers.";
55  return;
56  }
57  else if(!m_word.empty()) {
58  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "TrigMonAlg")
59  << "addTimers error! Timers already added!";
60  return;
61  }
62 
63  m_word.push_back(tbeg.getEncoded());
64  m_word.push_back(tend.getEncoded());
65 }

◆ addWord()

void TrigMonAlg::addWord ( unsigned int  word)

Definition at line 83 of file TrigMonAlg.cxx.

84 {
85  //
86  // Save start and stop time for one algorithm call
87  //
88  if(m_word.size() != 2 && !isCached()) {
89  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "TrigMonAlg")
90  << "addWord error! Timers must be added first.";
91  return;
92  }
93 
94  m_word.push_back(word);
95 }

◆ elapsed()

double TrigMonAlg::elapsed ( ) const
inline

Definition at line 57 of file TrigMonAlg.h.

57 { return stop().getElapsed(start()); }

◆ getByte()

const std::vector<uint8_t>& TrigMonAlg::getByte ( ) const
inline

Definition at line 50 of file TrigMonAlg.h.

50 { return m_byte; }

◆ getNRoi()

uint8_t TrigMonAlg::getNRoi ( ) const

Definition at line 107 of file TrigMonAlg.cxx.

108 {
109  //
110  // Get number of RoIs
111  //
112  return m_byte.size()-1;
113 }

◆ getPosition()

uint8_t TrigMonAlg::getPosition ( ) const

Definition at line 98 of file TrigMonAlg.cxx.

99 {
100  //
101  // Return algorithm position with top bit set to zero
102  //
103  return (m_byte[0] & AlgBits::maskPos);
104 }

◆ getRoiId()

uint8_t TrigMonAlg::getRoiId ( unsigned int  i = 0) const

Definition at line 116 of file TrigMonAlg.cxx.

117 {
118  //
119  // Return roi id
120  //
121  if(i+1 < m_byte.size()) return m_byte[i+1];
122 
123  return Trig::getRoiId_Unknown();
124 }

◆ getRoiIdSet()

const std::set< uint8_t > TrigMonAlg::getRoiIdSet ( ) const

Definition at line 127 of file TrigMonAlg.cxx.

128 {
129  //
130  // Return set of all roi ids
131  //
132  return std::set<uint8_t>(m_byte.begin()+1, m_byte.end());
133 }

◆ getTimer()

double TrigMonAlg::getTimer ( ) const
inline

Definition at line 56 of file TrigMonAlg.h.

56 { return stop().getElapsed(start()); }

◆ getWord()

const std::vector<uint32_t>& TrigMonAlg::getWord ( ) const
inline

Definition at line 51 of file TrigMonAlg.h.

51 { return m_word; }

◆ isCached()

bool TrigMonAlg::isCached ( ) const

Definition at line 136 of file TrigMonAlg.cxx.

137 {
138  //
139  // check top bit for caching state
140  //
141  return (m_byte[0] & AlgBits::maskCache);
142 }

◆ isCalled()

bool TrigMonAlg::isCalled ( ) const

Definition at line 145 of file TrigMonAlg.cxx.

146 {
147  //
148  // check top bit for caching state
149  //
150  return !isCached();
151 }

◆ start()

const TrigMonTimer TrigMonAlg::start ( ) const

Definition at line 154 of file TrigMonAlg.cxx.

155 {
156  //
157  // This function only make sense when timers exists, so first check isCalled()=false
158  //
159  if(!isCached() && m_word.size() >= 2) {
160  return TrigMonTimer(m_word[0]);
161  }
162 
163  return TrigMonTimer(0);
164 }

◆ stop()

const TrigMonTimer TrigMonAlg::stop ( ) const

Definition at line 167 of file TrigMonAlg.cxx.

168 {
169  //
170  // This function only make sense when timers exists, so first check isCalled()=true
171  //
172  if(!isCached() && m_word.size() >= 2) {
173  return TrigMonTimer(m_word[1]);
174  }
175 
176  return TrigMonTimer(0);
177 }

Friends And Related Function Documentation

◆ TrigMonAlgCnv_p1

friend class TrigMonAlgCnv_p1
friend

Definition at line 60 of file TrigMonAlg.h.

Member Data Documentation

◆ m_byte

std::vector<uint8_t> TrigMonAlg::m_byte
private

Definition at line 62 of file TrigMonAlg.h.

◆ m_word

std::vector<uint32_t> TrigMonAlg::m_word
private

Definition at line 63 of file TrigMonAlg.h.


The documentation for this class was generated from the following files:
AlgBits::maskPos
const uint32_t maskPos
Definition: TrigMonAlg.cxx:16
TrigMonAlg::isCached
bool isCached() const
Definition: TrigMonAlg.cxx:136
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
roi_id
std::vector< QString > roi_id
Definition: VP1TriggerHandleL1.cxx:38
TrigMonTimer
Definition: TrigMonTimer.h:27
python.TriggerHandler.tend
string tend
Definition: TriggerHandler.py:300
TrigMonAlg::stop
const TrigMonTimer stop() const
Definition: TrigMonAlg.cxx:167
lumiFormat.i
int i
Definition: lumiFormat.py:85
TrigMonTimer::getElapsed
double getElapsed(const TrigMonTimer &start) const
Definition: TrigMonTimer.cxx:75
TrigMonAlg::m_word
std::vector< uint32_t > m_word
Definition: TrigMonAlg.h:63
Trig::getRoiId_Unknown
uint8_t getRoiId_Unknown()
Definition: TrigMonRoi.h:89
TrigMonAlg::m_byte
std::vector< uint8_t > m_byte
Definition: TrigMonAlg.h:62
REPORT_MESSAGE_WITH_CONTEXT
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:345
AlgBits::maskCache
const uint32_t maskCache
Definition: TrigMonAlg.cxx:15
TrigMonAlg::start
const TrigMonTimer start() const
Definition: TrigMonAlg.cxx:154
TrigMonTimer::getEncoded
uint32_t getEncoded() const
Definition: TrigMonTimer.h:38