21 #include "art_root_io/RootDB/SQLite3Wrapper.h" 31 : fInheritNumberTimeSamples(pset.
get<
bool>(
"InheritNumberTimeSamples", false))
37 fProp = std::make_unique<detinfo::DetectorPropertiesStandard>(pset,
42 std::set<std::string>({
"InheritNumberTimeSamples" })
46 fProp->CheckIfConfigured();
56 fProp->ValidateAndConfigure(p, {
"InheritNumberTimeSamples" });
68 fProp->UpdateClocks(gar::providerFrom<detinfo::DetectorClocksServiceGAr>());
105 if(filename.size() != 0) {
107 TFile*
file = (TFile*)
new TFile(filename.c_str(),
"READ");
108 if(file != 0 && !file->IsZombie() && file->IsOpen()) {
112 ::art::SQLite3Wrapper sqliteDB(file,
"RootFileDB");
116 unsigned int iNumberTimeSamples = 0;
117 unsigned int nNumberTimeSamples = 0;
120 sqlite3_prepare_v2(sqliteDB,
"SELECT PSetBlob from ParameterSets;", -1, &stmt, NULL);
121 while (sqlite3_step(stmt) == SQLITE_ROW) {
134 unsigned int newNumberTimeSamples =
ps.get<
unsigned int>(
"NumberTimeSamples");
138 if(newNumberTimeSamples !=
fPS.
get<
unsigned int>(
"NumberTimeSamples")) {
139 if(nNumberTimeSamples == 0)
140 iNumberTimeSamples = newNumberTimeSamples;
141 else if(newNumberTimeSamples != iNumberTimeSamples) {
143 <<
"Historical values of NumberTimeSamples do not agree: " 144 << iNumberTimeSamples <<
" " << newNumberTimeSamples <<
"\n" ;
146 ++nNumberTimeSamples;
156 nNumberTimeSamples != 0 &&
157 iNumberTimeSamples !=
fProp->NumberTimeSamples()) {
158 MF_LOG_INFO(
"DetectorPropertiesServiceStandardGAr")
159 <<
"Overriding configuration parameter NumberTimeSamples using historical value.\n" 160 <<
" Configured value: " <<
fProp->NumberTimeSamples() <<
"\n" 161 <<
" Historical (used) value: " << iNumberTimeSamples;
163 fProp->SetNumberTimeSamples(iNumberTimeSamples);
187 (ps.
get<
std::string>(
"service_type",
"") ==
"DetectorPropertiesService")
188 && (ps.
get<
std::string>(
"service_provider",
"") ==
"DetectorPropertiesServiceStandardGAr")
bool fInheritNumberTimeSamples
Flag saying whether to inherit NumberTimeSamples.
static ParameterSet make(intermediate_table const &tbl)
struct sqlite3_stmt sqlite3_stmt
fhicl::ParameterSet fPS
Original parameter set.
std::unique_ptr< detinfo::DetectorPropertiesStandard > fProp
void postOpenFile(std::string const &filename)
ProviderPackFromServices< Services... > extractProviders()
Returns a provider pack with providers from specified services.
void preProcessEvent(::art::Event const &evt, art::ScheduleContext)
T get(std::string const &key) const
virtual void reconfigure(fhicl::ParameterSet const &pset) override
General LArSoft Utilities.
static constexpr double ps
#define MF_LOG_INFO(category)
GlobalSignal< detail::SignalResponseType::FIFO, void(Event const &, ScheduleContext)> sPreProcessEvent
General GArSoft Utilities.
bool isDetectorPropertiesServiceStandardGAr(const fhicl::ParameterSet &ps) const
GlobalSignal< detail::SignalResponseType::LIFO, void(std::string const &)> sPostOpenFile
std::optional< T > get_if_present(std::string const &key) const
The geometry of one entire detector, as served by art.
DetectorPropertiesServiceStandardGAr(fhicl::ParameterSet const &pset,::art::ActivityRegistry ®)
"Standard" implementation of DetectorProperties service
auto const & get(AssnsNode< L, R, D > const &r)
art framework interface to geometry description
cet::coded_exception< error, detail::translate > exception
#define DEFINE_ART_SERVICE_INTERFACE_IMPL(svc, iface)