Public Member Functions | Private Member Functions | Private Attributes | List of all members
cvn::SparsePixelMap Class Reference

#include <SparsePixelMap.h>

Public Member Functions

 SparsePixelMap (unsigned int dim, unsigned int views, bool usePixelTruth=false)
 
 SparsePixelMap ()
 
 ~SparsePixelMap ()
 
void AddHit (unsigned int view, std::vector< float > coordinates, std::vector< float > features)
 Default AddHit implementation, which just adds pixel value and coordinates. More...
 
void AddHit (unsigned int view, std::vector< float > coordinates, std::vector< float > features, std::vector< int > pdgs, std::vector< int > tracks, std::vector< float > energies, std::vector< std::string > processes)
 AddHit function that includes per-pixel truth labelling for segmentation. More...
 
unsigned int GetDim () const
 
unsigned int GetViews () const
 
std::vector< unsigned int > GetNPixels () const
 
unsigned int GetNPixels (size_t view) const
 
std::vector< std::vector< std::vector< float > > > GetCoordinates () const
 
std::vector< std::vector< float > > GetCoordinates (size_t view) const
 
std::vector< std::vector< std::vector< float > > > GetFeatures () const
 
std::vector< std::vector< float > > GetFeatures (size_t view) const
 
std::vector< std::vector< std::vector< int > > > GetPixelPDGs () const
 
std::vector< std::vector< int > > GetPixelPDGs (size_t view) const
 
std::vector< std::vector< std::vector< int > > > GetPixelTrackIDs () const
 
std::vector< std::vector< int > > GetPixelTrackIDs (size_t view) const
 
std::vector< std::vector< std::vector< float > > > GetPixelEnergies () const
 
std::vector< std::vector< float > > GetPixelEnergies (size_t view) const
 
std::vector< std::vector< std::vector< std::string > > > GetProcesses () const
 
std::vector< std::vector< std::string > > GetProcesses (size_t view) const
 

Private Member Functions

template<class T >
std::vector< T > FlattenVector (std::vector< std::vector< T >> vec) const
 

Private Attributes

unsigned int fDim
 Dimensionality of each pixel map. More...
 
unsigned int fViews
 Number of views. More...
 
bool fUsePixelTruth
 Whether to use a per-pixel ground truth for pixel segmentation. More...
 
std::vector< std::vector< std::vector< float > > > fCoordinates
 Coordinates of non-zero pixels. More...
 
std::vector< std::vector< std::vector< float > > > fFeatures
 Features of non-zero pixels. More...
 
std::vector< std::vector< std::vector< int > > > fPixelPDGs
 True particle PDG responsible for pixel. More...
 
std::vector< std::vector< std::vector< int > > > fPixelTrackIDs
 G4 track IDs responsible for pixelel. More...
 
std::vector< std::vector< std::vector< float > > > fPixelEnergies
 
std::vector< std::vector< std::vector< std::string > > > fProcesses
 

Detailed Description

Definition at line 14 of file SparsePixelMap.h.

Constructor & Destructor Documentation

cvn::SparsePixelMap::SparsePixelMap ( unsigned int  dim,
unsigned int  views,
bool  usePixelTruth = false 
)

Definition at line 14 of file SparsePixelMap.cxx.

15  : fDim(dim), fViews(views), fUsePixelTruth(usePixelTruth)
16  {
17  fCoordinates.resize(fViews);
18  fFeatures.resize(fViews);
19  if (fUsePixelTruth) {
20  fPixelPDGs.resize(fViews);
21  fPixelTrackIDs.resize(fViews);
22  fPixelEnergies.resize(fViews);
23  fProcesses.resize(fViews);
24 // *******************************************
25  }
26  }
std::vector< std::vector< std::vector< std::string > > > fProcesses
unsigned int fViews
Number of views.
std::vector< std::vector< std::vector< int > > > fPixelPDGs
True particle PDG responsible for pixel.
std::vector< std::vector< std::vector< int > > > fPixelTrackIDs
G4 track IDs responsible for pixelel.
std::vector< std::vector< std::vector< float > > > fFeatures
Features of non-zero pixels.
std::vector< std::vector< std::vector< float > > > fCoordinates
Coordinates of non-zero pixels.
std::vector< std::vector< std::vector< float > > > fPixelEnergies
bool fUsePixelTruth
Whether to use a per-pixel ground truth for pixel segmentation.
unsigned int fDim
Dimensionality of each pixel map.
cvn::SparsePixelMap::SparsePixelMap ( )
inline

Definition at line 18 of file SparsePixelMap.h.

18 {};
cvn::SparsePixelMap::~SparsePixelMap ( )
inline

Definition at line 19 of file SparsePixelMap.h.

19 {};

Member Function Documentation

void cvn::SparsePixelMap::AddHit ( unsigned int  view,
std::vector< float >  coordinates,
std::vector< float >  features 
)

