All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AuxDetGeometry.h
Go to the documentation of this file.
1 /**
2  * @file AuxDetGeometry.h
3  * @brief art framework interface to geometry description for auxiliary detectors
4  * @author brebel@fnal.gov
5  * @see AuxDetGeometry_service.cc
6  *
7  */
8 
9 #ifndef GEO_AUXDETGEOMETRY_H
10 #define GEO_AUXDETGEOMETRY_H
11 
12 // larsoft libraries
14 
15 // framework libraries
16 #include "art/Framework/Services/Registry/ServiceDeclarationMacros.h"
17 namespace art {
18  class ActivityRegistry;
19  class Run;
20 }
21 #include "fhiclcpp/ParameterSet.h"
22 
23 // C/C++ standard libraries
24 #include <string>
25 
26 
27 namespace geo {
28 
29  /**
30  * @brief The geometry of one entire detector, as served by art
31  *
32  * This class extends the interface of the geometry service provider,
33  * GeometryCore, to the one of an art service.
34  * It handles the correct initialization of the provider using information
35  *
36  * It relies on geo::ExptGeoHelperInterface service to obtain the
37  * channel mapping algorithm proper for the selected geometry.
38  *
39  * The geometry initialization happens immediately on construction.
40  * Optionally, the geometry is automatically reinitialized on each run based
41  * on the information contained in the art::Run object.
42  *
43  * Configuration
44  * ==============
45  *
46  * In addition to the parameters documented in geo::GeometryCore, the
47  * following parameters are supported:
48  *
49  * - *RelativePath* (string, default: no path): this path is prepended to the
50  * geometry file names before searching from them; the path string does not
51  * affect the file name
52  * - *GDML* (string, mandatory): path of the GDML file to be served to Geant4
53  * for detector simulation. The full file is composed out of the optional
54  * relative path specified by `RelativePath` path and the base name
55  * specified in `GDML` parameter; this path is searched for in the
56  * directories configured in the `FW_SEARCH_PATH` environment variable;
57  * - *ROOT* (string, mandatory): currently overridden by `GDML` parameter,
58  * whose value is used instead;
59  * this path is assembled in the same way as the one for `GDML` parameter,
60  * except that no alternative (wireless) geometry is used even if
61  * `DisableWiresInG4` is specified (see below); this file is used to load
62  * the geometry used in the internal simulation and reconstruction,
63  * basically everywhere except for the Geant4 simulation
64  * - *DisableWiresInG4* (boolean, default: false): if true, Geant4 is loaded
65  * with an alternative geometry from a file with the standard name as
66  * configured with the /GDML/ parameter, but with an additional "_nowires"
67  * appended before the ".gdml" suffix
68  * - *ForceUseFCLOnly* (boolean, default: false): information on the current
69  * geometry is stored in each run by the event generator producers; if this
70  * information does not describe the current geometry, a new geometry is
71  * loaded according to the information in the run. If `ForceUseFCLOnly`
72  * is set to `true`, this mechanism is disabled and the geometry is just
73  * loaded at the beginning of the job from the information in the job
74  * configuration, once and for all.
75  * - *SortingParameters* (a parameter set; default: empty): this configuration
76  * is directly passed to the channel mapping algorithm (see
77  * geo::ChannelMapAlg); its content is dependent on the chosen
78  * implementation of ChannelMapAlg
79  *
80  * @note Currently, the file defined by `GDML` parameter is also served to
81  * ROOT for the internal geometry representation.
82  *
83  */
85  {
86  public:
87 
88  AuxDetGeometry(fhicl::ParameterSet const& pset, art::ActivityRegistry& reg);
89 
90  /// Returns a constant reference to the service provider
91  AuxDetGeometryCore const& GetProvider() const { return fProvider; }
92 
93  /// Returns a constant pointer to the service provider
94  AuxDetGeometryCore const* GetProviderPtr() const { return &GetProvider(); }
95 
96  private:
97 
98  /// Updates the geometry if needed at the beginning of each new run
99  void preBeginRun(art::Run const& run);
100 
101  /// Expands the provided paths and loads the geometry description(s)
102  void LoadNewGeometry(std::string gdmlfile, std::string rootfile);
103 
104  void InitializeChannelMap();
105 
106  /// Returns a reference to the service provider
108 
109  /// Returns a pointer to the service provider
111 
112  AuxDetGeometryCore fProvider; ///< the actual service provider
113 
114  std::string fRelPath; ///< Relative path added to FW_SEARCH_PATH to search for
115  ///< geometry file
116  bool fForceUseFCLOnly; ///< Force Geometry to only use the geometry
117  ///< files specified in the fcl file
118  fhicl::ParameterSet fSortingParameters;///< Parameter set to define the channel map sorting
119  };
120 
121 } // namespace geo
122 
123 DECLARE_ART_SERVICE(geo::AuxDetGeometry, SHARED)
124 
125 #endif // GEO_AUXDETGEOMETRY_H
AuxDetGeometryCore const * GetProviderPtr() const
Returns a constant pointer to the service provider.
fhicl::ParameterSet fSortingParameters
Parameter set to define the channel map sorting.
AuxDetGeometryCore const & GetProvider() const
Returns a constant reference to the service provider.
Description of geometry of one set of auxiliary detectors.
The geometry of one entire detector, as served by art.
void LoadNewGeometry(std::string gdmlfile, std::string rootfile)
Expands the provided paths and loads the geometry description(s)
Access the description of auxiliary detector geometry.
AuxDetGeometryCore * GetProviderPtr()
Returns a pointer to the service provider.
AuxDetGeometry(fhicl::ParameterSet const &pset, art::ActivityRegistry &reg)
void preBeginRun(art::Run const &run)
Updates the geometry if needed at the beginning of each new run.
AuxDetGeometryCore fProvider
the actual service provider
AuxDetGeometryCore & GetProvider()
Returns a reference to the service provider.