4 #include "art_root_io/RootDB/SQLite3Wrapper.h" 33 auto trig_handle = evt.
getHandle<std::vector<raw::Trigger> >(
fClocks->TrigModuleName());
35 std::vector<std::string> cfgNames =
fClocks->ConfigNames();
36 std::vector<double> cfgValues =
fClocks->ConfigValues();
40 if(!trig_handle.isValid() || trig_handle->empty()) {
47 if(trig_handle->size()>1)
49 throw cet::exception(
"DetectorClocksServiceStandardGAr::preProcessEvent")
51 << trig_handle->size()
52 <<
" triggers (only 1 trigger/event supported)\n";
54 const ::art::Ptr<raw::Trigger> trig_ptr(trig_handle,0);
56 fClocks->SetTriggerTime(trig_ptr->TriggerTime(),
57 trig_ptr->BeamGateTime() );
80 if(!
fClocks->InheritClockConfig())
return;
85 if(!filename.empty()) {
87 TFile*
file = TFile::Open(filename.c_str(),
"READ");
88 if(file != 0 && !file->IsZombie() && file->IsOpen()) {
90 std::vector<std::string> cfgName =
fClocks->ConfigNames();
91 std::vector<double> cfgValue =
fClocks->ConfigValues();
95 ::art::SQLite3Wrapper sqliteDB(file,
"RootFileDB");
103 sqlite3_prepare_v2(sqliteDB,
"SELECT PSetBlob from ParameterSets;", -1, &stmt, NULL);
105 while (sqlite3_step(stmt) == SQLITE_ROW) {
111 if(!
fClocks->IsRightConfig(
ps))
continue;
115 double value_from_file =
ps.get<
double>(cfgName.at(i).c_str());
117 if(!(config_count.at(i)))
119 config_value.at(i) = value_from_file;
121 else if(config_value.at(i) != value_from_file)
124 << Form(
"\033[95mFound historical value disagreement for %s ... %g != %g",
125 cfgName.at(i).c_str(),
129 config_count.at(i) +=1;
139 if(config_count.at(i) && cfgValue.at(i) != config_value.at(i)) {
142 << Form(
"\033[93mOverriding configuration parameter %s ... %g (fcl) => %g (data file)\033[00m",
143 cfgName.at(i).c_str(),
147 fClocks->SetConfigValue(i,config_value.at(i));
virtual void reconfigure(fhicl::ParameterSet const &pset) override
Handle< PROD > getHandle(SelectorBase const &) const
static ParameterSet make(intermediate_table const &tbl)
void postOpenFile(std::string const &filename)
struct sqlite3_stmt sqlite3_stmt
DetectorClocksServiceStandardGAr(fhicl::ParameterSet const &pset,::art::ActivityRegistry ®)
void preProcessEvent(::art::Event const &evt, art::ScheduleContext)
std::unique_ptr< detinfo::DetectorClocksStandardGAr > fClocks
General LArSoft Utilities.
static constexpr double ps
#define MF_LOG_INFO(category)
GlobalSignal< detail::SignalResponseType::FIFO, void(Event const &, ScheduleContext)> sPreProcessEvent
void preBeginRun(::art::Run const &run)
GlobalSignal< detail::SignalResponseType::FIFO, void(Run const &)> sPreBeginRun
GlobalSignal< detail::SignalResponseType::LIFO, void(std::string const &)> sPostOpenFile
cet::coded_exception< error, detail::translate > exception
#define DEFINE_ART_SERVICE_INTERFACE_IMPL(svc, iface)