AuxDetChannelMapAlg.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file AuxDetChannelMapAlg.h
3 /// \brief Interface to algorithm class for a specific detector channel mapping
4 ///
5 /// This is a virtual base class, it is expected that each experiment will
6 /// create their own derived class which will own a dervied version of the
7 /// AuxDetGeoObjectSorter
8 ///
9 /// \version $Id: $
10 /// \author brebel@fnal.gov
11 ////////////////////////////////////////////////////////////////////////
12 #ifndef GEO_AUXDETCHANNELMAPALG_H
13 #define GEO_AUXDETCHANNELMAPALG_H
14 
15 #include "Geometry/AuxDetGeoObjectSorter.h"
16 
17 // Framework libraries
18 #include "cetlib_except/exception.h"
19 
20 // ROOT libraries
21 #include "TVector3.h"
22 
23 // C/C++ standard libraries
24 #include <vector>
25 #include <map>
26 #include <set>
27 
28 namespace gar {
29  namespace geo{
30 
31  // forward-declaration from geometry
32  struct AuxDetGeometryData_t;
33  class AuxDetGeo;
34 
35  namespace seg {
36 
38 
39  typedef std::pair<uint32_t, size_t> chanAndSV;
40 
41  public:
42 
43  virtual ~AuxDetChannelMapAlg() = default;
44 
45  virtual void Initialize(AuxDetGeometryData_t& geodata) = 0;
46  virtual void Uninitialize() = 0;
47 
48  // method returns the entry in the sorted AuxDetGeo vector so that the
49  // Geometry in turn can return that object
50  virtual size_t NearestAuxDet (const double* point,
51  std::vector<geo::AuxDetGeo*> const& auxDets) const;
52  virtual size_t NearestSensitiveAuxDet(const double* point,
53  std::vector<geo::AuxDetGeo*> const& auxDets,
54  size_t & ad) const;
55  virtual size_t ChannelToAuxDet (std::vector<geo::AuxDetGeo*> const& auxDets,
56  std::string const& detName,
57  uint32_t const& channel) const;
58  virtual std::pair<size_t, size_t> ChannelToSensitiveAuxDet(std::vector<geo::AuxDetGeo*> const& auxDets,
59  std::string const& detName,
60  uint32_t const& channel) const;
61 
62  // Experiments must implement these method. It accounts for auxiliary detectors like
63  // Multiwire proportional chambers where there is only a single sensitive volume, but
64  // multiple channels running through that volume.
65  virtual uint32_t PositionToAuxDetChannel(double const worldLoc[3],
66  std::vector<geo::AuxDetGeo*> const& auxDets,
67  size_t & ad,
68  size_t & sv) const = 0;
69 
70  virtual const TVector3 AuxDetChannelToPosition(uint32_t const& channel,
71  std::string const& auxDetName,
72  std::vector<geo::AuxDetGeo*> const& auxDets) const = 0;
73 
74  protected:
75 
76  std::map<size_t, std::string> fADGeoToName; ///< map the AuxDetGeo index to the name
77  std::map<std::string, size_t> fNameToADGeo; ///< map the names to the AuxDetGeo index
78  std::map<size_t, std::vector<chanAndSV> > fADGeoToChannelAndSV; ///< map the AuxDetGeo index to a vector of
79  ///< pairs corresponding to the channel and
80  ///< AuxDetSensitiveGeo index
81 
82  };
83  }
84  }
85 } // gar
86 #endif // GEO_AUXDETCHANNELMAPALG_H
virtual std::pair< size_t, size_t > ChannelToSensitiveAuxDet(std::vector< geo::AuxDetGeo * > const &auxDets, std::string const &detName, uint32_t const &channel) const
virtual size_t NearestAuxDet(const double *point, std::vector< geo::AuxDetGeo * > const &auxDets) const
virtual size_t ChannelToAuxDet(std::vector< geo::AuxDetGeo * > const &auxDets, std::string const &detName, uint32_t const &channel) const
virtual void Initialize(AuxDetGeometryData_t &geodata)=0
std::pair< uint32_t, size_t > chanAndSV
std::string string
Definition: nybbler.cc:12
Data in the geometry description.
virtual uint32_t PositionToAuxDetChannel(double const worldLoc[3], std::vector< geo::AuxDetGeo * > const &auxDets, size_t &ad, size_t &sv) const =0
uint8_t channel
Definition: CRTFragment.hh:201
virtual const TVector3 AuxDetChannelToPosition(uint32_t const &channel, std::string const &auxDetName, std::vector< geo::AuxDetGeo * > const &auxDets) const =0
std::map< std::string, size_t > fNameToADGeo
map the names to the AuxDetGeo index
virtual ~AuxDetChannelMapAlg()=default
General GArSoft Utilities.
virtual size_t NearestSensitiveAuxDet(const double *point, std::vector< geo::AuxDetGeo * > const &auxDets, size_t &ad) const
std::map< size_t, std::string > fADGeoToName
map the AuxDetGeo index to the name
std::map< size_t, std::vector< chanAndSV > > fADGeoToChannelAndSV
LArSoft geometry interface.
Definition: ChannelGeo.h:16