ATLAS Offline Software
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 
23 class MTCalibPebHypoTool : virtual public AthAlgTool {
24 public:
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 
46 private:
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
MTCalibPebHypoTool::m_pebSubDetList
Gaudi::Property< std::set< uint32_t > > m_pebSubDetList
Definition: MTCalibPebHypoTool.h:108
MTCalibPebHypoTool::ROBRequestInstruction::GET
@ GET
Definition: MTCalibPebHypoTool.h:55
MTCalibPebHypoTool::~MTCalibPebHypoTool
virtual ~MTCalibPebHypoTool()
Standard destructor.
Definition: MTCalibPebHypoTool.cxx:126
MTCalibPebHypoTool::m_acceptRate
Gaudi::Property< double > m_acceptRate
Definition: MTCalibPebHypoTool.h:67
MTCalibPebHypoTool::decide
StatusCode decide(const Input &input) const
Decides whether to accept the event.
Definition: MTCalibPebHypoTool.cxx:177
MTCalibPebHypoTool::m_decisionId
HLT::Identifier m_decisionId
The decision id of the tool instance.
Definition: MTCalibPebHypoTool.h:125
MTCalibPebHypoTool
Base class for tools used by MTCalibPebHypoAlg.
Definition: MTCalibPebHypoTool.h:23
hist_file_dump.d
d
Definition: hist_file_dump.py:137
MTCalibPebHypoTool::MTCalibPebHypoTool
MTCalibPebHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition: MTCalibPebHypoTool.cxx:119
SG::HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:38
MTCalibPebHypoTool::m_useRandomSeed
Gaudi::Property< bool > m_useRandomSeed
Definition: MTCalibPebHypoTool.h:63
MTCalibPebHypoTool::m_doCrunch
Gaudi::Property< bool > m_doCrunch
Definition: MTCalibPebHypoTool.h:83
MTCalibPebHypoTool::ROBRequestInstruction::isRandom
bool isRandom
Flag switching requests of a random sub-sample of the ROB list.
Definition: MTCalibPebHypoTool.h:57
MTCalibPebHypoTool::ROBRequestInstruction::ADD
@ ADD
Definition: MTCalibPebHypoTool.h:55
MTCalibPebHypoTool::m_checkDataConsistency
Gaudi::Property< bool > m_checkDataConsistency
Definition: MTCalibPebHypoTool.h:87
MTCalibPebHypoTool::m_randomDataWHK
SG::WriteHandleKeyArray< xAOD::TrigCompositeContainer > m_randomDataWHK
WriteHandleKey array for collections specified in the CreateRandomData property.
Definition: MTCalibPebHypoTool.h:127
MTCalibPebHypoTool::ROBRequestInstruction::INVALID
@ INVALID
Definition: MTCalibPebHypoTool.h:55
MTCalibPebHypoTool::ROBRequestInstruction::ADDGET
@ ADDGET
Definition: MTCalibPebHypoTool.h:55
MTCalibPebHypoTool::m_burnTimePerCycleMillisec
Gaudi::Property< unsigned int > m_burnTimePerCycleMillisec
Definition: MTCalibPebHypoTool.h:71
MTCalibPebHypoTool::Input::decision
TrigCompositeUtils::Decision * decision
Definition: MTCalibPebHypoTool.h:38
TrigCompositeUtils.h
MTCalibPebHypoTool::ROBRequestInstruction::ROBRequestInstruction
ROBRequestInstruction(std::string_view str)
Constructor from string key in the ROBAccessDict property.
Definition: MTCalibPebHypoTool.cxx:314
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MTCalibPebHypoTool::m_robDataProviderSvc
ServiceHandle< IROBDataProviderSvc > m_robDataProviderSvc
Definition: MTCalibPebHypoTool.h:120
MTCalibPebHypoTool::Input::Input
Input(TrigCompositeUtils::Decision *d, const EventContext &ctx)
Definition: MTCalibPebHypoTool.h:36
MTCalibPebHypoTool::m_timeBetweenRobReqMillisec
Gaudi::Property< unsigned int > m_timeBetweenRobReqMillisec
Definition: MTCalibPebHypoTool.h:100
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
AthAlgTool.h
MTCalibPebHypoTool::ROBRequestInstruction::nRandom
size_t nRandom
Size of random request.
Definition: MTCalibPebHypoTool.h:59
test_pyathena.parent
parent
Definition: test_pyathena.py:15
MTCalibPebHypoTool::ROBRequestInstruction::toString
const std::string toString() const
String form for debug print-outs.
Definition: MTCalibPebHypoTool.cxx:335
MTCalibPebHypoTool::m_pebRobList
Gaudi::Property< std::set< uint32_t > > m_pebRobList
Definition: MTCalibPebHypoTool.h:104
MTCalibPebHypoTool::ROBRequestInstruction
ROB request instruction description.
Definition: MTCalibPebHypoTool.h:49
xAOD::TrigComposite_v1
Class used to describe composite objects in the HLT.
Definition: TrigComposite_v1.h:52
xAODType
Definition: ObjectType.h:13
HLT::Identifier
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:20
MTCalibPebHypoTool::m_burnTimeRandomly
Gaudi::Property< bool > m_burnTimeRandomly
Definition: MTCalibPebHypoTool.h:79
MTCalibPebHypoTool::ROBRequestInstruction::COL
@ COL
Definition: MTCalibPebHypoTool.h:55
MTCalibPebHypoTool::m_robAccessDictProp
Gaudi::Property< std::map< std::string, std::vector< uint32_t > > > m_robAccessDictProp
Definition: MTCalibPebHypoTool.h:91
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
MTCalibPebHypoTool::m_numBurnCycles
Gaudi::Property< unsigned int > m_numBurnCycles
Definition: MTCalibPebHypoTool.h:75
MTCalibPebHypoTool::m_createRandomData
Gaudi::Property< std::map< std::string, unsigned int > > m_createRandomData
Definition: MTCalibPebHypoTool.h:112
MTCalibPebHypoTool::initialize
virtual StatusCode initialize() override
Definition: MTCalibPebHypoTool.cxx:131
MTCalibPebHypoTool::Input::eventContext
const EventContext & eventContext
Definition: MTCalibPebHypoTool.h:39
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
MTCalibPebHypoTool::m_robAccessDict
std::vector< std::pair< ROBRequestInstruction, std::vector< uint32_t > > > m_robAccessDict
Ordered map of ROB request instructions filled from ROBAccessDict property at initialisation.
Definition: MTCalibPebHypoTool.h:129
HLTIdentifier.h
MTCalibPebHypoTool::m_cpuCrunchSvc
ServiceHandle< ICPUCrunchSvc > m_cpuCrunchSvc
Definition: MTCalibPebHypoTool.h:121
str
Definition: BTagTrackIpAccessor.cxx:11
AthAlgTool
Definition: AthAlgTool.h:26
MTCalibPebHypoTool::ROBRequestInstruction::type
enum MTCalibPebHypoTool::ROBRequestInstruction::Type type
MTCalibPebHypoTool::finalize
virtual StatusCode finalize() override
Definition: MTCalibPebHypoTool.cxx:169
IROBDataProviderSvc.h
MTCalibPebHypoTool::Input
Definition: MTCalibPebHypoTool.h:35
ServiceHandle< IROBDataProviderSvc >