19 #include "cetlib/HorizontalRule.h" 29 class GeometryConfigurationWriter;
111 using InfoPtr_t = std::unique_ptr<sumdata::GeometryConfigurationInfo>;
147 return std::make_unique<sumdata::GeometryConfigurationInfo>(std::move(info));
161 <<
"Built geometry configuration information from run data:\n" 164 return makeInfoPtr(std::move(confInfo));
179 mf::LogWarning(
"GeometryConfiguration") <<
"invalid version for configuration A:\n" << A;
183 mf::LogWarning(
"GeometryConfiguration") <<
"invalid version for configuration B:\n" << B;
190 assert(commonVersion >= 1);
207 produces<sumdata::GeometryConfigurationInfo, art::InRun>();
215 if (previousConfInfo && currentConfInfo) {
219 InfoPtr_t confInfo = previousConfInfo ? std::move(previousConfInfo) : std::move(currentConfInfo);
245 <<
"Geometry configuration information from service:\n" 248 return makeInfoPtr(std::move(confInfo));
257 auto consistentInfo = compareConfigurationInfo(A, B);
258 if (consistentInfo) {
return; }
261 cet::HorizontalRule rule{50};
263 <<
"Geometry used for run " <<
id <<
" is incompatible with the one configured in the job!" 264 <<
"\n=== job configuration " << rule(
'=') <<
"\n" 265 << B <<
"\n=== run configuration " << rule(
'=') <<
"\n" 266 << A <<
"\n======================" << rule(
'=') <<
"\n";
269 <<
"Geometry used for " <<
id <<
" is incompatible with the one configured in the job.";
278 return makeInfoPtr(*h);
287 return runData ? convertRunDataToGeometryInformation(*runData) :
InfoPtr_t{};
294 return allRunData.empty() ?
nullptr : allRunData.front().product();
fhicl::Atom< bool > SkipConfigurationCheck
Writes geometry configuration information into art runs.
std::string const & DetName() const
DataVersion_t dataVersion
Version of the data in this object (0 is invalid version).
void verifyConsistentConfigs(sumdata::GeometryConfigurationInfo const &A, sumdata::GeometryConfigurationInfo const &B, art::RunID const &id) const
GeometryConfigurationWriter(Parameters const &)
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
InfoPtr_t makeInfoFromRunData(art::Run const &run) const
InfoPtr_t readGeometryInformation(art::Run const &run) const
Reads geometry information from the run (returns null pointer if none).
bool isDataValid() const noexcept
Protocol: whether the data content is valid.
#define DEFINE_ART_PRODUCING_SERVICE(klass)
std::unique_ptr< sumdata::GeometryConfigurationInfo > InfoPtr_t
Alias for the pointer to the data product object to be put into the run.
static InfoPtr_t extractInfoFromGeometry()
Creates configuration information based on the current Geometry service.
Description of the current configuration of detector geometry.
unsigned int DataVersion_t
Type used for the version of data.
InfoPtr_t previousInfo(art::Run const &run) const
Loads the geometry information from the run (either directly or legacy).
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
sumdata::RunData const * readRunData(art::Run const &run) const
Returns a pointer to the sumdata::RunData in run (nullptr if none).
void postReadRun(art::Run &run) override
Writes the information from the service configuration into the run.
art framework interface to geometry description
cet::coded_exception< error, detail::translate > exception
Description of the current configuration of detector geometry.
std::vector< Handle< PROD > > getMany(SelectorBase const &selector=MatchAllSelector{}) const