Program Listing for File VoxelizeTriplets.h

Return to documentation for file (larflow/Voxelizer/VoxelizeTriplets.h)

#ifndef __VOXELIZE_TRIPLETS_H__
#define __VOXELIZE_TRIPLETS_H__

#include <Python.h>
#include "bytesobject.h"

#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <numpy/ndarrayobject.h>

#include <string>
#include <vector>

#include "larcv/core/DataFormat/IOManager.h"
#include "DataFormat/storage_manager.h"

#include "larflow/PrepFlowMatchData/PrepMatchTriplets.h"

namespace larflow {
namespace voxelizer {

  class VoxelizeTriplets {

  public:

    VoxelizeTriplets();

    VoxelizeTriplets( std::vector<float> origin,
                      std::vector<float> dim_len,
                      float voxel_size );
    ~VoxelizeTriplets() {};

    void process_fullchain( larcv::IOManager& iolcv,
                            std::string adc_producer,
                            std::string chstatus_producer,
                            bool has_mc=false );

  protected:

    int _ndims;
    std::vector<float> _origin;
    std::vector<float> _len;
    float _voxel_size;
    std::vector<int>   _nvoxels;
    void _define_voxels();

    std::set< std::array<int,3> >      _voxel_set;
    std::map< std::array<int,3>, int > _voxel_list;
    std::vector< std::vector<int> >    _voxelidx_to_tripidxlist;
    std::vector<int>                   _trip2voxelidx;


    larflow::prep::PrepMatchTriplets _triplet_maker;

  public:

    int get_axis_voxel( int axis, float coord ) const;


    void make_voxeldata( const larflow::prep::PrepMatchTriplets& triplet_data );
    PyObject* make_voxeldata_dict( const larflow::prep::PrepMatchTriplets& triplet_data );
    PyObject* make_voxeldata_dict();

    const std::vector<int>& get_nvoxels() const  { return _nvoxels; };

    const std::vector<float>& get_origin() const { return _origin; };

    const std::vector<float>& get_dim_len() const { return _len; };

    float get_voxel_size() const { return _voxel_size; };


  protected:


  private:

    static bool _setup_numpy;

  };

}
}

#endif