LDMX Software
Conditions.h
Go to the documentation of this file.
1
7#ifndef FRAMEWORK_CONDITIONS_H_
8#define FRAMEWORK_CONDITIONS_H_
9
10/*~~~~~~~~~~~*/
11/* Event */
12/*~~~~~~~~~~~*/
14#include "Framework/Exception/Exception.h"
15
16/*~~~~~~~~~~~~~~~*/
17/* Framework */
18/*~~~~~~~~~~~~~~~*/
20#include "Framework/Configure/Parameters.h"
21#include "Framework/Logger.h"
22
23/*~~~~~~~~~~~~~~~~*/
24/* C++ StdLib */
25/*~~~~~~~~~~~~~~~~*/
26#include <any>
27#include <map>
28
29namespace ldmx {
30class RunHeader;
31}
32
33namespace framework {
34
35class Process;
37class ConditionsObject;
38
44 public:
49
56
70 const ConditionsObject* getConditionPtr(const std::string& condition_name);
71
84 template <class T>
85 const T& getCondition(const std::string& condition_name) {
86 return dynamic_cast<const T&>(*getConditionPtr(condition_name));
87 }
88
95 ConditionsIOV getConditionIOV(const std::string& condition_name) const;
96
100 void onProcessStart();
101
105 void onProcessEnd();
106
111
116 const std::string& classname, const std::string& instancename,
117 const std::string& tagname, const framework::config::Parameters& params);
118
119 private:
122
124 std::map<std::string, std::shared_ptr<ConditionsObjectProvider>>
126
130 struct CacheEntry {
134 std::shared_ptr<ConditionsObjectProvider> provider_;
137 };
138
140 std::map<std::string, CacheEntry> cache_;
141};
142
143} // namespace framework
144
145#endif
Interval-of-validity object for conditions information.
Class that provides header information about an event such as event number and timestamp.
be configured to load conditions objects from CSV files.
Class which defines the run/event/type range for which a given condition is valid,...
Base class for all conditions objects, very simple.
Container and cache for conditions and conditions providers.
Definition Conditions.h:43
const T & getCondition(const std::string &condition_name)
Primary request action for a conditions object If the object is in the cache and still valid (IOV),...
Definition Conditions.h:85
Process & process_
Handle to the Process.
Definition Conditions.h:121
std::map< std::string, CacheEntry > cache_
Conditions cache.
Definition Conditions.h:140
std::map< std::string, std::shared_ptr< ConditionsObjectProvider > > provider_map_
Map of who provides which condition.
Definition Conditions.h:125
const ConditionsObject * getConditionPtr(const std::string &condition_name)
Primary request action for a conditions object If the object is in the cache and still valid (IOV),...
void onProcessEnd()
Calls onProcessEnd for all ConditionsObjectProviders.
ConditionsIOV getConditionIOV(const std::string &condition_name) const
Access the IOV for the given condition.
Conditions(Process &)
Constructor.
~Conditions()
Class destructor.
void onProcessStart()
Calls onProcessStart for all ConditionsObjectProviders.
void onNewRun(ldmx::RunHeader &)
Calls onNewRun for all ConditionsObjectProviders.
void createConditionsObjectProvider(const std::string &classname, const std::string &instancename, const std::string &tagname, const framework::config::Parameters &params)
Create a ConditionsObjectProvider given the information.
Class which represents the process under execution.
Definition Process.h:37
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:29
Run-specific configuration and data stored in its own output TTree alongside the event TTree in the o...
Definition RunHeader.h:57
All classes in the ldmx-sw project use this namespace.
An entry to store an already loaded conditions object.
Definition Conditions.h:130
const ConditionsObject * obj_
Const pointer to the retrieved conditions object.
Definition Conditions.h:136
ConditionsIOV iov_
Interval Of Validity for this entry in the cache.
Definition Conditions.h:132
std::shared_ptr< ConditionsObjectProvider > provider_
Provider that gave us the conditions object.
Definition Conditions.h:134