LDMX Software
framework::ConditionsObjectProvider Class Referenceabstract

Base class for all providers of conditions objects. More...

#include <ConditionsObjectProvider.h>

Public Member Functions

 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
 
 ConditionsObjectProvider (const std::string &objname, const std::string &tagname, const framework::config::Parameters &parameters, Process &process)
 Class constructor.
 
virtual ~ConditionsObjectProvider ()=default
 Class destructor.
 
virtual std::pair< const ConditionsObject *, ConditionsIOVgetCondition (const ldmx::EventHeader &context)=0
 Pure virtual getCondition function.
 
virtual void releaseConditionsObject (const ConditionsObject *co)
 Called by conditions system when done with a conditions object, appropriate point for cleanup.
 
virtual void onProcessStart ()
 Callback for the ConditionsObjectProvider to take any necessary action when the processing of events starts.
 
virtual void onProcessEnd ()
 Callback for the ConditionsObjectProvider to take any necessary action when the processing of events finishes, such as closing database connections.
 
virtual void onNewRun (ldmx::RunHeader &)
 Callback for the ConditionsObjectProvider to take any necessary action when the processing of events starts for a given run.
 
const std::string & getConditionObjectName () const
 Get the list of conditions objects available from this provider.
 
const std::string & getTagName () const
 Access the tag name.
 

Protected Member Functions

std::pair< const ConditionsObject *, ConditionsIOVrequestParentCondition (const std::string &name, const ldmx::EventHeader &context)
 Request another condition needed to construct this condition.
 
const Processprocess () const
 Get the process handle.
 

Protected Attributes

logging::logger the_log_
 The logger for this ConditionsObjectProvider.
 

Private Attributes

Processprocess_
 Handle to the Process.
 
std::string object_name_
 The name of the object provided by this provider.
 
std::string tagname_
 The tag name for the ConditionsObjectProvider.
 

Detailed Description

Base class for all providers of conditions objects.

Definition at line 44 of file ConditionsObjectProvider.h.

Constructor & Destructor Documentation

◆ ConditionsObjectProvider()

ConditionsObjectProvider::ConditionsObjectProvider ( const std::string & objname,
const std::string & tagname,
const framework::config::Parameters & parameters,
Process & process )

Class constructor.

Parameters
nameName for this instance of the class.
tagNameThe tag for the database entry (should not include whitespace)
processThe Process class associated with ConditionsObjectProvider, provided by the framework.
Note
The name provided to this function should not be the class name, but rather a logical label for this instance of the class, as more than one copy of a given class can be loaded into a Process with different parameters. Names should not include whitespace or special characters.

Definition at line 8 of file ConditionsObjectProvider.cxx.

11 : the_log_{logging::makeLogger(objname)},
13 object_name_{objname},
14 tagname_{tagname} {}
std::string object_name_
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.
logging::logger the_log_
The logger for this ConditionsObjectProvider.
Process & process_
Handle to the Process.

Member Function Documentation

◆ getCondition()

◆ getConditionObjectName()

const std::string & framework::ConditionsObjectProvider::getConditionObjectName ( ) const
inline

Get the list of conditions objects available from this provider.

Definition at line 114 of file ConditionsObjectProvider.h.

114{ return object_name_; }

References object_name_.

◆ getTagName()

const std::string & framework::ConditionsObjectProvider::getTagName ( ) const
inline

Access the tag name.

Definition at line 119 of file ConditionsObjectProvider.h.

119{ return tagname_; }

References tagname_.

◆ onNewRun()

virtual void framework::ConditionsObjectProvider::onNewRun ( ldmx::RunHeader & )
inlinevirtual

Callback for the ConditionsObjectProvider to take any necessary action when the processing of events starts for a given run.

Reimplemented in ecal::EcalGeometryProvider, framework::RandomNumberSeedService, and hcal::HcalGeometryProvider.

Definition at line 109 of file ConditionsObjectProvider.h.

109{}

◆ onProcessEnd()

virtual void framework::ConditionsObjectProvider::onProcessEnd ( )
inlinevirtual

Callback for the ConditionsObjectProvider to take any necessary action when the processing of events finishes, such as closing database connections.

Definition at line 103 of file ConditionsObjectProvider.h.

103{}

◆ onProcessStart()

virtual void framework::ConditionsObjectProvider::onProcessStart ( )
inlinevirtual

Callback for the ConditionsObjectProvider to take any necessary action when the processing of events starts.

Definition at line 96 of file ConditionsObjectProvider.h.

96{}

◆ process()

const Process & framework::ConditionsObjectProvider::process ( ) const
inlineprotected

Get the process handle.

Definition at line 130 of file ConditionsObjectProvider.h.

130{ return process_; }

References process_.

Referenced by framework::RandomNumberSeedService::onNewRun().

◆ releaseConditionsObject()

virtual void framework::ConditionsObjectProvider::releaseConditionsObject ( const ConditionsObject * co)
inlinevirtual

Called by conditions system when done with a conditions object, appropriate point for cleanup.

Note
Default behavior is to delete the object!

Reimplemented in ecal::EcalDetectorMapLoader, ecal::EcalGeometryProvider, ecal::EcalTriggerGeometryProvider, framework::RandomNumberSeedService, hcal::HcalDetectorMapLoader, hcal::HcalGeometryProvider, and hcal::HcalTriggerGeometryProvider.

Definition at line 88 of file ConditionsObjectProvider.h.

88 {
89 delete co;
90 }

◆ requestParentCondition()

std::pair< const ConditionsObject *, ConditionsIOV > ConditionsObjectProvider::requestParentCondition ( const std::string & name,
const ldmx::EventHeader & context )
protected

Request another condition needed to construct this condition.

Definition at line 17 of file ConditionsObjectProvider.cxx.

18 {
19 const ConditionsObject* obj = process_.getConditions().getConditionPtr(name);
20 ConditionsIOV iov = process_.getConditions().getConditionIOV(name);
21 return std::make_pair(obj, iov);
22}
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),...
ConditionsIOV getConditionIOV(const std::string &condition_name) const
Access the IOV for the given condition.
Conditions & getConditions()
Get a reference to the conditions system.
Definition Process.h:78

References framework::Conditions::getConditionIOV(), framework::Conditions::getConditionPtr(), framework::Process::getConditions(), and process_.

Referenced by ecal::EcalTriggerGeometryProvider::getCondition(), hcal::HcalReconConditionsProvider::getCondition(), and tracking::geo::TrackersTrackingGeometryProvider::getCondition().

Member Data Documentation

◆ object_name_

std::string framework::ConditionsObjectProvider::object_name_
private

The name of the object provided by this provider.

Definition at line 137 of file ConditionsObjectProvider.h.

Referenced by getConditionObjectName().

◆ process_

Process& framework::ConditionsObjectProvider::process_
private

Handle to the Process.

Definition at line 134 of file ConditionsObjectProvider.h.

Referenced by process(), and requestParentCondition().

◆ tagname_

std::string framework::ConditionsObjectProvider::tagname_
private

The tag name for the ConditionsObjectProvider.

Definition at line 140 of file ConditionsObjectProvider.h.

Referenced by getTagName().

◆ the_log_

logging::logger framework::ConditionsObjectProvider::the_log_
protected

The logger for this ConditionsObjectProvider.

Definition at line 127 of file ConditionsObjectProvider.h.


The documentation for this class was generated from the following files: