14 #include "messagefacility/MessageLogger/MessageLogger.h"
17 #include "art_root_io/RootDB/SQLite3Wrapper.h"
26 fhicl::ParameterSet
const& pset,
27 art::ActivityRegistry& reg)
29 lar::providerFrom<geo::Geometry>(),
30 lar::providerFrom<detinfo::LArPropertiesService>(),
31 std::set<std::string>({
"InheritNumberTimeSamples"})}
73 if (filename.empty()) {
return; }
75 std::unique_ptr<TFile>
file{TFile::Open(filename.c_str(),
"READ")};
76 if (!
file) {
return; }
78 if (
file->IsZombie() || !
file->IsOpen()) {
return; }
86 unsigned int iNumberTimeSamples = 0;
87 unsigned int nNumberTimeSamples = 0;
89 sqlite3_stmt* stmt =
nullptr;
90 sqlite3_prepare_v2(
sqliteDB,
"SELECT PSetBlob from ParameterSets;", -1, &stmt,
nullptr);
91 while (sqlite3_step(stmt) == SQLITE_ROW) {
92 fhicl::ParameterSet ps;
93 ps = fhicl::ParameterSet::make(reinterpret_cast<char const*>(sqlite3_column_text(stmt, 0)));
100 auto const newNumberTimeSamples = ps.get<
unsigned int>(
"NumberTimeSamples");
104 if (newNumberTimeSamples !=
fPS.get<
unsigned int>(
"NumberTimeSamples")) {
105 if (nNumberTimeSamples == 0)
106 iNumberTimeSamples = newNumberTimeSamples;
107 else if (newNumberTimeSamples != iNumberTimeSamples) {
108 throw cet::exception(__FUNCTION__)
109 <<
"Historical values of NumberTimeSamples do not agree: " << iNumberTimeSamples
110 <<
" " << newNumberTimeSamples <<
"\n";
112 ++nNumberTimeSamples;
121 mf::LogInfo(
"DetectorPropertiesServiceStandard")
122 <<
"Overriding configuration parameter NumberTimeSamples using "
123 "historical value.\n"
125 <<
" Historical (used) value: " << iNumberTimeSamples <<
"\n";
135 const fhicl::ParameterSet& ps)
const
141 return (ps.get<std::string>(
"service_type",
"") ==
"DetectorPropertiesService") &&
142 (ps.get<std::string>(
"service_provider",
"") ==
"DetectorPropertiesServiceStandard");
Utilities to manage ProviderPack objects with art.
unsigned int NumberTimeSamples() const override
BEGIN_PROLOG could also be dds filename
void SetNumberTimeSamples(unsigned int nsamp)
DetectorPropertiesServiceStandard(fhicl::ParameterSet const &pset, art::ActivityRegistry ®)
DetectorPropertiesStandard fProp
fhicl::ParameterSet fPS
Original parameter set.
bool isDetectorPropertiesServiceStandard(const fhicl::ParameterSet &ps) const
bool fInheritNumberTimeSamples
Flag saying whether to inherit NumberTimeSamples.
void postOpenFile(const std::string &filename)
art framework interface to geometry description