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