6#include "Framework/RunHeader.h"
49 else if (ecal_geometry_ !=
nullptr &&
53 "Attempting to run a single job with multiple geometries " +
58 EXCEPTION_RAISE(
"GeometryException",
59 "EcalGeometryProvider unable to get the name of the "
60 "detector from the RunHeader.");
72 const std::string& name,
const std::string& tagname,
76 ldmx::EcalGeometry::CONDITIONS_OBJECT_NAME, tagname, parameters,
79 parameters.
get<std::vector<framework::config::Parameters>>(
"geometries");
84 if (ecal_geometry_)
delete ecal_geometry_;
88std::pair<const framework::ConditionsObject*, framework::ConditionsIOV>
90 static const std::string keyname(
"detectors_valid");
92 if (!ecal_geometry_) {
95 if (!pver.exists(keyname)) {
96 ldmx_log(warn) <<
"No parameter " << keyname
97 <<
" found one of the detector vesrsions.";
102 std::vector<std::string> dets_valid =
103 pver.get<std::vector<std::string>>(keyname);
104 for (
auto detregex : dets_valid) {
105 std::string regex(detregex);
106 if (regex.empty())
continue;
107 if (regex[0] !=
'^') regex.insert(0, 1,
'^');
108 if (regex.back() !=
'$') regex +=
'$';
112 regcomp(®, regex.c_str(), REG_EXTENDED | REG_ICASE | REG_NOSUB);
115 regerror(rv, ®, err, 1024);
118 "Invalid detector regular expression : '" + regex +
"' " + err);
127 if (ecal_geometry_)
break;
129 if (!ecal_geometry_) {
130 EXCEPTION_RAISE(
"GeometryException",
"Unable to create EcalGeometry");
134 return std::make_pair(
Base class for provider of conditions information like pedestals, gains, electronics maps,...
#define DECLARE_CONDITIONS_PROVIDER(CLASS)
Macro which allows the framework to construct a producer given its name during configuration.
Class that translates raw positions of ECal module hits into cells in a hexagonal readout.
be configured to load conditions objects from CSV files.
virtual ~EcalGeometryProvider()
Destructor.
EcalGeometryProvider(const std::string &name, const std::string &tagname, const framework::config::Parameters ¶meters, framework::Process &process)
Class constructor.
virtual std::pair< const framework::ConditionsObject *, framework::ConditionsIOV > getCondition(const ldmx::EventHeader &context)
Provides access to the EcalGeometry or EcalTriggerGeometry.
std::string detector_geometry_
Geometry as last used.
std::vector< framework::config::Parameters > geometries_
parameters for the various geometry versions we can support
virtual void releaseConditionsObject(const framework::ConditionsObject *co)
Take no action on release, as the object is permanently owned by the Provider.
virtual void onNewRun(ldmx::RunHeader &rh)
Callback for the ConditionsObjectProvider to take any necessary action when the processing of events ...
Class which defines the run/event/type range for which a given condition is valid,...
Base class for all providers of conditions objects.
const Process & process() const
Get the process handle.
Base class for all conditions objects, very simple.
Class which represents the process under execution.
Class encapsulating parameters for configuring a processor.
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Translation between real-space positions and cell IDs within the ECal.
All classes in the ldmx-sw project use this namespace.