ATLAS Offline Software
Loading...
Searching...
No Matches
TimeBurner.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRIGGENERICALGS_TimeBurner_h
6#define TRIGGENERICALGS_TimeBurner_h
7
10#include "GaudiKernel/IAlgTool.h"
11#include "GaudiKernel/ICPUCrunchSvc.h"
12#include "GaudiKernel/ServiceHandle.h"
13
14#include <atomic>
15#include <string>
16
38class TimeBurner : public HypoBase {
39 public:
41 TimeBurner(const std::string& name, ISvcLocator* svcLoc);
42
43 virtual StatusCode initialize() override;
44 virtual StatusCode execute(const EventContext& eventContext) const override;
45 virtual StatusCode finalize() override;
46
47 private:
48 // Internal enum mapped from the TimeDistribution string property.
49 enum class TimeDist { Fixed, Landau };
51
52 Gaudi::Property<std::string> m_timeDistribution {
53 this, "TimeDistribution", "fixed",
54 "Distribution used to sample the per-event time. Allowed values: "
55 "\"fixed\" (use SleepTimeMillisec), \"landau\" (use LandauMPV/LandauSigma)."
56 };
57
58 Gaudi::Property<unsigned int> m_sleepTimeMillisec {
59 this, "SleepTimeMillisec", 0,
60 "Fixed per-event time [ms]. Used when TimeDistribution == \"fixed\"."
61 };
62
63 Gaudi::Property<double> m_landauMPV{
64 this, "LandauMPV", 105.0,
65 "MPV of the Landau distribution [ms]. "
66 "Used when TimeDistribution == \"landau\"."
67 };
68
69 Gaudi::Property<double> m_landauSigma{
70 this, "LandauSigma", 66.0,
71 "Sigma of the Landau distribution [ms]. "
72 "Used when TimeDistribution == \"landau\"."
73 };
74
75 Gaudi::Property<double> m_acceptFraction{
76 this, "AcceptFraction", 0.0,
77 "Probability in [0,1] of accepting an event. Default 0 = reject all."
78 };
79
80 Gaudi::Property<bool> m_burnCPU{
81 this, "BurnCPU", false,
82 "If true, busy-wait (via Gaudi::CPUCrunchSvc) instead of sleeping."
83 };
84
85 Gaudi::Property<double> m_maxTimeMs{
86 this, "MaxTimeMs", 450000.0,
87 "Upper bound on the per-event time [ms]. Set to <= 0 to disable the cap (e.g. to deliberately generate HLT timeouts)."
88 };
89
90 // Gaudi service that does a calibrated CPU-burning loop.
92 this, "CPUCrunchSvc", "CPUCrunchSvc",
93 "Handle to Gaudi CPUCrunchSvc (used when BurnCPU is true)."
94 };
95
96 // Slot-local random engines (thread-safe by construction).
98 this, "AthRNGSvc", "AthRNGSvc",
99 "Handle to the slot-local random number service."
100 };
101
102 // Unused dummy property to pass duck-test of HypoAlgs
103 ToolHandleArray<IAlgTool> m_hypoTools{this, "HypoTools", {}};
104
105 mutable std::atomic<unsigned long> m_nSeen{0};
106 mutable std::atomic<unsigned long> m_nAccepted{0};
107 mutable std::atomic<unsigned long> m_nRejected{0};
108};
109
110#endif // TRIGGENERICALGS_TimeBurner_h
HypoBase(const std::string &name, ISvcLocator *pSvcLocator)
constructor, to be called by sub-class constructors
Definition HypoBase.cxx:12
TimeBurner(const std::string &name, ISvcLocator *svcLoc)
Standard constructor.
Gaudi::Property< double > m_landauMPV
Definition TimeBurner.h:63
virtual StatusCode execute(const EventContext &eventContext) const override
Gaudi::Property< unsigned int > m_sleepTimeMillisec
Definition TimeBurner.h:58
TimeDist m_timeDist
Definition TimeBurner.h:50
Gaudi::Property< double > m_maxTimeMs
Definition TimeBurner.h:85
Gaudi::Property< double > m_acceptFraction
Definition TimeBurner.h:75
ServiceHandle< IAthRNGSvc > m_rngSvc
Definition TimeBurner.h:97
Gaudi::Property< bool > m_burnCPU
Definition TimeBurner.h:80
ToolHandleArray< IAlgTool > m_hypoTools
Definition TimeBurner.h:103
std::atomic< unsigned long > m_nSeen
Definition TimeBurner.h:105
virtual StatusCode finalize() override
ServiceHandle< ICPUCrunchSvc > m_cpuCrunchSvc
Definition TimeBurner.h:91
Gaudi::Property< std::string > m_timeDistribution
Definition TimeBurner.h:52
std::atomic< unsigned long > m_nAccepted
Definition TimeBurner.h:106
virtual StatusCode initialize() override
Gaudi::Property< double > m_landauSigma
Definition TimeBurner.h:69
std::atomic< unsigned long > m_nRejected
Definition TimeBurner.h:107