All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AuxDetChannelMapAlg.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file ChannelMapAlg.h
3 /// \brief Interface to algorithm class for a specific detector channel mapping
4 /// \ingroup Geometry
5 ///
6 /// \author brebel@fnal.gov
7 ////////////////////////////////////////////////////////////////////////
8 #ifndef GEO_AUXDETCHANNELMAPALG_H
9 #define GEO_AUXDETCHANNELMAPALG_H
10 
11 // ROOT libraries
12 #include "TVector3.h"
13 
14 // C/C++ standard libraries
15 #include <cstddef>
16 #include <cstdint>
17 #include <map>
18 #include <string>
19 #include <vector>
20 
21 namespace geo{
22 
23  // forward-declaration from geometry
24  struct AuxDetGeometryData_t;
25  class AuxDetGeo;
26 
27  /// \ingroup Geometry
29 
30  typedef std::pair<uint32_t, size_t> chanAndSV;
31 
32  public:
33 
34  virtual ~AuxDetChannelMapAlg() = default;
35 
36  virtual void Initialize(AuxDetGeometryData_t& geodata) = 0;
37  virtual void Uninitialize() = 0;
38 
39  // method returns the entry in the sorted AuxDetGeo vector so that the
40  // Geometry in turn can return that object
41  virtual size_t NearestAuxDet (const double* point,
42  std::vector<geo::AuxDetGeo> const& auxDets,
43  double tolerance = 0) const;
44  virtual size_t NearestSensitiveAuxDet (const double* point,
45  std::vector<geo::AuxDetGeo> const& auxDets,
46  size_t & ad,
47  double tolerance = 0) const;
48  virtual size_t ChannelToAuxDet (std::vector<geo::AuxDetGeo> const& auxDets,
49  std::string const& detName,
50  uint32_t const& channel) const;
51  virtual std::pair<size_t, size_t> ChannelToSensitiveAuxDet(std::vector<geo::AuxDetGeo> const& auxDets,
52  std::string const& detName,
53  uint32_t const& channel) const;
54 
55  // Experiments must implement these method. It accounts for auxiliary detectors like
56  // Multiwire proportional chambers where there is only a single sensitive volume, but
57  // multiple channels running through that volume.
58  virtual uint32_t PositionToAuxDetChannel(double const worldLoc[3],
59  std::vector<geo::AuxDetGeo> const& auxDets,
60  size_t & ad,
61  size_t & sv) const = 0;
62 
63  virtual const TVector3 AuxDetChannelToPosition(uint32_t const& channel,
64  std::string const& auxDetName,
65  std::vector<geo::AuxDetGeo> const& auxDets) const = 0;
66 
67  protected:
68 
69  std::map<size_t, std::string> fADGeoToName; ///< map the AuxDetGeo index to the name
70  std::map<std::string, size_t> fNameToADGeo; ///< map the names to the AuxDetGeo index
71  std::map<size_t, std::vector<chanAndSV> > fADGeoToChannelAndSV; ///< map the AuxDetGeo index to a vector of
72  ///< pairs corresponding to the channel and
73  ///< AuxDetSensitiveGeo index
74  };
75 }
76 #endif // GEO_AUXDETCHANNELMAPALG_H
std::map< std::string, size_t > fNameToADGeo
map the names to the AuxDetGeo index
virtual size_t ChannelToAuxDet(std::vector< geo::AuxDetGeo > const &auxDets, std::string const &detName, uint32_t const &channel) const
std::map< size_t, std::vector< chanAndSV > > fADGeoToChannelAndSV
auto const tolerance
virtual const TVector3 AuxDetChannelToPosition(uint32_t const &channel, std::string const &auxDetName, std::vector< geo::AuxDetGeo > const &auxDets) const =0
virtual ~AuxDetChannelMapAlg()=default
virtual void Initialize(AuxDetGeometryData_t &geodata)=0
virtual size_t NearestAuxDet(const double *point, std::vector< geo::AuxDetGeo > const &auxDets, double tolerance=0) const
virtual void Uninitialize()=0
std::pair< uint32_t, size_t > chanAndSV
virtual std::pair< size_t, size_t > ChannelToSensitiveAuxDet(std::vector< geo::AuxDetGeo > const &auxDets, std::string const &detName, uint32_t const &channel) const
std::map< size_t, std::string > fADGeoToName
map the AuxDetGeo index to the name
virtual uint32_t PositionToAuxDetChannel(double const worldLoc[3], std::vector< geo::AuxDetGeo > const &auxDets, size_t &ad, size_t &sv) const =0
virtual size_t NearestSensitiveAuxDet(const double *point, std::vector< geo::AuxDetGeo > const &auxDets, size_t &ad, double tolerance=0) const