Default AddHit implementation, which just adds pixel value and coordinates.

Definition at line 29 of file SparsePixelMap.cxx.

30  {
31 
32  if (coordinates.size() != fDim) {
34  << "Coordinate vector with size " << coordinates.size()
35  << " does not match sparse pixel map dimension " << fDim;
36  }
37 
38  if (fUsePixelTruth) {
40  << "Pixel truth is enabled for this SparsePixelMap, so you must include pixel PDG and "
41  << "track ID when calling AddHit.";
42  }
43 
44  fCoordinates[view].push_back(coordinates);
45  fFeatures[view].push_back(features);
46  }
std::vector< std::vector< std::vector< float > > > fFeatures
Features of non-zero pixels.
std::vector< std::vector< std::vector< float > > > fCoordinates
Coordinates of non-zero pixels.
bool fUsePixelTruth
Whether to use a per-pixel ground truth for pixel segmentation.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
unsigned int fDim
Dimensionality of each pixel map.
void cvn::SparsePixelMap::AddHit ( unsigned int  view,
std::vector< float >  coordinates,
std::vector< float >  features,
std::vector< int >  pdgs,
std::vector< int >  tracks,
std::vector< float >  energies,
std::vector< std::string processes 
)

AddHit function that includes per-pixel truth labelling for segmentation.

Definition at line 49 of file SparsePixelMap.cxx.

51  {
52 
53  if (coordinates.size() != fDim) {
55  << "Coordinate vector with size " << coordinates.size()
56  << " does not match sparse pixel map dimension " << fDim;
57  }
58 
59  if (!fUsePixelTruth) {
61  << "Pixel truth is disabled for this SparsePixelMap, but AddHit call includes "
62  << "pixel PDG, track ID and Energy";
63  }
64 
65  fCoordinates[view].push_back(coordinates);
66  fFeatures[view].push_back(features);
67  fPixelPDGs[view].push_back(pdgs);
68  fPixelTrackIDs[view].push_back(tracks);
69  fPixelEnergies[view].push_back(energies);
70  fProcesses[view].push_back(processes);
71 
72  }
std::vector< std::vector< std::vector< std::string > > > fProcesses
std::vector< std::vector< std::vector< int > > > fPixelPDGs
True particle PDG responsible for pixel.
std::vector< std::vector< std::vector< int > > > fPixelTrackIDs
G4 track IDs responsible for pixelel.
std::vector< std::vector< std::vector< float > > > fFeatures
Features of non-zero pixels.
std::vector< std::vector< std::vector< float > > > fCoordinates
Coordinates of non-zero pixels.
std::vector< std::vector< std::vector< float > > > fPixelEnergies
bool fUsePixelTruth
Whether to use a per-pixel ground truth for pixel segmentation.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
unsigned int fDim
Dimensionality of each pixel map.
template<class T >
std::vector<T> cvn::SparsePixelMap::FlattenVector ( std::vector< std::vector< T >>  vec) const
inlineprivate

Definition at line 52 of file SparsePixelMap.h.

52  {
53  std::vector<T> ret;
54  for (auto it : vec) {
55  ret.insert(ret.end(), it.begin(), it.end());
56  }
57  return ret;
58  }
std::vector<std::vector<std::vector<float> > > cvn::SparsePixelMap::GetCoordinates ( ) const
inline

Definition at line 29 of file SparsePixelMap.h.

29 { return fCoordinates; };
std::vector< std::vector< std::vector< float > > > fCoordinates
Coordinates of non-zero pixels.
std::vector<std::vector<float> > cvn::SparsePixelMap::GetCoordinates ( size_t  view) const
inline

Definition at line 30 of file SparsePixelMap.h.

30 { return fCoordinates[view]; };
std::vector< std::vector< std::vector< float > > > fCoordinates
Coordinates of non-zero pixels.
unsigned int cvn::SparsePixelMap::GetDim ( ) const
inline

Definition at line 24 of file SparsePixelMap.h.

24 { return fDim; };
unsigned int fDim
Dimensionality of each pixel map.
std::vector<std::vector<std::vector<float> > > cvn::SparsePixelMap::GetFeatures ( ) const
inline

Definition at line 32 of file SparsePixelMap.h.

32 { return fFeatures; };
std::vector< std::vector< std::vector< float > > > fFeatures
Features of non-zero pixels.
std::vector<std::vector<float> > cvn::SparsePixelMap::GetFeatures ( size_t  view) const
inline

Definition at line 33 of file SparsePixelMap.h.

33 { return fFeatures[view]; };
std::vector< std::vector< std::vector< float > > > fFeatures
Features of non-zero pixels.
std::vector< unsigned int > cvn::SparsePixelMap::GetNPixels ( ) const

Definition at line 74 of file SparsePixelMap.cxx.

