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