24 #include "cetlib_except/exception.h" 43 namespace geo {
class GeometryInfoCheck; }
56 fhicl::Comment{
"Whether the presence of this item is mandatory" },
73 {
"Information to check about geometry (legacy from RunData)" }
82 virtual void beginRun(
art::Run const&
run)
override;
101 void CheckGeometryInfo
106 void CheckLegacyGeometryInfo
114 static std::optional<GeometryInfoCheckInfo> makeGeometryInfoCheckInfo
128 return std::equal(a.begin(), a.end(), b.begin(), b.end(),
131 return ::tolower(static_cast<unsigned char>(a))
132 == ::tolower(static_cast<unsigned char>(b));
142 {
"GeometryConfigurationWriter" };
147 :
art::EDAnalyzer(config)
148 , fCheckInfo(makeGeometryInfoCheckInfo(config().GeometryInfo))
149 , fLegacyCheckInfo(makeGeometryInfoCheckInfo(config().GeometryLegacyInfo))
160 log <<
"Configuration:" 161 <<
"\n - geometry configuration check:";
163 if (
fCheckInfo->detectorName.empty()) log <<
" (any name)";
164 else log <<
" must match '" <<
fCheckInfo->detectorName <<
"'";
165 log <<
" [" << (
fCheckInfo->required?
"mandatory":
"optional") <<
"]";
167 else log <<
"not requested";
169 log <<
"\n - legacy geometry configuration information check:";
173 log <<
" [" << (
fLegacyCheckInfo->required?
"mandatory":
"optional") <<
"]";
175 else log <<
"not requested";
198 log <<
"Check on geometry information.";
205 log <<
"\nNo information found.";
208 log <<
"\nUnfortunately, that was required...";
210 <<
"Required geometry information not found as '" 216 <<
"\nFound geometry information (version " <<
info.dataVersion <<
")" 217 <<
" from '" << hInfo.
provenance()->inputTag().encode() <<
"'" 218 <<
"\nGeometry name is '" <<
info.detectorName <<
"'." 228 <<
"Geometry information reports an unexpected name '" 246 log <<
"Check on legacy geometry information.";
254 if (hInfoList.empty()) {
255 log <<
"\nNo information found.";
258 log <<
"\nUnfortunately, that was required...";
260 <<
"No legacy geometry information found!\n";
263 log <<
"\nFound " << hInfoList.size() <<
" legacy geometry records:";
265 for (
auto const& handle: hInfoList) {
267 if (handle.failedToGet()) log <<
" (not present)";
270 log <<
" (this will be used for the check)";
276 <<
"\nFound legacy geometry information " 277 <<
"\nGeometry name is '" <<
info.DetName() <<
"'." 287 <<
"Geometry legacy information reports an unexpected name '" 302 -> std::optional<GeometryInfoCheckInfo>
305 if (!
config(infoConfig))
return {};
GeometryInfoCheck(Parameters const &config)
void CheckLegacyGeometryInfo(art::Run const &run, GeometryInfoCheckInfo const &config) const
static std::optional< GeometryInfoCheckInfo > makeGeometryInfoCheckInfo(fhicl::OptionalTable< GeometryInfoConfig > const &config)
Fills a GeometryInfoCheckInfo out of the specified configuration.
Description of the current configuration of detector geometry.
ChannelGroupService::Name Name
InputTag inputTag() const
art framework interface to geometry description
virtual void beginRun(art::Run const &run) override
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
#define DEFINE_ART_MODULE(klass)
fhicl::Atom< bool > Required
Provenance const * provenance() const
std::vector< Handle< PROD > > getMany(SelectorBase const &selector=MatchAllSelector{}) const
std::string detectorName
Name of the detector; empty: don't check.
bool required
Whether the information must be present.
std::optional< GeometryInfoCheckInfo > fLegacyCheckInfo
Information on the check on the legacy geometry information.
static art::InputTag const GeometryConfigurationWriterTag
The name of the tag for the geometry information.
LArSoft geometry interface.
void CheckGeometryInfo(art::Run const &run, GeometryInfoCheckInfo const &config) const
virtual void analyze(art::Event const &) override
cet::coded_exception< error, detail::translate > exception
Description of the current configuration of detector geometry.
fhicl::OptionalAtom< std::string > Name
std::optional< GeometryInfoCheckInfo > fCheckInfo
Information on the check on the regular geometry information.