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

Caches and propagates event data to be used by monitoring algorithms. More...

#include <CostROSData.h>

Collaboration diagram for CostROSData:

Public Member Functions

void initialize (const std::map< std::string, std::vector< uint32_t >> &rosToRobMap)
 Create object based on ROS to ROB mapping. More...
 
int getBinForROS (const std::string &rosName) const
 Return cached bin for given ROS name. More...
 
std::string getROSForROB (uint32_t robId) const
 Return ROS name for given ROB. More...
 
std::vector< uint32_t > getROBForROS (const std::string &rosName) const
 Return list of ROBs name for given ROS. More...
 
std::string getROBName (uint32_t robId) const
 Create ROB name in hex string format. More...
 
unsigned getNROS () const
 Return number of saved unique ROSes. More...
 
const std::map< std::string, std::vector< uint32_t > > & getROStoROBMap () const
 Return ROS name to ROB ids map. More...
 
const std::map< uint32_t, std::string > & getROBtoROSMap () const
 Return ROB id to ROS name map. More...
 
MsgStream & msg () const
 Logging. More...
 
MsgStream & msg (const MSG::Level lvl) const
 Logging on a given level. More...
 
bool msgLvl (const MSG::Level lvl) const
 Returns if requested level is same or higher than logging level. More...
 

Private Attributes

std::map< std::string, std::vector< uint32_t > > m_rosToRob
 Mapping of ROS corresponding to ROB requests. More...
 
std::map< uint32_t, std::string > m_robToRos
 Mapping of ROB corresponding to ROS. More...
 
std::map< std::string, int > m_rosIdToBin
 Cached mapping of ros id to bin in ROS histograms. More...
 
boost::thread_specific_ptr< MsgStream > m_msgStream
 

Detailed Description

Caches and propagates event data to be used by monitoring algorithms.

The cache is created on passed rosToRob map

Definition at line 24 of file CostROSData.h.

Member Function Documentation

◆ getBinForROS()

int CostROSData::getBinForROS ( const std::string &  rosName) const

Return cached bin for given ROS name.

Parameters
[in]rosNameROS name
Returns
Bin number or -1 if not found

Definition at line 26 of file CostROSData.cxx.

26  {
27  try {
28  return m_rosIdToBin.at(rosName);
29  } catch (const std::out_of_range& e) {
30  ATH_MSG_DEBUG("Bin for ROS " << rosName << " not found");
31  return -1;
32  }
33 }

◆ getNROS()

unsigned CostROSData::getNROS ( ) const
inline

Return number of saved unique ROSes.

Returns
Number of ROSes

Definition at line 64 of file CostROSData.h.

64 {return m_rosIdToBin.size();}

◆ getROBForROS()

std::vector< uint32_t > CostROSData::getROBForROS ( const std::string &  rosName) const

Return list of ROBs name for given ROS.

Parameters
[in]rosNameROS name
Returns
List of ROBs

Definition at line 45 of file CostROSData.cxx.

45  {
46  try {
47  return m_rosToRob.at(rosName);
48  } catch (const std::out_of_range& e) {
49  ATH_MSG_DEBUG("ROBs for ROS " << rosName << " not found");
50  return std::vector<uint32_t>();
51  }
52 }

◆ getROBName()

std::string CostROSData::getROBName ( uint32_t  robId) const

Create ROB name in hex string format.

Parameters
[in]robIdROB id
Returns
ROB id saved in hexadecimal representation

Definition at line 54 of file CostROSData.cxx.

54  {
55  std::stringstream robName;
56  robName << "0x" << std::hex << robId;
57  return robName.str();
58 }

◆ getROBtoROSMap()

const std::map<uint32_t, std::string>& CostROSData::getROBtoROSMap ( ) const
inline

Return ROB id to ROS name map.

Returns
ROB id to ROS name map

Definition at line 76 of file CostROSData.h.

76 {return m_robToRos;}

◆ getROSForROB()

std::string CostROSData::getROSForROB ( uint32_t  robId) const

