13 const std::string& classname,
const std::string& objname,
17 classname, objname, tagname, params,
process_);
23 "ConditionAmbiguityException",
24 "Multiple ConditonsObjectProviders configured to provide " +
29 EXCEPTION_RAISE(
"ConditionsException",
30 "No ConditionsObjectProvider for " + classname);
39 for (
auto ptr :
providerMap_) ptr.second->onProcessEnd();
47 const std::string& condition_name)
const {
48 auto cacheptr =
cache_.find(condition_name);
49 if (cacheptr ==
cache_.end())
52 return cacheptr->second.iov;
56 const std::string& condition_name) {
58 auto cacheptr =
cache_.find(condition_name);
60 if (cacheptr ==
cache_.end()) {
64 EXCEPTION_RAISE(
"ConditionUnavailable",
65 "No provider is available for : " + condition_name);
68 std::pair<const ConditionsObject*, ConditionsIOV> cond =
69 copptr->second->getCondition(context);
73 "ConditionUnavailable",
74 "Null condition returned for requested item : " + condition_name);
82 cache_[condition_name] = ce;
86 if (cacheptr->second.iov.validForEvent(context))
87 return cacheptr->second.obj;
90 cacheptr->second.provider->releaseConditionsObject(cacheptr->second.obj);
92 std::pair<const ConditionsObject*, ConditionsIOV> cond =
93 cacheptr->second.provider->getCondition(context);
97 s <<
"Unable to update condition '" << condition_name <<
"' for event "
103 EXCEPTION_RAISE(
"ConditionUnavailable", s.str());
105 cacheptr->second.iov = cond.second;
106 cacheptr->second.obj = cond.first;
Container and caching class for conditions information.
Class which provides a singleton module factory that creates EventProcessor objects.
Class which represents the process under execution.
Class which defines the run/event/type range for which a given condition is valid,...
Base class for all providers of conditions objects.
virtual void onProcessStart()
Callback for the ConditionsObjectProvider to take any necessary action when the processing of events ...
const std::string & getConditionObjectName() const
Get the list of conditions objects available from this provider.
Base class for all conditions objects, very simple.
Process & process_
Handle to the Process.
std::map< std::string, CacheEntry > cache_
Conditions cache.
std::map< std::string, ConditionsObjectProvider * > providerMap_
Map of who provides which condition.
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.
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 ¶ms)
Create a ConditionsObjectProvider given the information.
ConditionsObjectProvider * createConditionsObjectProvider(const std::string &classname, const std::string &objName, const std::string &tagname, const framework::config::Parameters ¶ms, Process &process)
Make a conditions object provider.
static PluginFactory & getInstance()
Get the factory instance.
Class which represents the process under execution.
const ldmx::EventHeader * getEventHeader() const
Get the pointer to the current event header, if defined.
Class encapsulating parameters for configuring a processor.
All classes in the ldmx-sw project use this namespace.
An entry to store an already loaded conditions object.
ConditionsObjectProvider * provider
Provider that gave us the conditions object.
const ConditionsObject * obj
Const pointer to the retrieved conditions object.
ConditionsIOV iov
Interval Of Validity for this entry in the cache.