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

A Flag is an ordered collection of bits (vector<bool>) that can hold additional (boolean) information about a trigger object. More...

#include <TrigPassFlags.h>

Collaboration diagram for TrigPassFlags:

Public Member Functions

 TrigPassFlags ()
 
 TrigPassFlags (const unsigned int size, const unsigned int flagSize, const void *cont=0)
 Constructor to be used by the HLT algorithms Initialized the flags vector. More...
 
void setFlagBit (const unsigned int position, const unsigned int bitPosition, const bool bitValue, const void *cont=0)
 Set bit of the flag at index position. More...
 
void setFlag (const unsigned int position, const std::vector< bool > &flag, const void *cont=0)
 Set the flag at index position. More...
 
bool getFlagBit (const unsigned int position, const unsigned int bitPosition) const
 Returns the bit 'bitPosition' of the flag at index position. More...
 
const std::vector< bool > & getFlag (const unsigned int position) const
 Returns the flag (vector<bool>) at index position. More...
 
unsigned int size () const
 gets size of the container object vector More...
 
unsigned int flagSize () const
 gets size of the flag vector for the object at index More...
 

Private Attributes

const void * m_container_ptr
 
std::vector< std::vector< bool > > m_flagsPerObject
 list of trainsient n-bit value (STL docu assures that a vector of booleans is efficient) More...
 

Friends

class TrigPassFlagsCnv_p1
 

Detailed Description

A Flag is an ordered collection of bits (vector<bool>) that can hold additional (boolean) information about a trigger object.

This information can be stored by a Hypo algorithm, together with the trigger object in the same TE. Since trigger objects are often stored within a container in the TE, the TrigPassFlags class acts a container for the corresponding flags.

Note that all flags witin a TrigPassFlags object have to be of the same size (given as parameter flagSize in the constructor)

Warning
Hypo algorithms should use the helper functions (see below) to modify the TrigPassFlags content

Definition at line 29 of file TrigPassFlags.h.

Constructor & Destructor Documentation

◆ TrigPassFlags() [1/2]

TrigPassFlags::TrigPassFlags ( )

Definition at line 8 of file TrigPassFlags.cxx.

9  : m_container_ptr(0) {}

◆ TrigPassFlags() [2/2]

TrigPassFlags::TrigPassFlags ( const unsigned int  size,
const unsigned int  flagSize,
const void *  cont = 0 
)

Constructor to be used by the HLT algorithms Initialized the flags vector.

Parameters
sizethe size of container for which the flags will be recorded. This determines the length of the outer vector<vector<bool> > of m_flagsPerObject.
flagSizethe size of the flags. This determines the length of the inner vector<bool> m_flagsPerObject.
contpointer to the container, if given then the member functions will be performing additional check if the bits setting is the same (desired initailly container)

Definition at line 11 of file TrigPassFlags.cxx.

12  : m_container_ptr(cont) {
13  std::vector<bool> temp(flagSize,false);
14  m_flagsPerObject.resize(size,temp);
15 }

Member Function Documentation

◆ flagSize()

unsigned int TrigPassFlags::flagSize ( ) const
inline

gets size of the flag vector for the object at index

Definition at line 78 of file TrigPassFlags.h.

78 { return m_flagsPerObject[0].size(); }

◆ getFlag()

const std::vector< bool > & TrigPassFlags::getFlag ( const unsigned int  position) const

Returns the flag (vector<bool>) at index position.

Warning
Hypo algorithms should use the helper function HLT::getFlag (see below) to access the TrigPassFlags

Definition at line 54 of file TrigPassFlags.cxx.

54  {
55  if ( position >= size() )
56  throw std::runtime_error("Specified object position is larger than the size of the TrigPassFlags objects.");
57 
58  return m_flagsPerObject[position];
59 }

◆ getFlagBit()

bool TrigPassFlags::getFlagBit ( const unsigned int  position,
const unsigned int  bitPosition 
) const

Returns the bit 'bitPosition' of the flag at index position.

Warning
Hypo algorithms should use the helper function HLT::getFlagBit (see below) to access the TrigPassFlags

