ATLAS Offline Software
Loading...
Searching...
No Matches
AthMonitorAlgorithm.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
16
17#ifndef ATHMONITORALGORITHM_H
18#define ATHMONITORALGORITHM_H
19
21
26
35#include <string_view>
36#include <concepts>
37
38
39namespace Trig {
41}
42
44public:
45
49 AthMonitorAlgorithm(const std::string& name, ISvcLocator* pSvcLocator );
50
51
55 virtual ~AthMonitorAlgorithm();
56
57
63 virtual StatusCode initialize() override;
64
65
72 virtual StatusCode execute(const EventContext& ctx) const override;
73
74
84 virtual StatusCode fillHistograms(const EventContext& ctx) const = 0;
85
104 void fill( const ToolHandle<GenericMonitoringTool>& groupHandle,
105 std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>>&& variables ) const;
106
119
120 void fill( const ToolHandle<GenericMonitoringTool>& groupHandle,
121 const std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>>& variables ) const {
122 fill(groupHandle, std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>>{variables});
123 };
124
133 template <typename... T>
134 void fill( const ToolHandle<GenericMonitoringTool>& groupHandle, T&&... variables ) const {
135 fill(groupHandle, std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>>{std::forward<T>(variables)...});
136 }
137
146 void fill( std::string_view groupName,
147 std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>>&& variables ) const;
148
155 void fill( std::string_view groupName,
156 const std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>>& variables ) const {
157 fill( getGroup(groupName), std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>>{variables});
158 }
159
168 template <typename S, typename... T>
169 requires std::convertible_to<S, std::string_view>
170 void fill( S&& groupName, T&&... variables ) const {
171 fill(getGroup(std::forward<S>(groupName)), std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>>{std::forward<T>(variables)...});
172 }
173 // end of fill group
174
175
193
194
210
211
218
219
225 Environment_t envStringToEnum( const std::string& str ) const;
226
227
233 DataType_t dataType() const { return m_dataType; }
234
235
241 DataType_t dataTypeStringToEnum( const std::string& str ) const;
242
243
254 const ToolHandle<GenericMonitoringTool>& getGroup( std::string_view name ) const;
255
256
265 const ToolHandle<Trig::TrigDecisionTool>& getTrigDecisionTool() const;
266
277 bool trigChainsArePassed( const std::vector<std::string>& vTrigNames ) const;
278
285 SG::ReadHandle<xAOD::EventInfo> GetEventInfo( const EventContext& ) const;
286
291
295 virtual float lbAverageInteractionsPerCrossing( const EventContext& ctx ) const;
296
300 virtual float lbInteractionsPerCrossing( const EventContext& ctx ) const;
301
305 virtual float lbAverageLuminosity( const EventContext& ctx ) const;
306
310 virtual float lbLuminosityPerBCID( const EventContext& ctx ) const;
311
315 virtual double lbDuration( const EventContext& ctx ) const;
316
320 virtual float lbAverageLivefraction( const EventContext& ctx ) const;
321
325 virtual float livefractionPerBCID( const EventContext& ctx ) const;
326
330 virtual double lbLumiWeight( const EventContext& ctx ) const;
331 // end of lumi group
333
334
345 virtual StatusCode parseList( const std::string& line, std::vector<std::string>& result ) const;
346
347
348protected:
349 // Using the new way to declare JO properties: Gaudi::Property<int> m_myProperty {this,"MyProperty",0};
350 ToolHandleArray<GenericMonitoringTool> m_tools {this,"GMTools",{}};
351 // Keep TDT public until final decision from trigger on interface
352 // Initialization is in the ctor to avoid requiring a header
353 // dependency on TrigDecisionTool.h.
354 PublicToolHandle<Trig::TrigDecisionTool> m_trigDecTool;
355 ToolHandleArray<IDQFilterTool> m_DQFilterTools {this,"FilterTools",{}};
356
358 {this,"LuminosityCondDataKey","LuminosityCondData","SG Key of LuminosityCondData object"};
360 {this,"LBDurationCondDataKey","LBDurationCondData","SG Key of LBDurationCondData object"};
362 {this,"TrigLiveFractionCondDataKey","TrigLiveFractionCondData", "SG Key of TrigLiveFractionCondData object"};
363
366 Gaudi::Property<std::string> m_environmentStr {this,"Environment","user"};
367 Gaudi::Property<std::string> m_dataTypeStr {this,"DataType","userDefined"};
368
369 Gaudi::Property<std::string> m_triggerChainString {this,"TriggerChain",""};
370 std::vector<std::string> m_vTrigChainNames;
371
372 Gaudi::Property<std::string> m_fileKey {this,"FileKey",""};
373 Gaudi::Property<bool> m_useLumi {this,"EnableLumi",false};
374 Gaudi::Property<float> m_defaultLBDuration {this,"DefaultLBDuration",60.};
375 Gaudi::Property<int> m_detailLevel {this,"DetailLevel",0};
376 SG::ReadHandleKey<xAOD::EventInfo> m_EventInfoKey {this,"EventInfoKey","EventInfo"};
377
378private:
379 typedef std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> MonVarVec_t;
380 std::string m_name;
381 std::unordered_map<std::string, size_t, CxxUtils::TransparentStringHash, std::equal_to<>> m_toolLookupMap;
382
383 const ToolHandle<GenericMonitoringTool> m_dummy;
384
385
386 Gaudi::Property<bool> m_enforceExpressTriggers{this,
387 "EnforceExpressTriggers", false,
388 "Requires that matched triggers made the event enter the express stream"};
389};
390
391#endif
Hold luminosity block duration data produced from /TRIGGER/LUMI/LBLB.
Hold luminosity data produced by LuminosityCondAlg.
Header file to be included by clients of the Monitored infrastructure.
Property holding a SG store/key/clid from which a ReadHandle is made.
Hold live fraction data produced by TrigLiveFractionCondAlg.
virtual StatusCode fillHistograms(const EventContext &ctx) const =0
adds event to the monitoring histograms
Gaudi::Property< int > m_detailLevel
Sets the level of detail used in the monitoring.
bool trigChainsArePassed(const std::vector< std::string > &vTrigNames) const
Check whether triggers are passed.
Environment_t environment() const
Accessor functions for the environment.
AthMonitorAlgorithm::DataType_t m_dataType
Instance of the DataType_t enum.
DataType_t dataTypeStringToEnum(const std::string &str) const
Convert the data type string from the python configuration to an enum object.
Environment_t envStringToEnum(const std::string &str) const
Convert the environment string from the python configuration to an enum object.
Gaudi::Property< std::string > m_triggerChainString
Trigger chain string pulled from the job option and parsed into a vector.
Gaudi::Property< bool > m_useLumi
Allows use of various luminosity functions.
virtual StatusCode parseList(const std::string &line, std::vector< std::string > &result) const
Parse a string into a vector.
virtual StatusCode initialize() override
initialize
DataType_t dataType() const
Accessor functions for the data type.
Environment_t
Specifies the processing environment.
const ToolHandle< Trig::TrigDecisionTool > & getTrigDecisionTool() const
Get the trigger decision tool member.
const ToolHandle< GenericMonitoringTool > & getGroup(std::string_view name) const
Get a specific monitoring tool from the tool handle array.
std::vector< std::string > m_vTrigChainNames
Vector of trigger chain names parsed from trigger chain string.
Gaudi::Property< float > m_defaultLBDuration
Default duration of one lumi block.
SG::ReadHandle< xAOD::EventInfo > GetEventInfo(const EventContext &) const
Return a ReadHandle for an EventInfo object (get run/event numbers, etc.).
const ToolHandle< GenericMonitoringTool > m_dummy
PublicToolHandle< Trig::TrigDecisionTool > m_trigDecTool
Tool to tell whether a specific trigger is passed.
std::unordered_map< std::string, size_t, CxxUtils::TransparentStringHash, std::equal_to<> > m_toolLookupMap
DataType_t
Specifies what type of input data is being monitored.
AthMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
SG::ReadCondHandleKey< TrigLiveFractionCondData > m_trigLiveFractionDataKey
virtual ~AthMonitorAlgorithm()
Destructor.
Gaudi::Property< bool > m_enforceExpressTriggers
ToolHandleArray< GenericMonitoringTool > m_tools
Array of Generic Monitoring Tools.
SG::ReadCondHandleKey< LBDurationCondData > m_lbDurationDataKey
std::vector< std::reference_wrapper< Monitored::IMonitoredVariable > > MonVarVec_t
ToolHandleArray< IDQFilterTool > m_DQFilterTools
Array of Data Quality filter tools.
SG::ReadHandleKey< xAOD::EventInfo > m_EventInfoKey
Key for retrieving EventInfo from StoreGate.
AthMonitorAlgorithm::Environment_t m_environment
Instance of the Environment_t enum.
Gaudi::Property< std::string > m_environmentStr
Environment string pulled from the job option and converted to enum.
Gaudi::Property< std::string > m_dataTypeStr
DataType string pulled from the job option and converted to enum.
SG::ReadCondHandleKey< LuminosityCondData > m_lumiDataKey
virtual StatusCode execute(const EventContext &ctx) const override
Applies filters and trigger requirements.
Gaudi::Property< std::string > m_fileKey
Internal Athena name for file.
An algorithm that can be simultaneously executed in multiple threads.
Property holding a SG store/key/clid from which a ReadHandle is made.
void fill(const ToolHandle< GenericMonitoringTool > &groupHandle, T &&... variables) const
Fills a variadic list of variables to a group by reference.
void fill(S &&groupName, T &&... variables) const
Fills a variadic list of variables to a group by name.
void fill(const ToolHandle< GenericMonitoringTool > &groupHandle, const std::vector< std::reference_wrapper< Monitored::IMonitoredVariable > > &variables) const
Fills a vector of variables to a group by reference.
void fill(const ToolHandle< GenericMonitoringTool > &groupHandle, std::vector< std::reference_wrapper< Monitored::IMonitoredVariable > > &&variables) const
Fills a vector of variables to a group by reference.
void fill(std::string_view groupName, const std::vector< std::reference_wrapper< Monitored::IMonitoredVariable > > &variables) const
Fills a vector of variables to a group by name.
virtual float lbLuminosityPerBCID(const EventContext &ctx) const
Calculate the instantaneous luminosity per bunch crossing.
virtual float lbAverageLuminosity(const EventContext &ctx) const
Calculate average luminosity (in ub-1 s-1 => 10^30 cm-2 s-1).
virtual float lbAverageLivefraction(const EventContext &ctx) const
Calculate the average luminosity livefraction.
virtual float lbInteractionsPerCrossing(const EventContext &ctx) const
Calculate instantaneous number of interactions, i.e.
virtual float lbAverageInteractionsPerCrossing(const EventContext &ctx) const
Calculate the average mu, i.e.
virtual double lbLumiWeight(const EventContext &ctx) const
Calculate the average integrated luminosity multiplied by the live fraction.
virtual double lbDuration(const EventContext &ctx) const
Calculate the duration of the luminosity block (in seconds).
virtual float livefractionPerBCID(const EventContext &ctx) const
Calculate the live fraction per bunch crossing ID.
The common trigger namespace for trigger analysis tools.