13 const std::string& classname,
const std::string& objname,
15 auto cop = ConditionsObjectProvider::Factory::get().make(
16 classname, objname, tagname, params,
process_);
18 EXCEPTION_RAISE(
"UnableToCreate",
19 "No ConditionsObjectProvider for " + classname);
22 std::string provides = cop.value()->getConditionObjectName();
25 "ConditionAmbiguityException",
26 "Multiple ConditonsObjectProviders configured to provide " + provides);
44 const std::string& condition_name)
const {
45 auto cacheptr =
cache_.find(condition_name);
46 if (cacheptr ==
cache_.end()) {
49 return cacheptr->second.iov_;
54 const std::string& condition_name) {
56 auto cacheptr =
cache_.find(condition_name);
58 if (cacheptr ==
cache_.end()) {
62 EXCEPTION_RAISE(
"ConditionUnavailable",
63 "No provider is available for : " + condition_name);
66 std::pair<const ConditionsObject*, ConditionsIOV> cond =
67 copptr->second->getCondition(context);
71 "ConditionUnavailable",
72 "Null condition returned for requested item : " + condition_name);
77 ce.
iov_ = cond.second;
80 cache_[condition_name] = ce;
84 if (cacheptr->second.iov_.validForEvent(context)) {
85 return cacheptr->second.obj_;
88 cacheptr->second.provider_->releaseConditionsObject(
89 cacheptr->second.obj_);
91 std::pair<const ConditionsObject*, ConditionsIOV> cond =
92 cacheptr->second.provider_->getCondition(context);
96 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;
Base class for provider of conditions information like pedestals, gains, electronics maps,...
Container and caching class for conditions information.
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 conditions objects, very simple.
Process & process_
Handle to the Process.
std::map< std::string, CacheEntry > cache_
Conditions cache.
std::map< std::string, std::shared_ptr< ConditionsObjectProvider > > provider_map_
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.
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.
const ConditionsObject * obj_
Const pointer to the retrieved conditions object.
ConditionsIOV iov_
Interval Of Validity for this entry in the cache.
std::shared_ptr< ConditionsObjectProvider > provider_
Provider that gave us the conditions object.