PixelMap.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file PixelMap.h
3 /// \brief PixelMap for CVN
4 /// \author Alexander Radovic - a.radovic@gmail.com
5 ////////////////////////////////////////////////////////////////////////
6 
7 #ifndef CVN_PIXELMAP_H
8 #define CVN_PIXELMAP_H
9 
10 #include <ostream>
11 #include <vector>
12 
15 #include "TH2F.h"
16 
17 namespace cvn
18 {
19 
20 
21  /// PixelMap, basic input to CVN neural net
22  class PixelMap
23  {
24  public:
25  PixelMap(unsigned int nWire, unsigned int nTdc, const Boundary& bound);
26  PixelMap(){ fTotHits = 0; };
27 
28  /// Length in wires
29  unsigned int NWire() const {return fNWire;};
30 
31  /// Width in tdcs
32  unsigned int NTdc() const {return fNTdc;};
33 
34  /// Total number of pixels in map
35  unsigned int NPixel() const {return fPE.size();};
36 
37  /// Map boundary
38  Boundary Bound() const {return fBound;};
39 
40  /// Number of inputs for the neural net
41  unsigned int NInput() const {return NPixel();};
42 
43  void FillInputVector(float* input) const;
44 
45  /// Add a hit to the map if it is contained within the wire, tdc rcvne
46  /// Could be expanded later to add to overflow accordingly.
47  void Add(const unsigned int& wire, const double& tdc, const unsigned int& view, const double& pe);
48 
49 
50  /// Take global wire, tdc (detector) and return index in fPE vector
51  unsigned int GlobalToIndex(const unsigned int& wire,
52  const double& tdc,
53  const unsigned int& view)
54  ;
55 
56  /// Take local wire, tdc (within map) and return index in fPE vector
57  unsigned int LocalToIndex(const unsigned int& wire,
58  const unsigned int& tdc)
59  const;
60 
61  /// Take global wire, tdc (detector) and return index in fPE vector
62  unsigned int GlobalToIndexSingle(const unsigned int& wire,
63  const double& tdc,
64  const unsigned int& view)
65 ;
66 
67  void SetTotHits(unsigned int tothits){ fTotHits = tothits; }
68  unsigned int GetTotHits(){ return fTotHits; }
69  /// Draw pixel map to the screen. This is pretty hokey and the aspect ratio
70  /// is totally unrealistic.
71  void Print() const;
72 
73  /// Return the pixel map as a 2D histogram for visualization.
74  TH2F* ToTH2() const;
75  TH2F* ToLabTH2() const;
76  TH2F* SingleViewToTH2(const unsigned int& view) const;
77 
78  unsigned int fNWire; ///< Number of wires, length of pixel map
79  unsigned int fNTdc; ///< Number of tdcs, width of pixel map
80  std::vector<float> fPE; ///< Vector of PE measurements for pixels
81  std::vector<float> fPEX; ///< Vector of X PE measurements for pixels
82  std::vector<float> fPEY; ///< Vector of Y PE measurements for pixels
83  std::vector<float> fPEZ; ///< Vector of Y PE measurements for pixels
84  std::vector<double> fPur; ///< Vector of purity for pixels
85  std::vector<double> fPurX; ///< Vector of X purity for pixels
86  std::vector<double> fPurY; ///< Vector of Y purity for pixels
87  std::vector<double> fPurZ; ///< Vector of Y purity for pixels
88  std::vector<HitType> fLab; ///< Vector of Truth labels for pixels
89  std::vector<HitType> fLabX; ///< Vector of X Truth labels for pixels
90  std::vector<HitType> fLabY; ///< Vector of Y Truth labels for pixels
91  std::vector<HitType> fLabZ; ///< Vector of Y Truth labels for pixels
92  unsigned int fTotHits; ///< Number of hits that make up the pixel map
93 
94  Boundary fBound; //< Boundary of pixel map
95 
96  };
97 
98  std::ostream& operator<<(std::ostream& os, const PixelMap& m);
99 
100 }
101 
102 #endif // CVN_PIXELMAP_H
void Print() const
Definition: PixelMap.cxx:124
std::vector< float > fPEY
Vector of Y PE measurements for pixels.
Definition: PixelMap.h:82
unsigned int NPixel() const
Total number of pixels in map.
Definition: PixelMap.h:35
TH2F * SingleViewToTH2(const unsigned int &view) const
Definition: PixelMap.cxx:206
unsigned int fNWire
Number of wires, length of pixel map.
Definition: PixelMap.h:78
unsigned int GetTotHits()
Definition: PixelMap.h:68
std::ostream & operator<<(std::ostream &os, const PixelMapProducer &p)
void FillInputVector(float *input) const
Definition: PixelMap.cxx:34
TH2F * ToLabTH2() const
Definition: PixelMap.cxx:186
Utility class for truth labels.
void SetTotHits(unsigned int tothits)
Definition: PixelMap.h:67
TH2F * ToTH2() const
Return the pixel map as a 2D histogram for visualization.
Definition: PixelMap.cxx:166
std::vector< float > fPE
Vector of PE measurements for pixels.
Definition: PixelMap.h:80
unsigned int GlobalToIndexSingle(const unsigned int &wire, const double &tdc, const unsigned int &view)
Take global wire, tdc (detector) and return index in fPE vector.
Definition: PixelMap.cxx:102
std::vector< float > fPEZ
Vector of Y PE measurements for pixels.
Definition: PixelMap.h:83
std::vector< HitType > fLabY
Vector of Y Truth labels for pixels.
Definition: PixelMap.h:90
static int input(void)
Definition: code.cpp:15695
void Add(const unsigned int &wire, const double &tdc, const unsigned int &view, const double &pe)
Definition: PixelMap.cxx:46
std::vector< float > fPEX
Vector of X PE measurements for pixels.
Definition: PixelMap.h:81
unsigned int GlobalToIndex(const unsigned int &wire, const double &tdc, const unsigned int &view)
Take global wire, tdc (detector) and return index in fPE vector.
Definition: PixelMap.cxx:72
Boundary Bound() const
Map boundary.
Definition: PixelMap.h:38
unsigned int NTdc() const
Width in tdcs.
Definition: PixelMap.h:32
PixelMap, basic input to CVN neural net.
Definition: PixelMap.h:22
std::vector< double > fPurY
Vector of Y purity for pixels.
Definition: PixelMap.h:86
std::vector< HitType > fLabX
Vector of X Truth labels for pixels.
Definition: PixelMap.h:89
std::vector< double > fPurZ
Vector of Y purity for pixels.
Definition: PixelMap.h:87
std::vector< HitType > fLab
Vector of Truth labels for pixels.
Definition: PixelMap.h:88
unsigned int fTotHits
Number of hits that make up the pixel map.
Definition: PixelMap.h:92
unsigned int NInput() const
Number of inputs for the neural net.
Definition: PixelMap.h:41
unsigned int fNTdc
Number of tdcs, width of pixel map.
Definition: PixelMap.h:79
Boundary fBound
Definition: PixelMap.h:94
std::vector< HitType > fLabZ
Vector of Y Truth labels for pixels.
Definition: PixelMap.h:91
unsigned int NWire() const
Length in wires.
Definition: PixelMap.h:29
unsigned int LocalToIndex(const unsigned int &wire, const unsigned int &tdc) const
Take local wire, tdc (within map) and return index in fPE vector.
Definition: PixelMap.cxx:93
Boundary for CVN PixelMap.
std::vector< double > fPur
Vector of purity for pixels.
Definition: PixelMap.h:84
std::vector< double > fPurX
Vector of X purity for pixels.
Definition: PixelMap.h:85