Definition at line 44 of file TrigPassFlags.cxx.

44  {
45  if ( position >= size() )
46  throw std::runtime_error("Specified object position is larger than the size of the TrigPassFlags objects.");
47 
48  if ( bitPosition >= flagSize() )
49  throw std::runtime_error("Specified bitPosition is larger than the flag size.");
50 
51  return m_flagsPerObject[position][bitPosition];
52 }

◆ setFlag()

void TrigPassFlags::setFlag ( const unsigned int  position,
const std::vector< bool > &  flag,
const void *  cont = 0 
)

Set the flag at index position.

Parameters
positionpostion of the flag in the vector of flags
flagValuevalue of the flag (can be used if flagSize is smaller than sizeof(int)
Warning
Hypo algorithms should use the helper function HLT::setFlag (see below) to modify the TrigPassFlags

Definition at line 31 of file TrigPassFlags.cxx.

31  {
32  if (m_container_ptr && cont != m_container_ptr)
33  throw std::runtime_error("Passed container does not match the container that created this TrigPassFlags. No flag set.");
34 
35  if ( position >= size() )
36  throw std::runtime_error("Specified flag position is larger than the size of the TrigPassFlags object. No flag set.");
37 
38  if ( flag.size() != flagSize() )
39  throw std::runtime_error("Size of specified flag is different from the flag size of the TrigPassFlags object. No flag set.");
40 
41  m_flagsPerObject[position] = flag;
42 }

◆ setFlagBit()

void TrigPassFlags::setFlagBit ( const unsigned int  position,
const unsigned int  bitPosition,
const bool  bitValue,
const void *  cont = 0 
)

Set bit of the flag at index position.

Parameters
positionpostion of the flag in the vector of flags
bitPositionposition of the bit within the flag
bitValueenable/disable the bit
Warning
Hypo algorithms should use the helper function HLT::setFlagBit (see below) to modify the TrigPassFlags

Definition at line 18 of file TrigPassFlags.cxx.

18  {
19  if (m_container_ptr && cont != m_container_ptr)
20  throw std::runtime_error("Passed container does not match the container that created this TrigPassFlags. No flag bit set.");
21 
22  if ( position >= size() )
23  throw std::runtime_error("Specified flag position is larger than the size of the TrigPassFlags object. No flag bit set.");
24 
25  if ( bitPosition >= flagSize() )
26  throw std::runtime_error("Specified bitPosition is larger than the flag size. No flag bit set.");
27 
28  m_flagsPerObject[position][bitPosition] = bitValue;
29 }

◆ size()

unsigned int TrigPassFlags::size ( ) const
inline

gets size of the container object vector

Definition at line 73 of file TrigPassFlags.h.

73 { return m_flagsPerObject.size(); }

Friends And Related Function Documentation

◆ TrigPassFlagsCnv_p1

friend class TrigPassFlagsCnv_p1
friend

Definition at line 81 of file TrigPassFlags.h.

Member Data Documentation

◆ m_container_ptr

const void* TrigPassFlags::m_container_ptr
private

Definition at line 83 of file TrigPassFlags.h.

◆ m_flagsPerObject

std::vector<std::vector<bool> > TrigPassFlags::m_flagsPerObject
private

list of trainsient n-bit value (STL docu assures that a vector of booleans is efficient)

Definition at line 84 of file TrigPassFlags.h.


The documentation for this class was generated from the following files:
TrigPassFlags::size
unsigned int size() const
gets size of the container object vector
Definition: TrigPassFlags.h:73
master.flag
bool flag
Definition: master.py:29
TrigPassFlags::flagSize
unsigned int flagSize() const
gets size of the flag vector for the object at index
Definition: TrigPassFlags.h:78
TrigPassFlags::m_container_ptr
const void * m_container_ptr
Definition: TrigPassFlags.h:83
TrigPassFlags::m_flagsPerObject
std::vector< std::vector< bool > > m_flagsPerObject
list of trainsient n-bit value (STL docu assures that a vector of booleans is efficient)
Definition: TrigPassFlags.h:84