7#include "Framework/RunHeader.h"
51 else if (hcal_geometry_ !=
nullptr &&
55 "Attempting to run a single job with multiple geometries " +
60 EXCEPTION_RAISE(
"GeometryException",
61 "HcalGeometryProvider unable to get the name of the "
62 "detector from the RunHeader.");
74 const std::string& name,
const std::string& tagname,
79 tagname, parameters, process},
85 if (hcal_geometry_)
delete hcal_geometry_;
89std::pair<const framework::ConditionsObject*, framework::ConditionsIOV>
91 static const std::string keyname(
"detectors_valid");
93 if (!hcal_geometry_) {
100 for (
auto key : phex.
keys()) {
104 if (!pver.
exists(keyname)) {
105 ldmx_log(warn) <<
"No parameter " << keyname <<
" found in " << key;
110 std::vector<std::string> dets_valid =
111 pver.
get<std::vector<std::string> >(keyname);
112 for (
auto detregex : dets_valid) {
113 std::string regex(detregex);
114 if (regex.empty())
continue;
115 if (regex[0] !=
'^') regex.insert(0, 1,
'^');
116 if (regex.back() !=
'$') regex +=
'$';
120 regcomp(®, regex.c_str(), REG_EXTENDED | REG_ICASE | REG_NOSUB);
123 regerror(rv, ®, err, 1024);
126 "Invalid detector regular expression : '" + regex +
"' " + err);
135 if (hcal_geometry_)
break;
137 if (!hcal_geometry_) {
138 EXCEPTION_RAISE(
"GeometryException",
"Unable to create HcalGeometry");
142 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 HCal ID into positions of strip hits.
be configured to load conditions objects from CSV files.
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.
std::vector< std::string > keys() const
Get a list of the keys available.
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
bool exists(const std::string &name) const
Check to see if a parameter exists.
virtual ~HcalGeometryProvider()
Destructor.
virtual void releaseConditionsObject(const framework::ConditionsObject *co)
Take no action on release, as the object is permanently owned by the Provider.
virtual std::pair< const framework::ConditionsObject *, framework::ConditionsIOV > getCondition(const ldmx::EventHeader &context)
Provides access to the HcalGeometry.
virtual void onNewRun(ldmx::RunHeader &rh)
Callback for the ConditionsObjectProvider to take any necessary action when the processing of events ...
std::string detector_geometry_
Geometry as last used.
framework::config::Parameters params_
Handle to the parameters, needed for future use during get condition.
HcalGeometryProvider(const std::string &name, const std::string &tagname, const framework::config::Parameters ¶meters, framework::Process &process)
Class constructor.
Implementation of HCal strip readout.
All classes in the ldmx-sw project use this namespace.