LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
AuxDetGeometryCore.h
Go to the documentation of this file.
1 
8 #ifndef GEO_AUXDETGEOMETRYCORE_H
9 #define GEO_AUXDETGEOMETRYCORE_H
10 
11 // LArSoft libraries
12 
13 // Framework and infrastructure libraries
14 #include "fhiclcpp/ParameterSet.h"
15 
16 // ROOT libraries
17 #include <TVector3.h>
18 
19 // C/C++ standard libraries
20 #include <cstddef> // size_t
21 #include <string>
22 #include <vector>
23 #include <memory> // std::shared_ptr<>
24 
26 
27 // ROOT class prototypes
28 class TGeoManager;
29 class TGeoNode;
30 class TGeoMaterial;
31 
32 
34 namespace geo {
35 
36 
37  // Forward declarations within namespace.
38  class AuxDetGeo;
39  class AuxDetSensitiveGeo;
40  class AuxDetGeometryCore;
41 
42 
46 
48  using AuxDetList_t = std::vector<AuxDetGeo*>;
49 
51 
52  }; // AuxDetGeometryData_t
53 
54 
101  public:
102 
105 
114 
117 
118  // You shall not copy or move or assign me!
119  AuxDetGeometryCore(AuxDetGeometryCore const&) = delete;
121  AuxDetGeometryCore& operator= (AuxDetGeometryCore const&) = delete;
122  AuxDetGeometryCore& operator= (AuxDetGeometryCore&&) = delete;
123 
124 
132  std::string ROOTFile() const { return fROOTfile; }
133 
141  std::string GDMLFile() const { return fGDMLfile; }
142 
143 
145  std::string DetectorName() const { return fDetectorName; }
146 
147  //
148  // object description and information
149  //
150 
152 
153  //
154  // group features
155  //
156 
165  unsigned int NAuxDets() const { return AuxDets().size(); }
166 
173  unsigned int NAuxDetSensitive(size_t const& aid) const;
174 
175  //
176  // access
177  //
178 
180  std::vector<AuxDetGeo*> const& AuxDetGeoVec() const { return AuxDets(); }
181 
190  AuxDetGeo const& AuxDet(unsigned int const ad = 0) const;
191 
199  unsigned int FindAuxDetAtPosition(double const worldLoc[3]) const;
200 
207  void FindAuxDetSensitiveAtPosition(double const worldLoc[3],
208  size_t & adg,
209  size_t & sv) const;
210 
219  AuxDetGeo const& PositionToAuxDet(double const worldLoc[3],
220  unsigned int &ad) const;
221 
231  const AuxDetSensitiveGeo& PositionToAuxDetSensitive(double const worldLoc[3],
232  size_t & ad,
233  size_t & sv) const;
234 
235  uint32_t PositionToAuxDetChannel(double const worldLoc[3],
236  size_t & ad,
237  size_t & sv) const;
238  TVector3 AuxDetChannelToPosition(uint32_t const& channel,
239  std::string const& auxDetName) const;
240 
241 
242  const AuxDetGeo& ChannelToAuxDet(std::string const& auxDetName,
243  uint32_t const& channel) const; // return the AuxDetGeo for the given detector
244  // name and channel
245 
246  const AuxDetSensitiveGeo& ChannelToAuxDetSensitive(std::string const& auxDetName,
247  uint32_t const& channel) const; // return the AuxDetSensitiveGeo for the given
248 
251 
274  void LoadGeometryFile(std::string gdmlfile, std::string rootfile);
275 
276 
278  bool hasAuxDetChannelMap() const { return bool(fChannelMapAlg); }
279 
280 
299  void ApplyChannelMap(std::shared_ptr<geo::AuxDetChannelMapAlg> pChannelMap);
301 
302 
303  protected:
304 
306  geo::AuxDetChannelMapAlg const* AuxDetChannelMap() const { return fChannelMapAlg.get(); }
307 
309  AuxDetList_t& AuxDets() { return fGeoData.auxDets; }
311  AuxDetList_t const& AuxDets() const { return fGeoData.auxDets; }
313 
314  private:
315 
316  void FindAuxDet(std::vector<const TGeoNode*>& path, unsigned int depth);
317 
318  void MakeAuxDet(std::vector<const TGeoNode*>& path, int depth);
319 
321  void ClearGeometry();
322 
324 
325  std::string fDetectorName;
326  std::string fGDMLfile;
327  std::string fROOTfile;
328  std::shared_ptr<const geo::AuxDetChannelMapAlg> fChannelMapAlg;
329  }; // class GeometryCore
330 
331 } // namespace geo
332 
333 
334 
335 
336 #endif // GEO_AUXDETGEOMETRYCORE_H
std::vector< AuxDetGeo * > AuxDetList_t
Type of list of auxiliary detectors.
AuxDetGeometryData_t fGeoData
The detector description data.
std::string fDetectorName
Name of the detector.
std::string GDMLFile() const
Returns the full directory path to the GDML file source.
Description of geometry of one set of auxiliary detectors.
bool hasAuxDetChannelMap() const
Returns whether we have a channel map.
std::string ROOTFile() const
Returns the full directory path to the geometry file source.
std::shared_ptr< const geo::AuxDetChannelMapAlg > fChannelMapAlg
Object containing the channel to wire mapping.
unsigned int NAuxDets() const
Returns the number of auxiliary detectors.
geo::AuxDetChannelMapAlg const * AuxDetChannelMap() const
Returns the object handling the channel map.
AuxDetList_t auxDets
The auxiliary detectors.
std::string fROOTfile
path to geometry file for geometry in GeometryCore
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
std::string fGDMLfile
path to geometry file used for Geant4 simulation
std::vector< AuxDetGeo * > const & AuxDetGeoVec() const
Returns the full list of pointer to the auxiliary detectors.
Namespace collecting geometry-related classes utilities.
AuxDetGeometryData_t::AuxDetList_t AuxDetList_t
Type of list of auxiliary detectors.
AuxDetList_t const & AuxDets() const
Return the internal auxiliary detectors list.