10 : fClocks(std::make_unique<detinfo::DetectorClocksStandard>(pset))
13 reg.
sPreProcessEvent.watch (
this, &DetectorClocksServiceStandard::preProcessEvent);
14 reg.
sPostOpenFile.watch (
this, &DetectorClocksServiceStandard::postOpenFile);
15 reg.
sPreBeginRun.watch (
this, &DetectorClocksServiceStandard::preBeginRun);
51 if(!
fClocks->InheritClockConfig())
return;
56 if(!filename.empty()) {
58 TFile*
file = TFile::Open(filename.c_str(),
"READ");
59 if(file != 0 && !file->IsZombie() && file->IsOpen()) {
61 std::vector<std::string> cfgName =
fClocks->ConfigNames();
62 std::vector<double> cfgValue =
fClocks->ConfigValues();
73 sqlite3_stmt * stmt = 0;
74 sqlite3_prepare_v2(sqliteDB,
"SELECT PSetBlob from ParameterSets;", -1, &stmt, NULL);
76 while (sqlite3_step(stmt) == SQLITE_ROW) {
81 if(!
fClocks->IsRightConfig(ps))
continue;
85 double value_from_file = ps.
get<
double>(cfgName.at(i).c_str());
87 if(!(config_count.at(i)))
89 config_value.at(i) = value_from_file;
91 else if(config_value.at(i) != value_from_file)
93 throw cet::exception(__FUNCTION__) << Form(
"\033[95mFound historical value disagreement for %s ... %g != %g",
94 cfgName.at(i).c_str(),
97 <<
"\033[00m" << std::endl;
98 config_count.at(i) +=1;
108 if(config_count.at(i) && cfgValue.at(i) != config_value.at(i)) {
110 std::cout << Form(
"\033[93mOverriding configuration parameter %s ... %g (fcl) => %g (data file)\033[00m",
111 cfgName.at(i).c_str(),
116 fClocks->SetConfigValue(i,config_value.at(i));
bool setDetectorClocksStandardTrigger(detinfo::DetectorClocksStandard &detClocks, Event const &event)
Loads DetectorClocksStandard trigger times.
#define DEFINE_ART_SERVICE_INTERFACE_IMPL(svc, iface)
void make_ParameterSet(intermediate_table const &tbl, ParameterSet &ps)
virtual void reconfigure(fhicl::ParameterSet const &pset) override
void preBeginRun(const art::Run &run)
T get(std::string const &key) const
void postOpenFile(const std::string &filename)
art service managing detinfo::DetectorClocksStandard.
GlobalSignal< detail::SignalResponseType::FIFO, void(Run const &)> sPreBeginRun
GlobalSignal< detail::SignalResponseType::FIFO, void(Event const &)> sPreProcessEvent
GlobalSignal< detail::SignalResponseType::LIFO, void(std::string const &)> sPostOpenFile
void preProcessEvent(const art::Event &evt)
std::unique_ptr< detinfo::DetectorClocksStandard > fClocks
Functions to load trigger time in detinfo::DetectorClocksStandard.
DetectorClocksServiceStandard(fhicl::ParameterSet const &pset, art::ActivityRegistry ®)
cet::coded_exception< error, detail::translate > exception