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/Logger.h"
23
24/*~~~~~~~~~~~~~~~~*/
25/* C++ StdLib */
26/*~~~~~~~~~~~~~~~~*/
27#include <map>
28
29namespace ldmx {
30class EventHeader;
31class RunHeader;
32} // namespace ldmx
33
34namespace framework {
35
36class Process;
38
41 const std::string& objname, const std::string& tagname,
42 const framework::config::Parameters& params, Process& process);
43
49 public:
51 static const int CLASSTYPE{10};
52
67 ConditionsObjectProvider(const std::string& objname,
68 const std::string& tagname,
69 const framework::config::Parameters& parameters,
71
76
81 virtual std::pair<const ConditionsObject*, ConditionsIOV> getCondition(
82 const ldmx::EventHeader& context) = 0;
83
89 virtual void releaseConditionsObject(const ConditionsObject* co) {
90 delete co;
91 }
92
97 virtual void onProcessStart() {}
98
104 virtual void onProcessEnd() {}
105
110 virtual void onNewRun(ldmx::RunHeader&) {}
111
115 const std::string& getConditionObjectName() const { return objectName_; }
116
121 static void declare(const std::string& classname,
123
127 const std::string& getTagName() const { return tagname_; }
128
129 protected:
131 std::pair<const ConditionsObject*, ConditionsIOV> requestParentCondition(
132 const std::string& name, const ldmx::EventHeader& context);
133
135 logging::logger theLog_;
136
138 const Process& process() const { return process_; }
139
140 private:
143
145 std::string objectName_;
146
148 std::string tagname_;
149};
150
151} // namespace framework
152
164#define DECLARE_CONDITIONS_PROVIDER(CLASS) \
165 framework::ConditionsObjectProvider* CLASS##_ldmx_make( \
166 const std::string& name, const std::string& tagname, \
167 const framework::config::Parameters& params, \
168 framework::Process& process) { \
169 return new CLASS(name, tagname, params, process); \
170 } \
171 __attribute__((constructor(1000))) static void CLASS##_ldmx_declare() { \
172 framework::ConditionsObjectProvider::declare(#CLASS, &CLASS##_ldmx_make); \
173 }
174
184#define DECLARE_CONDITIONS_PROVIDER_NS(NS, CLASS) \
185 framework::ConditionsObjectProvider* CLASS##_ldmx_make( \
186 const std::string& name, const std::string& tagname, \
187 const framework::config::Parameters& params, \
188 framework::Process& process) { \
189 return new NS::CLASS(name, tagname, params, process); \
190 } \
191 __attribute__((constructor(1000))) static void CLASS##_ldmx_declare() { \
192 framework::ConditionsObjectProvider::declare( \
193 std::string(#NS) + "::" + std::string(#CLASS), &CLASS##_ldmx_make); \
194 }
195
196#endif
Interval-of-validity object for conditions information.
Base class for conditions information like pedestals, gains, electronics maps, etc.
be configured to load conditions objects from CSV files.
Base class for all providers of conditions objects.
static const int CLASSTYPE
Constant used to types by the PluginFactory.
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.
logging::logger theLog_
The logger for this ConditionsObjectProvider.
virtual ~ConditionsObjectProvider()
Class destructor.
virtual void onNewRun(ldmx::RunHeader &)
Callback for the ConditionsObjectProvider to take any necessary action when the processing of events ...
std::string objectName_
The name of the object provided by this provider.
const Process & process() const
Get the process handle.
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.
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.
static void declare(const std::string &classname, ConditionsObjectProviderMaker *)
Internal function which is part of the PluginFactory machinery.
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:27
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:54
All classes in the ldmx-sw project use this namespace.
Definition PerfDict.cxx:45
ConditionsObjectProvider * ConditionsObjectProviderMaker(const std::string &objname, const std::string &tagname, const framework::config::Parameters &params, Process &process)
Typedef for PluginFactory use.