Class VoxelizeTriplets¶
- Defined in File VoxelizeTriplets.h
Class Documentation¶
-
class
VoxelizeTriplets
¶ Take spacepoint proposals from larflow::prep::PrepMatchTriplets and convert into voxels.
This class takes in space point proposals in the form of (U,V,Y) wire combinations from larflow::prep::PrepMatchTriplets. It assigns those space points to a location in a sparse voxel array defined in the constructor. The class also provides tools to get numpy arrays that help to make associations between spacepoints and voxels. Namely, a map from space point to occupied voxel index and a map from occupied voxel to a list of spacepoint indices that lie within the voxel. This information is intended for use in training sparse convolutional neural networks whose inputs are the voxels.
The voxel grid can be defined using the constructor with arguments. If the default constructor is used, a default grid is setup whose values are relevant for the MicroBooNE LArTPC.
Public Functions
-
VoxelizeTriplets
()¶ construct where default dimensions are used to define voxel grid
Origin is set to:
- x: (-801 ticks)*(0.5 usec/tick)*(drift velocity cm/usec) cm
- y: -120.0 cm
- z: 0.0 cm
The drift velocity is retrieved from larlite::LArProperties.
The length is set to:
- x: (1010 pixel rows)*(6 ticks/pixel)*(0.5 usec/tick)*(drift velocity cm/usec) cm
- y: 240.0 cm
- z: 1037.0 cm
The voxel size is set to 0.3 cm. This is the wire pitch in MicroBoone.
-
VoxelizeTriplets
(std::vector<float> origin, std::vector<float> dim_len, float voxel_size)¶ constructor where voxel grid can be specified
- Parameters
origin
: Position in 3D where origin of the voxel grid is located (in cm).dim_len
: Total length of each dimension (should be 3) in cm.voxel_size
: Length of height, width, and depth of an individual voxel in cm.
-
~VoxelizeTriplets
()¶
-
void
process_fullchain
(larcv::IOManager &iolcv, std::string adc_producer, std::string chstatus_producer, bool has_mc = false)¶ process data from image to make triplet and voxel data
This method uses an internal instance of larflow::prep::PrepMatchTriplets, _triplet_maker. The internal instance is used to extract spacepoint proposals from the wire plane images and then pass that info to make_voxeldata().
- Parameters
iolcv
: LArCV IOManager containing event dataadc_producer
: Root tree name containing wire images for eventchstatus_producer
: Root tree name containing channel status info for eventhas_mc
: The IOManager is expected to contain truth information from Monte Carlo simulations
-
int
get_axis_voxel
(int axis, float coord) const¶ get the voxel bin along one of the dimensions
- Return
- voxel bin index along the given dimension
- Parameters
axis
: Dimension we wantcoord
: Coordinate in the dimension we want
-
void
make_voxeldata
(const larflow::prep::PrepMatchTriplets &triplet_data)¶ takes in precomputed triplet data and saves filled voxels and maps between voxels and triplets
populates the following data members:
- _voxel_set
- _voxel_list
- _voxelidx_to_tripidxlist
- _trip2voxelidx
- Parameters
triplet_data
: Instance of triplet data, assumed to be filled already
-
PyObject *
make_voxeldata_dict
(const larflow::prep::PrepMatchTriplets &triplet_data)¶ takes in precomputed triplet data and outputs voxel data in the form of a python dict
Contents of the dictionary:
- dict[“voxcoord”] = (Nv,3) numpy int array; Nv (x,y,z) voxel coordinate
- dict[“voxlabel”] = (Nv) numpy int array; 1 if truth voxel, 0 otherwise.
- dict[“trip2vidx”] = (Nt) numpy int array; Nt voxel indices referencing the “coord” array
- dict[“vox2trips_list”] = List of length Nv with (Mi) numpy int arrays. Each array contains triplet index list to combine into the voxel.
Uses member containers filled in make_voxeldata().
- Return
- Python dictionary as described above. Ownership is transferred to calling namespace.
- Parameters
triplet_data
: larlite::prep::PrepMatchTriplets class containing spacepoint proposals
-
PyObject *
make_voxeldata_dict
()¶ calls make_voxeldata_dict with internal triplet maker data
- Return
- Python dictionary as described above. Ownership is transferred to calling namespace.
-
const std::vector<int> &
get_nvoxels
() const¶ get the number of total voxels
-
const std::vector<float> &
get_origin
() const¶ get the origin of the voxel grid
-
const std::vector<float> &
get_dim_len
() const¶ get the lengths of each dimension of the voxel grid
-
float
get_voxel_size
() const¶ get the voxel edge length
Protected Functions
-
void
_define_voxels
()¶ using the origin, grid length, and voxel size define the voxel grid
Protected Attributes
-
int
_ndims
¶ number of dimensions of the voxel grid (really only works in 3D)
-
std::vector<float>
_origin
¶ origin of the voxel grid in cm
-
std::vector<float>
_len
¶ length of the voxel grid in each dimension in cvm
-
float
_voxel_size
¶ voxel edge length in cm
-
std::vector<int>
_nvoxels
¶ number of voxels in each dimension
-
std::set<std::array<int, 3>>
_voxel_set
¶ set of occupied voxels
-
std::map<std::array<int, 3>, int>
_voxel_list
¶ map from voxel coordinate to voxel index
-
std::vector<std::vector<int>>
_voxelidx_to_tripidxlist
¶ voxel index to vector of triplet indices
-
std::vector<int>
_trip2voxelidx
¶ triplet index to voxel index map
-
larflow::prep::PrepMatchTriplets
_triplet_maker
¶ internal triplet maker, used if making from images only
-