18 #include "art_root_io/RootDB/SQLite3Wrapper.h" 30 lar::providerFrom<geo::Geometry>(),
31 lar::providerFrom<detinfo::LArPropertiesService>(),
32 std::set<std::string>({
"InheritNumberTimeSamples"})}
74 if (filename.empty()) {
return; }
76 std::unique_ptr<TFile>
file{TFile::Open(filename.c_str(),
"READ")};
77 if (!
file) {
return; }
79 if (
file->IsZombie() || !
file->IsOpen()) {
return; }
83 art::SQLite3Wrapper sqliteDB(
file.get(),
"RootFileDB");
87 unsigned int iNumberTimeSamples = 0;
88 unsigned int nNumberTimeSamples = 0;
91 sqlite3_prepare_v2(sqliteDB,
"SELECT PSetBlob from ParameterSets;", -1, &stmt,
nullptr);
92 while (sqlite3_step(stmt) == SQLITE_ROW) {
101 auto const newNumberTimeSamples = ps.
get<
unsigned int>(
"NumberTimeSamples");
105 if (newNumberTimeSamples !=
fPS.
get<
unsigned int>(
"NumberTimeSamples")) {
106 if (nNumberTimeSamples == 0)
107 iNumberTimeSamples = newNumberTimeSamples;
108 else if (newNumberTimeSamples != iNumberTimeSamples) {
110 <<
"Historical values of NumberTimeSamples do not agree: " << iNumberTimeSamples
111 <<
" " << newNumberTimeSamples <<
"\n";
113 ++nNumberTimeSamples;
123 <<
"Overriding configuration parameter NumberTimeSamples using " 124 "historical value.\n" 126 <<
" Historical (used) value: " << iNumberTimeSamples <<
"\n";
142 return (ps.
get<
std::string>(
"service_type",
"") ==
"DetectorPropertiesService") &&
143 (ps.
get<
std::string>(
"service_provider",
"") ==
"DetectorPropertiesServiceStandard");
unsigned int NumberTimeSamples() const override
static ParameterSet make(intermediate_table const &tbl)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
struct sqlite3_stmt sqlite3_stmt
void SetNumberTimeSamples(unsigned int nsamp)
art framework interface to geometry description
DetectorPropertiesServiceStandard(fhicl::ParameterSet const &pset, art::ActivityRegistry ®)
T get(std::string const &key) const
DetectorPropertiesStandard fProp
fhicl::ParameterSet fPS
Original parameter set.
General LArSoft Utilities.
static constexpr double ps
bool isDetectorPropertiesServiceStandard(const fhicl::ParameterSet &ps) const
bool fInheritNumberTimeSamples
Flag saying whether to inherit NumberTimeSamples.
void postOpenFile(const std::string &filename)
cet::coded_exception< error, detail::translate > exception
#define DEFINE_ART_SERVICE_INTERFACE_IMPL(svc, iface)