Classes | Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
geo::GeometryInfoCheck Class Reference
Inheritance diagram for geo::GeometryInfoCheck:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Classes

struct  Config
 
struct  GeometryInfoCheckInfo
 
struct  GeometryInfoConfig
 

Public Types

using Parameters = art::EDAnalyzer::Table< Config >
 
- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 GeometryInfoCheck (Parameters const &config)
 
virtual void beginRun (art::Run const &run) override
 
virtual void analyze (art::Event const &) override
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Member Functions

void CheckGeometryInfo (art::Run const &run, GeometryInfoCheckInfo const &config) const
 
void CheckLegacyGeometryInfo (art::Run const &run, GeometryInfoCheckInfo const &config) const
 

Static Private Member Functions

static std::optional< GeometryInfoCheckInfomakeGeometryInfoCheckInfo (fhicl::OptionalTable< GeometryInfoConfig > const &config)
 Fills a GeometryInfoCheckInfo out of the specified configuration. More...
 

Private Attributes

std::optional< GeometryInfoCheckInfofCheckInfo
 Information on the check on the regular geometry information. More...
 
std::optional< GeometryInfoCheckInfofLegacyCheckInfo
 Information on the check on the legacy geometry information. More...
 

Static Private Attributes

static art::InputTag const GeometryConfigurationWriterTag { "GeometryConfigurationWriter" }
 The name of the tag for the geometry information. More...
 

Additional Inherited Members

- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 44 of file GeometryInfoCheck_module.cc.

Member Typedef Documentation

Definition at line 78 of file GeometryInfoCheck_module.cc.

Constructor & Destructor Documentation

geo::GeometryInfoCheck::GeometryInfoCheck ( Parameters const &  config)
explicit

Definition at line 146 of file GeometryInfoCheck_module.cc.

148  , fCheckInfo(makeGeometryInfoCheckInfo(config().GeometryInfo))
149  , fLegacyCheckInfo(makeGeometryInfoCheckInfo(config().GeometryLegacyInfo))
150 {
151 
152  if (fCheckInfo)
153  consumes<sumdata::GeometryConfigurationInfo>(GeometryConfigurationWriterTag);
154  if (fLegacyCheckInfo) consumesMany<sumdata::RunData>();
155 
156 
157  // --- BEGIN -- Configuration dump -------------------------------------------
158  {
159  mf::LogDebug log { "GeometryInfoCheck" };
160  log << "Configuration:"
161  << "\n - geometry configuration check:";
162  if (fCheckInfo) {
163  if (fCheckInfo->detectorName.empty()) log << " (any name)";
164  else log << " must match '" << fCheckInfo->detectorName << "'";
165  log << " [" << (fCheckInfo->required? "mandatory": "optional") << "]";
166  }
167  else log << "not requested";
168 
169  log << "\n - legacy geometry configuration information check:";
170  if (fLegacyCheckInfo) {
171  if (fLegacyCheckInfo->detectorName.empty()) log << " (any name)";
172  else log << " must match '" << fLegacyCheckInfo->detectorName << "'";
173  log << " [" << (fLegacyCheckInfo->required? "mandatory": "optional") << "]";
174  }
175  else log << "not requested";
176 
177  }
178  // --- END -- Configuration dump ---------------------------------------------
179 
180 } // geo::GeometryInfoCheck::GeometryInfoCheck()
static std::optional< GeometryInfoCheckInfo > makeGeometryInfoCheckInfo(fhicl::OptionalTable< GeometryInfoConfig > const &config)
Fills a GeometryInfoCheckInfo out of the specified configuration.
static Config * config
Definition: config.cpp:1054
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.
std::optional< GeometryInfoCheckInfo > fCheckInfo
Information on the check on the regular geometry information.

Member Function Documentation

virtual void geo::GeometryInfoCheck::analyze ( art::Event const &  )
inlineoverridevirtual

Implements art::EDAnalyzer.

Definition at line 84 of file GeometryInfoCheck_module.cc.

84 {}
void geo::GeometryInfoCheck::beginRun ( art::Run const &  run)
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 184 of file GeometryInfoCheck_module.cc.

184  {
185 
188 
189 } // geo::GeometryInfoCheck::beginRun()
void CheckLegacyGeometryInfo(art::Run const &run, GeometryInfoCheckInfo const &config) const
std::optional< GeometryInfoCheckInfo > fLegacyCheckInfo
Information on the check on the legacy geometry information.
void CheckGeometryInfo(art::Run const &run, GeometryInfoCheckInfo const &config) const
std::optional< GeometryInfoCheckInfo > fCheckInfo
Information on the check on the regular geometry information.
void geo::GeometryInfoCheck::CheckGeometryInfo ( art::Run const &  run,
GeometryInfoCheckInfo const &  config 
) const
private

Performs a geometry information check.

Exceptions
cet::exceptionon check failures

Definition at line 194 of file GeometryInfoCheck_module.cc.

