ATLAS Offline Software
Loading...
Searching...
No Matches
AthMonitorAlgorithm.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
16
17#ifndef ATHMONITORALGORITHM_H
18#define ATHMONITORALGORITHM_H
19
21
26
34
35namespace Trig {
37}
38
40public:
41
45 AthMonitorAlgorithm(const std::string& name, ISvcLocator* pSvcLocator );
46
47
51 virtual ~AthMonitorAlgorithm();
52
53
59 virtual StatusCode initialize() override;
60
61
68 virtual StatusCode execute(const EventContext& ctx) const override;
69
70
80 virtual StatusCode fillHistograms(const EventContext& ctx) const = 0;
81
100 void fill( const ToolHandle<GenericMonitoringTool>& groupHandle,
101 std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>>&& variables ) const;
102
115
116 void fill( const ToolHandle<GenericMonitoringTool>& groupHandle,
117 const std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>>& variables ) const {
118 fill(groupHandle, std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>>{variables});
119 };
120
127 template <typename... T>
128 void fill( const ToolHandle<GenericMonitoringTool>& groupHandle, T&&... variables ) const {
129 fill(groupHandle, std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>>{std::forward<T>(variables)...});
130 }
131
140 void fill( const std::string& groupName,
141 std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>>&& variables ) const;
142
149 void fill( const std::string& groupName,
150 const std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>>& variables ) const {
151 fill( getGroup(groupName), std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>>{variables});
152 }
153
160 template <typename... T>
161 void fill( const std::string& groupName, T&&... variables ) const {
162 fill(getGroup(groupName), std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>>{std::forward<T>(variables)...});
163 }
164 // end of fill group
165
166
184
185
201
202
209
210
216 Environment_t envStringToEnum( const std::string& str ) const;
217
218
224 DataType_t dataType() const { return m_dataType; }
225
226
232 DataType_t dataTypeStringToEnum( const std::string& str ) const;
233
234
245 const ToolHandle<GenericMonitoringTool>& getGroup( const std::string& name ) const;
246
247
256 const ToolHandle<Trig::TrigDecisionTool>& getTrigDecisionTool() const;
257
268 bool trigChainsArePassed( const std::vector<std::string>& vTrigNames ) const;
269
276 SG::ReadHandle<xAOD::EventInfo> GetEventInfo( const EventContext& ) const;
277
282
286 virtual float lbAverageInteractionsPerCrossing( const EventContext& ctx = Gaudi::Hive::currentContext() ) const;
287
291 virtual float lbInteractionsPerCrossing( const EventContext& ctx = Gaudi::Hive::currentContext() ) const;
292
296 virtual float lbAverageLuminosity( const EventContext& ctx = Gaudi::Hive::currentContext() ) const;
297
301 virtual float lbLuminosityPerBCID( const EventContext& ctx = Gaudi::Hive::currentContext() ) const;
302
306 virtual double lbDuration( const EventContext& ctx = Gaudi::Hive::currentContext() ) const;
307
311 virtual float lbAverageLivefraction( const EventContext& ctx = Gaudi::Hive::currentContext() ) const;
312
316 virtual float livefractionPerBCID( const EventContext& ctx = Gaudi::Hive::currentContext() ) const;
317
321 virtual double lbLumiWeight( const EventContext& ctx = Gaudi::Hive::currentContext() ) const;
322 // end of lumi group
324
325
336 virtual StatusCode parseList( const std::string& line, std::vector<std::string>& result ) const;
337
338
339protected:
340 // Using the new way to declare JO properties: Gaudi::Property<int> m_myProperty {this,"MyProperty",0};
341 ToolHandleArray<GenericMonitoringTool> m_tools {this,"GMTools",{}};
342 // Keep TDT public until final decision from trigger on interface
343 // Initialization is in the ctor to avoid requiring a header
344 // dependency on TrigDecisionTool.h.
345 PublicToolHandle<Trig::TrigDecisionTool> m_trigDecTool;
346 ToolHandleArray<IDQFilterTool> m_DQFilterTools {this,"FilterTools",{}};
347
349 {this,"LuminosityCondDataKey","LuminosityCondData","SG Key of LuminosityCondData object"};
351 {this,"LBDurationCondDataKey","LBDurationCondData","SG Key of LBDurationCondData object"};
353 {this,"TrigLiveFractionCondDataKey","TrigLiveFractionCondData", "SG Key of TrigLiveFractionCondData object"};
354
357 Gaudi::Property<std::string> m_environmentStr {this,"Environment","user"};
358 Gaudi::Property<std::string> m_dataTypeStr {this,"DataType","userDefined"};
359
360 Gaudi::Property<std::string> m_triggerChainString {this,"TriggerChain",""};
361 std::vector<std::string> m_vTrigChainNames;
362
363 Gaudi::Property<std::string> m_fileKey {this,"FileKey",""};
364 Gaudi::Property<bool> m_useLumi {this,"EnableLumi",false};
365 Gaudi::Property<float> m_defaultLBDuration {this,"DefaultLBDuration",60.};
366 Gaudi::Property<int> m_detailLevel {this,"DetailLevel",0};
367 SG::ReadHandleKey<xAOD::EventInfo> m_EventInfoKey {this,"EventInfoKey","EventInfo"};
368
369private:
370 typedef std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> MonVarVec_t;
371 std::string m_name;
372 std::unordered_map<std::string, size_t> m_toolLookupMap;
373
374 const ToolHandle<GenericMonitoringTool> m_dummy;
375
376
377 Gaudi::Property<bool> m_enforceExpressTriggers{this,
378 "EnforceExpressTriggers", false,
379 "Requires that matched triggers made the event enter the express stream"};
380};
381
382#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
const ToolHandle< GenericMonitoringTool > & getGroup(const std::string &name) const
Get a specific monitoring tool from the tool handle array.
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.
std::unordered_map< std::string, size_t > m_toolLookupMap
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.
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.
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(const std::string &groupName, const std::vector< std::reference_wrapper< Monitored::IMonitoredVariable > > &variables) const
Fills a vector 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(const std::string &groupName, T &&... variables) const
Fills a variadic list of variables to a group by name.
virtual double lbLumiWeight(const EventContext &ctx=Gaudi::Hive::currentContext()) const
Calculate the average integrated luminosity multiplied by the live fraction.
virtual float lbInteractionsPerCrossing(const EventContext &ctx=Gaudi::Hive::currentContext()) const
Calculate instantaneous number of interactions, i.e.
virtual float lbLuminosityPerBCID(const EventContext &ctx=Gaudi::Hive::currentContext()) const
Calculate the instantaneous luminosity per bunch crossing.
virtual float livefractionPerBCID(const EventContext &ctx=Gaudi::Hive::currentContext()) const
Calculate the live fraction per bunch crossing ID.
virtual float lbAverageLuminosity(const EventContext &ctx=Gaudi::Hive::currentContext()) const
Calculate average luminosity (in ub-1 s-1 => 10^30 cm-2 s-1).
virtual float lbAverageInteractionsPerCrossing(const EventContext &ctx=Gaudi::Hive::currentContext()) const
Calculate the average mu, i.e.
virtual float lbAverageLivefraction(const EventContext &ctx=Gaudi::Hive::currentContext()) const
Calculate the average luminosity livefraction.
virtual double lbDuration(const EventContext &ctx=Gaudi::Hive::currentContext()) const
Calculate the duration of the luminosity block (in seconds)
The common trigger namespace for trigger analysis tools.