6#include "Framework/RunHeader.h"
35 if (detector_geometry_.empty())
36 detector_geometry_ = rh_det;
37 else if (ts_geometry_ !=
nullptr && !rh_det.empty() &&
38 detector_geometry_ != rh_det) {
41 "Attempting to run a single job with multiple geometries " +
42 detector_geometry_ +
" and '" + rh_det +
"'");
44 if (detector_geometry_.empty())
45 EXCEPTION_RAISE(
"GeometryException",
46 "TrigScintGeometryProvider unable to get the detector "
47 "name from the RunHeader; set the 'detector' parameter.");
52 std::string detector_geometry_;
56TrigScintGeometryProvider::TrigScintGeometryProvider(
57 const std::string& name,
const std::string& tagname,
61 CONDITIONS_OBJECT_NAME,
62 tagname, parameters, process},
66 detector_geometry_ = parameters.
get<std::string>(
"detector",
"");
69TrigScintGeometryProvider::~TrigScintGeometryProvider() {
70 if (ts_geometry_)
delete ts_geometry_;
74std::pair<const framework::ConditionsObject*, framework::ConditionsIOV>
76 static const std::string keyname(
"detectors_valid");
80 (params_.
exists(
"trig_scint_geometry"))
82 "trig_scint_geometry"))
85 for (
auto key : pts.
keys()) {
89 if (!pver.
exists(keyname)) {
90 ldmx_log(warn) <<
"No parameter " << keyname <<
" found in " << key;
94 std::vector<std::string> dets_valid =
95 pver.
get<std::vector<std::string> >(keyname);
96 for (
auto detregex : dets_valid) {
97 std::string regex(detregex);
98 if (regex.empty())
continue;
99 if (regex[0] !=
'^') regex.insert(0, 1,
'^');
100 if (regex.back() !=
'$') regex +=
'$';
104 regcomp(®, regex.c_str(), REG_EXTENDED | REG_ICASE | REG_NOSUB);
107 regerror(rv, ®, err, 1024);
110 "Invalid detector regular expression : '" + regex +
"' " + err);
112 int nmatch = regexec(®, detector_geometry_.c_str(), 0, 0, 0);
119 if (ts_geometry_)
break;
122 EXCEPTION_RAISE(
"GeometryException",
123 "Unable to create TrigScintGeometry");
127 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 a trigger-scintillator (module, bar) into a global bar-center position.
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.
Bar-center positions of the trigger-scintillator modules.
virtual void onNewRun(ldmx::RunHeader &rh)
Callback for the ConditionsObjectProvider to take any necessary action when the processing of events ...
virtual void releaseConditionsObject(const framework::ConditionsObject *co)
Called by conditions system when done with a conditions object, appropriate point for cleanup.
virtual std::pair< const framework::ConditionsObject *, framework::ConditionsIOV > getCondition(const ldmx::EventHeader &context)
Pure virtual getCondition function.
All classes in the ldmx-sw project use this namespace.