ATLAS Offline Software
Loading...
Searching...
No Matches
MTCalibPebHypoTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRIGEXPARTIALEB_MTCALIBPEBHYPOTOOL_H
6#define TRIGEXPARTIALEB_MTCALIBPEBHYPOTOOL_H
7
8// Trigger includes
12
13// Athena includes
15
16// Gaudi includes
17#include "Gaudi/Parsers/Factory.h" // needed to declare less common Property types
18#include "GaudiKernel/ICPUCrunchSvc.h"
19
23class MTCalibPebHypoTool : virtual public AthAlgTool {
24public:
26 MTCalibPebHypoTool(const std::string& type, const std::string& name, const IInterface* parent);
28 virtual ~MTCalibPebHypoTool();
29
30 // ------------------------- AthAlgTool methods ------------------------------
31 virtual StatusCode initialize() override;
32 virtual StatusCode finalize() override;
33
34 // ------------------------- Public types ------------------------------------
35 struct Input {
36 Input(TrigCompositeUtils::Decision* d, const EventContext& ctx)
37 : decision(d), eventContext(ctx) {}
39 const EventContext& eventContext;
40 };
41
42 // ------------------------- Specific methods of this class ------------------
44 StatusCode decide(const Input& input) const;
45
46private:
47 // ------------------------- Types -------------------------------------------
51 ROBRequestInstruction(std::string_view str);
53 const std::string toString() const;
57 bool isRandom = false;
59 size_t nRandom = 0;
60 };
61
62 // ------------------------- Properties --------------------------------------
63 Gaudi::Property<bool> m_useRandomSeed {
64 this, "UseRandomSeed", false,
65 "If true, use random seed for the internal RNG. If false, use a seed based on run/event number and tool name."
66 };
67 Gaudi::Property<double> m_acceptRate {
68 this, "RandomAcceptRate", -1,
69 "Rate of random accepts, <=0 is never, >=1 is always"
70 };
71 Gaudi::Property<unsigned int> m_burnTimePerCycleMillisec {
72 this, "BurnTimePerCycleMillisec", 0,
73 "Burn time per cycle in milliseconds"
74 };
75 Gaudi::Property<unsigned int> m_numBurnCycles {
76 this, "NumBurnCycles", 0,
77 "Number of time burning cycles"
78 };
79 Gaudi::Property<bool> m_burnTimeRandomly {
80 this, "BurnTimeRandomly", true,
81 "If true, burn time per cycle is a random value from uniform distribution between 0 and the given value"
82 };
83 Gaudi::Property<bool> m_doCrunch {
84 this, "Crunch", false,
85 "Crunch CPU instead of sleeping"
86 };
87 Gaudi::Property<bool> m_checkDataConsistency {
88 this, "CheckDataConsistency", false,
89 "Perform consistency checks for all retrieved ROB data"
90 };
91 Gaudi::Property<std::map<std::string,std::vector<uint32_t> > > m_robAccessDictProp {
92 this, "ROBAccessDict", {},
93 "Dictionary of prefetch/retrieve operations with given ROB IDs. The value is a vector of ROB IDs. "
94 "The string key has to contain :ADD: (prefetch), :GET: (retrieve), :ADDGET: (prefetch+retrieve) or :COL: (full "
95 "event building). :ADD:, :GET: and :ADDGET: may be also appended with :RNDX: where X is an integer. In this case, "
96 "random X ROBs will be prefetched/retrieved from the provided list, e.g. :GET:RND10: retrieves 10 random ROBs from "
97 "the list. Otherwise the full list is used. Note std::map is sorted by std::less<std::string>, so starting the key "
98 "with a number may be needed to enforce ordering, e.g. '01 :ADD:RND10:'."
99 };
100 Gaudi::Property<unsigned int> m_timeBetweenRobReqMillisec {
101 this, "TimeBetweenROBReqMillisec", 0,
102 "Delay in milliseconds between subsequent ROB request operations from ROBAccessDict"
103 };
104 Gaudi::Property<std::set<uint32_t> > m_pebRobList {
105 this, "PEBROBList", {},
106 "The list of ROBs to add for partial event building in each passed event"
107 };
108 Gaudi::Property<std::set<uint32_t> > m_pebSubDetList {
109 this, "PEBSubDetList", {},
110 "The list of SubDets to add for partial event building in each passed event"
111 };
112 Gaudi::Property<std::map<std::string,unsigned int> > m_createRandomData {
113 this, "CreateRandomData", {},
114 "Create random data which can be serialised and saved to output. The property value should be a dictionary in the "
115 "form {name: number} where name is the collection name and number is the maximum number of elements and "
116 "their decorations"
117 };
118
119 // ------------------------- Service or tool handles -------------------------
120 ServiceHandle<IROBDataProviderSvc> m_robDataProviderSvc{this, "ROBDataProviderSvc", "ROBDataProviderSvc", "Name of the ROB data provider"};
121 ServiceHandle<ICPUCrunchSvc> m_cpuCrunchSvc{this, "CPUCrunchSvc", "CPUCrunchSvc", "Name of the CPU cruncher"};
122
123 // ------------------------- Other private members ---------------------------
129 std::vector<std::pair<ROBRequestInstruction,std::vector<uint32_t>>> m_robAccessDict;
130};
131
132#endif // TRIGEXPARTIALEB_MTCALIBPEBHYPOTOOL_H
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
virtual ~MTCalibPebHypoTool()
Standard destructor.
virtual StatusCode finalize() override
Gaudi::Property< double > m_acceptRate
ServiceHandle< ICPUCrunchSvc > m_cpuCrunchSvc
Gaudi::Property< unsigned int > m_timeBetweenRobReqMillisec
Gaudi::Property< std::map< std::string, std::vector< uint32_t > > > m_robAccessDictProp
Gaudi::Property< unsigned int > m_numBurnCycles
std::vector< std::pair< ROBRequestInstruction, std::vector< uint32_t > > > m_robAccessDict
Ordered map of ROB request instructions filled from ROBAccessDict property at initialisation.
Gaudi::Property< std::set< uint32_t > > m_pebSubDetList
Gaudi::Property< std::set< uint32_t > > m_pebRobList
Gaudi::Property< bool > m_useRandomSeed
StatusCode decide(const Input &input) const
Decides whether to accept the event.
SG::WriteHandleKeyArray< xAOD::TrigCompositeContainer > m_randomDataWHK
WriteHandleKey array for collections specified in the CreateRandomData property.
virtual StatusCode initialize() override
ServiceHandle< IROBDataProviderSvc > m_robDataProviderSvc
MTCalibPebHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
HLT::Identifier m_decisionId
The decision id of the tool instance.
Gaudi::Property< unsigned int > m_burnTimePerCycleMillisec
Gaudi::Property< bool > m_burnTimeRandomly
Gaudi::Property< bool > m_doCrunch
Gaudi::Property< bool > m_checkDataConsistency
Gaudi::Property< std::map< std::string, unsigned int > > m_createRandomData
HandleKeyArray< WriteHandle< T >, WriteHandleKey< T >, Gaudi::DataHandle::Writer > WriteHandleKeyArray
const EventContext & eventContext
TrigCompositeUtils::Decision * decision
Input(TrigCompositeUtils::Decision *d, const EventContext &ctx)
const std::string toString() const
String form for debug print-outs.
bool isRandom
Flag switching requests of a random sub-sample of the ROB list.
ROBRequestInstruction(std::string_view str)
Constructor from string key in the ROBAccessDict property.