APAGeometryAlg.h
Go to the documentation of this file.
1 /////////////////////////////////////////////////////////////////
2 // \fileAPAGeometryAlg.h
3 // tylerdalion@gmail.com
4 ////////////////////////////////////////////////////////////////////
5 #ifndef APAGeometryALG_H
6 #define APAGeometryALG_H
7 
8 #include <stdint.h>
9 #include <vector>
10 
11 #include "TVector3.h"
12 
16 
17 namespace fhicl { class ParameterSet; }
18 
19 namespace apa{
20 
21  // each APA has 4 separate views
22  typedef enum _apa_plane_proj {
23  kU, ///< U view on both sides of the APA
24  kV, ///< V view on both sides of the APA
25  kZ0, ///< Z view on the smaller-x side of the APA
26  kZ1, ///< Z view on the larger-x side of the APA
28  } APAView_t;
29 
30 
31  //---------------------------------------------------------------
33  public:
34 
35 
38 
39  void reconfigure(fhicl::ParameterSet const& p);
40 
41  void Init(); ///< Initialize some chanel numbers to speed up other methods
42 
43  bool APAChannelsIntersect( uint32_t chan1,
44  uint32_t chan2,
45  std::vector< geo::WireIDIntersection > & IntersectVector) const;
46  ///< If the channels intersect, get all intersections
47 
48  bool LineSegChanIntersect( TVector3 xyzStart,
49  TVector3 xyzEnd,
50  uint32_t chan,
51  std::vector< geo::WireID >& widsCrossed,
52  bool ExtendLine ) const;
53  ///< If a line given by start/end points intersects a channel
54 
55  std::vector<geo::WireID> ChanSegsPerSide(uint32_t chan, unsigned int side) const;
56  std::vector<geo::WireID> ChanSegsPerSide(std::vector<geo::WireID> wids, unsigned int side) const;
57 
58  std::vector<double> ThreeChanPos( uint32_t u, uint32_t v, uint32_t z ) const;
59  ///< Find the center of the 3 intersections, choose best if multiple
60 
61  geo::WireID NearestWireIDOnChan( const double WorldLoc[3],
62  uint32_t chan,
63  unsigned int const plane,
64  unsigned int const tpc=0,
65  unsigned int const cstat=0) const;
66 
67  unsigned int ChannelToAPA(uint32_t chan) const; ///< Get number of the APA containing the given channel
68  void ChannelToAPA( uint32_t chan,
69  unsigned int & apa,
70  unsigned int & cryo) const;
71  APAView_t APAView(uint32_t chan) const; ///< Get which of the 4 APA views the channel is in
72  unsigned int ChannelsInView( geo::View_t geoview ) const;
73  uint32_t FirstChannelInView( geo::View_t geoview,
74  unsigned int apa,
75  unsigned int cryo ) const;
76  uint32_t FirstChannelInView( geo::View_t geoview,
77  uint32_t chan ) const;
78  uint32_t FirstChannelInView( uint32_t chan ) const;
79  unsigned int ChannelsInAPAView( APAView_t apaview ) const;
80  unsigned int ChannelsPerAPA() const { return fChannelsPerAPA; };
81 
82 
83  private:
84 
85  art::ServiceHandle<geo::Geometry const> fGeom; // handle to geometry service
86 
87  unsigned int fChannelsPerAPA; ///< All APAs have this same number of channels
88  unsigned int fAPAsPerCryo;
89 
90  // channel boundaries to avoid calling ChannelToWire repetitively
91  uint32_t fFirstU;
92  uint32_t fLastU;
93  uint32_t fFirstV;
94  uint32_t fLastV;
95  uint32_t fFirstZ0;
96  uint32_t fLastZ0;
97  uint32_t fFirstZ1;
98  uint32_t fLastZ1;
99 
100  double fChannelRange[2]; // for each induction view: U=0, V=1
101 
102  }; // class APAGeometryAlg
103 
104 } // namespace apa
105 
106 #endif // ifndef APAGeometryALG_H
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
U view on both sides of the APA.
unsigned int fAPAsPerCryo
V view on both sides of the APA.
art framework interface to geometry description
Z view on the larger-x side of the APA.
enum apa::_apa_plane_proj APAView_t
virtual void reconfigure(fhicl::ParameterSet const &pset)
_apa_plane_proj
p
Definition: test.py:223
unsigned int fChannelsPerAPA
All APAs have this same number of channels.
void Init(void)
Definition: gXSecComp.cxx:138
Definition of data types for geometry description.
Z view on the smaller-x side of the APA.
art::ServiceHandle< geo::Geometry const > fGeom