GeometryGAr.h
Go to the documentation of this file.
1 /**
2  * @file GeometryGAr.h
3  * @brief art framework interface to geometry description
4  * @author brebel@fnal.gov
5  * @see Geometry_service.cc
6  *
7  * Revised <seligman@nevis.columbia.edu> 29-Jan-2009
8  * Revise the class to make it into more of a general detector interface
9  * Revised <petrillo@fnal.gov> 27-Apr-2015
10  * Factorization into a framework-independent GeometryCore.h and a
11  * art framework interface
12  * Revised <petrillo@fnal.gov> 10-Nov-2015
13  * Complying with the provider requirements described in ServiceUtil.h
14  */
15 
16 #ifndef GEO_GEOMETRY_H
17 #define GEO_GEOMETRY_H
18 
19 // GArSoft libraries
20 #include "Geometry/GeometryCore.h"
22 
23 // the following are included for convenience only
26 
27 // framework libraries
28 #include "fhiclcpp/ParameterSet.h"
33 #include "art/Framework/Services/Registry/ServiceHandle.h" // for the convenience of includers
34 
35 // ROOT libraries
36 
37 // C/C++ standard libraries
38 #include <vector>
39 #include <map>
40 #include <set>
41 #include <cstring>
42 #include <memory>
43 #include <iterator> // std::forward_iterator_tag
44 
45 
46 namespace gar {
47  namespace geo {
48 
49  /**
50  * @brief The geometry of one entire detector, as served by art
51  *
52  * This class extends the interface of the geometry service provider,
53  * GeometryCore, to the one of an art service.
54  * It handles the correct initialization of the provider using information
55  *
56  * It relies on geo::ExptGeoHelperInterface service to obtain the
57  * channel mapping algorithm proper for the selected geometry.
58  *
59  * The geometry initialization happens immediately on construction.
60  * Optionally, the geometry is automatically reinitialized on each run based
61  * on the information contained in the ::art::Run object.
62  *
63  * Configuration
64  * ==============
65  *
66  * In addition to the parameters documented in geo::GeometryCore, the
67  * following parameters are supported:
68  *
69  * - *RelativePath* (string, default: no path): this path is prepended to the
70  * geometry file names before searching from them; the path string does not
71  * affect the file name
72  * - *GDML* (string, mandatory): path of the GDML file to be served to Geant4
73  * for detector simulation. The full file is composed out of the optional
74  * relative path specified by `RelativePath` path and the base name
75  * specified in `GDML` parameter; this path is searched for in the
76  * directories configured in the `FW_SEARCH_PATH` environment variable;
77  * - *ROOT* (string, mandatory): currently overridden by `GDML` parameter,
78  * whose value is used instead;
79  * this path is assembled in the same way as the one for `GDML` parameter,
80  * except that no alternative (wireless) geometry is used even if
81  * `DisableWiresInG4` is specified (see below); this file is used to load
82  * the geometry used in the internal simulation and reconstruction,
83  * basically everywhere except for the Geant4 simulation
84  * - *DisableWiresInG4* (boolean, default: false): if true, Geant4 is loaded
85  * with an alternative geometry from a file with the standard name as
86  * configured with the /GDML/ parameter, but with an additional "_nowires"
87  * appended before the ".gdml" suffix
88  * - *ForceUseFCLOnly* (boolean, default: false): information on the current
89  * geometry is stored in each run by the event generator producers; if this
90  * information does not describe the current geometry, a new geometry is
91  * loaded according to the information in the run. If `ForceUseFCLOnly`
92  * is set to `true`, this mechanism is disabled and the geometry is just
93  * loaded at the beginning of the job from the information in the job
94  * configuration, once and for all.
95  * - *SortingParameters* (a parameter set; default: empty): this configuration
96  * is directly passed to the channel mapping algorithm (see
97  * geo::ChannelMapAlg); its content is dependent on the chosen
98  * implementation of ChannelMapAlg
99  *
100  * @note Currently, the file defined by `GDML` parameter is also served to
101  * ROOT for the internal geometry representation.
102  *
103  */
104  class GeometryGAr: public GeometryCore
105  {
106  public:
107 
108  using provider_type = GeometryCore; ///< type of service provider
109 
111 
112  /// Updates the geometry if needed at the beginning of each new run
113  void preBeginRun(::art::Run const& run);
114 
115  /// Returns a pointer to the geometry service provider
116  provider_type const* provider() const { return static_cast<provider_type const*>(this); }
117 
119 
120  private:
121 
122  /// Expands the provided paths and loads the geometry description(s)
123  void LoadNewGeometry(std::string const& gdmlfile,
124  std::string const& rootfile,
125  bool bForceReload = false);
126 
128 
130 
132 
134 
136 
137  std::string fRelPath; ///< Relative path added to FW_SEARCH_PATH to search for
138  ///< geometry file
140  fhicl::ParameterSet fSortingParameters;///< Parameter set to define the channel map sorting
141 
142  fhicl::ParameterSet fSegParameters; ///< Parameter set to define the segmentation algorithms
143  fhicl::ParameterSet fECALSegParameters; ///< Parameters for the ECAL Segmentation
144  fhicl::ParameterSet fMinervaSegParameters; ///< Parameters for the Tracker Sc Segmentation
145  fhicl::ParameterSet fMuIDSegParameters; ///< Parameters for the MuID Segmentation
146 
148  };
149 
150  } // namespace geo
151 } //namespace gar
152 
154 
155 #endif // GEO_GEOMETRY_H
fhicl::ParameterSet fSortingParameters
Parameter set to define the channel map sorting.
Definition: GeometryGAr.h:140
bool CheckConfigurationInfo(gar::sumdata::GeometryConfigurationInfo const &other) const
GeometryGAr(fhicl::ParameterSet const &pset,::art::ActivityRegistry &reg)
fhicl::ParameterSet fMuIDSegParameters
Parameters for the MuID Segmentation.
Definition: GeometryGAr.h:145
std::string string
Definition: nybbler.cc:12
void LoadNewGeometry(std::string const &gdmlfile, std::string const &rootfile, bool bForceReload=false)
Expands the provided paths and loads the geometry description(s)
fhicl::ParameterSet fMinervaSegParameters
Parameters for the Tracker Sc Segmentation.
Definition: GeometryGAr.h:144
gar::sumdata::GeometryConfigurationInfo const & configurationInfo() const
Definition: GeometryGAr.h:118
Description of geometry of one entire detector.
Definition: GeometryCore.h:436
std::string fRelPath
Definition: GeometryGAr.h:137
Definition: Run.h:17
Description of the current configuration of detector geometry.
fhicl::ParameterSet fECALSegParameters
Parameters for the ECAL Segmentation.
Definition: GeometryGAr.h:143
#define DECLARE_ART_SERVICE(svc, scope)
static Config * config
Definition: config.cpp:1054
void preBeginRun(::art::Run const &run)
Updates the geometry if needed at the beginning of each new run.
provider_type const * provider() const
Returns a pointer to the geometry service provider.
Definition: GeometryGAr.h:116
static gar::sumdata::GeometryConfigurationInfo const & ReadConfigurationInfo(art::Run const &run)
General GArSoft Utilities.
gar::sumdata::GeometryConfigurationInfo fConfInfo
Definition: GeometryGAr.h:147
fhicl::ParameterSet fSegParameters
Parameter set to define the segmentation algorithms.
Definition: GeometryGAr.h:142
GeometryCore(fhicl::ParameterSet const &pset)
Initialize geometry from a given configuration.
The geometry of one entire detector, as served by art.
Definition: GeometryGAr.h:104
static bool CompareConfigurationInfo(gar::sumdata::GeometryConfigurationInfo const &A, gar::sumdata::GeometryConfigurationInfo const &B)
void FillGeometryConfigurationInfo(fhicl::ParameterSet const &config)
LArSoft geometry interface.
Definition: ChannelGeo.h:16