fire v0.19.0
Framework for sImulation and Reconstruction of Events
Conditions.h
1#ifndef FIRE_CONDITIONS_H
2#define FIRE_CONDITIONS_H
3
4#include "fire/exception/Exception.h"
5#include "fire/EventHeader.h"
6#include "fire/exception/Exception.h"
7#include "fire/ConditionsProvider.h"
8#include "fire/config/Parameters.h"
10
11#include <map>
12
13namespace fire {
14
16class Process;
17
67 public:
81
97 const ConditionsObject* getConditionPtr(const std::string& condition_name);
98
113 template <class ConditionType>
114 const ConditionType& get(const std::string& condition_name) {
115 try {
116 return dynamic_cast<const ConditionType&>(*getConditionPtr(condition_name));
117 } catch (const std::bad_cast&) {
118 throw Exception("BadCast",
119 "Condition '"+condition_name+"' is not the input type '"
120 +boost::core::demangle(typeid(ConditionType).name())+"'.");
121 }
122 }
123
130 ConditionsIntervalOfValidity getConditionIOV(const std::string& condition_name) const;
131
135 void onProcessStart();
136
140 void onProcessEnd();
141
147 void onNewRun(RunHeader& rh);
148
149 private:
157
160
164 struct CacheEntry {
171 };
172
175};
176
177} // namespace fire
178
179#endif
Defines the run/event/type range for which a given condition is valid, including for all time.
Definition: ConditionsIntervalOfValidity.h:13
Base class for all conditions objects, very simple.
Definition: ConditionsObject.h:11
Container and cache for conditions and conditions providers.
Definition: Conditions.h:66
Conditions(const config::Parameters &ps, Process &p)
Configure the conditions system and attach the current process.
Definition: Conditions.cxx:9
std::map< std::string, std::shared_ptr< ConditionsProvider > > providers_
Map of who provides which condition.
Definition: Conditions.h:159
const ConditionType & get(const std::string &condition_name)
Primary request action for a conditions object.
Definition: Conditions.h:114
Process & process_
Handle to the Process.
Definition: Conditions.h:156
const ConditionsObject * getConditionPtr(const std::string &condition_name)
Core request action for a conditions object.
Definition: Conditions.cxx:46
void onProcessStart()
Calls onProcessStart for all instances of ConditionsProvider.
Definition: Conditions.cxx:25
void onProcessEnd()
Calls onProcessEnd for all instances of ConditionsProvider.
Definition: Conditions.cxx:29
void onNewRun(RunHeader &rh)
Calls onNewRun for all instances of ConditionsProvider.
Definition: Conditions.cxx:33
std::map< std::string, CacheEntry > cache_
Conditions cache.
Definition: Conditions.h:174
ConditionsIntervalOfValidity getConditionIOV(const std::string &condition_name) const
Access the interval of validity for the given condition.
Definition: Conditions.cxx:37
Standard base exception class with some useful output information.
Definition: Exception.h:18
The central object managing the data processing.
Definition: Process.h:16
Container for run parameters.
Definition: RunHeader.h:27
Class encapsulating parameters for configuring a processor.
Definition: Parameters.h:28
Interface to Boost.Logging.
fire::Process Process
alias Process into this namespace
Definition: EventProcessor.h:105
An entry to store an already loaded conditions object.
Definition: Conditions.h:164
std::shared_ptr< ConditionsProvider > provider
Provider that gave us the conditions object.
Definition: Conditions.h:168
ConditionsIntervalOfValidity iov
Interval Of Validity for this entry in the cache.
Definition: Conditions.h:166
const ConditionsObject * obj
Const pointer to the retrieved conditions object.
Definition: Conditions.h:170