ATLAS Offline Software
CostData.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRIGCOSTANALYSIS_COSTDATA_H
6 #define TRIGCOSTANALYSIS_COSTDATA_H 1
7 
8 #include "GaudiKernel/StatusCode.h"
10 #include "TrigConfData/HLTChain.h"
12 
13 #include "CostROSData.h"
14 
15 #include <map>
16 #include <vector>
17 
26 class CostData {
27  public:
31  CostData();
32 
36  ~CostData() = default;
37 
41  CostData& operator=(const CostData&) = delete;
42 
46  CostData(const CostData&) = delete;
47 
52 
57 
62 
66  const CostROSData& costROSData() const;
67 
72 
76  const std::map<std::string, std::set<size_t>>& chainToAlgMap() const;
77 
81  void setChainToAlgMap( const std::map<std::string, std::set<size_t>>& algToChains );
82 
86  const std::map<std::string, std::set<size_t>>& chainToUniqAlgMap() const;
87 
91  void setChainToUniqAlgMap( const std::map<std::string, std::set<size_t>>& algToChains );
92 
96  const std::map<std::string, std::map<int16_t, std::set<size_t>>>& sequencersMap() const;
97 
101  void setSequencersMap( const std::map<std::string, std::map<int16_t, std::set<size_t>>>& seqToAlg );
102 
106  const std::vector<TrigCompositeUtils::AlgToChainTool::ChainInfo>& seededChains() const;
107 
111  void setSeededChains(const std::vector<TrigCompositeUtils::AlgToChainTool::ChainInfo>& seededChains);
112 
116  const std::map<size_t, std::vector<size_t>>& algToRequestMap() const;
117 
121  void setLb(uint32_t lb);
122 
126  void setOnlineSlot(uint32_t slot);
127 
131  void setLivetime(float time, bool liveTimeIsPerEvent);
132 
137  float liveTime() const;
138 
143  bool liveTimeIsPerEvent() const;
144 
149  uint32_t lb() const;
150 
154  uint32_t onlineSlot() const;
155 
159  bool isMasterSlot() const;
160 
165  float algTotalTimeMilliSec() const;
166 
167 
171  const std::string& algNameToClassType(size_t algNameHash) const;
172 
177  void setTypeMap( const std::unordered_map<uint32_t, std::string>& typeMap );
178 
179  private:
180 
185  StatusCode cache();
186 
190  float m_liveTime;
194  const std::unordered_map<uint32_t, std::string>* m_typeMapPtr;
195  std::map<size_t, std::vector<size_t>> m_algToRos;
196  const CostROSData* m_costROSData = nullptr;
197  const std::map<std::string, std::set<size_t>>* m_chainToAlgIdx = nullptr;
198  const std::map<std::string, std::set<size_t>>* m_chainToUniqAlgIdx = nullptr;
199  const std::map<std::string, std::map<int16_t, std::set<size_t>>>* m_sequencers = nullptr;
200  const std::vector<TrigCompositeUtils::AlgToChainTool::ChainInfo>* m_seededChains = nullptr;
201 
202 };
203 
204 #endif // TRIGCOSTANALYSIS_COSTDATA_H
CostROSData.h
CostData::setSequencersMap
void setSequencersMap(const std::map< std::string, std::map< int16_t, std::set< size_t >>> &seqToAlg)
Set the sequence to alg idx map.
Definition: CostData.cxx:142
CostData::m_rosCollection
const xAOD::TrigCompositeContainer * m_rosCollection
Cached non-owning pointer to ros cost collection.
Definition: CostData.h:188
CostData::sequencersMap
const std::map< std::string, std::map< int16_t, std::set< size_t > > > & sequencersMap() const
Getter of the sequence to alg idx map.
Definition: CostData.cxx:155
CostData::m_seededChains
const std::vector< TrigCompositeUtils::AlgToChainTool::ChainInfo > * m_seededChains
Set of seeded chains to monitor.
Definition: CostData.h:200
CostData::isMasterSlot
bool isMasterSlot() const
Definition: CostData.cxx:107
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
CostData::liveTime
float liveTime() const
Getter of effective P1 walltime represented by either the current event, or the current lumi block.
Definition: CostData.cxx:112
CostData::setTypeMap
void setTypeMap(const std::unordered_map< uint32_t, std::string > &typeMap)
Set internal type map pointer.
Definition: CostData.cxx:130
CostData::~CostData
~CostData()=default
Default destructor.
CostData::chainToUniqAlgMap
const std::map< std::string, std::set< size_t > > & chainToUniqAlgMap() const
Getter of the chain to its unique alg names map.
Definition: CostData.cxx:151
HLTChain.h
CostData::CostData
CostData(const CostData &)=delete
Forbid copy.
CostData::m_slot
uint32_t m_slot
Current online slot number.
Definition: CostData.h:192
CostData::algNameToClassType
const std::string & algNameToClassType(size_t algNameHash) const
Get the class typename given an algorithm instance name.
Definition: CostData.cxx:117
xAOD::int16_t
setScaleOne setStatusOne setSaturated int16_t
Definition: gFexGlobalRoI_v1.cxx:55
CostData::set
StatusCode set(const xAOD::TrigCompositeContainer *costCollection, const xAOD::TrigCompositeContainer *rosCollection, uint32_t onlineSlot)
Cache the cost and ros collections, after formally requesting it from storegate.
Definition: CostData.cxx:20
CostData::m_costROSData
const CostROSData * m_costROSData
Helper class to store ROS to ROB mapping.
Definition: CostData.h:196
CostData::setLb
void setLb(uint32_t lb)
Setter of effective P1 walltime represented by the current event.
Definition: CostData.cxx:53
CostData::seededChains
const std::vector< TrigCompositeUtils::AlgToChainTool::ChainInfo > & seededChains() const
Getter of the seeded chains set.
Definition: CostData.cxx:159
CostData::m_sequencers
const std::map< std::string, std::map< int16_t, std::set< size_t > > > * m_sequencers
Mapping of sequence to algorithms.
Definition: CostData.h:199
CostData::chainToAlgMap
const std::map< std::string, std::set< size_t > > & chainToAlgMap() const
Getter of the alg name to chains map.
Definition: CostData.cxx:147
CostData::m_chainToAlgIdx
const std::map< std::string, std::set< size_t > > * m_chainToAlgIdx
Mapping of chain to algorithms idx.
Definition: CostData.h:197
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CostData::setOnlineSlot
void setOnlineSlot(uint32_t slot)
Setter of the online Slot number of the current event.
Definition: CostData.cxx:57
CostData::operator=
CostData & operator=(const CostData &)=delete
Forbid assignment.
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
CostData::setSeededChains
void setSeededChains(const std::vector< TrigCompositeUtils::AlgToChainTool::ChainInfo > &seededChains)
Set the seeded chains set.
Definition: CostData.cxx:163
CostData::m_costCollection
const xAOD::TrigCompositeContainer * m_costCollection
Cached non-owning pointer to main algorithm cost collection.
Definition: CostData.h:187
CostData::cache
StatusCode cache()
Compute and cache derived quantities, called automatically after set().
Definition: CostData.cxx:39
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
TrigCompositeContainer.h
CostData::algToRequestMap
const std::map< size_t, std::vector< size_t > > & algToRequestMap() const
Getter of map between algorithm (index in costCollection) and ROS requests (indicies in rosCollection...
Definition: CostData.cxx:91
CostData::m_algTotalTime
uint64_t m_algTotalTime
Integrated CPU time of all algorithms in the event.
Definition: CostData.h:189
CostData::lb
uint32_t lb() const
Current luminosity block number.
Definition: CostData.cxx:99
CostROSData
Caches and propagates event data to be used by monitoring algorithms.
Definition: CostROSData.h:24
CostData::rosCollection
const xAOD::TrigCompositeContainer & rosCollection() const
Getter of the cached ros cost collection pointer.
Definition: CostData.cxx:80
CostData::m_liveTime
float m_liveTime
Effective walltime of either the event or the LB, in seconds (.
Definition: CostData.h:190
CostData::liveTimeIsPerEvent
bool liveTimeIsPerEvent() const
If a call to liveTime() is providing data on a single event or a whole LB.
Definition: CostData.cxx:67
CostData::m_algToRos
std::map< size_t, std::vector< size_t > > m_algToRos
Mapping of indexes from m_costCollection to corresponding ROS requests made by algorithm.
Definition: CostData.h:195
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
CostData::setCostROSData
void setCostROSData(const CostROSData &costROSData)
Set ROS to ROB map.
Definition: CostData.cxx:49
CostData::costCollection
const xAOD::TrigCompositeContainer & costCollection() const
Getter of the cached algorithm cost collection pointer.
Definition: CostData.cxx:72
CostData::m_liveTimeIsPerEvent
bool m_liveTimeIsPerEvent
If the livetime represents a single event or all of the current LB.
Definition: CostData.h:193
CostData::setChainToAlgMap
void setChainToAlgMap(const std::map< std::string, std::set< size_t >> &algToChains)
Set the alg name to chains map.
Definition: CostData.cxx:134
CostData::setLivetime
void setLivetime(float time, bool liveTimeIsPerEvent)
Setter of effective P1 walltime represented by the current event, or the current lumi block.
Definition: CostData.cxx:61
CostData::m_chainToUniqAlgIdx
const std::map< std::string, std::set< size_t > > * m_chainToUniqAlgIdx
Mapping of chain name to its unique algorithms.
Definition: CostData.h:198
CostData::setChainToUniqAlgMap
void setChainToUniqAlgMap(const std::map< std::string, std::set< size_t >> &algToChains)
Set the chain to its unique alg names map.
Definition: CostData.cxx:138
CostData::CostData
CostData()
Construct an empty CostData.
Definition: CostData.cxx:9
CostData::algTotalTimeMilliSec
float algTotalTimeMilliSec() const
Getter of the total algorithm CPU time in the event.
Definition: CostData.cxx:95
CostData::m_lb
uint32_t m_lb
Current luminosity block number.
Definition: CostData.h:191
CostData::m_typeMapPtr
const std::unordered_map< uint32_t, std::string > * m_typeMapPtr
Cached non-owning pointer mapping algorithm instance names to types.
Definition: CostData.h:194
CostData
Caches and propagates event data to be used by monitoring algorithms.
Definition: CostData.h:26
CostData::costROSData
const CostROSData & costROSData() const
Getter of the ROS to ROB map.
Definition: CostData.cxx:87
AlgToChainTool.h
CostData::onlineSlot
uint32_t onlineSlot() const
Definition: CostData.cxx:103