fire v0.19.0
Framework for sImulation and Reconstruction of Events
ConditionsProvider.h
1#ifndef FIRE_CONDITIONSPROVIDER_H
2#define FIRE_CONDITIONSPROVIDER_H
3
4#include <map>
5
6#include "fire/ConditionsIntervalOfValidity.h"
7#include "fire/ConditionsObject.h"
8#include "fire/RunHeader.h"
9#include "fire/config/Parameters.h"
10#include "fire/exception/Exception.h"
11#include "fire/factory/Factory.h"
12#include "fire/logging/Logger.h"
13
14namespace fire {
15
17class Conditions;
18
84 public:
91 using Factory =
93 const config::Parameters&>;
99
103 virtual ~ConditionsProvider() = default;
104
114 getCondition(const EventHeader& context) = 0;
115
124 virtual void release(const ConditionsObject* co) { delete co; }
125
130 virtual void onProcessStart() {}
131
137 virtual void onProcessEnd() {}
138
143 virtual void onNewRun(RunHeader&) {}
144
149
153 const std::string& getTagName() const { return tagname_; }
154
158 virtual void attach(Conditions* c) final { conditions_ = c; }
159
160 protected:
173 requestParentCondition(const std::string& name, const EventHeader& context);
174
177
178 private:
181
184
187};
188
189} // namespace fire
190
212#define DECLARE_CONDITIONS_PROVIDER(CLASS) \
213 namespace { \
214 auto v = fire::ConditionsProvider::Factory::get().declare<CLASS>(); \
215 }
216
217#endif
Base class for all conditions objects, very simple.
Definition: ConditionsObject.h:11
Base class for all providers of conditions objects.
Definition: ConditionsProvider.h:83
virtual void attach(Conditions *c) final
Attach the central conditions system to this provider.
Definition: ConditionsProvider.h:158
virtual std::pair< const ConditionsObject *, ConditionsIntervalOfValidity > getCondition(const EventHeader &context)=0
Pure virtual getCondition function.
Conditions * conditions_
Handle to the central conditions system.
Definition: ConditionsProvider.h:180
const std::string & getTagName() const
Access the tag name.
Definition: ConditionsProvider.h:153
const std::string & getConditionObjectName() const
Get the condition object available from this provider.
Definition: ConditionsProvider.h:148
std::string tagname_
The tag name for the ConditionsProvider.
Definition: ConditionsProvider.h:186
virtual void release(const ConditionsObject *co)
Called by conditions system when done with a conditions object, appropriate point for cleanup.
Definition: ConditionsProvider.h:124
std::pair< const ConditionsObject *, ConditionsIntervalOfValidity > requestParentCondition(const std::string &name, const EventHeader &context)
Request another condition needed to construct this condition.
Definition: ConditionsProvider.cxx:12
virtual ~ConditionsProvider()=default
default destructor, virtual so derived types can be destructed
virtual void onNewRun(RunHeader &)
Callback for the ConditionsProvider to take any necessary action when the processing of events starts...
Definition: ConditionsProvider.h:143
logging::logger theLog_
The logger for this ConditionsProvider.
Definition: ConditionsProvider.h:176
virtual void onProcessStart()
Callback for the ConditionsProvider to take any necessary action when the processing of events starts...
Definition: ConditionsProvider.h:130
ConditionsProvider(const fire::config::Parameters &ps)
Configure the registered provider.
Definition: ConditionsProvider.cxx:6
std::string objectName_
The name of the object provided by this provider.
Definition: ConditionsProvider.h:183
virtual void onProcessEnd()
Callback for the ConditionsProvider to take any necessary action when the processing of events finish...
Definition: ConditionsProvider.h:137
Container and cache for conditions and conditions providers.
Definition: Conditions.h:66
Header information of an event such as event number and timestamp.
Definition: EventHeader.h:27
Container for run parameters.
Definition: RunHeader.h:27
Class encapsulating parameters for configuring a processor.
Definition: Parameters.h:28
Factory to dynamically create objects derived from a specific prototype class.
Definition: Factory.h:231
Interface to Boost.Logging.
log::sources::severity_channel_logger_mt< level, std::string > logger
Short names for boost::log.
Definition: Logger.h:84