Public Member Functions | Public Attributes | Private Attributes | List of all members
cnn::RegPixelMap3D Class Reference

RegPixelMap3D, input to 3D CNN neural net. More...

#include <RegPixelMap3D.h>

Public Member Functions

 RegPixelMap3D (const RegCNNBoundary3D &bound, const bool &Cropped, const bool &prongOnly)
 
 RegPixelMap3D ()
 
void AddHit (float rel_x, float rel_y, float rel_z, float charge, int hit_prong_tag)
 
bool IsCroppedPM () const
 
std::vector< float > GetPM () const
 
std::vector< float > GetCroppedPM () const
 
void Finish ()
 
unsigned int LocalToIndex (const unsigned int &bin_x, const unsigned int &bin_y, const unsigned int &bin_z) const
 
TH3F * ToTH3 () const
 
TH3F * ToCroppedTH3 () const
 

Public Attributes

RegCNNBoundary3D fBound
 
bool fCropped
 
bool fProngOnly
 
unsigned int fInPM
 
std::vector< float > fPE
 
std::vector< float > fPECropped
 
std::vector< int > fProngTag
 

Private Attributes

TAxis x_axis
 
TAxis y_axis
 
TAxis z_axis
 

Detailed Description

RegPixelMap3D, input to 3D CNN neural net.

Definition at line 22 of file RegPixelMap3D.h.

Constructor & Destructor Documentation

cnn::RegPixelMap3D::RegPixelMap3D ( const RegCNNBoundary3D bound,
const bool Cropped,
const bool prongOnly 
)

Definition at line 16 of file RegPixelMap3D.cxx.

16  :
17  fBound(bound),
18  fCropped(cropped),
19  fProngOnly(prongOnly),
20  fInPM(0),
22  fPECropped(32*32*32), // Fixed to 32x32x32
24  {
28  }
std::vector< int > fProngTag
Definition: RegPixelMap3D.h:50
float StopPos(const unsigned int &axis) const
float StartPos(const unsigned int &axis) const
std::vector< float > fPE
Definition: RegPixelMap3D.h:48
int NBins(const unsigned int &axis) const
RegCNNBoundary3D fBound
Definition: RegPixelMap3D.h:44
unsigned int fInPM
Definition: RegPixelMap3D.h:47
std::vector< float > fPECropped
Definition: RegPixelMap3D.h:49
cnn::RegPixelMap3D::RegPixelMap3D ( )
inline

Definition at line 26 of file RegPixelMap3D.h.

26 {};

Member Function Documentation

void cnn::RegPixelMap3D::AddHit ( float  rel_x,
float  rel_y,
float  rel_z,
float  charge,
int  hit_prong_tag 
)

Definition at line 30 of file RegPixelMap3D.cxx.

31  {
32  if (fBound.IsWithin(rel_x, rel_y, rel_z)) {
33  fInPM = 1;
34  int xbin = x_axis.FindBin(rel_x);
35  int ybin = y_axis.FindBin(rel_y);
36  int zbin = z_axis.FindBin(rel_z);
37  fPE[LocalToIndex(xbin-1, ybin-1, zbin-1)] += charge;
38  fProngTag[LocalToIndex(xbin-1, ybin-1, zbin-1)] = hit_prong_tag;
39  }
40  }
std::vector< int > fProngTag
Definition: RegPixelMap3D.h:50
bool IsWithin(const float &rel_x, const float &rel_y, const float &rel_z)
unsigned int LocalToIndex(const unsigned int &bin_x, const unsigned int &bin_y, const unsigned int &bin_z) const
std::vector< float > fPE
Definition: RegPixelMap3D.h:48
RegCNNBoundary3D fBound
Definition: RegPixelMap3D.h:44
unsigned int fInPM
Definition: RegPixelMap3D.h:47
void cnn::RegPixelMap3D::Finish ( )

Definition at line 42 of file RegPixelMap3D.cxx.

42  {
43  // fProngOnly=True means only the primary prong is selected to creat pixel maps
44  // and that prong needs to be either a muon or antimuon (FIXIT)?
45  // Caveat 1: the prong tag of that pixel is determined by the track id of the track
46  // associlated with the last hit that associated with that pixel. It means
47  // if this pixel-associated hits belong to different prongs, we could
48  // either add deposited energy from other prongs (if other prongs' hit is
49  // in the front), or throw the energy from primary prong away (if there is
50  // one or more hits from other prongs in the last). A better way could be
51  // determining the prong tag by looping the hits, instead of the pixels.
52  // That means we should create a new pixel map only with the spacepoints
53  // associated with the primary prong, instead of using the prong tag
54  // (little effect on the results, ignored for now)
55  if (fProngOnly) {
56  std::cout<<"Do Prong Only selection ......"<<std::endl;
57  for (unsigned int i_p= 0; i_p< fPE.size(); ++i_p) {
58  if (fProngTag[i_p] != 0)
59  fPE[i_p] = 0;
60  } // end of i_p
61  } // end of fProngOnly
62 
63  if (fCropped) {
64  std::cout<<"Crop pixel size to 32x32x32 ......"<<std::endl;
65  int cropped_xbin_low = 50 - 16; //int cropped_xbin_high = 50 + 16;
66  int cropped_ybin_low = 50 - 16; //int cropped_ybin_high = 50 + 16;
67  int cropped_zbin_low = 0; //int cropped_zbin_high = 32;
68  for (int i_x= 0; i_x< 32; ++i_x) {
69  for (int i_y= 0; i_y< 32; ++i_y) {
70  for (int i_z= 0; i_z< 32; ++i_z) {
71  int cropped_index = i_x*32*32 + i_y*32 + i_z%32;
72  int ii_x = i_x + cropped_xbin_low;
73  int ii_y = i_y + cropped_ybin_low;
74  int ii_z = i_z + cropped_zbin_low;
75  int index = LocalToIndex(ii_x, ii_y, ii_z);
76  fPECropped[cropped_index] = fPE[index];
77  } // end of i_z
78  } // end of i_y
79  } // end of i_x
80  } // end of fCropped
81  }
std::vector< int > fProngTag
Definition: RegPixelMap3D.h:50
unsigned int LocalToIndex(const unsigned int &bin_x, const unsigned int &bin_y, const unsigned int &bin_z) const
std::vector< float > fPE
Definition: RegPixelMap3D.h:48
std::vector< float > fPECropped
Definition: RegPixelMap3D.h:49
QTextStream & endl(QTextStream &s)
std::vector<float> cnn::RegPixelMap3D::GetCroppedPM ( ) const
inline