Return ROS name for given ROB.

Parameters
[in]robIdROB id
Returns
ROS name

Definition at line 36 of file CostROSData.cxx.

36  {
37  try {
38  return m_robToRos.at(robId);
39  } catch (const std::out_of_range& e) {
40  ATH_MSG_DEBUG("ROS for ROB " << getROBName(robId) << " not found");
41  return "";
42  }
43 }

◆ getROStoROBMap()

const std::map<std::string, std::vector<uint32_t> >& CostROSData::getROStoROBMap ( ) const
inline

Return ROS name to ROB ids map.

Returns
ROS name to ROB ids map

Definition at line 70 of file CostROSData.h.

70 {return m_rosToRob;}

◆ initialize()

void CostROSData::initialize ( const std::map< std::string, std::vector< uint32_t >> &  rosToRobMap)

Create object based on ROS to ROB mapping.

Definition at line 8 of file CostROSData.cxx.

8  {
9 
10  unsigned rosCounter = 0;
11 
12  for (const auto& rosRequest : rosToRobMap) {
13  for (uint32_t robId : rosRequest.second) {
14  m_robToRos[robId] = rosRequest.first;
15  }
16  m_rosIdToBin[rosRequest.first] = rosCounter;
17  ++rosCounter;
18  }
19 
20  m_rosToRob = rosToRobMap;
21 
22  m_msgStream.reset(new MsgStream(nullptr, "CostROSData"));
23 }

◆ msg() [1/2]

MsgStream & CostROSData::msg ( ) const

Logging.

Returns
Message stream reference.

Definition at line 60 of file CostROSData.cxx.

60  {
61  return *m_msgStream;
62 }

◆ msg() [2/2]

MsgStream & CostROSData::msg ( const MSG::Level  lvl) const

Logging on a given level.

Parameters
[in]lvlVerbosity level
Returns
Message stream reference.

Definition at line 64 of file CostROSData.cxx.

64  {
65  return *m_msgStream << lvl;
66 }

◆ msgLvl()

bool CostROSData::msgLvl ( const MSG::Level  lvl) const

Returns if requested level is same or higher than logging level.

Parameters
[in]lvlVerbosity level
Returns
If requested level is same or higher than logging level

Definition at line 68 of file CostROSData.cxx.

68  {
69  return lvl >= m_msgStream->level();
70 }

Member Data Documentation

◆ m_msgStream

boost::thread_specific_ptr<MsgStream> CostROSData::m_msgStream
mutableprivate

Definition at line 103 of file CostROSData.h.

◆ m_robToRos

std::map<uint32_t, std::string> CostROSData::m_robToRos
private

Mapping of ROB corresponding to ROS.

Definition at line 100 of file CostROSData.h.

◆ m_rosIdToBin

std::map<std::string, int> CostROSData::m_rosIdToBin
private

Cached mapping of ros id to bin in ROS histograms.

Definition at line 101 of file CostROSData.h.

◆ m_rosToRob

std::map<std::string, std::vector<uint32_t> > CostROSData::m_rosToRob
private

Mapping of ROS corresponding to ROB requests.

Definition at line 99 of file CostROSData.h.


The documentation for this class was generated from the following files:
CostROSData::m_rosIdToBin
std::map< std::string, int > m_rosIdToBin
Cached mapping of ros id to bin in ROS histograms.
Definition: CostROSData.h:101
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
CostROSData::m_rosToRob
std::map< std::string, std::vector< uint32_t > > m_rosToRob
Mapping of ROS corresponding to ROB requests.
Definition: CostROSData.h:99
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CostROSData::getROBName
std::string getROBName(uint32_t robId) const
Create ROB name in hex string format.
Definition: CostROSData.cxx:54
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
CostROSData::m_msgStream
boost::thread_specific_ptr< MsgStream > m_msgStream
Definition: CostROSData.h:103
CostROSData::m_robToRos
std::map< uint32_t, std::string > m_robToRos
Mapping of ROB corresponding to ROS.
Definition: CostROSData.h:100