RegPixelMap.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file RegPixelMap.h
3 /// \brief RegPixelMap for Regression modified from Dominick's PixelMap
4 /// \author Jianming Bian - bianjm@uci.edu
5 ////////////////////////////////////////////////////////////////////////
6 
7 #ifndef CVN_REGPIXELMAP_H
8 #define CVN_REGPIXELMAP_H
9 
10 #include <ostream>
11 #include <vector>
12 
13 #include "CVN/func/Boundary.h"
14 #include "CVN/func/HitType.h"
15 #include "TH2F.h"
16 
17 namespace cvn
18 {
19 
20 
21  /// RegPixelMap, basic input to CVN neural net
23  {
24  public:
25  RegPixelMap(unsigned int nPlane, unsigned int nCell, const Boundary& bound);
26  RegPixelMap(unsigned int nPlane, unsigned int nCell, unsigned int vtxPlane, unsigned int vtxXCell, unsigned int vtxYCell, const Boundary& bound);
28 
29  /// Length in planes
30  unsigned int NPlane() const {return fNPlane;};
31 
32  /// Width in cells
33  unsigned int NCell() const {return fNCell;};
34 
35  /// Total number of pixels in map
36  unsigned int NPixel() const {return fPE.size();};
37 
38  /// Map boundary
39  Boundary Bound() const {return fBound;};
40 
41  /// Number of inputs for the neural net
42  unsigned int NInput() const {return NPixel();};
43 
44  void FillInputVector(float* input) const;
45 
46  /// Add a hit to the map if it is contained within the plane, cell rcvne
47  /// Could be expanded later to add to overflow accordingly.
48  void Add(const unsigned int& plane, const unsigned int& cell,
49  const float& pe, const HitType label, const double purity);
50 
51  void Add(const unsigned int plane, const unsigned int cell, const int view,
52  const float pe, const HitType label, const double purity);
53 
54  /// Take global plane, cell (detector) and return index in fPE vector
55  unsigned int GlobalToIndex(const unsigned int& plane,
56  const unsigned int& cell);
57 
58  /// Take local plane, cell (within map) and return index in fPE vector
59  unsigned int LocalToIndex(const unsigned int& plane,
60  const unsigned int& cell) const;
61 
62  /// Take global plane, cell (detector) and return index in fPE vector
63  unsigned int GlobalToIndexSingle(const unsigned int& plane,
64  const unsigned int& cell);
65 
66  /// Draw pixel map to the screen. This is pretty hokey and the aspect ratio
67  /// is totally unrealistic.
68  void Print();
69 
70  /// Return the pixel map as a 2D histogram for visualization.
71  TH2F* ToTH2(TString name) const;
72  TH2F* ToLabTH2(TString name) const;
73  TH2F* SingleViewToTH2(const unsigned int& view,TString name) const;
74  TH2F* SingleViewToLabTH2(const unsigned int& view,TString name) const;
75 
76  unsigned int fNPlane; ///< Number of planes, length of pixel map
77  unsigned int fNCell; ///< Number of cells, width of pixel map
78  unsigned int fVtxPlane;
79  unsigned int fVtxXCell;
80  unsigned int fVtxYCell;
81 
82  std::vector<float> fPE; ///< Vector of PE measurements for pixels
83  std::vector<float> fPEX; ///< Vector of X PE measurements for pixels
84  std::vector<float> fPEY; ///< Vector of Y PE measurements for pixels
85  std::vector<double> fPur; ///< Vector of purity for pixels
86  std::vector<double> fPurX; ///< Vector of X purity for pixels
87  std::vector<double> fPurY; ///< 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 
92  Boundary fBound; //< Boundary of pixel map
93 
94  };
95 
96  std::ostream& operator<<(std::ostream& os, const RegPixelMap& m);
97 
98 }
99 
100 #endif // CVN_REGPIXELMAP_H
std::vector< HitType > fLabY
Vector of Y Truth labels for pixels.
Definition: RegPixelMap.h:90
Boundary fBound
Definition: RegPixelMap.h:92
const XML_Char * name
Definition: expat.h:151
std::vector< double > fPurX
Vector of X purity for pixels.
Definition: RegPixelMap.h:86
enum cvn::HType HitType
void Add(const unsigned int &plane, const unsigned int &cell, const float &pe, const HitType label, const double purity)
Definition: RegPixelMap.cxx:65
unsigned int GlobalToIndex(const unsigned int &plane, const unsigned int &cell)
Take global plane, cell (detector) and return index in fPE vector.
unsigned int fNPlane
Number of planes, length of pixel map.
Definition: RegPixelMap.h:76
unsigned int NPixel() const
Total number of pixels in map.
Definition: RegPixelMap.h:36
std::ostream & operator<<(std::ostream &os, const PixelMapProducer &p)
void FillInputVector(float *input) const
Definition: RegPixelMap.cxx:53
unsigned int NInput() const
Number of inputs for the neural net.
Definition: RegPixelMap.h:42
TH2F * ToTH2(TString name) const
Return the pixel map as a 2D histogram for visualization.
std::vector< float > fPEX
Vector of X PE measurements for pixels.
Definition: RegPixelMap.h:83
Defines an enumeration for prong classification.
std::vector< HitType > fLabX
Vector of X Truth labels for pixels.
Definition: RegPixelMap.h:89
std::vector< double > fPur
Vector of purity for pixels.
Definition: RegPixelMap.h:85
unsigned int fNCell
Number of cells, width of pixel map.
Definition: RegPixelMap.h:77
const char * label
TH2F * SingleViewToLabTH2(const unsigned int &view, TString name) const
unsigned int GlobalToIndexSingle(const unsigned int &plane, const unsigned int &cell)
Take global plane, cell (detector) and return index in fPE vector.
Boundary Bound() const
Map boundary.
Definition: RegPixelMap.h:39
unsigned int fVtxYCell
Definition: RegPixelMap.h:80
std::vector< HitType > fLab
Vector of Truth labels for pixels.
Definition: RegPixelMap.h:88
unsigned int LocalToIndex(const unsigned int &plane, const unsigned int &cell) const
Take local plane, cell (within map) and return index in fPE vector.
unsigned int NCell() const
Width in cells.
Definition: RegPixelMap.h:33
std::vector< float > fPEY
Vector of Y PE measurements for pixels.
Definition: RegPixelMap.h:84
unsigned int NPlane() const
Length in planes.
Definition: RegPixelMap.h:30
void purity()
Definition: purity.C:35
RegPixelMap, basic input to CVN neural net.
Definition: RegPixelMap.h:22
unsigned int fVtxPlane
Definition: RegPixelMap.h:78
std::vector< float > fPE
Vector of PE measurements for pixels.
Definition: RegPixelMap.h:82
TH2F * SingleViewToTH2(const unsigned int &view, TString name) const
unsigned int fVtxXCell
Definition: RegPixelMap.h:79
std::vector< double > fPurY
Vector of Y purity for pixels.
Definition: RegPixelMap.h:87
TH2F * ToLabTH2(TString name) const