GeometryBuilder.h
Go to the documentation of this file.
1 /**
2  * @file larcorealg/Geometry/GeometryBuilder.h
3  * @brief Interface for geometry extractor classes.
4  * @author Gianluca Petrillo (petrillo@slac.stanford.edu)
5  * @date January 29, 2019
6  *
7  * This is a header-only library.
8  */
9 
10 #ifndef LARCOREALG_GEOMETRY_GEOMETRYBUILDER_H
11 #define LARCOREALG_GEOMETRY_GEOMETRYBUILDER_H
12 
13 // LArSoft libraries
17 
18 // ROOT libraries
19 #include "TGeoNode.h"
20 
21 // C++ standard library
22 #include <vector>
23 #include <string>
24 #include <iterator> // std::back_inserter()
25 #include <algorithm> // std::transform()
26 
27 namespace geo {
28 
29  /**
30  * @brief Manages the extraction of LArSoft geometry information from ROOT.
31  *
32  * The general interface only provides abstraction for the high level objects
33  * (cryostats and auxiliary detectors).
34  * The implementations can use a finer internal structure to address single
35  * subcomponents (e.g. wire planes).
36  *
37  * Builder objects can be configured via FHiCL parameters.
38  *
39  * This is an abstract interface.
40  *
41  *
42  * Customization of geometry objects
43  * ----------------------------------
44  *
45  * The builders return collections of LArSoft geometry objects dynamically
46  * allocated. In this way, in future it will be possible to easily customize
47  * those objects for detector-specific needs.
48  * Note that as of LArSoft `v08_06_00`, no polymorphism is actually
49  * implemented.
50  *
51  */
53 
54  public:
55 
56  // --- BEGIN Data types ----------------------------------------------------
57  /// Identification of a single node in ROOT geometry.
59 
60  /// Type of direct collection of geometry objects.
61  template <typename GeoObj>
62  using GeoColl_t = std::vector<GeoObj>;
63 
64  // --- END Data types ------------------------------------------------------
65 
66 
67  // --- BEGIN Constructors and destructor -----------------------------------
68  /// Virtual destructor.
69  virtual ~GeometryBuilder() = default;
70 
71  // --- END Constructors and destructor -------------------------------------
72 
73 
74  // --- BEGIN Cryostat information ------------------------------------------
75  /// @name Cryostat information
76  /// @{
77 
78  /// Collection of cryostat information objects.
80 
81  /**
82  * @brief Looks for all cryostats under the specified path.
83  * @param path path pointing to the starting node
84  * @return a list of fully constructed cryostats
85  *
86  * The cryostats contain all their inner elements.
87  * The current node itself of the path is also considered as cryostat
88  * candidate, then it is descended into.
89  */
91  { auto myPath = path; return doExtractCryostats(myPath); }
92 
93  /// @}
94  // --- END Cryostat information --------------------------------------------
95 
96 
97  // --- BEGIN Auxiliary detector information --------------------------------
98  /// @name Auxiliary detector information
99  /// @{
100 
101  /// Collection of auxiliary detector information objects.
103 
104  /**
105  * @brief Looks for all auxiliary detectors under the specified path.
106  * @param path path pointing to the starting node
107  * @return a list of fully constructed auxiliary detectors
108  *
109  * The auxiliary detectors contain all their inner elements.
110  * The current node itself of the path is also considered as auxiliary
111  * detector candidate, then it is descended into.
112  */
114  { auto myPath = path; return doExtractAuxiliaryDetectors(myPath); }
115 
116  /// @}
117  // --- END Auxiliary detector information ----------------------------------
118 
119 
120  // --- END Static utility methods ------------------------------------------
121 
122  protected:
123 
124  /// Custom implementation of `extractCryostats()`.
125  virtual Cryostats_t doExtractCryostats(Path_t& path) = 0;
126 
127  /// Custom implementation of `extractAuxiliaryDetectors()`.
128  virtual AuxDets_t doExtractAuxiliaryDetectors(Path_t& path) = 0;
129 
130 
131  }; // class GeometryBuilder
132 
133 } // namespace geo
134 
135 
136 #endif // LARCOREALG_GEOMETRY_GEOMETRYBUILDER_H
virtual Cryostats_t doExtractCryostats(Path_t &path)=0
Custom implementation of extractCryostats().
Encapsulate the construction of a single cyostat.
Cryostats_t extractCryostats(Path_t const &path)
Looks for all cryostats under the specified path.
Class representing a path in ROOT geometry.
GeoColl_t< geo::AuxDetGeo > AuxDets_t
Collection of auxiliary detector information objects.
virtual ~GeometryBuilder()=default
Virtual destructor.
AuxDets_t extractAuxiliaryDetectors(Path_t const &path)
Looks for all auxiliary detectors under the specified path.
Encapsulate the geometry of an auxiliary detector.
GeoColl_t< geo::CryostatGeo > Cryostats_t
Collection of cryostat information objects.
virtual AuxDets_t doExtractAuxiliaryDetectors(Path_t &path)=0
Custom implementation of extractAuxiliaryDetectors().
Manages the extraction of LArSoft geometry information from ROOT.
Representation of a node and its ancestry.
Definition: GeoNodePath.h:38
LArSoft geometry interface.
Definition: ChannelGeo.h:16
std::vector< GeoObj > GeoColl_t
Type of direct collection of geometry objects.