Definition at line 31 of file RegPixelMap3D.h.

31 {return fPECropped;};
std::vector< float > fPECropped
Definition: RegPixelMap3D.h:49
std::vector<float> cnn::RegPixelMap3D::GetPM ( ) const
inline

Definition at line 30 of file RegPixelMap3D.h.

30 {return fPE;};
std::vector< float > fPE
Definition: RegPixelMap3D.h:48
bool cnn::RegPixelMap3D::IsCroppedPM ( ) const
inline

Definition at line 29 of file RegPixelMap3D.h.

29 {return fCropped;};
unsigned int cnn::RegPixelMap3D::LocalToIndex ( const unsigned int &  bin_x,
const unsigned int &  bin_y,
const unsigned int &  bin_z 
) const

Definition at line 83 of file RegPixelMap3D.cxx.

85  {
86  unsigned int index = bin_x*fBound.NBins(1)*fBound.NBins(2) + bin_y*fBound.NBins(2) + bin_z%fBound.NBins(2);
87  assert(index < fPE.size());
88  return index;
89  }
std::vector< float > fPE
Definition: RegPixelMap3D.h:48
int NBins(const unsigned int &axis) const
RegCNNBoundary3D fBound
Definition: RegPixelMap3D.h:44
TH3F * cnn::RegPixelMap3D::ToCroppedTH3 ( ) const

Definition at line 106 of file RegPixelMap3D.cxx.

106  {
107  // Create a histogram
108  TH3F* hist = new TH3F("RegCroppedPixelMap3D", "X:Y:Z", 32, 0, 32*x_axis.GetBinWidth(0),
109  32, 0, 32*y_axis.GetBinWidth(0),
110  32, 0, 32*z_axis.GetBinWidth(0));
111  for (int ix= 0; ix< 32; ++ix) {
112  for (int iy= 0; iy< 32; ++iy) {
113  for (int iz= 0; iz< 32; ++iz) {
114  int cropped_index = ix*32*32 + iy*32 + iz%32;
115  hist->SetBinContent(ix+1, iy+1, iz+1, fPECropped[cropped_index]);
116  }
117  }
118  }
119  return hist;
120  }
std::vector< float > fPECropped
Definition: RegPixelMap3D.h:49
TH3F * cnn::RegPixelMap3D::ToTH3 ( ) const

Definition at line 91 of file RegPixelMap3D.cxx.

91  {
92  // Create a histogram
93  TH3F* hist = new TH3F("RegPixelMap3D", "X:Y:Z", fBound.NBins(0), fBound.StartPos(0), fBound.StopPos(0),
96  for (int ix= 0; ix< fBound.NBins(0); ++ix) {
97  for (int iy= 0; iy< fBound.NBins(1); ++iy) {
98  for (int iz= 0; iz< fBound.NBins(2); ++iz) {
99  hist->SetBinContent(ix+1, iy+1, iz+1, fPE[LocalToIndex(ix, iy, iz)]);
100  }
101  }
102  }
103  return hist;
104  }
float StopPos(const unsigned int &axis) const
float StartPos(const unsigned int &axis) const
unsigned int LocalToIndex(const unsigned int &bin_x, const unsigned int &bin_y, const unsigned int &bin_z) const
std::vector< float > fPE
Definition: RegPixelMap3D.h:48
int NBins(const unsigned int &axis) const
RegCNNBoundary3D fBound
Definition: RegPixelMap3D.h:44

Member Data Documentation

RegCNNBoundary3D cnn::RegPixelMap3D::fBound

Definition at line 44 of file RegPixelMap3D.h.

bool cnn::RegPixelMap3D::fCropped

Definition at line 45 of file RegPixelMap3D.h.

unsigned int cnn::RegPixelMap3D::fInPM

Definition at line 47 of file RegPixelMap3D.h.

std::vector<float> cnn::RegPixelMap3D::fPE

Definition at line 48 of file RegPixelMap3D.h.

std::vector<float> cnn::RegPixelMap3D::fPECropped

Definition at line 49 of file RegPixelMap3D.h.

bool cnn::RegPixelMap3D::fProngOnly

Definition at line 46 of file RegPixelMap3D.h.

std::vector<int> cnn::RegPixelMap3D::fProngTag

Definition at line 50 of file RegPixelMap3D.h.

TAxis cnn::RegPixelMap3D::x_axis
private

Definition at line 53 of file RegPixelMap3D.h.

TAxis cnn::RegPixelMap3D::y_axis
private

Definition at line 54 of file RegPixelMap3D.h.

TAxis cnn::RegPixelMap3D::z_axis
private

Definition at line 55 of file RegPixelMap3D.h.


The documentation for this class was generated from the following files: