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