195 {
196 
197  mf::LogDebug log { "GeometryInfoCheck" };
198  log << "Check on geometry information.";
199 
200  //
201  // fetch geometry information
202  //
204  if (!run.getByLabel(GeometryConfigurationWriterTag, hInfo)) {
205  log << "\nNo information found.";
206  if (!config.required) return; // well... all ok?
207 
208  log << "\nUnfortunately, that was required...";
209  throw cet::exception("GeometryInfoCheck")
210  << "Required geometry information not found as '"
212  } // if no info
213 
214  sumdata::GeometryConfigurationInfo const& info { *hInfo };
215  log
216  << "\nFound geometry information (version " << info.dataVersion << ")"
217  << " from '" << hInfo.provenance()->inputTag().encode() << "'"
218  << "\nGeometry name is '" << info.detectorName << "'."
219  ;
220 
221  //
222  // check: the name
223  //
224  if (!config.detectorName.empty()
225  && !case_insensitive_equal(info.detectorName, config.detectorName)
226  ) {
227  throw cet::exception("GeometryInfoCheck")
228  << "Geometry information reports an unexpected name '"
229  << info.detectorName << "' ('" << config.detectorName << "' expected)\n"
230  ;
231  } // if
232 
233  //
234  // all checks done
235  //
236 
237 } // geo::GeometryInfoCheck::CheckGeometryInfo()
std::string encode() const
Definition: InputTag.cc:97
static Config * config
Definition: config.cpp:1054
Provenance const * provenance() const
Definition: Handle.h:205
static art::InputTag const GeometryConfigurationWriterTag
The name of the tag for the geometry information.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
Description of the current configuration of detector geometry.
void geo::GeometryInfoCheck::CheckLegacyGeometryInfo ( art::Run const &  run,
GeometryInfoCheckInfo const &  config 
) const
private

Performs a legacy geometry information check

Exceptions
cet::exceptionon check failures

Definition at line 242 of file GeometryInfoCheck_module.cc.

243 {
244 
245  mf::LogDebug log { "GeometryInfoCheck" };
246  log << "Check on legacy geometry information.";
247 
248  //
249  // fetch geometry information
250  //
251  //std::vector<art::Handle<sumdata::RunData>> hInfoList;
252  //run.getManyByType(hInfoList);
253  auto hInfoList = run.getMany<sumdata::RunData>();
254  if (hInfoList.empty()) {
255  log << "\nNo information found.";
256  if (!config.required) return; // well... all ok?
257 
258  log << "\nUnfortunately, that was required...";
259  throw cet::exception("GeometryInfoCheck")
260  << "No legacy geometry information found!\n";
261  } // if no info
262 
263  log << "\nFound " << hInfoList.size() << " legacy geometry records:";
264  art::Handle<sumdata::RunData> const* hInfo = nullptr;
265  for (auto const& handle: hInfoList) {
266  log << "\n - " << handle.provenance()->inputTag().encode();
267  if (handle.failedToGet()) log << " (not present)";
268  else if (!hInfo) {
269  hInfo = &handle;
270  log << " (this will be used for the check)";
271  }
272  } // for all handles
273 
274  sumdata::RunData const& info { *(hInfo->product()) };
275  log
276  << "\nFound legacy geometry information "
277  << "\nGeometry name is '" << info.DetName() << "'."
278  ;
279 
280  //
281  // check: the name
282  //
283  if (!config.detectorName.empty()
284  && !case_insensitive_equal(info.DetName(), config.detectorName)
285  ) {
286  throw cet::exception("GeometryInfoCheck")
287  << "Geometry legacy information reports an unexpected name '"
288  << info.DetName() << "' ('" << config.detectorName << "' expected)\n"
289  ;
290  } // if
291 
292  //
293  // all checks done
294  //
295 
296 } // geo::GeometryInfoCheck::CheckLegacyGeometryInfo()
InputTag inputTag() const
Definition: Provenance.cc:91
std::string encode() const
Definition: InputTag.cc:97
static Config * config
Definition: config.cpp:1054
Provenance const * provenance() const
Definition: Handle.h:205
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
auto geo::GeometryInfoCheck::makeGeometryInfoCheckInfo ( fhicl::OptionalTable< GeometryInfoConfig > const &  config)
staticprivate

Fills a GeometryInfoCheckInfo out of the specified configuration.

Definition at line 301 of file GeometryInfoCheck_module.cc.

303 {
304  GeometryInfoConfig infoConfig;
305  if (!config(infoConfig)) return {};
306 
307  GeometryInfoCheckInfo info;
308  info.required = infoConfig.Required();
309  infoConfig.Name(info.detectorName); // so far, not specifying it defaults to empty
310 
311  return { std::move(info) };
312 } // geo::GeometryInfoCheck::makeGeometryInfoCheckInfo()
static Config * config
Definition: config.cpp:1054
def move(depos, offset)
Definition: depos.py:107

Member Data Documentation

std::optional<GeometryInfoCheckInfo> geo::GeometryInfoCheck::fCheckInfo
private

Information on the check on the regular geometry information.

Definition at line 94 of file GeometryInfoCheck_module.cc.

std::optional<GeometryInfoCheckInfo> geo::GeometryInfoCheck::fLegacyCheckInfo
private

Information on the check on the legacy geometry information.

Definition at line 97 of file GeometryInfoCheck_module.cc.

art::InputTag const geo::GeometryInfoCheck::GeometryConfigurationWriterTag { "GeometryConfigurationWriter" }
staticprivate

The name of the tag for the geometry information.

Definition at line 111 of file GeometryInfoCheck_module.cc.


The documentation for this class was generated from the following file: