All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GeometryTest_module.cc
Go to the documentation of this file.
1 /** ****************************************************************************
2  * @file GeometryTest_module.cc
3  * @brief Runs geometry unit tests from a test algorithm
4  * @author Gianluca Petrillo (petrillo@fnal.gov)
5  * @date May 8th, 2015
6  */
7 
8 // LArSoft includes
11 
12 // Framework includes
13 #include "art/Framework/Core/ModuleMacros.h"
14 #include "art/Framework/Core/EDAnalyzer.h"
15 #include "art/Framework/Services/Registry/ServiceHandle.h"
16 
17 // C/C++ standard library
18 #include <memory> // std::unique_ptr<>
19 
20 
21 namespace art { class Event; } // art::Event declaration
22 namespace fhicl { class ParameterSet; }
23 
24 namespace geo {
25  /**
26  * @brief Performs tests on the geometry as seen by Geometry service
27  *
28  * Configuration parameters
29  * =========================
30  *
31  * See GeometryTestAlg.
32  */
33  class GeometryTest: public art::EDAnalyzer {
34  public:
35  explicit GeometryTest(fhicl::ParameterSet const& pset);
36 
37  virtual void analyze(art::Event const&) {}
38  virtual void beginJob();
39 
40  private:
41 
42  std::unique_ptr<geo::GeometryTestAlg> tester; ///< the test algorithm
43 
44  }; // class GeometryTest
45 } // namespace geo
46 
47 
48 //******************************************************************************
49 namespace geo {
50 
51  //......................................................................
52  GeometryTest::GeometryTest(fhicl::ParameterSet const& pset)
53  : EDAnalyzer(pset)
54  , tester(new geo::GeometryTestAlg(pset))
55  {
56  } // GeometryTest::GeometryTest()
57 
58 
59  //......................................................................
61  {
62  art::ServiceHandle<geo::Geometry const> geom;
63 
64  // 1. we set it up with the geometry from the environment
65  tester->Setup(*geom);
66 
67  // 2. then we run it!
68  tester->Run();
69 
70  } // GeometryTest::beginJob()
71 
72 
73  //......................................................................
74  DEFINE_ART_MODULE(GeometryTest)
75 
76 } // namespace geo
Unit test for geometry functionalities.
Performs tests on the geometry as seen by Geometry service.
std::unique_ptr< geo::GeometryTestAlg > tester
the test algorithm
virtual void analyze(art::Event const &)
GeometryTest(fhicl::ParameterSet const &pset)
Performs tests on the geometry as seen by Geometry service.
virtual void beginJob()
art framework interface to geometry description