LDMX Software
ConditionsObjectProvider.h
Go to the documentation of this file.
1
8#ifndef FRAMEWORK_CONDITIONSOBJECTPROVIDER_H_
9#define FRAMEWORK_CONDITIONSOBJECTPROVIDER_H_
10
11/*~~~~~~~~~~~*/
12/* Event */
13/*~~~~~~~~~~~*/
14#include "Framework/Exception/Exception.h"
15
16/*~~~~~~~~~~~~~~~*/
17/* Framework */
18/*~~~~~~~~~~~~~~~*/
21#include "Framework/Configure/Parameters.h"
22#include "Framework/Factory.h"
23#include "Framework/Logger.h"
24
25/*~~~~~~~~~~~~~~~~*/
26/* C++ StdLib */
27/*~~~~~~~~~~~~~~~~*/
28#include <map>
29
30namespace ldmx {
31class EventHeader;
32class RunHeader;
33} // namespace ldmx
34
35namespace framework {
36
37class Process;
39
45 public:
48 std::shared_ptr<ConditionsObjectProvider>, const std::string&,
49 const std::string&, const framework::config::Parameters&,
50 Process&);
51
66 ConditionsObjectProvider(const std::string& objname,
67 const std::string& tagname,
68 const framework::config::Parameters& parameters,
70
74 virtual ~ConditionsObjectProvider() = default;
75
80 virtual std::pair<const ConditionsObject*, ConditionsIOV> getCondition(
81 const ldmx::EventHeader& context) = 0;
82
88 virtual void releaseConditionsObject(const ConditionsObject* co) {
89 delete co;
90 }
91
96 virtual void onProcessStart() {}
97
103 virtual void onProcessEnd() {}
104
109 virtual void onNewRun(ldmx::RunHeader&) {}
110
114 const std::string& getConditionObjectName() const { return object_name_; }
115
119 const std::string& getTagName() const { return tagname_; }
120
121 protected:
123 std::pair<const ConditionsObject*, ConditionsIOV> requestParentCondition(
124 const std::string& name, const ldmx::EventHeader& context);
125
127 logging::logger the_log_;
128
130 const Process& process() const { return process_; }
131
132 private:
135
137 std::string object_name_;
138
140 std::string tagname_;
141};
142
143} // namespace framework
144
157#define DECLARE_CONDITIONS_PROVIDER(CLASS) \
158 FACTORY_REGISTRATION(framework::ConditionsObjectProvider, CLASS)
159
160#endif
Interval-of-validity object for conditions information.
Base class for conditions information like pedestals, gains, electronics maps, etc.
Header holding Factory class and supporting macros.
be configured to load conditions objects from CSV files.
Base class for all providers of conditions objects.
std::string object_name_
The name of the object provided by this provider.
virtual void onProcessStart()
Callback for the ConditionsObjectProvider to take any necessary action when the processing of events ...
std::pair< const ConditionsObject *, ConditionsIOV > requestParentCondition(const std::string &name, const ldmx::EventHeader &context)
Request another condition needed to construct this condition.
virtual void onNewRun(ldmx::RunHeader &)
Callback for the ConditionsObjectProvider to take any necessary action when the processing of events ...
const Process & process() const
Get the process handle.
DECLARE_FACTORY(ConditionsObjectProvider, std::shared_ptr< ConditionsObjectProvider >, const std::string &, const std::string &, const framework::config::Parameters &, Process &)
declare that we have a factory for these types of classes
std::string tagname_
The tag name for the ConditionsObjectProvider.
virtual void onProcessEnd()
Callback for the ConditionsObjectProvider to take any necessary action when the processing of events ...
virtual std::pair< const ConditionsObject *, ConditionsIOV > getCondition(const ldmx::EventHeader &context)=0
Pure virtual getCondition function.
ConditionsObjectProvider(const std::string &objname, const std::string &tagname, const framework::config::Parameters &parameters, Process &process)
Class constructor.
const std::string & getTagName() const
Access the tag name.
virtual void releaseConditionsObject(const ConditionsObject *co)
Called by conditions system when done with a conditions object, appropriate point for cleanup.
logging::logger the_log_
The logger for this ConditionsObjectProvider.
virtual ~ConditionsObjectProvider()=default
Class destructor.
Process & process_
Handle to the Process.
const std::string & getConditionObjectName() const
Get the list of conditions objects available from this provider.
Base class for all conditions objects, very simple.
Class which represents the process under execution.
Definition Process.h:36
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:29
Provides header information an event such as event number and timestamp.
Definition EventHeader.h:44
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.