RegPixelMap.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file RegPixelMap.h
3 /// \brief RegPixelMap for RegCNN modified from PixelMap.h
4 /// \author Ilsoo Seong - iseong@uci.edu
5 ////////////////////////////////////////////////////////////////////////
6 
7 #ifndef REGCNN_REGPIXELMAP_H
8 #define REGCNN_REGPIXELMAP_H
9 
10 #include <ostream>
11 #include <vector>
12 
15 #include "TH2F.h"
16 
17 namespace cnn
18 {
19 
20 
21  /// RegPixelMap, basic input to CNN neural net
23  {
24  public:
25  RegPixelMap(unsigned int nWire, unsigned int nWRes, unsigned int nTdc, unsigned int nTRes, const RegCNNBoundary& bound, const bool& prongOnly);
27 
28  /// Length in wires
29  unsigned int NWire() const {return fNWire;};
30 
31  /// Number of Merged wires
32  unsigned int NWRes() const {return fNWRes;};
33 
34  /// Width in tdcs
35  unsigned int NTdc() const {return fNTdc;};
36 
37  /// Number of Merged tdcs
38  unsigned int NTRes() const {return fNTRes;};
39 
40  /// Total number of pixels in map
41  unsigned int NPixel() const {return fPE.size();};
42 
43  /// Map boundary
44  RegCNNBoundary Bound() const {return fBound;};
45 
46  /// Number of inputs for the neural net
47  unsigned int NInput() const {return NPixel();};
48 
49  void FillInputVector(float* input) const;
50 
51  /// Add a hit to the map if it is contained within the wire, tdc rcnne
52  /// Could be expanded later to add to overflow accordingly.
53  void Add(const int& wire, const int& tdc, const unsigned int& view, const double& pe, const unsigned int& tpc, int hit_prong_tag);
54 
55  void GetTPC(const int& wire, const int& tdc, const unsigned int& view, const unsigned int& tpc);
56  /// Take global wire, tdc (detector) and return index in fPE vector
57  unsigned int GlobalToIndex(const int& wire,
58  const int& tdc,
59  const unsigned int& view) ;
60 
61  /// Take local wire, tdc (within map) and return index in fPE vector
62  unsigned int LocalToIndex(const unsigned int& wire,
63  const unsigned int& tdc)
64  const;
65 
66  /// Take global wire, tdc (detector) and return index in fPE vector
67  unsigned int GlobalToIndexSingle(const int& wire,
68  const int& tdc,
69  const unsigned int& view);
70 
71  /// Draw pixel map to the screen. This is pretty hokey and the aspect ratio
72  /// is totally unrealistic.
73  void Print();
74 
75  /// Return the pixel map as a 2D histogram for visualization.
76  TH2F* ToTH2() const;
77  TH2F* ToLabTH2() const;
78  TH2F* SingleViewToTH2(const unsigned int& view) const;
79 
80  // Add Finish method in order to determine whether to produce prong only
81  // pixel maps or the full event pixel maps
82  void Finish();
83 
84  unsigned int fNWire; ///< Number of wires, length of pixel map
85  unsigned int fNWRes;
86  unsigned int fNTdc; ///< Number of tdcs, width of pixel map
87  unsigned int fNTRes;
88  unsigned int fInPM; // check Empty Pixel Map
89  unsigned int fTPC;
90  double fdist;
91  std::vector<float> fPE; ///< Vector of PE measurements for pixels
92  std::vector<float> fPEX; ///< Vector of X PE measurements for pixels
93  std::vector<float> fPEY; ///< Vector of Y PE measurements for pixels
94  std::vector<float> fPEZ; ///< Vector of Y PE measurements for pixels
95  std::vector<double> fPur; ///< Vector of purity for pixels
96  std::vector<double> fPurX; ///< Vector of X purity for pixels
97  std::vector<double> fPurY; ///< Vector of Y purity for pixels
98  std::vector<double> fPurZ; ///< Vector of Y purity for pixels
99  std::vector<HitType> fLab; ///< Vector of Truth labels for pixels
100  std::vector<HitType> fLabX; ///< Vector of X Truth labels for pixels
101  std::vector<HitType> fLabY; ///< Vector of Y Truth labels for pixels
102  std::vector<HitType> fLabZ; ///< Vector of Y Truth labels for pixels
103 
104  RegCNNBoundary fBound; //< RegCNNBoundary of pixel map
105  bool fProngOnly; //< whether to use prong only pixel map
106  std::vector<int> fProngTagX;
107  std::vector<int> fProngTagY;
108  std::vector<int> fProngTagZ;
109 
110  };
111 
112  std::ostream& operator<<(std::ostream& os, const RegPixelMap& m);
113 
114 }
115 
116 #endif // CNN_PIXELMAP_H
RegCNNBoundary Bound() const
Map boundary.
Definition: RegPixelMap.h:44
unsigned int GlobalToIndex(const int &wire, const int &tdc, const unsigned int &view)
Take global wire, tdc (detector) and return index in fPE vector.
std::vector< HitType > fLab
Vector of Truth labels for pixels.
Definition: RegPixelMap.h:99
unsigned int GlobalToIndexSingle(const int &wire, const int &tdc, const unsigned int &view)
Take global wire, tdc (detector) and return index in fPE vector.
unsigned int fNTdc
Number of tdcs, width of pixel map.
Definition: RegPixelMap.h:86
RegPixelMap, basic input to CNN neural net.
Definition: RegPixelMap.h:22
std::vector< int > fProngTagY
Definition: RegPixelMap.h:107
std::vector< int > fProngTagZ
Definition: RegPixelMap.h:108
unsigned int fInPM
Definition: RegPixelMap.h:88
unsigned int fNWire
Number of wires, length of pixel map.
Definition: RegPixelMap.h:84
std::vector< float > fPEZ
Vector of Y PE measurements for pixels.
Definition: RegPixelMap.h:94
unsigned int fNWRes
Definition: RegPixelMap.h:85
RegCNNBoundary fBound
Definition: RegPixelMap.h:104
void Add(const int &wire, const int &tdc, const unsigned int &view, const double &pe, const unsigned int &tpc, int hit_prong_tag)
Definition: RegPixelMap.cxx:60
std::vector< HitType > fLabY
Vector of Y Truth labels for pixels.
Definition: RegPixelMap.h:101
unsigned int NInput() const
Number of inputs for the neural net.
Definition: RegPixelMap.h:47
unsigned int NPixel() const
Total number of pixels in map.
Definition: RegPixelMap.h:41
std::vector< double > fPurY
Vector of Y purity for pixels.
Definition: RegPixelMap.h:97
TH2F * ToLabTH2() const
static int input(void)
Definition: code.cpp:15695
TH2F * SingleViewToTH2(const unsigned int &view) const
std::vector< float > fPEX
Vector of X PE measurements for pixels.
Definition: RegPixelMap.h:92
std::vector< float > fPE
Vector of PE measurements for pixels.
Definition: RegPixelMap.h:91
std::vector< double > fPurX
Vector of X purity for pixels.
Definition: RegPixelMap.h:96
std::vector< float > fPEY
Vector of Y PE measurements for pixels.
Definition: RegPixelMap.h:93
unsigned int NTdc() const
Width in tdcs.
Definition: RegPixelMap.h:35
unsigned int fTPC
Definition: RegPixelMap.h:89
unsigned int NTRes() const
Number of Merged tdcs.
Definition: RegPixelMap.h:38
unsigned int NWire() const
Length in wires.
Definition: RegPixelMap.h:29
Defines an enumeration for cellhit classification.
std::vector< HitType > fLabX
Vector of X Truth labels for pixels.
Definition: RegPixelMap.h:100
RegCNNBoundary for RegCNN PixelMap modified from CVNBoundary.h.
std::vector< double > fPurZ
Vector of Y purity for pixels.
Definition: RegPixelMap.h:98
std::ostream & operator<<(std::ostream &os, const RegPixelMap3DProducer &p)
std::vector< HitType > fLabZ
Vector of Y Truth labels for pixels.
Definition: RegPixelMap.h:102
unsigned int fNTRes
Definition: RegPixelMap.h:87
void GetTPC(const int &wire, const int &tdc, const unsigned int &view, const unsigned int &tpc)
TH2F * ToTH2() const
Return the pixel map as a 2D histogram for visualization.
void FillInputVector(float *input) const
Definition: RegPixelMap.cxx:48
std::vector< int > fProngTagX
Definition: RegPixelMap.h:106
unsigned int NWRes() const
Number of Merged wires.
Definition: RegPixelMap.h:32
unsigned int LocalToIndex(const unsigned int &wire, const unsigned int &tdc) const
Take local wire, tdc (within map) and return index in fPE vector.
std::vector< double > fPur
Vector of purity for pixels.
Definition: RegPixelMap.h:95