74  {
75 
76  std::vector<unsigned int> ret(fViews);
77  for (size_t it = 0; it < fViews; ++it) {
78  ret[it] = fFeatures[it].size();
79  }
80  return ret;
81  }
unsigned int fViews
Number of views.
std::vector< std::vector< std::vector< float > > > fFeatures
Features of non-zero pixels.
unsigned int cvn::SparsePixelMap::GetNPixels ( size_t  view) const
inline

Definition at line 27 of file SparsePixelMap.h.

27 { return fFeatures[view].size(); };
std::vector< std::vector< std::vector< float > > > fFeatures
Features of non-zero pixels.
std::vector<std::vector<std::vector<float> > > cvn::SparsePixelMap::GetPixelEnergies ( ) const
inline

Definition at line 41 of file SparsePixelMap.h.

41 {return fPixelEnergies; };
std::vector< std::vector< std::vector< float > > > fPixelEnergies
std::vector<std::vector<float> > cvn::SparsePixelMap::GetPixelEnergies ( size_t  view) const
inline

Definition at line 42 of file SparsePixelMap.h.

42 {return fPixelEnergies[view]; };
std::vector< std::vector< std::vector< float > > > fPixelEnergies
std::vector<std::vector<std::vector<int> > > cvn::SparsePixelMap::GetPixelPDGs ( ) const
inline

Definition at line 35 of file SparsePixelMap.h.

35 { return fPixelPDGs; };
std::vector< std::vector< std::vector< int > > > fPixelPDGs
True particle PDG responsible for pixel.
std::vector<std::vector<int> > cvn::SparsePixelMap::GetPixelPDGs ( size_t  view) const
inline

Definition at line 36 of file SparsePixelMap.h.

36 { return fPixelPDGs[view]; };
std::vector< std::vector< std::vector< int > > > fPixelPDGs
True particle PDG responsible for pixel.
std::vector<std::vector<std::vector<int> > > cvn::SparsePixelMap::GetPixelTrackIDs ( ) const
inline

Definition at line 38 of file SparsePixelMap.h.

38 {return fPixelTrackIDs; };
std::vector< std::vector< std::vector< int > > > fPixelTrackIDs
G4 track IDs responsible for pixelel.
std::vector<std::vector<int> > cvn::SparsePixelMap::GetPixelTrackIDs ( size_t  view) const
inline

Definition at line 39 of file SparsePixelMap.h.

39 {return fPixelTrackIDs[view]; };
std::vector< std::vector< std::vector< int > > > fPixelTrackIDs
G4 track IDs responsible for pixelel.
std::vector<std::vector<std::vector<std::string> > > cvn::SparsePixelMap::GetProcesses ( ) const
inline

Definition at line 44 of file SparsePixelMap.h.

44 { return fProcesses; };
std::vector< std::vector< std::vector< std::string > > > fProcesses
std::vector<std::vector<std::string> > cvn::SparsePixelMap::GetProcesses ( size_t  view) const
inline

Definition at line 45 of file SparsePixelMap.h.

45 { return fProcesses[view]; };
std::vector< std::vector< std::vector< std::string > > > fProcesses
unsigned int cvn::SparsePixelMap::GetViews ( ) const
inline

Definition at line 25 of file SparsePixelMap.h.

25 { return fViews; }
unsigned int fViews
Number of views.

Member Data Documentation

std::vector<std::vector<std::vector<float> > > cvn::SparsePixelMap::fCoordinates
private

Coordinates of non-zero pixels.

Definition at line 63 of file SparsePixelMap.h.

unsigned int cvn::SparsePixelMap::fDim
private

Dimensionality of each pixel map.

Definition at line 60 of file SparsePixelMap.h.

std::vector<std::vector<std::vector<float> > > cvn::SparsePixelMap::fFeatures
private

Features of non-zero pixels.

Definition at line 64 of file SparsePixelMap.h.

std::vector<std::vector<std::vector<float> > > cvn::SparsePixelMap::fPixelEnergies
private

Definition at line 67 of file SparsePixelMap.h.

std::vector<std::vector<std::vector<int> > > cvn::SparsePixelMap::fPixelPDGs
private

True particle PDG responsible for pixel.

Definition at line 65 of file SparsePixelMap.h.

std::vector<std::vector<std::vector<int> > > cvn::SparsePixelMap::fPixelTrackIDs
private

G4 track IDs responsible for pixelel.

Definition at line 66 of file SparsePixelMap.h.

std::vector<std::vector<std::vector<std::string> > > cvn::SparsePixelMap::fProcesses
private

Definition at line 68 of file SparsePixelMap.h.

bool cvn::SparsePixelMap::fUsePixelTruth
private

Whether to use a per-pixel ground truth for pixel segmentation.

Definition at line 62 of file SparsePixelMap.h.

unsigned int cvn::SparsePixelMap::fViews
private

Number of views.

Definition at line 61 of file SparsePixelMap.h.


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