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/*~~~~~~~~~~~*/
13
14/*~~~~~~~~~~~~~~~*/
15/* Framework */
16/*~~~~~~~~~~~~~~~*/
18#include "Framework/Configure/Parameters.h"
19#include "Framework/Logger.h"
20
21/*~~~~~~~~~~~~~~~~*/
22/* C++ StdLib */
23/*~~~~~~~~~~~~~~~~*/
24#include <map>
25
26namespace ldmx {
27class RunHeader;
28}
29
30namespace framework {
31
32class Process;
34class ConditionsObject;
35
41 public:
46
53
67 const ConditionsObject* getConditionPtr(const std::string& condition_name);
68
81 template <class T>
82 const T& getCondition(const std::string& condition_name) {
83 return dynamic_cast<const T&>(*getConditionPtr(condition_name));
84 }
85
92 ConditionsIOV getConditionIOV(const std::string& condition_name) const;
93
97 void onProcessStart();
98
102 void onProcessEnd();
103
108
113 const std::string& classname, const std::string& instancename,
114 const std::string& tagname, const framework::config::Parameters& params);
115
116 private:
119
121 std::map<std::string, std::shared_ptr<ConditionsObjectProvider>>
123
127 struct CacheEntry {
131 std::shared_ptr<ConditionsObjectProvider> provider_;
134 };
135
137 std::map<std::string, CacheEntry> cache_;
138};
139
140} // namespace framework
141
142#endif
Interval-of-validity object for conditions information.
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:40
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:82
Process & process_
Handle to the Process.
Definition Conditions.h:118
std::map< std::string, CacheEntry > cache_
Conditions cache.
Definition Conditions.h:137
std::map< std::string, std::shared_ptr< ConditionsObjectProvider > > provider_map_
Map of who provides which condition.
Definition Conditions.h:122
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:34
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:26
Run-specific configuration and data stored in its own output TTree alongside the event TTree in the o...
Definition RunHeader.h:68
All classes in the ldmx-sw project use this namespace.
An entry to store an already loaded conditions object.
Definition Conditions.h:127
const ConditionsObject * obj_
Const pointer to the retrieved conditions object.
Definition Conditions.h:133
ConditionsIOV iov_
Interval Of Validity for this entry in the cache.
Definition Conditions.h:129
std::shared_ptr< ConditionsObjectProvider > provider_
Provider that gave us the conditions object.
Definition Conditions.h:131