From c5b35dbe71953fc2bfff5931de8ee6ef114b985d Mon Sep 17 00:00:00 2001 From: Corey <> Date: Wed, 2 Feb 2022 14:14:36 -0600 Subject: [PATCH] Removing weird include directory --- larcv/include/app/queueio/BatchData.h | 102 ---- larcv/include/app/queueio/BatchDataQueue.h | 79 ---- .../app/queueio/BatchDataQueueFactory.h | 87 ---- larcv/include/app/queueio/BatchFillerBBox.h | 119 ----- .../include/app/queueio/BatchFillerPIDLabel.h | 86 ---- .../include/app/queueio/BatchFillerParticle.h | 86 ---- .../app/queueio/BatchFillerSparseTensor.h | 130 ------ .../include/app/queueio/BatchFillerTemplate.h | 83 ---- larcv/include/app/queueio/BatchFillerTensor.h | 135 ------ larcv/include/app/queueio/BatchHolder.h | 55 --- larcv/include/app/queueio/QueueIOTypes.h | 37 -- larcv/include/app/queueio/QueueProcessor.h | 158 ------- larcv/include/app/queueio/queueio.h | 35 -- .../larcv3/app/filter/EmptyImageFilter.h | 74 --- .../larcv3/app/filter/EmptyTensorFilter.h | 84 ---- .../larcv3/app/imagemod/BBoxFromParticle.h | 88 ---- .../larcv3/app/imagemod/DenseToSparse.h | 90 ---- .../include/larcv3/app/imagemod/Downsample.h | 100 ---- larcv/include/larcv3/app/imagemod/Embed.h | 114 ----- .../larcv3/app/imagemod/Image2DFromTensor2D.h | 78 ---- .../larcv3/app/imagemod/SparseToDense.h | 88 ---- .../larcv3/app/imagemod/Tensor2DFromImage2D.h | 71 --- .../larcv3/app/imagemod/TensorFromCluster.h | 90 ---- larcv/include/larcv3/app/imagemod/Threshold.h | 97 ---- larcv/include/larcv3/app/imagemod/imagemod.h | 30 -- .../app/sbnd_imagemod/CompressAndEmbed.h | 75 --- .../sbnd_imagemod/CosmicNeutrinoSegLabel.h | 96 ---- .../app/sbnd_imagemod/ParentParticleSeg.h | 119 ----- .../larcv3/app/sbnd_imagemod/sbnd_imagemod.h | 30 -- .../larcv3/core/base/LArCVBaseUtilFunc.h | 25 - larcv/include/larcv3/core/base/LArCVTypes.h | 80 ---- larcv/include/larcv3/core/base/Watch.h | 70 --- larcv/include/larcv3/core/base/base.h | 32 -- larcv/include/larcv3/core/base/larbys.h | 65 --- larcv/include/larcv3/core/base/larcv_base.h | 123 ----- larcv/include/larcv3/core/base/larcv_logger.h | 173 ------- larcv/include/larcv3/core/base/stack_trace.h | 93 ---- larcv/include/larcv3/core/dataformat/BBox.h | 236 ---------- .../larcv3/core/dataformat/DataFormatTypes.h | 160 ------- .../core/dataformat/DataProductFactory.h | 92 ---- .../larcv3/core/dataformat/EventBBox.h | 137 ------ .../larcv3/core/dataformat/EventBase.h | 114 ----- .../include/larcv3/core/dataformat/EventID.h | 120 ----- .../larcv3/core/dataformat/EventParticle.h | 110 ----- .../core/dataformat/EventSparseCluster.h | 137 ------ .../core/dataformat/EventSparseTensor.h | 130 ------ .../larcv3/core/dataformat/EventTensor.h | 133 ------ .../larcv3/core/dataformat/IOManager.h | 281 ----------- .../larcv3/core/dataformat/ImageMeta.h | 253 ---------- .../include/larcv3/core/dataformat/Particle.h | 290 ------------ larcv/include/larcv3/core/dataformat/Point.h | 133 ------ larcv/include/larcv3/core/dataformat/Tensor.h | 205 -------- larcv/include/larcv3/core/dataformat/Vertex.h | 107 ----- larcv/include/larcv3/core/dataformat/Voxel.h | 439 ------------------ .../larcv3/core/dataformat/dataformat.h | 46 -- .../larcv3/core/processor/ProcessBase.h | 100 ---- .../larcv3/core/processor/ProcessDriver.h | 140 ------ .../larcv3/core/processor/ProcessFactory.h | 90 ---- .../larcv3/core/processor/ProcessorTypes.h | 9 - .../include/larcv3/core/processor/processor.h | 33 -- 60 files changed, 6672 deletions(-) delete mode 100644 larcv/include/app/queueio/BatchData.h delete mode 100644 larcv/include/app/queueio/BatchDataQueue.h delete mode 100644 larcv/include/app/queueio/BatchDataQueueFactory.h delete mode 100644 larcv/include/app/queueio/BatchFillerBBox.h delete mode 100644 larcv/include/app/queueio/BatchFillerPIDLabel.h delete mode 100644 larcv/include/app/queueio/BatchFillerParticle.h delete mode 100644 larcv/include/app/queueio/BatchFillerSparseTensor.h delete mode 100644 larcv/include/app/queueio/BatchFillerTemplate.h delete mode 100644 larcv/include/app/queueio/BatchFillerTensor.h delete mode 100644 larcv/include/app/queueio/BatchHolder.h delete mode 100644 larcv/include/app/queueio/QueueIOTypes.h delete mode 100644 larcv/include/app/queueio/QueueProcessor.h delete mode 100644 larcv/include/app/queueio/queueio.h delete mode 100644 larcv/include/larcv3/app/filter/EmptyImageFilter.h delete mode 100644 larcv/include/larcv3/app/filter/EmptyTensorFilter.h delete mode 100644 larcv/include/larcv3/app/imagemod/BBoxFromParticle.h delete mode 100644 larcv/include/larcv3/app/imagemod/DenseToSparse.h delete mode 100644 larcv/include/larcv3/app/imagemod/Downsample.h delete mode 100644 larcv/include/larcv3/app/imagemod/Embed.h delete mode 100644 larcv/include/larcv3/app/imagemod/Image2DFromTensor2D.h delete mode 100644 larcv/include/larcv3/app/imagemod/SparseToDense.h delete mode 100644 larcv/include/larcv3/app/imagemod/Tensor2DFromImage2D.h delete mode 100644 larcv/include/larcv3/app/imagemod/TensorFromCluster.h delete mode 100644 larcv/include/larcv3/app/imagemod/Threshold.h delete mode 100644 larcv/include/larcv3/app/imagemod/imagemod.h delete mode 100644 larcv/include/larcv3/app/sbnd_imagemod/CompressAndEmbed.h delete mode 100644 larcv/include/larcv3/app/sbnd_imagemod/CosmicNeutrinoSegLabel.h delete mode 100644 larcv/include/larcv3/app/sbnd_imagemod/ParentParticleSeg.h delete mode 100644 larcv/include/larcv3/app/sbnd_imagemod/sbnd_imagemod.h delete mode 100644 larcv/include/larcv3/core/base/LArCVBaseUtilFunc.h delete mode 100644 larcv/include/larcv3/core/base/LArCVTypes.h delete mode 100644 larcv/include/larcv3/core/base/Watch.h delete mode 100644 larcv/include/larcv3/core/base/base.h delete mode 100644 larcv/include/larcv3/core/base/larbys.h delete mode 100644 larcv/include/larcv3/core/base/larcv_base.h delete mode 100644 larcv/include/larcv3/core/base/larcv_logger.h delete mode 100644 larcv/include/larcv3/core/base/stack_trace.h delete mode 100644 larcv/include/larcv3/core/dataformat/BBox.h delete mode 100644 larcv/include/larcv3/core/dataformat/DataFormatTypes.h delete mode 100644 larcv/include/larcv3/core/dataformat/DataProductFactory.h delete mode 100644 larcv/include/larcv3/core/dataformat/EventBBox.h delete mode 100644 larcv/include/larcv3/core/dataformat/EventBase.h delete mode 100644 larcv/include/larcv3/core/dataformat/EventID.h delete mode 100644 larcv/include/larcv3/core/dataformat/EventParticle.h delete mode 100644 larcv/include/larcv3/core/dataformat/EventSparseCluster.h delete mode 100644 larcv/include/larcv3/core/dataformat/EventSparseTensor.h delete mode 100644 larcv/include/larcv3/core/dataformat/EventTensor.h delete mode 100644 larcv/include/larcv3/core/dataformat/IOManager.h delete mode 100644 larcv/include/larcv3/core/dataformat/ImageMeta.h delete mode 100644 larcv/include/larcv3/core/dataformat/Particle.h delete mode 100644 larcv/include/larcv3/core/dataformat/Point.h delete mode 100644 larcv/include/larcv3/core/dataformat/Tensor.h delete mode 100644 larcv/include/larcv3/core/dataformat/Vertex.h delete mode 100644 larcv/include/larcv3/core/dataformat/Voxel.h delete mode 100644 larcv/include/larcv3/core/dataformat/dataformat.h delete mode 100644 larcv/include/larcv3/core/processor/ProcessBase.h delete mode 100644 larcv/include/larcv3/core/processor/ProcessDriver.h delete mode 100644 larcv/include/larcv3/core/processor/ProcessFactory.h delete mode 100644 larcv/include/larcv3/core/processor/ProcessorTypes.h delete mode 100644 larcv/include/larcv3/core/processor/processor.h diff --git a/larcv/include/app/queueio/BatchData.h b/larcv/include/app/queueio/BatchData.h deleted file mode 100644 index f582f656..00000000 --- a/larcv/include/app/queueio/BatchData.h +++ /dev/null @@ -1,102 +0,0 @@ -/** - * \file BatchData.h - * - * \ingroup ThreadIO - * - * \brief Class def header for a class BatchData - * - * @author kazuhiro cadams - */ - -/** \addtogroup ThreadIO - - @{*/ -#ifndef __LARCV3THREADIO_BATCHDATA_H -#define __LARCV3THREADIO_BATCHDATA_H - -#include -#include -#include "QueueIOTypes.h" -#include "larcv3/core/dataformat/DataFormatTypes.h" - -#ifdef LARCV_INTERNAL -#include -#include -#endif - -namespace larcv3 { - /** - \class BatchData - - */ - template - class BatchData { - - public: - - /// Default constructor - BatchData() - : _current_size(0) - , _state(BatchDataState_t::kBatchStateUnknown) - {} - - /// Default destructor - ~BatchData() {} - - /// Read access to the data: - const std::vector& data() const; - - // Writeable access to data: - std::vector & writeable_data() {return _data;} - -#ifdef LARCV_INTERNAL - pybind11::array_t pydata(); -#endif - - inline const std::vector& dim() const { return _dim; } - inline const std::vector& dense_dim() const { return _dense_dim; } - - // Data size is number of elements regardless of the size of each element - size_t data_size(bool calculate=false) const; - - inline size_t current_data_size() const { return _current_size; } - - size_t entry_data_size() const; - - void set_dim(const std::vector& dim); - void set_dense_dim(const std::vector& dense_dim); - void set_entry_data(const std::vector& entry_data); - - void reset(); - void reset_data(); - - inline bool is_filled() const - { return ( _state == BatchDataState_t::kBatchStateFilled ); } - - inline BatchDataState_t state() const - { return _state; } - - private: - // This holds the data for this instance, and is changed often - std::vector _data; - // This holds the dimensions of the container for readout data (including sparse), - // and is static. _data is flattened and this provides reshaping information - std::vector _dim; - // This holds the dense shape of this data, in the case that the data is sparse - // In the case that the data is dense, this matches _dim. - std::vector _dense_dim; - size_t _current_size; - BatchDataState_t _state; - }; -} - - -#ifdef LARCV_INTERNAL -template -void init_batchdata_(pybind11::module m); - -void init_batchdata(pybind11::module m); -#endif - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/app/queueio/BatchDataQueue.h b/larcv/include/app/queueio/BatchDataQueue.h deleted file mode 100644 index 48c13e6e..00000000 --- a/larcv/include/app/queueio/BatchDataQueue.h +++ /dev/null @@ -1,79 +0,0 @@ -/** - * \file BatchDataQueue.h - * - * \ingroup ThreadIO - * - * \brief Class def header for a class BatchDataQueue - * - * @author kazuhiro - */ - -/** \addtogroup ThreadIO - - @{*/ -#ifndef __LARCV3THREADIO_BATCHDATAQUEUE_H -#define __LARCV3THREADIO_BATCHDATAQUEUE_H - -#include -#include "BatchData.h" - -namespace larcv3 { - /** - \class BatchDataQueue - User defined class BatchDataQueue ... these comments are used to generate - doxygen documentation! - */ - template - class BatchDataQueue { - - public: - /// Default constructor - BatchDataQueue(); - - /// Default destructor - ~BatchDataQueue(){} - - void reset(); - - // Return detailed state of the next batch - inline BatchDataState_t next_state() const - { return _data_next.state(); } - - // Return whether the next batch of data is ready to go or not: - bool is_next_ready () const; - - // Access to the current batch of data - // Returns const reference and it is expected that _data_current will persist until - // pop is called. - const BatchData& get_batch () const; - - // Pop moves _data_next into _data_current and resets _data_next. - void pop(); - - - // Writeable access to the next batch of data - BatchData& get_next_writeable(); - - // Set the data for the next batch - void set_next_data (const std::vector& source); - - - private: - larcv3::BatchData _data_current; - larcv3::BatchData _data_next; - - }; - -} - -#ifdef LARCV_INTERNAL -#include -template -void init_batchdataqueue(pybind11::module m); - -void init_batchdataqueue(pybind11::module m); -#endif - - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/app/queueio/BatchDataQueueFactory.h b/larcv/include/app/queueio/BatchDataQueueFactory.h deleted file mode 100644 index 39c9f869..00000000 --- a/larcv/include/app/queueio/BatchDataQueueFactory.h +++ /dev/null @@ -1,87 +0,0 @@ -/** - * \file BatchDataQueueFactory.h - * - * \ingroup ThreadIO - * - * \brief Class def header for a class BatchDataQueueFactory - * - * @author kazuhiro - */ - -/** \addtogroup ThreadIO - - @{*/ -#ifndef __LARCV3THREADIO_BATCHDATAQUEUEFACTORY_H -#define __LARCV3THREADIO_BATCHDATAQUEUEFACTORY_H - -#include -#include -#include "BatchDataQueue.h" -#include "larcv3/core/base/larcv_logger.h" -#include "larcv3/core/base/larbys.h" - -namespace larcv3 { - class QueueProcessor; - /** - \class BatchDataQueueFactory - User defined class BatchDataQueueFactory ... these comments are used to generate - doxygen documentation! - */ - template - class BatchDataQueueFactory { - friend QueueProcessor; - public: - - BatchDataQueueFactory() - {} - - ~BatchDataQueueFactory() - {} - - static const BatchDataQueueFactory& get(); - - inline bool exist_queue(std::string name) const - { - auto iter = _queue_m.find(name); - return iter != _queue_m.end(); - } - - bool is_next_ready() const; - - // Pop all queues to promote next to current - void pop_all(); - - const BatchDataQueue& get_queue(std::string name) const; - - inline bool make_queue(std::string name) - { - if (exist_queue(name)) { - LARCV_SERROR() << "Queue name " << name << " already present..." << std::endl; - return false; - } - _queue_m.emplace(std::make_pair(name, BatchDataQueue())); - return true; - } - - BatchDataQueue& get_queue_writeable(std::string name); - - private: - static BatchDataQueueFactory& get_writeable(); - - private: - static BatchDataQueueFactory* _me; - std::map > _queue_m; - }; - -} - -#ifdef LARCV_INTERNAL -#include -template -void init_batchdataqueuefactory(pybind11::module m); - -void init_batchdataqueuefactory(pybind11::module m); -#endif - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/app/queueio/BatchFillerBBox.h b/larcv/include/app/queueio/BatchFillerBBox.h deleted file mode 100644 index f2aecf8b..00000000 --- a/larcv/include/app/queueio/BatchFillerBBox.h +++ /dev/null @@ -1,119 +0,0 @@ -/** - * \file BatchFillerBBox.h - * - * \ingroup ThreadIO - * - * \brief Class def header for a class BatchFillerBBox2D - * - * @author cadams - */ - -/** \addtogroup ThreadIO - - @{*/ -#ifndef __LARCV3THREADIO_BATCHFILLERBBOX_H__ -#define __LARCV3THREADIO_BATCHFILLERBBOX_H__ - -#include "larcv3/core/processor/ProcessFactory.h" -#include "BatchFillerTemplate.h" - -#include "larcv3/core/dataformat/EventBBox.h" - -namespace larcv3 { - - /** - \class ProcessBase - User defined class BatchFillerTensor ... these comments are used to generate - doxygen documentation! - */ - template - class BatchFillerBBox : public BatchFillerTemplate { - - public: - - /// Default constructor - BatchFillerBBox(const std::string name="BatchFillerBBox"); - - /// Default destructor - ~BatchFillerBBox(){} - - void configure(const json&); - - void initialize(); - - bool process(IOManager& mgr); - - void finalize(); - - static json default_config(){ - json c = { - {"Producer", std::string()}, - {"MaxBoxes", 25}, - {"UnfilledBoxValue", 0.0}, - {"Channels", std::vector()}, - }; - return c; - } - protected: - - void _batch_begin_(); - void _batch_end_(); - - private: - - size_t set_data_size(const EventBBox& image_data); - int _check_projection(const int & projection_id); - - // std::string _bbox_producer; - // size_t _max_boxes; - // float _unfilled_box_value; - // std::vector _slice_v; - - json config; - - std::vector _entry_data; - }; - - typedef BatchFillerBBox<2> BatchFillerBBox2D; - typedef BatchFillerBBox<3> BatchFillerBBox3D; - - // Template instantiation for IO - template<> inline std::string product_unique_name() { - return "BatchFillerBBox2D"; - } - template<> inline std::string product_unique_name() { - return "BatchFillerBBox3D"; - } - - /** - \class larcv3::BatchFillerBBoxFactory - \brief A concrete factory class for larcv3::BatchFillerBBox - */ - template - class BatchFillerBBoxProcessFactory : public ProcessFactoryBase { - public: - /// ctor - BatchFillerBBoxProcessFactory() { - ProcessFactory::get().add_factory(product_unique_name>(), - this); - } - /// dtor - ~BatchFillerBBoxProcessFactory() {} - /// creation method - ProcessBase* create(const std::string instance_name) { - return new BatchFillerBBox(instance_name); - } - }; - -} - -#ifdef LARCV_INTERNAL -template -void init_bf_bbox_(pybind11::module m); - -void init_bf_bbox(pybind11::module m); -#endif - -#endif -/** @} */ // end of doxygen group - diff --git a/larcv/include/app/queueio/BatchFillerPIDLabel.h b/larcv/include/app/queueio/BatchFillerPIDLabel.h deleted file mode 100644 index 9d166c40..00000000 --- a/larcv/include/app/queueio/BatchFillerPIDLabel.h +++ /dev/null @@ -1,86 +0,0 @@ -/** - * \file BatchFillerPIDLabel.h - * - * \ingroup ThreadIO - * - * \brief Class def header for a class BatchFillerPIDLabel - * - * @author kazuhiro - */ - -/** \addtogroup ThreadIO - - @{*/ -#ifndef __LARCV3THREADIO_BATCHFILLERPIDLABEL_H__ -#define __LARCV3THREADIO_BATCHFILLERPIDLABEL_H__ - -#include "larcv3/core/processor/ProcessFactory.h" -#include "BatchFillerTemplate.h" - -namespace larcv3 { - - /** - \class ProcessBase - User defined class BatchFillerPIDLabel ... these comments are used to generate - doxygen documentation! - */ - class BatchFillerPIDLabel : public BatchFillerTemplate { - - public: - - /// Default constructor - BatchFillerPIDLabel(const std::string name="BatchFillerPIDLabel"); - - /// Default destructor - ~BatchFillerPIDLabel(){} - - void configure(const json&); - - void initialize(); - - bool process(IOManager& mgr); - - void _batch_begin_(); - - void _batch_end_(); - - void finalize(); - - static json default_config(){ - json c = { - {"Producer", std::string()}, - {"PdgClassList", std::vector()}, - }; - return c; - } - - private: - - json config; - - std::vector _entry_data; - }; - - /** - \class larcv3::BatchFillerPIDLabelFactory - \brief A concrete factory class for larcv3::BatchFillerPIDLabel - */ - class BatchFillerPIDLabelProcessFactory : public ProcessFactoryBase { - public: - /// ctor - BatchFillerPIDLabelProcessFactory() { ProcessFactory::get().add_factory("BatchFillerPIDLabel",this); } - /// dtor - ~BatchFillerPIDLabelProcessFactory() {} - /// creation method - ProcessBase* create(const std::string instance_name) { return new BatchFillerPIDLabel(instance_name); } - }; - -} - -#ifdef LARCV_INTERNAL -void init_bf_pid(pybind11::module m); -#endif - -#endif -/** @} */ // end of doxygen group - diff --git a/larcv/include/app/queueio/BatchFillerParticle.h b/larcv/include/app/queueio/BatchFillerParticle.h deleted file mode 100644 index 6f872ef7..00000000 --- a/larcv/include/app/queueio/BatchFillerParticle.h +++ /dev/null @@ -1,86 +0,0 @@ -/** - * \file BatchFillerParticle.h - * - * \ingroup ThreadIO - * - * \brief Class def header for a class BatchFillerParticle - * - * @author kazuhiro - */ - -/** \addtogroup ThreadIO - - @{*/ -#ifndef __LARCV3THREADIO_BATCHFILLERPARTICLE_H__ -#define __LARCV3THREADIO_BATCHFILLERPARTICLE_H__ - -#include "larcv3/core/processor/ProcessFactory.h" -#include "BatchFillerTemplate.h" -#include "larcv3/core/dataformat/EventParticle.h" - -namespace larcv3 { - - /** - \class ProcessBase - User defined class BatchFillerParticle ... these comments are used to generate - doxygen documentation! - */ - class BatchFillerParticle : public BatchFillerTemplate { - - public: - - /// Default constructor - BatchFillerParticle(const std::string name="BatchFillerParticle"); - - /// Default destructor - ~BatchFillerParticle(){} - - void configure(const json&); - - void initialize(); - - bool process(IOManager& mgr); - - void _batch_begin_(); - - void _batch_end_(); - - void finalize(); - - static json default_config(){ - json c = { - {"Producer", std::string()}, - }; - return c; - } - - private: - - json config; - - std::vector _entry_data; - }; - - /** - \class larcv3::BatchFillerParticleFactory - \brief A concrete factory class for larcv3::BatchFillerParticle - */ - class BatchFillerParticleProcessFactory : public ProcessFactoryBase { - public: - /// ctor - BatchFillerParticleProcessFactory() { ProcessFactory::get().add_factory("BatchFillerParticle",this); } - /// dtor - ~BatchFillerParticleProcessFactory() {} - /// creation method - ProcessBase* create(const std::string instance_name) { return new BatchFillerParticle(instance_name); } - }; - -} - -#ifdef LARCV_INTERNAL - -void init_bf_particle(pybind11::module m); -#endif - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/app/queueio/BatchFillerSparseTensor.h b/larcv/include/app/queueio/BatchFillerSparseTensor.h deleted file mode 100644 index 052db9aa..00000000 --- a/larcv/include/app/queueio/BatchFillerSparseTensor.h +++ /dev/null @@ -1,130 +0,0 @@ -/** - * \file BatchFillerSparseTensor.h - * - * \ingroup ThreadIO - * - * \brief Class def header for a class BatchFillerSparseTensor2D - * - * @author cadams - */ - -/** \addtogroup ThreadIO - - @{*/ -#ifndef __LARCV3THREADIO_BATCHFILLERSPARSETENSOR_H__ -#define __LARCV3THREADIO_BATCHFILLERSPARSETENSOR_H__ - -#include "larcv3/core/processor/ProcessFactory.h" -#include "BatchFillerTemplate.h" - -#include "larcv3/core/dataformat/EventSparseTensor.h" - -namespace larcv3 { - - /** - \class ProcessBase - User defined class BatchFillerTensor ... these comments are used to generate - doxygen documentation! - */ - template - class BatchFillerSparseTensor : public BatchFillerTemplate { - - public: - - /// Default constructor - BatchFillerSparseTensor(const std::string name="BatchFillerSparseTensor"); - - /// Default destructor - ~BatchFillerSparseTensor(){} - - void configure(const json&); - - void initialize(); - - bool process(IOManager& mgr); - - void finalize(); - - static json default_config(){ - json c = { - {"Producer", std::string()}, - {"Augment", true}, - {"MaxVoxels", 0}, - {"UnfilledVoxelValue", -999.}, - {"Channels", std::vector()}, - {"IncludeValues", true}, - }; - return c; - } - - protected: - - void _batch_begin_(); - void _batch_end_(); - - private: - - json config; - - size_t set_data_size(const EventSparseTensor& image_data); - int _check_projection(const int & projection_id, const std::vector & _slice_v); - - // std::string _tensor_producer; - // size_t _max_voxels; - // float _unfilled_voxel_value; - // std::vector _slice_v; - - - - std::vector _entry_data; - size_t _num_channels; - bool _allow_empty; - // bool _include_values; - // bool _augment; - }; - - typedef BatchFillerSparseTensor<2> BatchFillerSparseTensor2D; - typedef BatchFillerSparseTensor<3> BatchFillerSparseTensor3D; - - // Template instantiation for IO - template<> inline std::string product_unique_name() { - return "BatchFillerSparseTensor2D"; - } - template<> inline std::string product_unique_name() { - return "BatchFillerSparseTensor3D"; - } - - /** - \class larcv3::BatchFillerSparseTensorFactory - \brief A concrete factory class for larcv3::BatchFillerSparseTensor - */ - template - class BatchFillerSparseTensorProcessFactory : public ProcessFactoryBase { - public: - /// ctor - BatchFillerSparseTensorProcessFactory() { - ProcessFactory::get().add_factory(product_unique_name>(), - this); - } - /// dtor - ~BatchFillerSparseTensorProcessFactory() {} - /// creation method - ProcessBase* create(const std::string instance_name) { - return new BatchFillerSparseTensor(instance_name); - } - }; - -} - - -#ifdef LARCV_INTERNAL -template -void init_bf_sparse_tensor_(pybind11::module m); - -void init_bf_sparse_tensor(pybind11::module m); -#endif - - -#endif -/** @} */ // end of doxygen group - diff --git a/larcv/include/app/queueio/BatchFillerTemplate.h b/larcv/include/app/queueio/BatchFillerTemplate.h deleted file mode 100644 index 4c4d27ca..00000000 --- a/larcv/include/app/queueio/BatchFillerTemplate.h +++ /dev/null @@ -1,83 +0,0 @@ -/** - * \file BatchFillerTemplate.h - * - * \ingroup ThreadIO - * - * \brief Class def header for a class BatchFillerTemplate - * - * @author kazuhiro - */ - -/** \addtogroup ThreadIO - - @{*/ -#ifndef __LARCV3THREADIO_BATCHFILLERTEMPLATE_H__ -#define __LARCV3THREADIO_BATCHFILLERTEMPLATE_H__ - -#include "BatchHolder.h" -#include "BatchData.h" - -namespace larcv3 { - class ThreadProcessor; - class QueueProcessor; - /** - \class ProcessBase - User defined class BatchFillerTemplate ... these comments are used to generate - doxygen documentation! - */ - template - class BatchFillerTemplate : public BatchHolder { - friend ThreadProcessor; - friend QueueProcessor; - public: - - /// Default constructor - BatchFillerTemplate(const std::string name = "BatchFillerTemplate") - : BatchHolder(name) - {} - - /// Default destructor - virtual ~BatchFillerTemplate() {} - - inline void batch_begin() { - _batch_data_ptr->reset_data(); - _batch_begin_(); - } - - inline void batch_end() - { - if (!_batch_data_ptr->is_filled()) { - LARCV_CRITICAL() << "Batch data is not filled @ end-of-batch (" << _batch_data_ptr->current_data_size() - << "/" << _batch_data_ptr->data_size() << ")!" << std::endl; - throw larbys(); - } - _batch_end_(); - } - - inline const BatchData& batch_data() const { return *(_batch_data_ptr); } - - BatchDataType_t data_type() const; - - inline size_t type_size() const { return sizeof(T); } - - protected: - - inline void set_dim(std::vector dim) {_batch_data_ptr->set_dim(dim);} - inline void set_dense_dim(std::vector dense_dim) {_batch_data_ptr->set_dense_dim(dense_dim);} - inline void set_entry_data(const std::vector& data) - { _batch_data_ptr->set_entry_data(data); } - - virtual void _batch_begin_() =0; - virtual void _batch_end_() =0; - - private: - - BatchData* _batch_data_ptr; - - }; - -} - -#endif -/** @} */ // end of doxygen group - diff --git a/larcv/include/app/queueio/BatchFillerTensor.h b/larcv/include/app/queueio/BatchFillerTensor.h deleted file mode 100644 index 7377304a..00000000 --- a/larcv/include/app/queueio/BatchFillerTensor.h +++ /dev/null @@ -1,135 +0,0 @@ -/** - * \file BatchFillerTensor.h - * - * \ingroup ThreadIO - * - * \brief Class def header for a class BatchFillerTensor2D - * - * @author cadams - */ - -/** \addtogroup ThreadIO - - @{*/ -#ifndef __LARCV3THREADIO_BATCHFILLERTENSOR_H__ -#define __LARCV3THREADIO_BATCHFILLERTENSOR_H__ - -#include "larcv3/core/processor/ProcessFactory.h" -#include "BatchFillerTemplate.h" - -#include "larcv3/core/dataformat/EventSparseTensor.h" -#include "larcv3/core/dataformat/EventTensor.h" - -namespace larcv3 { - - /** - \class ProcessBase - User defined class BatchFillerTensor ... these comments are used to generate - doxygen documentation! - */ - template - class BatchFillerTensor : public BatchFillerTemplate { - - public: - - /// Default constructor - BatchFillerTensor(const std::string name="BatchFillerTensor"); - - /// Default destructor - ~BatchFillerTensor(){} - - void configure(const json&); - - void initialize(); - - bool process(IOManager& mgr); - - void finalize(); - - static json default_config(){ - json c = { - {"Producer", std::string()}, - {"TensorType", "sparse"}, - {"Augment", true}, - {"EmptyVoxelValue", -999.}, - {"Channels", std::vector()}, - {"AllowEmpty", true} - }; - return c; - } - - protected: - - void _batch_begin_(); - void _batch_end_(); - - private: - - json config; - - bool _process_sparse(IOManager& mgr); - bool _process_dense(IOManager& mgr); - int _check_projection(const int & projection_id); - size_t _set_image_size(const EventTensor& image_data); - void _assert_dimension(const EventTensor& image_data, const std::vector &) const; - - // std::string _tensor_producer; - // std::string _tensor_type; - // size_t _rows; - // size_t _cols; - size_t _dims[dimension]; ///< Total number of voxels in each dimension - // size_t _num_channels; - // std::vector _slice_v; - size_t _max_ch; - - std::vector _entry_data; - }; - - typedef BatchFillerTensor<2> BatchFillerTensor2D; - typedef BatchFillerTensor<3> BatchFillerTensor3D; - - // Template instantiation for IO - template<> inline std::string product_unique_name() { - return "BatchFillerTensor2D"; - } - template<> inline std::string product_unique_name() { - return "BatchFillerTensor3D"; - } - - /** - \class larcv3::BatchFillerTensorFactory - \brief A concrete factory class for larcv3::BatchFillerTensor - */ - template - class BatchFillerTensorProcessFactory : public ProcessFactoryBase { - public: - /// ctor - BatchFillerTensorProcessFactory() { - ProcessFactory::get().add_factory(product_unique_name>(), - this); - } - /// dtor - ~BatchFillerTensorProcessFactory() {} - /// creation method - ProcessBase* create(const std::string instance_name) { - return new BatchFillerTensor(instance_name); - } - }; - - -} - -#ifdef LARCV_INTERNAL -template -void init_bf_tensor_(pybind11::module m); - -void init_bf_tensor(pybind11::module m); -#endif - - -#endif - - - -/** @} */ // end of doxygen group - diff --git a/larcv/include/app/queueio/BatchHolder.h b/larcv/include/app/queueio/BatchHolder.h deleted file mode 100644 index c2570bd9..00000000 --- a/larcv/include/app/queueio/BatchHolder.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * \file BatchHolder.h - * - * \ingroup ThreadIO - * - * \brief Class def header for a class BatchHolder - * - * @author kazuhiro - */ - -/** \addtogroup ThreadIO - - @{*/ -#ifndef __LARCV3THREADIO_BATCHHOLDER_H__ -#define __LARCV3THREADIO_BATCHHOLDER_H__ - -#include "larcv3/core/processor/ProcessBase.h" -#include "QueueIOTypes.h" -namespace larcv3 { - class QueueProcessor; - - /** - \class ProcessBase - User defined class BatchHolder ... these comments are used to generate - doxygen documentation! - */ - class BatchHolder : public ProcessBase{ - friend class QueueProcessor; - public: - - /// Default constructor - BatchHolder(const std::string name="BatchFiller") - : ProcessBase(name) - , _batch_size(0) - {} - - /// Default destructor - virtual ~BatchHolder(){} - - inline size_t batch_size() const { return _batch_size; } - - virtual BatchDataType_t data_type() const = 0; - - inline bool is(const std::string question) const - { return (question == "BatchFiller"); } - - private: - size_t _batch_size; - }; - -} - -#endif -/** @} */ // end of doxygen group - diff --git a/larcv/include/app/queueio/QueueIOTypes.h b/larcv/include/app/queueio/QueueIOTypes.h deleted file mode 100644 index f75f116c..00000000 --- a/larcv/include/app/queueio/QueueIOTypes.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __LARCV3THREADIO_THREADIOTYPES_H -#define __LARCV3THREADIO_THREADIOTYPES_H - -#include - -namespace larcv3 { - - // enum ThreadFillerState_t : int{ - // kThreadStateIdle, - // kThreadStateStarting, - // kThreadStateRunning, - // kThreadStateUnknown - // }; - - enum class BatchDataType_t : int { - kBatchDataUnknown, - kBatchDataChar, - kBatchDataShort, - kBatchDataInt, - kBatchDataFloat, - kBatchDataDouble, - kBatchDataString, - kBatchDataParticle, - }; - - std::string BatchDataTypeName(BatchDataType_t type); - - enum class BatchDataState_t :int { - kBatchStateUnknown, - kBatchStateEmpty, - kBatchStateFilling, - kBatchStateFilled, - kBatchStateReleased - }; -} - -#endif diff --git a/larcv/include/app/queueio/QueueProcessor.h b/larcv/include/app/queueio/QueueProcessor.h deleted file mode 100644 index 8cb7d19b..00000000 --- a/larcv/include/app/queueio/QueueProcessor.h +++ /dev/null @@ -1,158 +0,0 @@ -/** - * \file QueueProcessor.h - * - * \ingroup ThreadIO - * - * \brief Class def header for a class QueueProcessor - * - * @author cadams - */ - -#ifndef __LARCV3THREADIO_QUEUEPROCESSOR_H -#define __LARCV3THREADIO_QUEUEPROCESSOR_H - -#include "larcv3/core/processor/ProcessDriver.h" -#include "QueueIOTypes.h" -#include "BatchDataQueue.h" -#include -#include - - -#ifdef LARCV_INTERNAL -#include -#include -#endif - -namespace larcv3 { - /** - \class QueueProcessor - User defined class QueueProcessor ... these comments are used to generate - doxygen docume ntation! - */ - class QueueProcessor : public larcv_base { - - public: - - /// Default constructor - QueueProcessor(std::string name = "QueueProcessor"); - - /// Default destructor - ~QueueProcessor(); - - /// Process a batch of entries, using _next_index_v to specify entries - bool batch_process(); - - /// Spawn a thread to batch process and return immediately - void prepare_next(); - - /// Reset the state - void reset(); - - - // configure the processor from a PSet object - void configure(const json& cfg, int color=0); - - // Check if the processor is configured - inline bool configured() const { return _configured;} - - // Go through all factories and pop the data - void pop_current_data(); - - // Set the next index to read/ - // This will just set the index_v object - void set_next_index(size_t index); - - // Set the next set of indexes to read: - void set_next_batch(const std::vector& index_v); - - static json default_config(){ - json c = { - {"Verbosity", 2}, - {"InputFiles", std::vector()}, - {"ProcessName", 0}, - {"ProcessDriver", ProcessDriver::default_config()}, - }; - return c; - } - - // These functions only appear in larcv proper, not in included headers: -#ifdef LARCV_INTERNAL - /// from numpy ctor - void set_next_batch(pybind11::array_t index_v); - -#endif - - - // Return true only if the fillers are preparing the next batch - bool is_reading() const; - - bool is_next_ready() const; - - template - const BatchDataQueue & get_queue(std::string process_name) const; - - // Get number of entries possible to read - size_t get_n_entries() const; - - // Return the list of processed entries for current data - const std::vector& processed_entries() const; - - // Return the list of processed eventIDs for current data - const std::vector& processed_events() const; - - // Read access to the process driver: - const ProcessDriver & pd() const; - - const std::string& storage_name(size_t process_id) const; - - size_t process_id(const std::string& name) const; - - inline const std::vector& batch_fillers() const - { return _batch_filler_id_v; } - - inline const std::vector& batch_types() const - { return _batch_data_type_v; } - - private: - - json config; - - bool set_batch_storage(); - bool begin_batch(); - bool end_batch(); - - bool _processing; - bool _configured; - std::vector _next_index_v; - - size_t _batch_global_counter; - - // This controls the different pieces of a batch (data, image, label, pid, etc) - std::vector _batch_filler_id_v; - std::vector _batch_data_type_v; - - // Each QueueProcessor gets one process driver object. - // We assume that the batch_process call can be parallelized with OpenMP - larcv3::ProcessDriver _driver; - - // List of processes for fillers: - std::vector _process_name_v; - - // Meta data about read entries variables - std::vector _current_batch_entries_v; - std::vector _current_batch_events_v; - std::vector _next_batch_entries_v; - std::vector _next_batch_events_v; - - std::future _preparation_future; - - }; - -} -#ifdef LARCV_INTERNAL -#include -void init_queueprocessor(pybind11::module m); -#endif - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/app/queueio/queueio.h b/larcv/include/app/queueio/queueio.h deleted file mode 100644 index b2f84eb3..00000000 --- a/larcv/include/app/queueio/queueio.h +++ /dev/null @@ -1,35 +0,0 @@ - -/** - * \file larbys.h - * - * \ingroup core_Base - * - * \brief Class def header for exception classes for larcv3 framework - * - * @author cadams - */ - -/** \addtogroup core_Base - - @{*/ -#ifndef __LARCV3QUEUEIO_QUEUEIO_H__ -#define __LARCV3QUEUEIO_QUEUEIO_H__ - - -#include "BatchData.h" -#include "BatchDataQueue.h" -#include "BatchDataQueueFactory.h" -#include "QueueIOTypes.h" -#include "QueueProcessor.h" - -#ifndef LARCV_NO_PYBIND -#ifdef LARCV_INTERNAL -#include -__attribute__ ((visibility ("default"))) void init_queueio(pybind11::module m); -#endif -// bindings -#endif - - -// include guards -#endif diff --git a/larcv/include/larcv3/app/filter/EmptyImageFilter.h b/larcv/include/larcv3/app/filter/EmptyImageFilter.h deleted file mode 100644 index d741158d..00000000 --- a/larcv/include/larcv3/app/filter/EmptyImageFilter.h +++ /dev/null @@ -1,74 +0,0 @@ -/** - * \file EmptyImageFilter.h - * - * \ingroup Package_Name - * - * \brief Class def header for a class EmptyImageFilter - * - * @author kazuhiro - */ - -/** \addtogroup Package_Name - - @{*/ -#ifndef __LARCV3FILTER_EMPTYIMAGEFILTER_H__ -#define __LARCV3FILTER_EMPTYIMAGEFILTER_H__ - -#include "larcv3/core/processor/ProcessBase.h" -#include "larcv3/core/processor/ProcessFactory.h" -namespace larcv3 { - - /** - \class ProcessBase - User defined class EmptyImageFilter ... these comments are used to generate - doxygen documentation! - */ - class EmptyImageFilter : public larcv3::ProcessBase { - - public: - - /// Default constructor - EmptyImageFilter(const std::string name="EmptyImageFilter"); - - /// Default destructor - ~EmptyImageFilter(){} - - void configure(const json&); - - void initialize(); - - bool process(larcv3::IOManager& mgr); - - void finalize(); - - static json default_config() { - json c = { - {"ImageProducer", ""}, - }; - return c; - } - - private: - - json config; - }; - - /** - \class larcv3::EmptyImageFilterFactory - \brief A concrete factory class for larcv3::EmptyImageFilter - */ - class EmptyImageFilterProcessFactory : public ProcessFactoryBase { - public: - /// ctor - EmptyImageFilterProcessFactory() { ProcessFactory::get().add_factory("EmptyImageFilter",this); } - /// dtor - ~EmptyImageFilterProcessFactory() {} - /// creation method - ProcessBase* create(const std::string instance_name) { return new EmptyImageFilter(instance_name); } - }; - -} - -#endif -/** @} */ // end of doxygen group - diff --git a/larcv/include/larcv3/app/filter/EmptyTensorFilter.h b/larcv/include/larcv3/app/filter/EmptyTensorFilter.h deleted file mode 100644 index 244444ba..00000000 --- a/larcv/include/larcv3/app/filter/EmptyTensorFilter.h +++ /dev/null @@ -1,84 +0,0 @@ -/** - * \file EmptyTensorFilter.h - * - * \ingroup Package_Name - * - * \brief Class def header for a class EmptyTensorFilter - * - * @author drinkingkazu - */ - -/** \addtogroup Package_Name - - @{*/ -#ifndef __LARCV3FILTER_EMPTYTENSORFILTER_H__ -#define __LARCV3FILTER_EMPTYTENSORFILTER_H__ - -#include "larcv3/core/processor/ProcessBase.h" -#include "larcv3/core/processor/ProcessFactory.h" -namespace larcv3 { - - /** - \class ProcessBase - User defined class EmptyTensorFilter ... these comments are used to generate - doxygen documentation! - */ - class EmptyTensorFilter : public larcv3::ProcessBase { - - public: - - /// Default constructor - EmptyTensorFilter(const std::string name="EmptyTensorFilter"); - - /// Default destructor - ~EmptyTensorFilter(){} - - void configure(const json&); - - void initialize(); - - bool process(larcv3::IOManager& mgr); - - void finalize(); - - static json default_config() { - json c = { - {"TensorProducer", std::vector()}, // Name of producer - {"TensorType", std::vector()}, // Type of produce, eg, sparse2d - {"MinVoxelCount", std::vector()}, // Min Number of voxels per projection - {"MinVoxelValue", std::vector()}, // Min voxel value per projection - }; - return c; - } - - private: - template - bool process_tensor(IOManager & mgr, std::string producer, int min_voxel_count, float min_voxel_value); - - template - bool process_sparse(IOManager & mgr, std::string producer, int min_voxel_count, float min_voxel_value); - - - json config; - - }; - - /** - \class larcv3::EmptyTensorFilterFactory - \brief A concrete factory class for larcv3::EmptyTensorFilter - */ - class EmptyTensorFilterProcessFactory : public ProcessFactoryBase { - public: - /// ctor - EmptyTensorFilterProcessFactory() { ProcessFactory::get().add_factory("EmptyTensorFilter",this); } - /// dtor - ~EmptyTensorFilterProcessFactory() {} - /// creation method - ProcessBase* create(const std::string instance_name) { return new EmptyTensorFilter(instance_name); } - }; - -} - -#endif -/** @} */ // end of doxygen group - diff --git a/larcv/include/larcv3/app/imagemod/BBoxFromParticle.h b/larcv/include/larcv3/app/imagemod/BBoxFromParticle.h deleted file mode 100644 index cb4844bf..00000000 --- a/larcv/include/larcv3/app/imagemod/BBoxFromParticle.h +++ /dev/null @@ -1,88 +0,0 @@ -/** - * \file BBoxFromParticle.h - * - * \ingroup ImageMod - * - * \brief Class def header for a class BBoxFromParticle - * - * @author cadams - */ - -/** \addtogroup ImageMod - - @{*/ -#ifndef __LARCV_BBOXFROMPARTICLE_H__ -#define __LARCV_BBOXFROMPARTICLE_H__ - -#include "larcv3/core/processor/ProcessBase.h" -#include "larcv3/core/processor/ProcessFactory.h" - -namespace larcv3 { - - /** - \class ProcessBase - User defined class BBoxFromParticle ... these comments are used to generate - doxygen documentation! - */ - class BBoxFromParticle : public ProcessBase { - - public: - - /// Default constructor - BBoxFromParticle(const std::string name="BBoxFromParticle"); - - /// Default destructor - ~BBoxFromParticle(){} - - void configure(const json&); - - void initialize(); - - bool process(IOManager& mgr); - - void finalize(); - - static json default_config(){ - json c = { - {"Producer", std::string()}, - {"OutputProducer", std::string()}, - }; - return c; - } - - private: - - json config; - - template - bool bbox_from_particle(IOManager& mgr, std::string producer, std::string output_producer); - - }; - - /** - \class larcv3::BBoxFromParticleProcessFactory - \brief A concrete factory class for larcv3::BBoxFromParticle - */ - - - class BBoxFromParticleProcessFactory : public ProcessFactoryBase { - public: - /// ctor - BBoxFromParticleProcessFactory() { ProcessFactory::get().add_factory("BBoxFromParticle",this); } - /// dtor - ~BBoxFromParticleProcessFactory() {} - /// creation method - ProcessBase* create(const std::string instance_name) { return new BBoxFromParticle(instance_name); } - }; - - -} - -#ifdef LARCV_INTERNAL -#include -void init_bbox_from_particle(pybind11::module m); -#endif - -#endif -/** @} */ // end of doxygen group - diff --git a/larcv/include/larcv3/app/imagemod/DenseToSparse.h b/larcv/include/larcv3/app/imagemod/DenseToSparse.h deleted file mode 100644 index f057774b..00000000 --- a/larcv/include/larcv3/app/imagemod/DenseToSparse.h +++ /dev/null @@ -1,90 +0,0 @@ -/** - * \file DenseToSparse.h - * - * \ingroup ImageMod - * - * \brief Class def header for a class DenseToSparse - * - * @author cadams - */ - -/** \addtogroup ImageMod - - @{*/ -#ifndef __LARCV3_DENSETOSPARSE_H__ -#define __LARCV3_DENSETOSPARSE_H__ - -#include "larcv3/core/processor/ProcessBase.h" -#include "larcv3/core/processor/ProcessFactory.h" -namespace larcv3 { - - /** - \class ProcessBase - User defined class DenseToSparse ... these comments are used to generate - doxygen documentation! - */ - class DenseToSparse : public ProcessBase { - - public: - - /// Default constructor - DenseToSparse(const std::string name="DenseToSparse"); - - /// Default destructor - ~DenseToSparse(){} - - void configure(const json&); - - void initialize(); - - bool process(IOManager& mgr); - - void finalize(); - - static json default_config(){ - json c = { - {"Producer", std::string()}, - {"Product", std::string()}, - {"OutputProducer", std::string()}, - {"ReferenceProducer", std::string()} - }; - return c; - } - - private: - - json config; - - template - bool process_product( - IOManager& mgr, - std::string producer, - std::string output_producer, - std::string ref_producer); - - }; - - /** - \class larcv3::DenseToSparseFactory - \brief A concrete factory class for larcv3::DenseToSparse - */ - class DenseToSparseProcessFactory : public ProcessFactoryBase { - public: - /// ctor - DenseToSparseProcessFactory() { ProcessFactory::get().add_factory("DenseToSparse",this); } - /// dtor - ~DenseToSparseProcessFactory() {} - /// creation method - ProcessBase* create(const std::string instance_name) { return new DenseToSparse(instance_name); } - }; - -} - -#ifdef LARCV_INTERNAL -#include -void init_dense_to_sparse(pybind11::module m); -#endif - -#endif -/** @} */ // end of doxygen group - diff --git a/larcv/include/larcv3/app/imagemod/Downsample.h b/larcv/include/larcv3/app/imagemod/Downsample.h deleted file mode 100644 index 5b1179ba..00000000 --- a/larcv/include/larcv3/app/imagemod/Downsample.h +++ /dev/null @@ -1,100 +0,0 @@ -/** - * \file Downsample.h - * - * \ingroup ImageMod - * - * \brief Class def header for a class Downsample - * - * @author cadams - */ - -/** \addtogroup ImageMod - - @{*/ -#ifndef __LARCV3_DOWNSAMPLE_H__ -#define __LARCV3_DOWNSAMPLE_H__ - -#include "larcv3/core/processor/ProcessBase.h" -#include "larcv3/core/processor/ProcessFactory.h" -namespace larcv3 { - - /** - \class ProcessBase - User defined class Downsample ... these comments are used to generate - doxygen documentation! - */ - class Downsample : public ProcessBase { - - public: - - /// Default constructor - Downsample(const std::string name="Downsample"); - - /// Default destructor - ~Downsample(){} - - void configure(const json&); - - void initialize(); - - bool process(IOManager& mgr); - - void finalize(); - - - static json default_config(){ - json c = { - {"Producer", std::string()}, - {"Product", std::string()}, - {"OutputProducer", std::string()}, - {"Downsample", 0}, - {"PoolType", kPoolAverage}, - }; - return c; - } - - - private: - - template< class dataproduct> - bool process_data_product( - IOManager& mgr, - std::string producer, - std::string output_producer, - int downsample, - PoolType_t pool); - - json config; - - }; - - - /** - \class larcv3::ThresholdFactory - \brief A concrete factory class for larcv3::Downsample - */ - class DownsampleProcessFactory : public ProcessFactoryBase { - public: - /// ctor - DownsampleProcessFactory() { ProcessFactory::get().add_factory("Downsample",this); } - /// dtor - ~DownsampleProcessFactory() {} - /// creation method - ProcessBase* create(const std::string instance_name) { return new Downsample(instance_name); } - }; - -} - -#ifdef LARCV_INTERNAL -#include -void init_downsample(pybind11::module m); -#endif - - -#endif -/** @} */ // end of doxygen group - - - - - \ No newline at end of file diff --git a/larcv/include/larcv3/app/imagemod/Embed.h b/larcv/include/larcv3/app/imagemod/Embed.h deleted file mode 100644 index c21f200c..00000000 --- a/larcv/include/larcv3/app/imagemod/Embed.h +++ /dev/null @@ -1,114 +0,0 @@ -/** - * \file Embed.h - * - * \ingroup ImageMod - * - * \brief Class def header for a class Embed - * - * Embed an object into a bigger image, without downsampling. - * - * @author cadams - */ - -/** \addtogroup ImageMod - - @{*/ -#ifndef __LARCV3_EMBED_H__ -#define __LARCV3_EMBED_H__ - -#include "larcv3/core/processor/ProcessBase.h" -#include "larcv3/core/processor/ProcessFactory.h" -#include "larcv3/core/dataformat/ImageMeta.h" -namespace larcv3 { - - /** - \class ProcessBase - User defined class embed ... these comments are used to generate - doxygen documentation! - */ - class Embed : public ProcessBase { - - public: - - /// Default constructor - Embed(const std::string name="Embed"); - - /// Default destructor - ~Embed(){} - - void configure(const json&); - - void initialize(); - - bool process(IOManager& mgr); - - void finalize(); - - - static json default_config(){ - json c = { - {"Producer", std::string()}, - {"Product", std::string()}, - {"OutputProducer", std::string()}, - {"TargetSize", std::vector()}, - }; - return c; - } - - - private: - - template< size_t dimension> - bool process_dense_product( - IOManager& mgr, - std::string producer, - std::string output_producer, - const std::vector target_size); - - template< size_t dimension> - bool process_sparse_product( - IOManager& mgr, - std::string producer, - std::string output_producer, - const std::vector target_size); - - template< size_t dimension> - std::vector create_new_image_meta_and_offsets( - const ImageMeta & input, - const std::vector & target_size, - ImageMeta & new_meta); - - json config; - - }; - - - /** - \class larcv3::ThresholdFactory - \brief A concrete factory class for larcv3::Embed - */ - class EmbedProcessFactory : public ProcessFactoryBase { - public: - /// ctor - EmbedProcessFactory() { ProcessFactory::get().add_factory("Embed",this); } - /// dtor - ~EmbedProcessFactory() {} - /// creation method - ProcessBase* create(const std::string instance_name) { return new Embed(instance_name); } - }; - -} - -#ifdef LARCV_INTERNAL -#include -void init_embed(pybind11::module m); -#endif - - -#endif -/** @} */ // end of doxygen group - - - - - \ No newline at end of file diff --git a/larcv/include/larcv3/app/imagemod/Image2DFromTensor2D.h b/larcv/include/larcv3/app/imagemod/Image2DFromTensor2D.h deleted file mode 100644 index ff5e5bb7..00000000 --- a/larcv/include/larcv3/app/imagemod/Image2DFromTensor2D.h +++ /dev/null @@ -1,78 +0,0 @@ -// /** -// * \file Image2DFromTensor2D.h -// * -// * \ingroup Package_Name -// * -// * \brief Class def header for a class Image2DFromTensor2D -// * -// * @author kazuhiro -// */ - -// /** \addtogroup Package_Name - -// @{*/ -// #ifndef __LARCV_IMAGE2DFROMTENSOR2D_H__ -// #define __LARCV_IMAGE2DFROMTENSOR2D_H__ - -// #include "larcv3/core/processor/ProcessBase.h" -// #include "larcv3/core/processor/ProcessFactory.h" - -// namespace larcv3 { - -// /** -// \class ProcessBase -// User defined class Image2DFromTensor2D ... these comments are used to generate -// doxygen documentation! -// */ -// class Image2DFromTensor2D : public ProcessBase { - -// public: - -// /// Default constructor -// Image2DFromTensor2D(const std::string name="Image2DFromTensor2D"); - -// /// Default destructor -// ~Image2DFromTensor2D(){} - -// void configure(const PSet&); - -// void initialize(); - -// bool process(IOManager& mgr); - -// void finalize(); - -// private: -// void configure_labels(const PSet& cfg); -// enum PIType_t { -// kPITypeFixedPI, -// kPITypeInputVoxel, -// kPITypeUndefined -// }; -// std::vector _base_pi_v; -// std::vector _fixed_pi_v; -// std::vector _type_pi_v; -// std::vector _tensor2d_producer_v; -// std::vector _output_producer_v; - -// }; - -// /** -// \class larcv3::Image2DFromTensor2DFactory -// \brief A concrete factory class for larcv3::Image2DFromTensor2D -// */ -// class Image2DFromTensor2DProcessFactory : public ProcessFactoryBase { -// public: -// /// ctor -// Image2DFromTensor2DProcessFactory() { ProcessFactory::get().add_factory("Image2DFromTensor2D",this); } -// /// dtor -// ~Image2DFromTensor2DProcessFactory() {} -// /// creation method -// ProcessBase* create(const std::string instance_name) { return new Image2DFromTensor2D(instance_name); } -// }; - -// } - -// #endif -// /** @} */ // end of doxygen group - diff --git a/larcv/include/larcv3/app/imagemod/SparseToDense.h b/larcv/include/larcv3/app/imagemod/SparseToDense.h deleted file mode 100644 index ea89c34b..00000000 --- a/larcv/include/larcv3/app/imagemod/SparseToDense.h +++ /dev/null @@ -1,88 +0,0 @@ -/** - * \file SparseToDense.h - * - * \ingroup ImageMod - * - * \brief Class def header for a class SparseToDense - * - * @author cadams - */ - -/** \addtogroup ImageMod - - @{*/ -#ifndef __LARCV3_SPARSETODENSE_H__ -#define __LARCV3_SPARSETODENSE_H__ - -#include "larcv3/core/processor/ProcessBase.h" -#include "larcv3/core/processor/ProcessFactory.h" -namespace larcv3 { - - /** - \class ProcessBase - User defined class SparseToDense ... these comments are used to generate - doxygen documentation! - */ - class SparseToDense : public ProcessBase { - - public: - - /// Default constructor - SparseToDense(const std::string name="SparseToDense"); - - /// Default destructor - ~SparseToDense(){} - - void configure(const json&); - - void initialize(); - - bool process(IOManager& mgr); - - void finalize(); - - static json default_config(){ - json c = { - {"Producer", std::string()}, - {"Product", std::string()}, - {"OutputProducer", std::string()}, - }; - return c; - } - - private: - - json config; - - template - bool process_product( - IOManager& mgr, - std::string producer, - std::string output_producer); - - }; - - /** - \class larcv3::SparseToDenseFactory - \brief A concrete factory class for larcv3::SparseToDense - */ - class SparseToDenseProcessFactory : public ProcessFactoryBase { - public: - /// ctor - SparseToDenseProcessFactory() { ProcessFactory::get().add_factory("SparseToDense",this); } - /// dtor - ~SparseToDenseProcessFactory() {} - /// creation method - ProcessBase* create(const std::string instance_name) { return new SparseToDense(instance_name); } - }; - -} - -#ifdef LARCV_INTERNAL -#include -void init_sparse_to_dense(pybind11::module m); -#endif - -#endif -/** @} */ // end of doxygen group - diff --git a/larcv/include/larcv3/app/imagemod/Tensor2DFromImage2D.h b/larcv/include/larcv3/app/imagemod/Tensor2DFromImage2D.h deleted file mode 100644 index 4ee360c0..00000000 --- a/larcv/include/larcv3/app/imagemod/Tensor2DFromImage2D.h +++ /dev/null @@ -1,71 +0,0 @@ -// /** -// * \file Tensor2DFromImage2D.h -// * -// * \ingroup ImageMod -// * -// * \brief Class def header for a class Tensor2DFromImage2D -// * -// * @author coreyjadams and kazuhiro -// */ - -// /** \addtogroup ImageMod - -// @{*/ -// #ifndef __LARCV_TENSOR2DFROMIMAGE2D_H__ -// #define __LARCV_TENSOR2DFROMIMAGE2D_H__ - -// #include "larcv3/core/processor/ProcessBase.h" -// #include "larcv3/core/processor/ProcessFactory.h" -// namespace larcv3 { - -// /** -// \class ProcessBase -// User defined class Tensor2DFromImage2D ... these comments are used to generate -// doxygen documentation! -// */ -// class Tensor2DFromImage2D : public ProcessBase { - -// public: - -// /// Default constructor -// Tensor2DFromImage2D(const std::string name="Tensor2DFromImage2D"); - -// /// Default destructor -// ~Tensor2DFromImage2D(){} - -// void configure(const PSet&); - -// void initialize(); - -// bool process(IOManager& mgr); - -// void finalize(); - -// private: -// void configure_labels(const PSet& cfg); -// std::vector _thresholds_v; -// std::vector _projection_ids_v; -// std::string _image2d_producer; -// std::string _output_producer; -// std::string _reference_tensor2d; -// }; - -// /** -// \class larcv3::Tensor2DFromImage2DFactory -// \brief A concrete factory class for larcv3::Tensor2DFromImage2D -// */ -// class Tensor2DFromImage2DProcessFactory : public ProcessFactoryBase { -// public: -// /// ctor -// Tensor2DFromImage2DProcessFactory() { ProcessFactory::get().add_factory("Tensor2DFromImage2D",this); } -// /// dtor -// ~Tensor2DFromImage2DProcessFactory() {} -// /// creation method -// ProcessBase* create(const std::string instance_name) { return new Tensor2DFromImage2D(instance_name); } -// }; - -// } - -// #endif -// /** @} */ // end of doxygen group - diff --git a/larcv/include/larcv3/app/imagemod/TensorFromCluster.h b/larcv/include/larcv3/app/imagemod/TensorFromCluster.h deleted file mode 100644 index 042035e2..00000000 --- a/larcv/include/larcv3/app/imagemod/TensorFromCluster.h +++ /dev/null @@ -1,90 +0,0 @@ -/** - * \file TensorFromCluster.h - * - * \ingroup ImageMod - * - * \brief Class def header for a class TensorFromCluster - * - * @author cadams - */ - -/** \addtogroup ImageMod - - @{*/ -#ifndef __LARCV_TENSORFROMCLUSTER_H__ -#define __LARCV_TENSORFROMCLUSTER_H__ - -#include "larcv3/core/processor/ProcessBase.h" -#include "larcv3/core/processor/ProcessFactory.h" - -namespace larcv3 { - - /** - \class ProcessBase - User defined class TensorFromCluster ... these comments are used to generate - doxygen documentation! - */ - class TensorFromCluster : public ProcessBase { - - public: - - /// Default constructor - TensorFromCluster(const std::string name="TensorFromCluster"); - - /// Default destructor - ~TensorFromCluster(){} - - void configure(const json&); - - void initialize(); - - bool process(IOManager& mgr); - - void finalize(); - - static json default_config(){ - json c = { - {"Producer", std::string()}, - {"Product", std::string()}, - {"OutputProducer", std::string()}, - }; - return c; - } - - private: - - json config; - - - template - bool merge_clusters(IOManager& mgr, std::string producer, std::string output_producer); - - }; - - /** - \class larcv3::TensorFromClusterFactory - \brief A concrete factory class for larcv3::TensorFromCluster - */ - - - class TensorFromClusterProcessFactory : public ProcessFactoryBase { - public: - /// ctor - TensorFromClusterProcessFactory() { ProcessFactory::get().add_factory("TensorFromCluster",this); } - /// dtor - ~TensorFromClusterProcessFactory() {} - /// creation method - ProcessBase* create(const std::string instance_name) { return new TensorFromCluster(instance_name); } - }; - - -} - -#ifdef LARCV_INTERNAL -#include -void init_tensor_from_cluster(pybind11::module m); -#endif - -#endif -/** @} */ // end of doxygen group - diff --git a/larcv/include/larcv3/app/imagemod/Threshold.h b/larcv/include/larcv3/app/imagemod/Threshold.h deleted file mode 100644 index 51113ff9..00000000 --- a/larcv/include/larcv3/app/imagemod/Threshold.h +++ /dev/null @@ -1,97 +0,0 @@ -/** - * \file Threshold.h - * - * \ingroup ImageMod - * - * \brief Class def header for a class Threshold - * - * @author cadams - */ - -/** \addtogroup ImageMod - - @{*/ -#ifndef __LARCV3_THRESHOLD_H__ -#define __LARCV3_THRESHOLD_H__ - -#include "larcv3/core/processor/ProcessBase.h" -#include "larcv3/core/processor/ProcessFactory.h" -namespace larcv3 { - - /** - \class ProcessBase - User defined class Threshold ... these comments are used to generate - doxygen documentation! - */ - class Threshold : public ProcessBase { - - public: - - /// Default constructor - Threshold(const std::string name="Threshold"); - - /// Default destructor - ~Threshold(){} - - void configure(const json&); - - void initialize(); - - bool process(IOManager& mgr); - - void finalize(); - - static json default_config(){ - json c = { - {"Producer", std::string()}, - {"Product", std::string()}, - {"OutputProducer", std::string()}, - {"Threshold", std::vector() = {0.0}}, - }; - return c; - } - - private: - - json config; - - template - bool process_dense_product( - IOManager& mgr, - std::string producer, - std::string output_producer, - const std::vector& threshold); - - template - bool process_sparse_product( - IOManager& mgr, - std::string producer, - std::string output_producer, - const std::vector& threshold); - - }; - - /** - \class larcv3::ThresholdFactory - \brief A concrete factory class for larcv3::Threshold - */ - class ThresholdProcessFactory : public ProcessFactoryBase { - public: - /// ctor - ThresholdProcessFactory() { ProcessFactory::get().add_factory("Threshold",this); } - /// dtor - ~ThresholdProcessFactory() {} - /// creation method - ProcessBase* create(const std::string instance_name) { return new Threshold(instance_name); } - }; - -} - -#ifdef LARCV_INTERNAL -#include -void init_threshold(pybind11::module m); -#endif - -#endif -/** @} */ // end of doxygen group - diff --git a/larcv/include/larcv3/app/imagemod/imagemod.h b/larcv/include/larcv3/app/imagemod/imagemod.h deleted file mode 100644 index 1b2e15bf..00000000 --- a/larcv/include/larcv3/app/imagemod/imagemod.h +++ /dev/null @@ -1,30 +0,0 @@ - -/** - * \file larbys.h - * - * \ingroup app_imagemod - * - * \brief Class def header for pybind11 for larcv3 framework - * - * @author cadams - */ - -/** \addtogroup core_Base - - @{*/ -#ifndef __LARCV3IMAGEMOD_IMAGEMOD_H__ -#define __LARCV3IMAGEMOD_IMAGEMOD_H__ - - - -#ifndef LARCV_NO_PYBIND -#ifdef LARCV_INTERNAL -#include -__attribute__ ((visibility ("default"))) void init_imagemod(pybind11::module m); -#endif -// bindings -#endif - - -// include guards -#endif diff --git a/larcv/include/larcv3/app/sbnd_imagemod/CompressAndEmbed.h b/larcv/include/larcv3/app/sbnd_imagemod/CompressAndEmbed.h deleted file mode 100644 index 41deb2b2..00000000 --- a/larcv/include/larcv3/app/sbnd_imagemod/CompressAndEmbed.h +++ /dev/null @@ -1,75 +0,0 @@ -// /** -// * \file CompressAndEmbed.h -// * -// * \ingroup Package_Name -// * -// * \brief Class def header for a class CompressAndEmbed -// * -// * @author cadams -// */ - -// /** \addtogroup Package_Name - -// @{*/ -// #ifndef __LARCV_COMPRESSANDEMBED_H__ -// #define __LARCV_COMPRESSANDEMBED_H__ - -// #include "larcv3/core/processor/ProcessBase.h" -// #include "larcv3/core/processor/ProcessFactory.h" -// // #include "larcv3/core/dataformat/Tensor.h" -// namespace larcv3 { - -// /** -// \class ProcessBase -// User defined class CompressAndEmbed ... these comments are used to generate -// doxygen documentation! -// */ -// class CompressAndEmbed : public ProcessBase { - -// public: - -// /// Default constructor -// CompressAndEmbed(const std::string name = "CompressAndEmbed"); - -// /// Default destructor -// ~CompressAndEmbed() {} - -// void configure(const PSet&); - -// void initialize(); - -// bool process(IOManager& mgr); - -// void finalize(); - -// private: - -// std::vector _producer_v; -// std::vector _data_type_v; -// std::vector _row_compression_v; -// std::vector _col_compression_v; -// std::vector _output_rows_v; -// std::vector _output_cols_v; -// std::vector _mode_v; - -// }; - -// /** -// \class larcv3::CompressAndEmbedFactory -// \brief A concrete factory class for larcv3::CompressAndEmbed -// */ -// class CompressAndEmbedProcessFactory : public ProcessFactoryBase { -// public: -// /// ctor -// CompressAndEmbedProcessFactory() { ProcessFactory::get().add_factory("CompressAndEmbed", this); } -// /// dtor -// ~CompressAndEmbedProcessFactory() {} -// /// creation method -// ProcessBase* create(const std::string instance_name) { return new CompressAndEmbed(instance_name); } -// }; - -// } - -// #endif -// /** @} */ // end of doxygen group - diff --git a/larcv/include/larcv3/app/sbnd_imagemod/CosmicNeutrinoSegLabel.h b/larcv/include/larcv3/app/sbnd_imagemod/CosmicNeutrinoSegLabel.h deleted file mode 100644 index 233622ff..00000000 --- a/larcv/include/larcv3/app/sbnd_imagemod/CosmicNeutrinoSegLabel.h +++ /dev/null @@ -1,96 +0,0 @@ -/** - * \file CosmicNeutrinoSegLabel.h - * - * \ingroup ImageMod - * - * \brief Class def header for a class CosmicNeutrinoSegLabel - * - * @author cadams - */ - -/** \addtogroup ImageMod - - @{*/ -#ifndef __LARCV_COSMICNEUTRINOSEGLABEL_H__ -#define __LARCV_COSMICNEUTRINOSEGLABEL_H__ - -#include "larcv3/core/processor/ProcessBase.h" -#include "larcv3/core/processor/ProcessFactory.h" -#include "larcv3/core/dataformat/Tensor.h" -#include "larcv3/core/dataformat/Particle.h" -#include "larcv3/core/dataformat/EventSparseCluster.h" - -namespace larcv3 { - -/** - \class ProcessBase - User defined class CosmicNeutrinoSegLabel ... these comments are - used to generate - doxygen documentation! -*/ -class CosmicNeutrinoSegLabel : public ProcessBase { - public: - - enum particleLabel {kBackground, kCosmic, kNeutrino}; - - /// Default constructor - CosmicNeutrinoSegLabel( - const std::string name = "CosmicNeutrinoSegLabel"); - - /// Default destructor - ~CosmicNeutrinoSegLabel() {} - - void configure(const json&); - - void initialize(); - - bool process(IOManager& mgr); - - void finalize(); - - Image2D seg_image_creator(const std::vector & particles, - const SparseCluster2D & clusters, - const ImageMeta2D & meta, - const int neutrino_label, - const int cosmic_label); - static json default_config(){ - json c = { - {"Cluster2dProducer", ""}, - {"OutputProducer", ""}, - {"ParticleProducer", ""}, - {"NeutrinoLabel", 1}, - {"CosmicLabel", 2} - }; - return c; - } - - private: - - json config; - - -}; - -/** - \class larcv3::CosmicNeutrinoSegLabelFactory - \brief A concrete factory class for larcv3::CosmicNeutrinoSegLabel -*/ -class CosmicNeutrinoSegLabelProcessFactory - : public ProcessFactoryBase { - public: - /// ctor - CosmicNeutrinoSegLabelProcessFactory() { - ProcessFactory::get().add_factory("CosmicNeutrinoSegLabel", - this); - } - /// dtor - ~CosmicNeutrinoSegLabelProcessFactory() {} - /// creation method - ProcessBase* create(const std::string instance_name) { - return new CosmicNeutrinoSegLabel(instance_name); - } -}; -} - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/larcv3/app/sbnd_imagemod/ParentParticleSeg.h b/larcv/include/larcv3/app/sbnd_imagemod/ParentParticleSeg.h deleted file mode 100644 index 59ee47a3..00000000 --- a/larcv/include/larcv3/app/sbnd_imagemod/ParentParticleSeg.h +++ /dev/null @@ -1,119 +0,0 @@ -/** - * \file ParentParticleSeg.h - * - * \ingroup ImageMod - * - * \brief Class def header for a class ParentParticleSeg - * - * Merge all cluster2d voxel sets into a single set if they have a common ancestor - * @author cadams - */ - -/** \addtogroup ImageMod - - @{*/ -#ifndef __PARENTPARTICLESEG_H__ -#define __PARENTPARTICLESEG_H__ - -#include "larcv3/core/processor/ProcessBase.h" -#include "larcv3/core/processor/ProcessFactory.h" -#include "larcv3/core/dataformat/Tensor.h" -#include "larcv3/core/dataformat/Particle.h" -#include "larcv3/core/dataformat/Voxel.h" - -namespace larcv3 { - -/** - \class ProcessBase - User defined class ParentParticleSeg ... these comments are - used to generate - doxygen documentation! -*/ - -struct particle_node{ - int trackID; - int parentID; - int ancestorID; - bool primary; - bool is_virtual; - const Particle * reference; - particle_node * parent; - std::vector daughters; -}; - -class ParentParticleSeg : public ProcessBase { - public: - /// Default constructor - ParentParticleSeg( - const std::string name = "ParentParticleSeg"); - - /// Default destructor - ~ParentParticleSeg() {} - - void configure(const json&); - - void initialize(); - - bool process(IOManager& mgr); - - void finalize(); - - larcv3::VoxelSet cluster_merger(const larcv3::SparseCluster2D & clusters, - particle_node * primary_node); - - larcv3::VoxelSet cluster_merger(const larcv3::SparseCluster3D & clusters, - particle_node * primary_node); - - static json default_config(){ - json c = { - {"Cluster2dProducer", ""}, - {"Cluster3dProducer", ""}, - {"OutputProducer", ""}, - {"ParticleProducer", ""}, - }; - return c; - } - - private: - - json config; - - void get_all_daughter_ids(std::vector & ids, const particle_node * node); - - - // std::string _cluster3d_producer; - // std::string _cluster2d_producer; - // std::string _output_producer; - // std::string _particle_producer; - -}; - -/** - \class larcv3::ParentParticleSegFactory - \brief A concrete factory class for larcv3::ParentParticleSeg -*/ -class ParentParticleSegProcessFactory - : public ProcessFactoryBase { - public: - /// ctor - ParentParticleSegProcessFactory() { - ProcessFactory::get().add_factory("ParentParticleSeg", - this); - } - /// dtor - ~ParentParticleSegProcessFactory() {} - /// creation method - ProcessBase* create(const std::string instance_name) { - return new ParentParticleSeg(instance_name); - } -}; -} - -#ifdef LARCV_INTERNAL -#include -void init_parent_particle_seg(pybind11::module m); -#endif - - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/larcv3/app/sbnd_imagemod/sbnd_imagemod.h b/larcv/include/larcv3/app/sbnd_imagemod/sbnd_imagemod.h deleted file mode 100644 index 6a5a51b5..00000000 --- a/larcv/include/larcv3/app/sbnd_imagemod/sbnd_imagemod.h +++ /dev/null @@ -1,30 +0,0 @@ - -/** - * \file larbys.h - * - * \ingroup app_imagemod - * - * \brief Class def header for pybind11 for larcv3 framework - * - * @author cadams - */ - -/** \addtogroup core_Base - - @{*/ -#ifndef __LARCV3SBND_IMAGEMOD_IMAGEMOD_H__ -#define __LARCV3SBND_IMAGEMOD_IMAGEMOD_H__ - - - -#ifndef LARCV_NO_PYBIND -#ifdef LARCV_INTERNAL -#include -__attribute__ ((visibility ("default"))) void init_sbnd_imagemod(pybind11::module m); -#endif -// bindings -#endif - - -// include guards -#endif diff --git a/larcv/include/larcv3/core/base/LArCVBaseUtilFunc.h b/larcv/include/larcv3/core/base/LArCVBaseUtilFunc.h deleted file mode 100644 index a3c247ff..00000000 --- a/larcv/include/larcv3/core/base/LArCVBaseUtilFunc.h +++ /dev/null @@ -1,25 +0,0 @@ -/** - * \file LArCVBaseUtilFunc.h - * - * \ingroup core_Base - * - * \brief Utility functions in core_Base - * - * @author Kazu - Nevis 2015 - */ - -/** \addtogroup core_Base - - @{*/ - -#ifndef __LARCV3BASE_UTILFUNC_H__ -#define __LARCV3BASE_UTILFUNC_H__ - -namespace larcv3 { - - bool mpi_enabled(); - -} - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/larcv3/core/base/LArCVTypes.h b/larcv/include/larcv3/core/base/LArCVTypes.h deleted file mode 100644 index fed9cfd6..00000000 --- a/larcv/include/larcv3/core/base/LArCVTypes.h +++ /dev/null @@ -1,80 +0,0 @@ -/** - * \file LArCVTypes.h - * - * \ingroup core_Base - * - * \brief basic typedefs and enums (larcv3::Point2D, larcv3::msg, etc.) - * - * @author Kazu - Nevis 2015 - */ - -/** \addtogroup core_Base - - @{*/ - -#ifndef __LARCV3BASE_TYPES_H__ -#define __LARCV3BASE_TYPES_H__ - -#include -#include -#include -#include -#include - - -#include -#include -#include - - -/** - \namespace larcv3 - C++ namespace for developping LArTPC software interface to computer vision software (LArCV3) -*/ -namespace larcv3 { - - /// Used as an invalid value identifier for long long - const long long kINVALID_LONGLONG = std::numeric_limits< long long >::max(); - /// Used as an invalid value identifier for unsigned long long - const unsigned long long kINVALID_ULONGLONG = std::numeric_limits< unsigned long long >::max(); - /// Used as an invalid value identifier for size_t - const size_t kINVALID_SIZE = std::numeric_limits< size_t >::max(); - /// Used as an invalid value identifier for int - const int kINVALID_INT = std::numeric_limits< int >::max(); - /// Used as an invalid value identifier for unsigned int - const unsigned int kINVALID_UINT = std::numeric_limits< unsigned int >::max(); - /// Used as an invalid value identifier for unsigned short - const short kINVALID_SHORT = std::numeric_limits< short >::max(); - /// Used as an invalid value identifier for unsigned unsigned short - const unsigned short kINVALID_USHORT = std::numeric_limits< unsigned short >::max(); - /// Used as an invalid value identifier for single-point precision - const float kINVALID_FLOAT = std::numeric_limits< float >::max(); - /// Used as an invalid value identifier for double-point precision - const double kINVALID_DOUBLE = std::numeric_limits< double >::max(); - /// Used as an invalid value identifier for signed long precision - const long kINVALID_LONG = std::numeric_limits< long >::max(); - - /// Namespace for larcv3 message related types - namespace msg { - - /** - * @brief Message Level - */ - enum Level_t { kDEBUG, kINFO, kNORMAL, kWARNING, kERROR, kCRITICAL, kMSG_TYPE_MAX }; - - /// Formatted message prefix per message level - const std::string kStringPrefix[kMSG_TYPE_MAX] = - { - " \033[94m[DEBUG]\033[00m ", ///< kDEBUG message prefix - " \033[92m[INFO]\033[00m ", ///< kINFO message prefix - " \033[95m[NORMAL]\033[00m ", ///< kNORMAL message prefix - " \033[93m[WARNING]\033[00m ", ///< kWARNING message prefix - " \033[91m[ERROR]\033[00m ", ///< kERROR message prefix - " \033[5;1;33;41m[CRITICAL]\033[00m " ///< kCRITICAL message prefix - }; - ///< Prefix of message - } - -} -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/larcv3/core/base/Watch.h b/larcv/include/larcv3/core/base/Watch.h deleted file mode 100644 index c9eaf374..00000000 --- a/larcv/include/larcv3/core/base/Watch.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef __LARCV3_BASE_WATCH_H__ -#define __LARCV3_BASE_WATCH_H__ -/** - * \file Watch.h - * - * \ingroup core_Base - * - * \brief Class def header for a class larcv3::Watch - * - * @author kazuhiro - */ - -/** \addtogroup core_Base - - @{*/ - -#include -#include - - -namespace larcv3 { - - /** - \class larcv3::Watch - @brief a _very_ simple stopwatch class for simple time measurement - */ - class Watch { - public: - Watch(){} - ~Watch(){} - - /// Start stop watch - void Start() { - // Get current wall time - struct timeval current_time; - gettimeofday(¤t_time,NULL); - _wall_time_start = (double)current_time.tv_sec + (double)current_time.tv_usec * 1.e-6; - // Get current cpu time - _cpu_time_start = (double)(clock()); - } - /// Report wall-clock time [s] since Start() call - double WallTime() { - // Get current wall time - struct timeval current_time; - gettimeofday(¤t_time,NULL); - double now = (double)current_time.tv_sec + (double)current_time.tv_usec * 1.e-6; - // Return diff - return (now - _wall_time_start); - } - /// Report cpu-clock time [s] since Start() call - double CPUTime() { - // Get cpu time - double now = (double)(clock()); - // Return diff - return (now - _cpu_time_start)/CLOCKS_PER_SEC; - } - private: - double _cpu_time_start; - double _wall_time_start; - }; -} - -#ifdef LARCV_INTERNAL -#include -void init_Watch(pybind11::module m); -#endif - - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/larcv3/core/base/base.h b/larcv/include/larcv3/core/base/base.h deleted file mode 100644 index c9d11a92..00000000 --- a/larcv/include/larcv3/core/base/base.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * \file larbys.h - * - * \ingroup core_Base - * - * \brief Class def header for exception classes for larcv3 framework - * - * @author cadams - */ - -/** \addtogroup core_Base - - @{*/ -#ifndef __LARCV3BASE_BASE_H__ -#define __LARCV3BASE_BASE_H__ - - -#include "larbys.h" -#include "larcv_base.h" -#include "Watch.h" - -#ifndef LARCV_NO_PYBIND -#ifdef LARCV_INTERNAL -#include -__attribute__ ((visibility ("default"))) void init_base(pybind11::module m); -#endif -// bindings -#endif - - -// include guards -#endif diff --git a/larcv/include/larcv3/core/base/larbys.h b/larcv/include/larcv3/core/base/larbys.h deleted file mode 100644 index a64ad011..00000000 --- a/larcv/include/larcv3/core/base/larbys.h +++ /dev/null @@ -1,65 +0,0 @@ -/** - * \file larbys.h - * - * \ingroup core_Base - * - * \brief Class def header for exception classes for larcv3 framework - * - * @author kazuhiro tmw - */ - -/** \addtogroup core_Base - - @{*/ -#ifndef __LARCV3BASE_LARBYS_H__ -#define __LARCV3BASE_LARBYS_H__ - -#include -#include - - - - -namespace larcv3 { - - /** - \class larbys - Throw insignificant larbys when you find nonesense - */ - class larbys : public std::exception { - - public: - - /** - * @brief Constructs a new instance. - * - * @param[in] msg The message - */ - larbys(std::string msg="") : std::exception() - { - _msg = "\033[93m"; - _msg += msg; - _msg += "\033[00m"; - } - - virtual ~larbys() throw() {} - virtual const char* what() const throw() - { return _msg.c_str(); } - - private: - - std::string _msg; - }; -} - -#ifdef LARCV_INTERNAL -#include -void init_larbys(pybind11::module m); -#endif - -// PYBIND11_MODULE(larcv, m) { -// init_larbys(m); -// } - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/larcv3/core/base/larcv_base.h b/larcv/include/larcv3/core/base/larcv_base.h deleted file mode 100644 index 6f7df6c2..00000000 --- a/larcv/include/larcv3/core/base/larcv_base.h +++ /dev/null @@ -1,123 +0,0 @@ -/** - * \file larcv_base.h - * - * \ingroup core_Base - * - * \brief Class definition file of larcv3::larcv_base - * - * @author Kazu - Nevis 2015 - */ - -/** \addtogroup core_Base - - @{*/ - -#ifndef __LARCV3BASE_LARCV_BASE_H__ -#define __LARCV3BASE_LARCV_BASE_H__ - -#include -#include "larcv3/core/base/larcv_logger.h" -#include "pybind11_json/pybind11_json.hpp" -#include - -// for convenience -using json = nlohmann::json; - - - -namespace larcv3 { - - /** - \class larcv_base - Framework base class equipped with a logger class - */ - class larcv_base { - - public: - - /** - * @brief Constructs a new instance. - * - * @param[in] logger_name The logger name - */ - larcv_base(const std::string logger_name="larcv_base") - : _logger(nullptr) - { _logger = &(::larcv3::logger::get(logger_name)); } - - /** - * @brief Constructs a new instance. - * - * @param[in] original The original - */ - larcv_base(const larcv_base &original) : _logger(original._logger) {} - - /** - * @brief Destroys the object. - */ - virtual ~larcv_base(){}; - - /** - * @brief Get const reference to logger - * - * @return { description_of_the_return_value } - */ - inline const larcv3::logger& logger() const - { return *_logger; } - - /** - * @brief Sets the verbosity. - * - * @param[in] level The level - */ - void set_verbosity(::larcv3::msg::Level_t level) - { _logger->set(level); } - - /** - * @brief Name getter, defined in a logger instance attribute - * - * @return name of the logger - */ - const std::string& name() const - { return logger().name(); } - - /** - * @brief Base config getter - * - * @return json config - */ - static json default_config(){ - json j = {{ "larcv_base" , - {"", ""} - }}; - return j; - }; - - protected: - /** - * @brief Augments the default configuration. - * - * @param[in] default_config The default configuration - * @param[in] user_config The user configuration - * - * @return Recursively updates the default config (first argument) - * with a user config (second argument). ANy items in the user_config are either - * added to the default config or replace the existing keys. - */ - json augment_default_config(const json& default_config, const json& user_config); - - private: - - - larcv3::logger *_logger; ///< logger - - }; -} - -#ifdef LARCV_INTERNAL -#include -void init_larcv_base(pybind11::module m); -#endif - -#endif - -/** @} */ // end of doxygen group diff --git a/larcv/include/larcv3/core/base/larcv_logger.h b/larcv/include/larcv3/core/base/larcv_logger.h deleted file mode 100644 index 30695352..00000000 --- a/larcv/include/larcv3/core/base/larcv_logger.h +++ /dev/null @@ -1,173 +0,0 @@ -/** - * \file larcv_logger.h - * - * \ingroup core_Base - * - * \brief larcv3::logger utility class definition header file. - * - * @author Kazu - Nevis 2015 - */ - -/** \addtogroup core_Base - - @{*/ -#ifndef __LARCV3BASE_LOGGER_H__ -#define __LARCV3BASE_LOGGER_H__ - -#include -#include -#include - - -#include "larcv3/core/base/LArCVTypes.h" - -namespace larcv3 { - - /** - \class logger - \brief Utility class used to show formatted message on the screen. - A logger class for larcv3. Simply shows a formatted colored message on a screen. \n - A static getter method is provided to create a sharable logger instance (see larcv_base for useage). \n - */ - class logger{ - - public: - - /// Default constructor - /** - * @brief logger constructor - * @details Create a new logger with specified name - * - */ - logger(const std::string& name="no_name") - : _ostrm(&std::cout) - , _name(name) - {} - - /** - * @brief Destroys the object. - */ - virtual ~logger(){}; - - private: - - /// ostream - std::ostream *_ostrm; - - /// Level - msg::Level_t _level; - - /// Name - std::string _name; - - /// Set of loggers - static std::map *_logger_m; - - /// Shared logger - static larcv3::logger* _shared_logger; - - /// Default logger level - static msg::Level_t _level_default; - - public: - - /// Logger's name - const std::string& name() const { return _name; } - - /// Verbosity level setter - void set(const msg::Level_t level) { _level = level; } - - /// Verbosity level getter - msg::Level_t level() const { return _level; } - - /// Comparison operator for static collection of loggers - inline bool operator<(const logger& rhs) const - { - if(_name < rhs.name()) return true; - if(_name > rhs.name()) return false; - return false; - } - - /// Getter of a message instance - static logger& get(const std::string name) - { - if(!_logger_m) _logger_m = new std::map(); - auto iter = _logger_m->find(name); - if(iter == _logger_m->end()) { - iter = _logger_m->emplace(name,logger(name)).first; - iter->second.set(msg::kNORMAL); - } - return iter->second; - }; - - static logger& get_shared(); - - /// Default logger level getter - static msg::Level_t default_level() { return _level_default; } - /// Default logger level setter (only affect future loggers) - static void default_level(msg::Level_t l) { _level_default = l; } - /// Force all loggers to change level - static void force_level(msg::Level_t l) - { - default_level(l); - for(auto& name_logger : *_logger_m) name_logger.second.set(l); - } - - // - // Verbosity level checker - // - inline bool debug () const { return _level <= msg::kDEBUG; } - inline bool info () const { return _level <= msg::kINFO; } - inline bool normal () const { return _level <= msg::kNORMAL; } - inline bool warning () const { return _level <= msg::kWARNING; } - inline bool error () const { return _level <= msg::kERROR; } - /// Formatted message (simplest) - std::ostream& send(const msg::Level_t) const; - /// Formatted message (function name included) - std::ostream& send(const msg::Level_t level, - const std::string& function ) const; - /// Formatted message (function name + line number) - std::ostream& send(const msg::Level_t level, - const std::string& function, - const unsigned int line_num ) const; - /// Formatted message (function name + line number + file name) - std::ostream& send(const msg::Level_t level, - const std::string& function, - const unsigned int line_num, - const std::string& file_name) const; - - }; -} - -#ifdef LARCV_INTERNAL -#include -// Wrapper init function: -void init_logger(pybind11::module m); -#endif - - -// -// Compiler macro for saving us from text typing -// -/// Compiler macro for DEBUG message -#define LARCV_DEBUG() if( logger().debug () ) logger().send(::larcv3::msg::kDEBUG, __FUNCTION__, __LINE__, __FILE__) -/// Compiler macro for INFO message -#define LARCV_INFO() if( logger().info () ) logger().send(::larcv3::msg::kINFO, __FUNCTION__, __LINE__ ) -/// Compiler macro for NORMAL message -#define LARCV_NORMAL() if( logger().normal () ) logger().send(::larcv3::msg::kNORMAL, __FUNCTION__ ) -/// Compiler macro for WARNING message -#define LARCV_WARNING() if( logger().warning () ) logger().send(::larcv3::msg::kWARNING, __FUNCTION__ ) -/// Compiler macro for ERROR message -#define LARCV_ERROR() if( logger().error () ) logger().send(::larcv3::msg::kERROR, __FUNCTION__, __LINE__ ) -/// Compiler macro for CRITICAL message -#define LARCV_CRITICAL() logger().send(::larcv3::msg::kCRITICAL, __FUNCTION__, __LINE__, __FILE__) - -#define LARCV_SDEBUG() if(larcv3::logger::get_shared().debug()) larcv3::logger::get_shared().send(::larcv3::msg::kDEBUG, __FUNCTION__,__LINE__,__FILE__) -#define LARCV_SINFO() if(larcv3::logger::get_shared().info()) larcv3::logger::get_shared().send(::larcv3::msg::kINFO, __FUNCTION__,__LINE__ ) -#define LARCV_SNORMAL() if(larcv3::logger::get_shared().normal()) larcv3::logger::get_shared().send(::larcv3::msg::kNORMAL, __FUNCTION__ ) -#define LARCV_SWARNING() if(larcv3::logger::get_shared().warning()) larcv3::logger::get_shared().send(::larcv3::msg::kWARNING, __FUNCTION__ ) -#define LARCV_SERROR() if(larcv3::logger::get_shared().error()) larcv3::logger::get_shared().send(::larcv3::msg::kERROR, __FUNCTION__,__LINE__ ) -#define LARCV_SCRITICAL() larcv3::logger::get_shared().send(::larcv3::msg::kCRITICAL, __FUNCTION__,__LINE__,__FILE__) - -/** @} */ // end of doxygen group logger -#endif diff --git a/larcv/include/larcv3/core/base/stack_trace.h b/larcv/include/larcv3/core/base/stack_trace.h deleted file mode 100644 index 8222eb1b..00000000 --- a/larcv/include/larcv3/core/base/stack_trace.h +++ /dev/null @@ -1,93 +0,0 @@ -// stacktrace.h (c) 2008, Timo Bingmann from http://idlebox.net/ -// published under the WTFPL v2.0 - -#ifndef __LARCV3BASE_STACKTRACE_H_ -#define __LARCV3BASE_STACKTRACE_H_ - -#include -#include -#include -#include - -/** Print a demangled stack backtrace of the caller function to FILE* out. */ -static inline void print_stacktrace(FILE *out = stderr, unsigned int max_frames = 63) -{ - fprintf(out, "stack trace:\n"); - - // storage array for stack trace address data - void* addrlist[max_frames+1]; - - // retrieve current stack addresses - int addrlen = backtrace(addrlist, sizeof(addrlist) / sizeof(void*)); - - if (addrlen == 0) { - fprintf(out, " \n"); - return; - } - - // resolve addresses into strings containing "filename(function+address)", - // this array must be free()-ed - char** symbollist = backtrace_symbols(addrlist, addrlen); - - // allocate string which will be filled with the demangled function name - size_t funcnamesize = 256; - char* funcname = (char*)malloc(funcnamesize); - - // iterate over the returned symbol lines. skip the first, it is the - // address of this function. - for (int i = 1; i < addrlen; i++) - { - char *begin_name = 0, *begin_offset = 0, *end_offset = 0; - - // find parentheses and +address offset surrounding the mangled name: - // ./module(function+0x15c) [0x8048a6d] - for (char *p = symbollist[i]; *p; ++p) - { - if (*p == '(') - begin_name = p; - else if (*p == '+') - begin_offset = p; - else if (*p == ')' && begin_offset) { - end_offset = p; - break; - } - } - - if (begin_name && begin_offset && end_offset - && begin_name < begin_offset) - { - *begin_name++ = '\0'; - *begin_offset++ = '\0'; - *end_offset = '\0'; - - // mangled name is now in [begin_name, begin_offset) and caller - // offset in [begin_offset, end_offset). now apply - // __cxa_demangle(): - - int status; - char* ret = abi::__cxa_demangle(begin_name, - funcname, &funcnamesize, &status); - if (status == 0) { - funcname = ret; // use possibly realloc()-ed string - fprintf(out, " %s : %s+%s\n", - symbollist[i], funcname, begin_offset); - } - else { - // demangling failed. Output function name as a C function with - // no arguments. - fprintf(out, " %s : %s()+%s\n", - symbollist[i], begin_name, begin_offset); - } - } - else - { - // couldn't parse the line? print the whole line. - fprintf(out, " %s\n", symbollist[i]); - } - } - - free(funcname); - free(symbollist); -} - -#endif // _STACKTRACE_H_ diff --git a/larcv/include/larcv3/core/dataformat/BBox.h b/larcv/include/larcv3/core/dataformat/BBox.h deleted file mode 100644 index c023dc87..00000000 --- a/larcv/include/larcv3/core/dataformat/BBox.h +++ /dev/null @@ -1,236 +0,0 @@ -/** - * \file BBox.h - * - * \ingroup DataFormat - * - * \brief Class def header for a class larcv3::BBox2D and larcv3::BBox3D - * - * @author kazuhiro, cadams - */ - -/** \addtogroup DataFormat - - @{*/ -#ifndef __LARCV3DATAFORMAT_BBOX_H__ -#define __LARCV3DATAFORMAT_BBOX_H__ - -#include -#include "larcv3/core/dataformat/DataFormatTypes.h" - - - -namespace larcv3 { - - /** - \class BBox - \brief Bounding box in ND - */ - - template - class BBox{ - public: - - BBox(); - - /** - * @brief Non default constructor - */ - BBox(const std::array& centroid, - const std::array& half_length, - const std::array & rotation = {}); - - - /** - * @brief Return rotation, flattened - * - * @return array of length dimension**2 - */ - std::array identity_rotation(); - - /** - * @brief Return Centroid - * - */ - const std::array& centroid() const {return _centroid;} - /** - * @brief Return half length - * - */ - const std::array& half_length() const {return _half_length;} - - /** - * @brief Return rotation_matrix - * - * @return array of size dimension**2 - */ - const std::array & rotation_matrix() const {return _rotation;} - - /** - * @brief Equality operator. - * - * @param[in] rhs The right hand side - * - * @return The result of the equality - */ - inline bool operator== (const BBox& rhs) const { - return ( _centroid == rhs._centroid && - _half_length == rhs._half_length && - _rotation == rhs._rotation); - } - - /** - * @brief Convert contents to readable string - * - * @return Formatted string - */ - std::string dump() const; - - - - private: - - // central location of the bbox. Rotations, if used, are around this point. - std::array _centroid; - - // half length of BBox in each dimension. - std::array _half_length; - - // unitary rotation matrix, defaults to identity. - std::array _rotation; - - public: - /** - * @brief Gets the datatype. - * - * @return The datatype. - */ - static hid_t get_datatype() { - hid_t datatype; - datatype = H5Tcreate (H5T_COMPOUND, sizeof (BBox)); - - hsize_t array_dimensions[1]; - array_dimensions[0] = dimension; - - hid_t double_type = H5Tarray_create(larcv3::get_datatype(), 1, array_dimensions); - - hsize_t rotation_dimensions[1]; - rotation_dimensions[0] = dimension*dimension; - hid_t rotation_type = H5Tarray_create(larcv3::get_datatype(), 1, rotation_dimensions); - - H5Tinsert (datatype, "centroid", - HOFFSET (BBox, _centroid), - double_type); - H5Tinsert (datatype, "half_length", - HOFFSET (BBox, _half_length), - double_type); - H5Tinsert (datatype, "rotation", - HOFFSET (BBox, _rotation), - rotation_type); - - return datatype; - } - - }; - - typedef BBox<2> BBox2D; - typedef BBox<3> BBox3D; - - - template - class BBoxCollection{ - - // template friend class EventBBox; - template friend class EventBBox; - - public: - - BBoxCollection(){}; - - /** - * @brief Get number of BBox - * - * @return Number of BBoxes - */ - inline size_t size() const { return _bbox_v.size(); } - /** - * @brief Access specific BBox - * - * @param[in] id The identifier - * - * @return larcv3::BBox - */ - const larcv3::BBox & bbox(InstanceID_t id) const {return _bbox_v.at(id);} - /** - * @brief Access all BBox as immutable vector - * - * @return Const ref to vector of bboxes - */ - inline const std::vector >& as_vector() const - { return _bbox_v; } - - // - // Write-access - // - - /** - * @brief Clear everything - */ - inline void clear_data() { _bbox_v.clear(); } - /** - * @brief Resize bbox array - * - * @param[in] num The number of boxes - */ - inline void resize(const size_t num) - { this->clear_data(); _bbox_v.resize(num); } - - /** - * @brief Access non-const reference of a specific BBox - * - * @param[in] id The identifier - * - * @return Mutable ref top bbox - */ - larcv3::BBox& writeable_bbox(const InstanceID_t id) {return _bbox_v.at(id);} - - /** - * @brief Move a BBox into a collection. - * - * @param bbox The bounding box - */ - void emplace(larcv3::BBox && bbox){_bbox_v.push_back(bbox);} - - /** - * @brief Set a BBox into a collection. - * - * @param[in] bbox The bounding box - */ - void append(const larcv3::BBox & bbox) {_bbox_v.push_back(bbox);} - - /** - * @brief Move an entire collection of bboxes - * - * @param orig The original - */ - void move(larcv3::BBoxCollection && orig) - { _bbox_v = std::move(orig._bbox_v); } - - private: - std::vector > _bbox_v; - - }; - - typedef BBoxCollection<2> BBoxCollection2D; - typedef BBoxCollection<3> BBoxCollection3D; - -} - -#ifdef LARCV_INTERNAL -#include - -void init_bbox(pybind11::module m); -#endif - - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/larcv3/core/dataformat/DataFormatTypes.h b/larcv/include/larcv3/core/dataformat/DataFormatTypes.h deleted file mode 100644 index c9fc5bee..00000000 --- a/larcv/include/larcv3/core/dataformat/DataFormatTypes.h +++ /dev/null @@ -1,160 +0,0 @@ -#ifndef __LARCV3DATAFORMAT_DATAFORMATTYPES_H__ -#define __LARCV3DATAFORMAT_DATAFORMATTYPES_H__ - -/** - * \file DataFormatTypes.h - * - * \ingroup DataFormat - * - * \brief Definition of many types for Dataformat - * - * @author cadams - */ - -#include "larcv3/core/base/LArCVTypes.h" -#include -#include -#include "hdf5.h" - -namespace larcv3 { - - /// Invalid rep for vector index - static const unsigned short kINVALID_INDEX = kINVALID_USHORT; - /// Image index type for Image2D within EventImage2D - typedef unsigned short ImageIndex_t; - /// ROI index type for Particle within EventROI - typedef unsigned short ParticleIndex_t; - /// Projection ID to distinguish different 2D projections - typedef unsigned short ProjectionID_t; - /// "ID" of MCShower/MCTrack in terms of its index number in the collection std::vector - typedef unsigned short MCSTIndex_t; - /// "ID" of MCTruth in terms of its index number in the collection std::vector - typedef unsigned short MCTIndex_t; - /// "ID" for a set of elements - typedef unsigned short InstanceID_t; - /// Invalid rep for InstanceID_t - static const unsigned short kINVALID_INSTANCEID = kINVALID_USHORT; - /// Invalid projection id - static const ProjectionID_t kINVALID_PROJECTIONID = kINVALID_USHORT; - - /** - * @brief Internal Structure to organize variable length objects - */ - struct Extents_t{ - unsigned long long int first; - unsigned int n; - }; - - /** - * @brief Internal Structure to organize variable length objects, tied to an ID - */ - struct IDExtents_t{ - unsigned long long int first; - unsigned int n; - unsigned int id; - }; - - - /// "ID" for Voxel3D - typedef unsigned long long VoxelID_t; - /// Invalid Voxel3DID_t definition - static const VoxelID_t kINVALID_VOXELID = kINVALID_ULONGLONG; - - /// Channel status constants - namespace chstatus { - static const short kNOTPRESENT = -1; ///< Channel does not exist - static const short kNEGATIVEPEDESTAL = -2; ///< Channel not reco-ed due to pedestal < 0 - /// Standard channel status enum stored in the database - enum ChannelStatus_t : int { - kDISCONNECTED=0, ///< Channel is not connected - kDEAD=1, ///< Dead channel - kLOWNOISE=2, ///< Abnormally low noise channel - kNOISY=3, ///< Abnormally high noise channel - kGOOD=4, ///< Good channel - kUNKNOWN=5 ///< Channel w/ unverified status - }; - } - - /// Coordinate unit type - enum DistanceUnit_t : int { - kUnitUnknown, ///< undefined scale (bad!) - kUnitCM, ///< cm scale - kUnitWireTime ///< wire/time in 2D image - }; - - /// Pooling type - enum PoolType_t : int { - kPoolSum, ///< sum channels - kPoolAverage, ///< average over channels - kPoolMax ///< max channel - }; - - /// Object appearance type in LArTPC - enum ShapeType_t : int { - kShapeShower, ///< Shower - kShapeTrack, ///< Track - kShapeUnknown ///< LArbys - }; - - /// "ID" of MCParticles in terms of its G4 track ID (unless mixing multiple MC samples) - typedef size_t MCTrackID_t; - /// A collection of MCTrackID_t for multiple MCParticles - typedef std::set MCTrackIDSet_t; - - /// ProducerID_t to identify a unique data product within a process (for larcv3::IOManager) - typedef size_t ProducerID_t; - /// ProductName_t to identify a unique data product within a process (for larcv3::IOManager) - typedef std::pair ProducerName_t; - /// Invalid ProducerID_t - static const ProducerID_t kINVALID_PRODUCER=kINVALID_SIZE; - - /** - * @brief Return a unique string for each dataproduct - * - * @tparam T larcv3 dataformat class and some default types - * - * @return string value unique to each product type - */ - template - std::string product_unique_name(); - - /// Type of geometrical point from projections - enum PointType_t : int { - kPoint3D, ///< 3D - kPointXY, ///< XY projection (0) - kPointYZ, ///< YZ projection (1) - kPointZX ///< ZX projection (2) - }; - - // In this section, we define and specialize a number of cases for mapping - // datatypes used in larcv3 to datatypes needed for hdf5 serialization. - - /** - * @brief Gets the datatype. - * - * @tparam T larcv3 serializable object - * - * @return The HDF5 datatype, as an hdf5 ID. - */ - template - hid_t get_datatype(); - - /** - * @brief Return a unique string for a type - * - * @tparam T built in type - * - * @return string value unique to each product type - */ - template - std::string as_string(); - - -} - -#ifdef LARCV_INTERNAL -#include -void init_dataformattypes(pybind11::module m); -#endif - -#endif diff --git a/larcv/include/larcv3/core/dataformat/DataProductFactory.h b/larcv/include/larcv3/core/dataformat/DataProductFactory.h deleted file mode 100644 index 4402db55..00000000 --- a/larcv/include/larcv3/core/dataformat/DataProductFactory.h +++ /dev/null @@ -1,92 +0,0 @@ -/** - * \file DataProductFactory.h - * - * \ingroup DataFormat - * - * \brief Class def header for a class DataProductFactory - * - * @author kazuhiro, cadams - */ - -/** \addtogroup DataFormat - - @{*/ -#ifndef __LARCV3DATAFORMAT_DATAPRODUCTFACTORY_H__ -#define __LARCV3DATAFORMAT_DATAPRODUCTFACTORY_H__ - -#include -#include -#include "larcv3/core/base/larcv_base.h" -#include "larcv3/core/base/larbys.h" -#include "larcv3/core/dataformat/EventBase.h" -#include "larcv3/core/dataformat/DataFormatTypes.h" -#include - -namespace larcv3 { - - class EventBase; - /** - \class DataProductFactoryBase - \brief Abstract base class for factory (to be implemented per data product) - */ - class DataProductFactoryBase { - public: - /// Default ctor - DataProductFactoryBase(){} - /// Default dtor (virtual) - virtual ~DataProductFactoryBase(){} - /// Abstract constructor method - virtual EventBase* create() = 0; - }; - - /** - \class ClusterAlgoFactory - \brief Factory class for instantiating event product instance by larcv3::IOManager - This factory class can instantiate a specified product instance w/ provided producer name. \n - The actual factory core (to which each product class must register creation factory instance) is \n - a static std::map. Use static method to get a static instance (larcv3::DataProductFactory::get) \n - to access a factory. - */ - class DataProductFactory : public larcv_base { - - public: - /// Default ctor, shouldn't be used - DataProductFactory() : larcv_base("DataProductFactory") - {} - /// Default dtor - ~DataProductFactory() {_factory_map.clear();} - /// Static sharable instance getter - static inline DataProductFactory& get() - { if(!_me) _me = new DataProductFactory; return *_me; } - - /// Factory registration method (should be called by global factory instance in algorithm header) - void add_factory(std::string type, larcv3::DataProductFactoryBase* factory); - - /// Factory creation method (should Ã¥be called by clients, possibly you!) - inline EventBase* create(const std::string& type, const std::string& producer) { - return create(ProducerName_t(type,producer)); - } - - /// Factory creation method (should be called by clients, possibly you!) - EventBase* create(const ProducerName_t& id); - - /// List registered products - void list() const; - - inline size_t unique_product_count() const - { return _id_to_type.size(); } - - inline const std::vector& product_names() const - { return _id_to_type; } - - private: - /// Factory container - std::map _factory_map; - /// Unique product type ID - std::vector _id_to_type; - /// Static self - static DataProductFactory* _me; - }; -} -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/larcv3/core/dataformat/EventBBox.h b/larcv/include/larcv3/core/dataformat/EventBBox.h deleted file mode 100644 index f715bea5..00000000 --- a/larcv/include/larcv3/core/dataformat/EventBBox.h +++ /dev/null @@ -1,137 +0,0 @@ -/** - * \file EventBBox.h - * - * \ingroup DataFormat - * - * \brief Class def header for a class EventBBox - * - * @author cadams - */ - -/** \addtogroup DataFormat - - @{*/ -#ifndef __LARCV3DATAFORMAT_EVENTBBOX_H -#define __LARCV3DATAFORMAT_EVENTBBOX_H - -#include "larcv3/core/dataformat/EventBase.h" -#include "larcv3/core/dataformat/BBox.h" -#include "larcv3/core/dataformat/DataProductFactory.h" - -class EventBBox; - -namespace larcv3 { - /** - \class EventBBox - User-defined data product class (please comment!) - */ - template - class EventBBox : public EventBase { - - public: - - /// Default constructor - EventBBox(); - - /// Default destructor - ~EventBBox(){} - - /** - * @brief Get the bbox collection at projection index - * - * @param[in] index The index - * - * @return All bboxes on this projection index - */ - inline larcv3::BBoxCollection at(size_t index) {return _bbox_c_v.at(index);} - - - /** - * @brief Set a collection of bboxes - * - * @param[in] bbox_c_v The bounding box c v - */ - void set(const std::vector>& bbox_c_v); - - /** - * @brief Append a collection of bboxes - * - * @param[in] bbox_c The bounding box c - */ - void append(const larcv3::BBoxCollection& bbox_c); - - /** - * @brief Emplace a collection of bboxes to the end of the list - * - * @param bbox_c The bounding box c - */ - void emplace_back(larcv3::BBoxCollection&& bbox_c); - void emplace(std::vector>&& bbox_c_v); - - inline const std::vector>& as_vector() const - { return _bbox_c_v; } - - // inline const larcv3::BBox& at(size_t index) const {return _bbox_c_v.at(index);} - - inline size_t size() const {return _bbox_c_v.size();} - - /// Data clear method - void clear (); - void initialize (hid_t group, uint compression); - void serialize (hid_t group); - void deserialize(hid_t group, size_t entry, bool reopen_groups=false); - void finalize (); - - - private: - - void open_in_datasets(hid_t group); - void open_out_datasets(hid_t group); - - std::vector> _bbox_c_v; ///< a collection of particles (index maintained) - - }; - - typedef EventBBox<2> EventBBox2D; - typedef EventBBox<3> EventBBox3D; -} - - -#include "IOManager.h" -namespace larcv3 { - - // Template instantiation for IO - template<> inline std::string product_unique_name() { return "bbox2d"; } - template<> inline std::string product_unique_name() { return "bbox3d"; } - - - /** - \class larcv3::EventTensor - \brief A concrete factory class for larcv3::EventTensor - */ - - template - class EventBBoxFactory : public DataProductFactoryBase { - public: - /// ctor - EventBBoxFactory() - { DataProductFactory::get().add_factory(product_unique_name>(),this); } - /// dtor - ~EventBBoxFactory() {} - /// create method - EventBase* create() { return new EventBBox; } - }; - -} - -#ifdef LARCV_INTERNAL -#include - -template -void init_eventbbox_instance(pybind11::module m); - -void init_eventbbox(pybind11::module m); -#endif - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/larcv3/core/dataformat/EventBase.h b/larcv/include/larcv3/core/dataformat/EventBase.h deleted file mode 100644 index dc6eeb34..00000000 --- a/larcv/include/larcv3/core/dataformat/EventBase.h +++ /dev/null @@ -1,114 +0,0 @@ -/** - * \file EventBase.h - * - * \ingroup DataFormat - * - * \brief Class def header for a class EventBase - * - * @author cadams, kazuhiro - */ - -/** \addtogroup DataFormat - - @{*/ -#ifndef __LARCV3DATAFORMAT_EVENTBASE_H -#define __LARCV3DATAFORMAT_EVENTBASE_H - -#include -#include "larcv3/core/base/larcv_base.h" -#include "larcv3/core/dataformat/DataFormatTypes.h" - -// There is no need to generate an explicit wrapper for EventBase, since it's virtual - -namespace larcv3 { - // class IOManager; - class DataProductFactory; - /** - \class EventBase - Base class for an event data product (what is stored in output file), holding run/subrun/event ID + producer name. - */ - class EventBase{ - friend class IOManager; - friend class DataProductFactory; - public: - - /// Destructor - virtual ~EventBase() = 0; - - /** - * @brief Clears the object. - */ - virtual void clear() = 0; - - /** - * @brief Initialization - * - * @param[in] group The group - * @param[in] compression The compression - */ - virtual void initialize (hid_t group, uint compression) = 0; - - /** - * @brief Serialize this object - * - * @param[in] group The group - */ - virtual void serialize (hid_t group) = 0; - - /** - * @brief Deserialize this object at specified entry - * - * @param[in] group The group - * @param[in] entry The entry - * @param[in] reopen_groups For re-opening groups, if file changed for example - */ - virtual void deserialize(hid_t group, size_t entry, bool reopen_groups) = 0; - - /** - * @brief Finalize this series of objects by closing HDF5 objects - */ - virtual void finalize() = 0; - - /** - * @brief Opens in datasets. - * - * @param[in] group The group - */ - virtual void open_in_datasets(hid_t group ) = 0; - - /** - * @brief Opens out datasets. - * - * @param[in] group The group - */ - virtual void open_out_datasets(hid_t group ) = 0; - - std::vector _open_in_datasets; - std::vector _open_in_dataspaces; - std::vector _open_out_datasets; - std::vector _open_out_dataspaces; - std::vector _data_types; - - /** - * @brief Gets the number objects. - * - * @param[in] group The group - * - * @return The number objects. - */ - int get_num_objects(hid_t group); - - - -// #endif - }; - -} - -#ifdef LARCV_INTERNAL -#include -void init_eventbase(pybind11::module m); -#endif - -#endif //inc guard -/** @} */ // end of doxygen group diff --git a/larcv/include/larcv3/core/dataformat/EventID.h b/larcv/include/larcv3/core/dataformat/EventID.h deleted file mode 100644 index acab22ca..00000000 --- a/larcv/include/larcv3/core/dataformat/EventID.h +++ /dev/null @@ -1,120 +0,0 @@ -/** - * \file EventID.h - * - * \ingroup DataFormat - * - * \brief Class def header for a class EventID - * - * @author kazuhiro, cadams - */ - -/** \addtogroup DataFormat - - @{*/ -#ifndef __LARCV3DATAFORMAT_EVENTID_H -#define __LARCV3DATAFORMAT_EVENTID_H - -#include -#include "larcv3/core/dataformat/DataFormatTypes.h" - -namespace larcv3 { -// class IOManager; -class DataProductFactory; -/** - \class EventID - Base class for an event data product (what is stored in output file), holding - run/subrun/event ID + producer name. -*/ -class EventID { - public: - /// Default constructor - EventID() : _run(kINVALID_LONG), _subrun(kINVALID_LONG), _event(kINVALID_LONG) {} - /// Copy ctor - EventID(const EventID& rhs) - : _run(rhs._run), _subrun(rhs._subrun), _event(rhs._event) {} - - /// Default destructor - ~EventID() = default; - /// Set all run/subrun/event to kINVALID_LONG - void clear(); - /// Run number getter - long run() const { return _run; } - /// SubRun number getter - long subrun() const { return _subrun; } - /// Event number getter - long event() const { return _event; } - - /** - * @brief Set the run number - * - * @param[in] _run The run - */ - inline void run(long _run) { this->_run = _run; } - /// SubRun number setter - inline void subrun(long _subrun) { this->_subrun = _subrun; } - /// Event number setter - inline void event(long _event) { this->_event = _event; } - - /// Make sure run/subrun/event ID is set - bool valid() const { - return !(_run == kINVALID_LONG || _subrun == kINVALID_LONG || - _event == kINVALID_LONG); - } - /// Comparison opearator for run/subrun/event id - inline bool operator==(const EventID& rhs) const { - return (_run == rhs.run() && _subrun == rhs.subrun() && - _event == rhs.event()); - } - /// Comparison opearator for run/subrun/event id - inline bool operator!=(const EventID& rhs) const { return !((*this) == rhs); } - /// Comparison opearator for run/subrun/event id (for sorted container like - /// std::set and/or std::map) - inline bool operator<(const EventID& rhs) const { - if (_run < rhs.run()) return true; - if (_run > rhs.run()) return false; - if (_subrun < rhs.subrun()) return true; - if (_subrun > rhs.subrun()) return false; - if (_event < rhs.event()) return true; - if (_event > rhs.event()) return false; - return false; - } - - /// Formatted string key getter (a string key consists of 0-padded run, - /// subrun, and event id) - std::string event_key() const; - - /// Setting the id - inline void set_id(const long run, const long subrun, - const long event) { - _run = run; - _subrun = subrun; - _event = event; - } - - public: - static hid_t get_datatype() { - hid_t datatype; - datatype = H5Tcreate (H5T_COMPOUND, sizeof (EventID)); - H5Tinsert (datatype, "run", - HOFFSET (EventID, _run), larcv3::get_datatype()); - H5Tinsert (datatype, "subrun", - HOFFSET (EventID, _subrun), larcv3::get_datatype()); - H5Tinsert (datatype, "event", - HOFFSET (EventID, _event), larcv3::get_datatype()); - return datatype; - } - - private: - long _run; ///< LArSoft run number - long _subrun; ///< LArSoft sub-run number - long _event; ///< LArSoft event number -}; -} // namespace larcv3 - -#ifdef LARCV_INTERNAL -#include -void init_eventid(pybind11::module m); -#endif - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/larcv3/core/dataformat/EventParticle.h b/larcv/include/larcv3/core/dataformat/EventParticle.h deleted file mode 100644 index 158567c4..00000000 --- a/larcv/include/larcv3/core/dataformat/EventParticle.h +++ /dev/null @@ -1,110 +0,0 @@ -/** - * \file EventParticle.h - * - * \ingroup DataFormat - * - * \brief Class def header for a class EventParticle - * - * @author kazuhiro - */ - -/** \addtogroup DataFormat - - @{*/ -#ifndef __LARCV3DATAFORMAT_EVENTPARTICLE_H -#define __LARCV3DATAFORMAT_EVENTPARTICLE_H - -#include "larcv3/core/dataformat/EventBase.h" -#include "larcv3/core/dataformat/Particle.h" -#include "larcv3/core/dataformat/DataProductFactory.h" - - -namespace larcv3 { - /** - \class EventParticle - User-defined data product class (please comment!) - */ - class EventParticle : public EventBase { - - public: - - /// Default constructor - EventParticle(); - - /// Default destructor - ~EventParticle(){} - - inline larcv3::Particle at(size_t index) {return _part_v.at(index);} - - - - void set(const std::vector& part_v); - void append(const larcv3::Particle& part); - void emplace_back(larcv3::Particle&& part); - void emplace(std::vector&& part_v); - - inline const std::vector& as_vector() const - { return _part_v; } - - // inline const larcv3::Particle& at(size_t index) const {return _part_v.at(index);} - - inline size_t size() const {return _part_v.size();} - - /// Data clear method - void clear (); - void initialize (hid_t group, uint compression); - void serialize (hid_t group); - void deserialize(hid_t group, size_t entry, bool reopen_groups=false); - void finalize (); - - // static EventParticle * to_particle(EventBase * e){ - // return (EventParticle *) e; - // } - - private: - - void open_in_datasets(hid_t group); - void open_out_datasets(hid_t group); - - std::vector _part_v; ///< a collection of particles (index maintained) - - }; -} - - -#include "IOManager.h" -namespace larcv3 { - - // Template instantiation for IO - template<> - inline std::string product_unique_name() { return "particle"; } - // template<> - // inline EventParticle& IOManager::get_data(const std::string&); - // template<> - // inline EventParticle& IOManager::get_data(const ProducerID_t); - - /** - \class larcv3::EventParticle - \brief A concrete factory class for larcv3::EventParticle - */ - class EventParticleFactory : public DataProductFactoryBase { - public: - /// ctor - EventParticleFactory() - { DataProductFactory::get().add_factory(product_unique_name(),this); } - /// dtor - ~EventParticleFactory() {} - /// create method - EventBase* create() { return new EventParticle; } - }; - - -} - -#ifdef LARCV_INTERNAL -#include -void init_eventparticle(pybind11::module m); -#endif - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/larcv3/core/dataformat/EventSparseCluster.h b/larcv/include/larcv3/core/dataformat/EventSparseCluster.h deleted file mode 100644 index c574d13f..00000000 --- a/larcv/include/larcv3/core/dataformat/EventSparseCluster.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * \file EventSparseCluster.h - * - * \ingroup DataFormat - * - * \brief Class def header for a class larcv3::EventSparseCluster 2D and 3D - * - * @author kazuhiro - * @author cadams - - - * \addtogroup DataFormat - -*/ -#ifndef __LARCV3DATAFORMAT_EVENTSPARSECLUSTER_H -#define __LARCV3DATAFORMAT_EVENTSPARSECLUSTER_H - -#include -#include "larcv3/core/dataformat/EventBase.h" -#include "larcv3/core/dataformat/DataProductFactory.h" -#include "larcv3/core/dataformat/Voxel.h" -#include "larcv3/core/dataformat/ImageMeta.h" - -namespace larcv3 { - - /** - \class EventSparseCluster2D - \brief Event-wise class to store a collection of VoxelSet (cluster) per projection id - */ - template - class EventSparseCluster : public EventBase { - - public: - - /// Default constructor - EventSparseCluster(); - - /// Default destructor - virtual ~EventSparseCluster() {} - - /// EventBase::clear() override - inline void clear() {_cluster_v.clear();} - - inline larcv3::SparseCluster at(size_t index) {return _cluster_v.at(index);} - - /// Access to all stores larcv3::SparseCluster - inline const std::vector >& as_vector() const { return _cluster_v; } - - /// Access SparseCluster of a specific projection ID - const larcv3::SparseCluster & sparse_cluster(const ProjectionID_t id) const; - - /// Number of valid projection id - inline size_t size() const { return _cluster_v.size(); } - - // - // Write-access - // - /// Emplace data - void emplace(larcv3::SparseCluster&& clusters); - /// Set data - void set(const larcv3::SparseCluster& clusters); - /// Emplace a new element - void emplace(larcv3::VoxelSetArray&& clusters, larcv3::ImageMeta&& meta); - - - - // IO functions: - void initialize (hid_t group, uint compression); - void serialize (hid_t group); - void deserialize(hid_t group, size_t entry, bool reopen_groups=false); - void finalize (); - - - static EventSparseCluster * to_sparse_cluster(EventBase * e){ - return (EventSparseCluster *) e; - } - - private: - void open_in_datasets(hid_t group); - void open_out_datasets(hid_t group); - std::vector > _cluster_v; - - }; - -typedef EventSparseCluster<2> EventSparseCluster2D; -typedef EventSparseCluster<3> EventSparseCluster3D; - -} - - -#include "IOManager.h" -namespace larcv3 { - - // Template instantiation for IO - template<> inline std::string product_unique_name() { return "cluster2d"; } - template<> inline std::string product_unique_name() { return "cluster3d"; } - - - // \class larcv3::EventSparseCluster - // \brief A concrete factory class for larcv3::EventSparseCluster - - - class EventSparseCluster2DFactory : public DataProductFactoryBase { - public: - /// ctor - EventSparseCluster2DFactory() - { DataProductFactory::get().add_factory(product_unique_name(), this); } - /// dtor - ~EventSparseCluster2DFactory() {} - /// create method - EventBase* create() { return new EventSparseCluster2D; } - }; - - class EventSparseCluster3DFactory : public DataProductFactoryBase { - public: - /// ctor - EventSparseCluster3DFactory() - { DataProductFactory::get().add_factory(product_unique_name(), this); } - /// dtor - ~EventSparseCluster3DFactory() {} - /// create method - EventBase* create() { return new EventSparseCluster3D; } - }; - -} - - -#ifdef LARCV_INTERNAL -#include -template -void init_eventsparse_cluster_base(pybind11::module m); - -void init_eventsparsecluster(pybind11::module m); -#endif - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/larcv3/core/dataformat/EventSparseTensor.h b/larcv/include/larcv3/core/dataformat/EventSparseTensor.h deleted file mode 100644 index ee744100..00000000 --- a/larcv/include/larcv3/core/dataformat/EventSparseTensor.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * \file EventSparseTensor.h - * - * \ingroup DataFormat - * - * \brief Class def header for a class larcv3::EventSparseTensor and larcv3::EventClusterPixel2D - * - * @author kazuhiro - * @author cadams - - * \addtogroup DataFormat -*/ - -#ifndef __LARCV3DATAFORMAT_EVENTSPARSETENSOR_H -#define __LARCV3DATAFORMAT_EVENTSPARSETENSOR_H - - -#include -#include "larcv3/core/dataformat/EventBase.h" -#include "larcv3/core/dataformat/DataProductFactory.h" -#include "larcv3/core/dataformat/Voxel.h" -#include "larcv3/core/dataformat/ImageMeta.h" - - - -namespace larcv3 { - - /** - \class EventSparseTensor - \brief Event-wise class to store a collection of VoxelSet (cluster) per projection id - */ - template - class EventSparseTensor : public EventBase { - - public: - - /// Default constructor - EventSparseTensor(); - - - // - // Read-access - // - /// Access to all stores larcv3::SparseTensor - inline const std::vector >& as_vector() const { return _tensor_v; } - /// Access SparseTensor of a specific projection ID - const larcv3::SparseTensor & sparse_tensor(const ProjectionID_t id) const; - /// Number of valid projection id - inline size_t size() const { return _tensor_v.size(); } - - inline larcv3::SparseTensor at(size_t index) {return _tensor_v.at(index);} - - - // - // Write-access - // - /// EventBase::clear() override - void clear() {} - /// Emplace data - void emplace(larcv3::SparseTensor && voxels); - /// Set data` - void set(const larcv3::SparseTensor & voxels); - /// Emplace a new element - void emplace(larcv3::VoxelSet&& voxels, larcv3::ImageMeta&& meta); - /// Set a new element - void set(const larcv3::VoxelSet& voxels, const larcv3::ImageMeta& meta); - - - // IO functions: - void initialize (hid_t group, uint compression); - void serialize (hid_t group); - void deserialize(hid_t group, size_t entry, bool reopen_groups=false); - void finalize (); - - private: - void open_in_datasets(hid_t group); - void open_out_datasets(hid_t group); - - std::vector > _tensor_v; - - - - }; - - -typedef EventSparseTensor<2> EventSparseTensor2D; -typedef EventSparseTensor<3> EventSparseTensor3D; - - -} - - -#include "IOManager.h" -namespace larcv3 { - - // Template instantiation for IO - template<> inline std::string product_unique_name() { return "sparse2d"; } - template<> inline std::string product_unique_name() { return "sparse3d"; } - - - /** - \class larcv3::EventSparseTensorFactory - \brief A concrete factory class for larcv3::EventSparseTensor - */ - - - template - class EventSparseTensorFactory : public DataProductFactoryBase { - public: - /// ctor - EventSparseTensorFactory() - { DataProductFactory::get().add_factory(product_unique_name>(), this); } - /// dtor - ~EventSparseTensorFactory() {} - /// create method - EventBase* create() { return new EventSparseTensor; } - }; - -} - -#ifdef LARCV_INTERNAL -#include -template -void init_eventsparse_tensor_base(pybind11::module m); - -void init_eventsparsetensor(pybind11::module m); -#endif - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/larcv3/core/dataformat/EventTensor.h b/larcv/include/larcv3/core/dataformat/EventTensor.h deleted file mode 100644 index 121e2df4..00000000 --- a/larcv/include/larcv3/core/dataformat/EventTensor.h +++ /dev/null @@ -1,133 +0,0 @@ -/** - * \file EventTensor.h - * - * \ingroup DataFormat - * - * \brief Class def header for a class EventTensor (was EventImage2D) - * - * @author kazuhiro - * @author cadams - */ - -/** \addtogroup DataFormat - - @{*/ -#ifndef __LARCV3DATAFORMAT_EVENTTENSOR_H -#define __LARCV3DATAFORMAT_EVENTTENSOR_H - -#include -#include "larcv3/core/dataformat/EventBase.h" -#include "larcv3/core/dataformat/Tensor.h" -#include "larcv3/core/dataformat/DataProductFactory.h" - -#ifdef LARCV_INTERNAL -#include -#include -#endif - -namespace larcv3 { - - /** - \class EventTensor - Event-wise class to store a collection of larcv3::Tensor - */ - template - class EventTensor : public EventBase { - - public: - - EventTensor(); - - /// Const reference getter to an array of larcv3::Tensor - const std::vector>& as_vector() const { return _image_v; } - -#ifdef LARCV_INTERNAL - /// Get a list of numpy arrays for each projection ID - // std::vector > numpy() const; -#endif - - // inline std::shared_ptr>& at(size_t index) const {return _image_v.at(index);} - - /// Deprecated (use as_vector): const reference getter to an array of larcv3::Tensor - const std::vector>& image2d_array() const { return _image_v; } - - /// Access Tensor of a specific projection ID - const larcv3::Tensor & tensor(const ProjectionID_t id) const; - - /// Number of valid projection id - inline size_t size() const { return _image_v.size(); } - - - /// Clears an array of larcv3::Tensor - void clear(); - /// Inserter into larcv3::Tensor array - void append(const Tensor& img); - /// Emplace into larcv3::Tensor array - void emplace(Tensor&& img); - /// Emplace into larcv3::Tensor array - void emplace(std::vector>&& image_v); - /// std::move to retrieve content larcv3::Tensor array - void move(std::vector>& image_v) - { image_v = std::move(_image_v); } - - void initialize (hid_t group, uint compression); - void serialize (hid_t group); - void deserialize(hid_t group, size_t entry, bool reopen_groups=false); - void finalize (); - - private: - void open_in_datasets(hid_t group); - void open_out_datasets(hid_t group); - - std::vector> _image_v; - - uint _compression; - - }; - - typedef EventTensor<1> EventTensor1D; - typedef EventTensor<2> EventTensor2D; - typedef EventTensor<3> EventTensor3D; - typedef EventTensor<4> EventTensor4D; - -} - -#include "IOManager.h" -namespace larcv3 { - - // Template instantiation for IO - template<> inline std::string product_unique_name() { return "tensor1d"; } - template<> inline std::string product_unique_name() { return "image2d"; } - template<> inline std::string product_unique_name() { return "tensor3d"; } - template<> inline std::string product_unique_name() { return "tensor4d"; } - - - /** - \class larcv3::EventTensor - \brief A concrete factory class for larcv3::EventTensor - */ - - template - class EventTensorFactory : public DataProductFactoryBase { - public: - /// ctor - EventTensorFactory() - { DataProductFactory::get().add_factory(product_unique_name>(),this); } - /// dtor - ~EventTensorFactory() {} - /// create method - EventBase* create() { return new EventTensor; } - }; - -} - -#ifdef LARCV_INTERNAL -#include -template -void init_event_tensor_base(pybind11::module m); - -void init_eventtensor(pybind11::module m); -#endif - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/larcv3/core/dataformat/IOManager.h b/larcv/include/larcv3/core/dataformat/IOManager.h deleted file mode 100644 index 099992fe..00000000 --- a/larcv/include/larcv3/core/dataformat/IOManager.h +++ /dev/null @@ -1,281 +0,0 @@ -/** - * \file IOManager.h - * - * \ingroup DataFormat - * - * \brief Class def header for a class larcv3::IOManager - * - * @author drinkingkazu - * @author coreyjadams - */ - -/** \addtogroup DataFormat - - @{*/ -#ifndef __LARCV3DATAFORMAT_IOMANAGER_H -#define __LARCV3DATAFORMAT_IOMANAGER_H - -#include -#include -#include -#include - -#include "hdf5.h" - -#ifdef LARCV_MPI -#include -#endif - -#include "larcv3/core/base/larcv_base.h" -#include "larcv3/core/base/larbys.h" -#include "larcv3/core/dataformat/EventBase.h" -#include "larcv3/core/dataformat/EventID.h" - -//#include "ProductMap.h" -namespace larcv3 { - - - /** - \class IOManager - \brief LArCV3 file IO hanlder class: it can read/write LArCV3 file. - */ - class IOManager : public larcv3::larcv_base { - - public: - /// Three IO modes: read, write, or read-and-write - enum IOMode_t { kREAD, kWRITE, kBOTH }; - enum ProductStatus_t {kUnknown, kInputFileUnread, kInputFileRead, kOutputOnly, kVirtual}; - - /// Default constructor - IOManager(IOMode_t mode = kREAD, std::string name = "IOManager"); - - /// Configuration json construction so you don't have to call setter functions - IOManager(const json& cfg); - void configure(const json& cfg); - - json get_config(){return config;} - - /// Destructor - ~IOManager(); - /// IO mode accessor - IOMode_t io_mode() const { return config["IOMode"].get();} - void reset(); - void add_in_file(const std::string filename); - void clear_in_file(); - void set_core_driver(const bool opt = true); - void set_out_file(const std::string name); - ProducerID_t producer_id(const ProducerName_t& name) const; - std::string product_type(const size_t id) const; - bool initialize(int color=0); - bool read_entry(const size_t index, bool force_reload = false); - bool save_entry(); - void finalize(); - void clear_entry(); - void set_id(const long run, const long subrun, const long event); - size_t current_entry() const { return _in_index; } - - size_t get_n_entries_out() const - { return _out_entries;} - - std::string get_file_out_name() const - { return config["Output"]["OutFileName"];} - - size_t get_n_entries() const - { return (_in_entries_total ? _in_entries_total : _out_entries); } - - std::shared_ptr get_data(const std::string& type, const std::string& producer); - std::shared_ptr get_data(const ProducerID_t id); - // - // Some template class getter for auto-cast - // - - template - inline T& get_data(const std::string& producer) - { return * std::dynamic_pointer_cast (this->get_data(product_unique_name(), producer)); } - - template - inline T& get_data(const ProducerID_t id) - { - if (id >= _product_type_v.size()) { - LARCV_CRITICAL() << "Invalid producer id: " << id << " requested " << std::endl; - throw larbys(); - } - auto ptr = this->get_data(id); - if (product_unique_name() != _product_type_v[id]) { - LARCV_CRITICAL() << "Unmatched type (in memory type = " << _product_type_v[id] - << " while specialization type = " << product_unique_name() - << std::endl; - throw larbys(); - } - return * std::dynamic_pointer_cast (ptr); - } - - const EventID& event_id() const; - - const EventID& last_event_id() const { return _last_event_id; } - - const std::vector producer_list(const std::string type) const - { - std::vector res; - for (auto const& key_value : _key_list) { - if (key_value.first.first != type) continue; - res.push_back(key_value.first.second); - } - return res; - } - - const std::vector product_list() const - { - std::vector res; - for (auto const& key_value : _key_list) { - res.push_back(key_value.first.first); - } - return res; - } - - const std::vector file_list() const - { return config["Input"]["InputFiles"].get >(); } - - static json default_config(){ - json c = { - {"Verbosity", logger::default_level()}, - {"IOMode", kREAD}, - {"Input" , { - {"InputFiles", std::vector()}, - {"UseH5CoreDriver", false}, - {"ReadOnlyName", std::vector()}, - {"ReadOnlyType", std::vector()}, - }}, - {"Output", { - {"OutFileName", ""}, - {"Compression", 1}, - {"StoreOnlyName", std::vector()}, - {"StoreOnlyType", std::vector()}, - }}, - }; - return c; - } - - protected: - void set_id(); - void prepare_input(); - size_t register_producer(const ProducerName_t& name); - - void open_new_input_file(std::string filename); - void read_current_event_id(); - - void append_event_id(); - - // Closes the objects currently open in file with id fid - int close_all_objects(hid_t fid); - - // Default configuration for IO manager: - json config; - - - // The hdf5 model enforces the same number of entries per group, - // since the entry list is defined per file. - - // IOManager supports only one output file, but multiple input files. - // Files are checked for consistency in which groups are present. - - // General Parameters - bool _prepared; - - - // Parameters controlling output file large scale tracking: - // ID of the output file: - hid_t _out_file; - // Current output index - size_t _out_index; - // Total output entries - size_t _out_entries; - - - // Parameters controllign input file large scale tracking: - // Current index in the input files - size_t _in_index; - size_t _current_offset; - // Total number of input entries - size_t _in_entries_total; - // Index of currently active file - size_t _in_active_file_index; - // Currently open file: - hid_t _in_open_file; - // List of total entries in input files - std::vector _in_entries_v; - - // Parameters for the event ID management: - EventID _event_id; - EventID _set_event_id; - EventID _last_event_id; - - hid_t _active_in_event_id_dataset; - hid_t _active_in_event_id_dataspace; - - hid_t data_group; - hid_t events_group; - - - // Parameters controlling the internals of an event. - // Dealing with input groups: - - - // Output groups. Since these are stored and need to be initialized, this is a member: - std::vector _out_group_v; - - - // Key list keeps track of the mapping from producer/product to an id: - std::map _key_list; - // This is the key list for all producers in the input file only: - std::map _in_key_list; - - - // Hold a copy of the file access property list: - hid_t _fapl; //FileAccPropList - - std::map _groups; - - - // Keeping track of products and producers: - size_t _product_ctr; - std::vector> _product_ptr_v; - std::vector _product_type_v; - std::vector _producer_name_v; - std::vector _product_status_v; - - // General IO: - std::map > _store_only; - std::map > _read_only; - std::vector _store_id_bool; - std::vector _read_id_bool; - - - // IOManager has to control the EventID dataset it's self for the output file. - hid_t _out_event_id_ds; // dataset - hid_t _event_id_datatype; // datatype - hid_t xfer_plist_id; - - // Internal bookkeeping for when the input file switches: - bool _force_reopen_groups; - - - // MPI Variables: -#ifdef LARCV_MPI - - MPI_Comm _private_comm; - int _private_rank; - int _private_size; - -#endif - - }; - -} -#ifdef LARCV_INTERNAL -#include -void init_iomanager(pybind11::module m); -#endif - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/larcv3/core/dataformat/ImageMeta.h b/larcv/include/larcv3/core/dataformat/ImageMeta.h deleted file mode 100644 index 1b8a94e1..00000000 --- a/larcv/include/larcv3/core/dataformat/ImageMeta.h +++ /dev/null @@ -1,253 +0,0 @@ -/** - * \file ImageMeta.h - * - * \ingroup DataFormat - * - * \brief Class def header for a class larcv3::ImageMeta - * - * @author kazuhiro - * @author cadams - * - * This class defines an abstract rectangular voxelized region in N dimension space - * The class is represented by it's number of dimensions, as well as the number - * of voxels in each dimension and the absolute length of each dimension in real space. - * A "position" is the real valued coordinate inside this space - * A "coordinate" is the voxelized location inside this space, ranging from 0 to n_dims - * An "index" is a unique, single value for each coordinate. - */ - -/** \addtogroup DataFormat - - @{*/ -#ifndef __LARCV3DATAFORMAT_IMAGEMETA_H__ -#define __LARCV3DATAFORMAT_IMAGEMETA_H__ - -#include -#include -#include "larcv3/core/dataformat/DataFormatTypes.h" -#include "larcv3/core/base/larbys.h" - -namespace larcv3 { - -template -class ImageMeta { - public: - /// Default constructor: Does nothing, valid defaults to false - ImageMeta(); - - /// Constructor with arguments: ndims, dims, image_sizes, unit. - ImageMeta(size_t projection_id, - const std::vector& number_of_voxels, - const std::vector& image_sizes, - const std::vector& origin = std::vector(), - DistanceUnit_t unit = kUnitUnknown); - - // Copy constructor - ImageMeta(const ImageMeta & other); - // Assignment operator: - ImageMeta& operator=(const ImageMeta & other); - - // Comparison operators: - inline bool operator==(const ImageMeta & rhs) const { - for (size_t i = 0; i < dimension; i ++){ - if (_image_sizes[i] != rhs._image_sizes[i]) - return false; - if (_number_of_voxels[i] != rhs._number_of_voxels[i]) - return false; - if (_origin[i] != rhs._origin[i]) - return false; - } - return ( - _projection_id == rhs._projection_id && - _unit == rhs._unit); - } - - inline bool operator!=(const ImageMeta & rhs) const { - return !((*this) == rhs); - } - - - - inline const size_t projection_id() const{ return _projection_id;} - inline const size_t id() const{return _projection_id;} - /// Operators to access information about the image meta: - - inline const double * image_size() const {return _image_sizes;} - inline const size_t * number_of_voxels() const {return _number_of_voxels;} - inline const double * origin() const {return _origin;} - std::vector< size_t > strides() const; - - - inline size_t n_dims() const { return dimension; } - - double image_size(size_t axis) const; - size_t number_of_voxels(size_t axis) const; - double origin(size_t axis) const; - - size_t total_voxels() const; - double total_volume() const; - - std::vector voxel_dimensions() const; - double voxel_dimensions(size_t axis) const; - - /// 2D length unit - inline DistanceUnit_t unit() const { return _unit; } - - /// Provide 1-D array index dimension from general coordinates - size_t index(const std::vector & coordinate) const; - - /// Vectorized version for converting all coordinates to index: - /// Coordinates is flattened here as [x0, y0, z0, x1, y1, z1, x2, y2, z2, x3 ....] - void index( const std::vector & coordinates, std::vector & output_index) const; - - - /// Convert 1D index to overall coordinates - std::vector coordinates( size_t index) const; - /// Vectorized version for converting all indexes into coordinates - /// Coordinates is flattened here as [x0, y0, z0, x1, y1, z1, x2, y2, z2, x3 ....] - void coordinates( const std::vector & index, std::vector & output_coordinates) const; - - - - /// Convert 1D index to overall coordiante along specified axis - size_t coordinate(size_t index, size_t axis) const; - /// There is no vectorized version of the single axis coordinate, open an issue if you need it. - - - /// Provide absolute coordinate of the center of a specified pixel index - std::vector position(size_t index) const; - - /// Provide absolute coordinate of the center of a specified pixel (row,col) - std::vector position(const std::vector & coordinates) const; - - - /// Same as above, but restricted to a single axis - double position(size_t index, size_t axis) const; - - /// Same as above, but restricted to a single axis - double position(const std::vector & coordinates, size_t axis) const; - - // Compress the meta by a common factor along each dimension - ImageMeta compress(size_t compression) const; - - // Compress the meta by a unique factor along each dimension - ImageMeta compress(std::array compression) const; - - - /// Provide the minimum and maximum real space values of the image. - std::vector min() const; - std::vector max() const; - double min(size_t axis) const; - double max(size_t axis) const; - - - //Provide a conversion from a real position to an index or coordinate - size_t position_to_index(const std::vector & position ) const; - std::vector position_to_coordinate(const std::vector & position) const; - /// Map just one position to just one coordinate - size_t position_to_coordinate(double position, size_t axis) const; - - // This function is useful to interactively build up a meta object - // Each dimension ImageMeta is meant to store the number of voxels as well as the physical space those voxels represent - // image_size is the physical length of the dimension, regardless of voxel size - // number_of_voxels is the total number of voxels used along the full image_size - // origin is the lowest value in physical space of this dimension. Typically this is 0 but doesn't need to be. - void set_dimension(size_t axis, double image_size, size_t number_of_voxels, double origin = 0); - - inline void set_projection_id(size_t projection_id){_projection_id = projection_id;} - - bool is_valid() const; - - - // These functions are mostly for historical compatibility and consistence: - // inline size_t std::enable_if::type cols () - // { - // } - - inline size_t cols() const {return _number_of_voxels[0];} - size_t rows() const; - - // inline void update(size_t row_count, size_t col_count) { - // _row_count = row_count; - // _col_count = col_count; - // } - // /// Reset origin coordinate - // inline void reset_origin(double x, double y) { - // BBox2D::update(x, y, max_x(), max_y()); - // } - - // /// Check if there's an overlap. If so return overlapping bounding box - // ImageMeta overlap(const ImageMeta& meta) const; - // /// Construct a union bounding box - // ImageMeta inclusive(const ImageMeta& meta) const; - - /// Dump info in text - std::string dump() const; - - - public: - static hid_t get_datatype() { - hid_t datatype; - datatype = H5Tcreate (H5T_COMPOUND, sizeof (ImageMeta)); - - hsize_t array_dimensions[1]; - array_dimensions[0] = dimension; - - - hid_t double_type = H5Tarray_create(larcv3::get_datatype(), 1, array_dimensions); - hid_t size_t_type = H5Tarray_create(larcv3::get_datatype(), 1, array_dimensions); - - H5Tinsert (datatype, "valid", - HOFFSET (ImageMeta, _valid), - larcv3::get_datatype()); - H5Tinsert (datatype, "projection_id", - HOFFSET (ImageMeta, _projection_id), - larcv3::get_datatype()); - H5Tinsert (datatype, "image_sizes", - HOFFSET (ImageMeta, _image_sizes), - double_type); - H5Tinsert (datatype, "number_of_voxels", - HOFFSET (ImageMeta, _number_of_voxels), - size_t_type); - H5Tinsert (datatype, "origin", - HOFFSET (ImageMeta, _origin), - double_type); - return datatype; - } - - - protected: - // ImageIndex_t _image_id; ///< Associated image ID (of the same producer - // name) - - bool _valid; ///< Boolean set to true only if voxel parameters are properly set - // size_t _n_dims; - size_t _projection_id; - double _image_sizes[dimension]; ///< image size in [_unit] along each dimension - size_t _number_of_voxels[dimension]; ///< Total number of voxels in each dimension - double _origin[dimension]; ///The location of index==0 - - - DistanceUnit_t _unit; ///< length unit -}; - -typedef ImageMeta<1> ImageMeta1D; -typedef ImageMeta<2> ImageMeta2D; -typedef ImageMeta<3> ImageMeta3D; -typedef ImageMeta<4> ImageMeta4D; - - -} // namespace larcv3 - -#ifdef LARCV_INTERNAL -#include - -void init_imagemeta(pybind11::module m); - -template -void init_imagemeta_base(pybind11::module m); - -#endif - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/larcv3/core/dataformat/Particle.h b/larcv/include/larcv3/core/dataformat/Particle.h deleted file mode 100644 index a641c5aa..00000000 --- a/larcv/include/larcv3/core/dataformat/Particle.h +++ /dev/null @@ -1,290 +0,0 @@ -/** - * \file Particle.h - * - * \ingroup DataFormat - * - * \brief Class def header for a class larcv3::Particle - * - * @author kazuhiro - */ - -/** \addtogroup DataFormat - - @{*/ -#ifndef __LARCV3DATAFORMAT_PARTICLE_H__ -#define __LARCV3DATAFORMAT_PARTICLE_H__ - -#include -#include "larcv3/core/dataformat/Vertex.h" -// #include "BBox.h" -#include "larcv3/core/dataformat/DataFormatTypes.h" - -// In hdf5, strings are fixed length so we set the maximum length here: -#define PARTICLE_PROCESS_STRLEN 64 - -#ifdef LARCV_INTERNAL -#include -#include -#endif - -namespace larcv3 { - - struct ParticleHolder{ - - - InstanceID_t _id; ///< "ID" of this particle - /// index number in the origin MCShower/MCTrack container array (kINVALID_USHORT if neither) - MCSTIndex_t _mcst_index; - ///< index number in the origin MCTruth container array (kINVALID_USHORT if MCShower/MCTrack) - MCTIndex_t _mct_index; - ShapeType_t _shape; ///< shows if it is (e+/e-/gamma) or other particle types - short _current_type; ///< if neutrino, shows interaction GENIE current type. else kINVALID_USHORT - short _interaction_type; ///< if neutrino, shows interaction GENIE code. else kINVALID_USHORT - - unsigned int _trackid; ///< Geant4 track id - int _pdg; ///< PDG code - double _px,_py,_pz; ///< (x,y,z) component of particle's initial momentum - Vertex _vtx; ///< (x,y,z,t) of particle's vertex information - Vertex _end_pt; ///< (x,y,z,t) at which particle disappeared from G4WorldVolume - Vertex _first_step; ///< (x,y,z,t) of the first energy deposition point in the detector - Vertex _last_step; ///< (x,y,z,t) of the last energy deposition point in the detector - double _dist_travel; ///< filled only if MCTrack origin: distance measured along the trajectory - double _energy_init; ///< initial energy of the particle - double _energy_deposit; ///< deposited energy of the particle in the detector - char _process[PARTICLE_PROCESS_STRLEN]; ///< string identifier of the particle's creation process from Geant4 - // std::vector _bb2d_v; ///< bounding box of particle's trajectory in 2D projections. index = ProjectionID_t - // larcv3::BBox3D _bb3d; ///< bounding box of particle's trajectory in 3D - // int _num_voxels; ///< Number of voxels in the particle's 3D cluster. - - unsigned int _parent_trackid; ///< Geant4 track id of the parent particle - int _parent_pdg; ///< PDG code of the parent particle - Vertex _parent_vtx; ///< (x,y,z,t) of parent's vertex information - - unsigned int _ancestor_trackid; ///< Geant4 track id of the ancestor particle - int _ancestor_pdg; ///< PDG code of the ancestor particle - Vertex _ancestor_vtx; ///< (x,y,z,t) of ancestor's vertex information - }; - - /** - \class Particle - \brief Particle/Interaction-wise truth information data - */ - class Particle{ - - public: - - /// Default constructor - Particle(larcv3::ShapeType_t shape=larcv3::kShapeUnknown); - - - - /// Default destructor - ~Particle(){} - /// particle's ID getter - inline ParticleIndex_t id () const { return _particle_holder._id; } - // origin/generator info getter - inline ShapeType_t shape () const { return _particle_holder._shape; } - inline MCSTIndex_t mcst_index () const { return _particle_holder._mcst_index; } - inline MCTIndex_t mct_index () const { return _particle_holder._mct_index; } - inline short nu_current_type () const { return _particle_holder._current_type; } - inline short nu_interaction_type () const { return _particle_holder._interaction_type; } - // particle's info getter - inline unsigned int track_id () const { return _particle_holder._trackid; } - inline int pdg_code () const { return _particle_holder._pdg; } - inline double px () const { return _particle_holder._px; } - inline double py () const { return _particle_holder._py; } - inline double pz () const { return _particle_holder._pz; } - inline double p () const { return sqrt(pow(_particle_holder._px,2)+pow(_particle_holder._py,2)+pow(_particle_holder._pz,2)); } - inline const larcv3::Vertex& position() const { return _particle_holder._vtx; } - inline double x () const { return _particle_holder._vtx.x(); } - inline double y () const { return _particle_holder._vtx.y(); } - inline double z () const { return _particle_holder._vtx.z(); } - inline double t () const { return _particle_holder._vtx.t(); } - inline const larcv3::Vertex& end_position () const { return _particle_holder._end_pt; } - inline const larcv3::Vertex& first_step () const { return _particle_holder._first_step; } - inline const larcv3::Vertex& last_step () const { return _particle_holder._last_step; } - inline double distance_travel () const { return _particle_holder._dist_travel; } - inline double energy_init () const { return _particle_holder._energy_init; } - inline double energy_deposit () const { return _particle_holder._energy_deposit; } - std::string creation_process() const; - - // const BBox2D& boundingbox_2d(ProjectionID_t id) const; - // inline const std::vector& boundingbox_2d() const { return _bb2d_v; } - // inline const BBox3D& boundingbox_3d() const { return _bb3d; } - - // inline int num_voxels() const { return _num_voxels; } - - // parent info getter - inline unsigned int parent_track_id () const { return _particle_holder._parent_trackid; } - inline int parent_pdg_code () const { return _particle_holder._parent_pdg; } - inline const larcv3::Vertex& parent_position () const { return _particle_holder._parent_vtx;} - inline double parent_x () const { return _particle_holder._parent_vtx.x(); } - inline double parent_y () const { return _particle_holder._parent_vtx.y(); } - inline double parent_z () const { return _particle_holder._parent_vtx.z(); } - inline double parent_t () const { return _particle_holder._parent_vtx.t(); } - - // ancestor info getter - inline unsigned int ancestor_track_id () const { return _particle_holder._ancestor_trackid; } - inline int ancestor_pdg_code () const { return _particle_holder._ancestor_pdg; } - inline const larcv3::Vertex& ancestor_position () const { return _particle_holder._ancestor_vtx;} - inline double ancestor_x () const { return _particle_holder._ancestor_vtx.x(); } - inline double ancestor_y () const { return _particle_holder._ancestor_vtx.y(); } - inline double ancestor_z () const { return _particle_holder._ancestor_vtx.z(); } - inline double ancestor_t () const { return _particle_holder._ancestor_vtx.t(); } - - // - // Setters - // - // generator/origin info setter - inline void id (InstanceID_t id ) { _particle_holder._id = id; } - inline void mcst_index (MCSTIndex_t id ) { _particle_holder._mcst_index = id; } - inline void mct_index (MCTIndex_t id ) { _particle_holder._mct_index = id; } - inline void shape (ShapeType_t shape ) { _particle_holder._shape = shape; } - inline void nu_current_type (short curr) {_particle_holder._current_type = curr; } - inline void nu_interaction_type (short itype) {_particle_holder._interaction_type = itype; } - // particle's info setter - inline void track_id (unsigned int id ) { _particle_holder._trackid = id; } - inline void pdg_code (int code) { _particle_holder._pdg = code; } - inline void momentum (double px, double py, double pz) { - _particle_holder._px = px; _particle_holder._py = py; _particle_holder._pz = pz; } - inline void position (const larcv3::Vertex& vtx) { _particle_holder._vtx = vtx; } - inline void position (double x, double y, double z, double t) { _particle_holder._vtx = Vertex(x,y,z,t); } - inline void end_position (const larcv3::Vertex& vtx) { _particle_holder._end_pt = vtx; } - inline void end_position (double x, double y, double z, double t) { _particle_holder._end_pt = Vertex(x,y,z,t); } - inline void first_step (const larcv3::Vertex& vtx) { _particle_holder._first_step = vtx; } - inline void first_step (double x, double y, double z, double t) { _particle_holder._first_step = Vertex(x,y,z,t); } - inline void last_step (const larcv3::Vertex& vtx) { _particle_holder._last_step = vtx; } - inline void last_step (double x, double y, double z, double t) { _particle_holder._last_step = Vertex(x,y,z,t); } - inline void distance_travel ( double dist ) { _particle_holder._dist_travel = dist; } - inline void energy_init (double e) { _particle_holder._energy_init = e; } - inline void energy_deposit (double e) { _particle_holder._energy_deposit = e; } - void creation_process (const std::string& proc); - // inline void boundingbox_2d(const std::vector& bb_v) { _bb2d_v = bb_v; } - // inline void boundingbox_2d(const BBox2D& bb, ProjectionID_t id) { _bb2d_v.resize(id+1); _bb2d_v[id] = bb; } - // inline void boundingbox_3d(const BBox3D& bb) { _bb3d = bb; } - // inline void num_voxels(int count) { _num_voxels = count; } - //inline void type_score (const std::vector& score_v) { _type_score_v = score_v; } - // parent info setter - inline void parent_track_id (unsigned int id ) { _particle_holder._parent_trackid = id;} - inline void parent_pdg_code (int code) { _particle_holder._parent_pdg = code; } - inline void parent_position (const larcv3::Vertex& vtx) { _particle_holder._parent_vtx = vtx; } - inline void parent_position (double x, double y, double z, double t) { _particle_holder._parent_vtx = Vertex(x,y,z,t); } - // ancestor info setter - inline void ancestor_track_id (unsigned int id ) { _particle_holder._ancestor_trackid = id;} - inline void ancestor_pdg_code (int code) { _particle_holder._ancestor_pdg = code; } - inline void ancestor_position (const larcv3::Vertex& vtx) { _particle_holder._ancestor_vtx = vtx; } - inline void ancestor_position (double x, double y, double z, double t) { _particle_holder._ancestor_vtx = Vertex(x,y,z,t); } - - std::string dump() const; - - // These functions only appear in larcv proper, not in included headers: -#ifdef LARCV_INTERNAL - // Return a numpy array of this object (no copy by default) - pybind11::array_t as_array(); -#endif - - - public: - static hid_t get_datatype() { - hid_t datatype; - datatype = H5Tcreate (H5T_COMPOUND, sizeof (ParticleHolder)); - - // Get the compound types: - hid_t string_type = H5Tcopy (H5T_C_S1); - H5Tset_size(string_type, PARTICLE_PROCESS_STRLEN); - - H5Tinsert(datatype, "id", - HOFFSET(Particle, _particle_holder._id), - larcv3::get_datatype()); - H5Tinsert(datatype, "mcst_index", - HOFFSET(Particle, _particle_holder._mcst_index), - larcv3::get_datatype()); - H5Tinsert(datatype, "mct_index", - HOFFSET(Particle, _particle_holder._mct_index), - larcv3::get_datatype()); - H5Tinsert(datatype, "shape", - HOFFSET(Particle, _particle_holder._shape), - larcv3::get_datatype()); - H5Tinsert(datatype, "current_type", - HOFFSET(Particle, _particle_holder._current_type), - larcv3::get_datatype()); - H5Tinsert(datatype, "interaction_type", - HOFFSET(Particle, _particle_holder._interaction_type), - larcv3::get_datatype()); - H5Tinsert(datatype, "trackid", - HOFFSET(Particle, _particle_holder._trackid), - larcv3::get_datatype()); - H5Tinsert(datatype, "pdg", - HOFFSET(Particle, _particle_holder._pdg), - larcv3::get_datatype()); - H5Tinsert(datatype, "px", - HOFFSET(Particle, _particle_holder._px), - larcv3::get_datatype()); - H5Tinsert(datatype, "py", - HOFFSET(Particle, _particle_holder._py), - larcv3::get_datatype()); - H5Tinsert(datatype, "pz", - HOFFSET(Particle, _particle_holder._pz), - larcv3::get_datatype()); - H5Tinsert(datatype, "vtx", - HOFFSET(Particle, _particle_holder._vtx), - Vertex::get_datatype()); - H5Tinsert(datatype, "end_pt", - HOFFSET(Particle, _particle_holder._end_pt), - Vertex::get_datatype()); - H5Tinsert(datatype, "first_step", - HOFFSET(Particle, _particle_holder._first_step), - Vertex::get_datatype()); - H5Tinsert(datatype, "last_step", - HOFFSET(Particle, _particle_holder._last_step), - Vertex::get_datatype()); - H5Tinsert(datatype, "dist_travel", - HOFFSET(Particle, _particle_holder._dist_travel), - larcv3::get_datatype()); - H5Tinsert(datatype, "energy_init", - HOFFSET(Particle, _particle_holder._energy_init), - larcv3::get_datatype()); - H5Tinsert(datatype, "energy_deposit", - HOFFSET(Particle, _particle_holder._energy_deposit), - larcv3::get_datatype()); - H5Tinsert(datatype, "process", - HOFFSET(Particle, _particle_holder._process), - string_type); - H5Tinsert(datatype, "parent_trackid", - HOFFSET(Particle, _particle_holder._parent_trackid), - larcv3::get_datatype()); - H5Tinsert(datatype, "parent_pdg", - HOFFSET(Particle, _particle_holder._parent_pdg), - larcv3::get_datatype()); - H5Tinsert(datatype, "parent_vtx", - HOFFSET(Particle, _particle_holder._parent_vtx), - Vertex::get_datatype()); - H5Tinsert(datatype, "ancestor_trackid", - HOFFSET(Particle, _particle_holder._ancestor_trackid), - larcv3::get_datatype()); - H5Tinsert(datatype, "ancestor_pdg", - HOFFSET(Particle, _particle_holder._ancestor_pdg), - larcv3::get_datatype()); - H5Tinsert(datatype, "ancestor_vtx", - HOFFSET(Particle, _particle_holder._ancestor_vtx), - Vertex::get_datatype()); - - return datatype; - } - - public: - - ParticleHolder _particle_holder; - - - }; - - -} -#ifdef LARCV_INTERNAL -#include -void init_particle(pybind11::module m); -#endif - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/larcv3/core/dataformat/Point.h b/larcv/include/larcv3/core/dataformat/Point.h deleted file mode 100644 index 625d2def..00000000 --- a/larcv/include/larcv3/core/dataformat/Point.h +++ /dev/null @@ -1,133 +0,0 @@ -/** - * \file Point.h - * - * \ingroup DataFormat - * - * \brief Class def header for a class Point - * - * @author kazuhiro - */ - -/** \addtogroup DataFormat - - @{*/ -#ifndef __LARCV3DATAFORMAT_POINT_H -#define __LARCV3DATAFORMAT_POINT_H - -#include -#include -#include -#include - - -namespace larcv3 { - - template - class Point { - public: - Point() : x() { }; - Point(std::array xv){ - for(size_t i = 0; i < dimension; i ++) x[i] = xv[i]; - } - ~Point() {} - - Point(const Point& pt){ - - for(size_t i = 0; i < dimension; i ++) x[i] = pt.x[i]; - }; - - std::array x; - - inline bool operator== (const Point& rhs) const { - - bool eq = true; - for(size_t i = 0; i < dimension; i ++) eq = (eq && x[i] == rhs.x[i]); - return eq; - } - - inline bool operator!= (const Point& rhs) const { - return !(rhs == (*this)); - } - - inline Point& operator*= (const double rhs) { - for(size_t i = 0; i < dimension; i ++) x[i] *= rhs; - return (*this); - } - - inline Point& operator/= (const double rhs) { - for(size_t i = 0; i < dimension; i ++) x[i] /= rhs; - return (*this); - } - - inline Point& operator+= (const Point& rhs) { - - for(size_t i = 0; i < dimension; i ++) x[i] += rhs.x[i]; - return (*this); - } - - inline Point& operator-= (const Point& rhs) { - - for(size_t i = 0; i < dimension; i ++) x[i] -= rhs.x[i]; - return (*this); - } - - inline Point operator* (const double rhs) const { - std::array new_x; - for(size_t i = 0; i < dimension; i ++) new_x[i] = rhs * x[i]; - return Point(new_x); - } - inline Point operator/ (const double rhs) const { - std::array new_x; - for(size_t i = 0; i < dimension; i ++) new_x[i] = x[i] / rhs; - return Point(new_x); - } - - inline Point operator+ (const Point& rhs) const { - - std::array new_x; - for(size_t i = 0; i < dimension; i ++) new_x[i] = x[i] + rhs.x[i]; - return Point(new_x); - } - - inline Point operator- (const Point& rhs) const { - - std::array new_x; - for(size_t i = 0; i < dimension; i ++) new_x[i] = x[i] - rhs.x[i]; - return Point(new_x); - } - - - inline double squared_distance(const Point& pt) const { - - double res(0.0); - for(size_t i = 0; i < dimension; i ++) res += pow(x[i]-pt.x[i],2); - return res; - } - - inline double distance(const Point& pt) const { - - return sqrt(squared_distance(pt)); - } - - inline Point direction(const Point& pt) const { - - Point res(pt - *this); - res /= distance(pt); return res; - } - - }; - -typedef Point<2> Point2D; -typedef Point<3> Point3D; -} - -#ifdef LARCV_INTERNAL -#include -template -void init_point_base(pybind11::module m); - -void init_point(pybind11::module m); -#endif - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/larcv3/core/dataformat/Tensor.h b/larcv/include/larcv3/core/dataformat/Tensor.h deleted file mode 100644 index c3e11b17..00000000 --- a/larcv/include/larcv3/core/dataformat/Tensor.h +++ /dev/null @@ -1,205 +0,0 @@ -/** - * \file Tensor.h - * - * \ingroup DataFormat - * - * \brief Class def header for an tensor data holder larcv3::Tensor (was Image2D) - * - * @author tmw, kazu, cadams - */ - -/** \addtogroup DataFormat - - @{*/ - -#ifndef __LARCV3DATAFORMAT_TENSOR_H__ -#define __LARCV3DATAFORMAT_TENSOR_H__ - -#include -#include -#include "larcv3/core/dataformat/ImageMeta.h" - -#ifdef LARCV_INTERNAL -#include -#include -#endif - -namespace larcv3 { - - /** - \TODO Need to work on implementations for overlay, resize, crop - \class Tensor - Meant to be a storage class for a tensor of arbitrary dimension (originally a 2D image). Ultimately data is 1D array. - */ - template - class Tensor { - template friend class EventTensor; - - public: - - /// Default Constructor: - Tensor(){} - - /// ctor by dimensions - Tensor(const std::vector & dims); - /// ctor from ImageMeta - Tensor(const ImageMeta&); - /// ctor from ImageMeta and 1D array data - Tensor(const ImageMeta&, const std::vector&); - /// copy ctor - Tensor(const Tensor&); - - - // These functions only appear in larcv proper, not in included headers: -#ifdef LARCV_INTERNAL - /// from numpy ctor - Tensor(pybind11::array_t); - - // Return a numpy array of this object (no copy by default) - pybind11::array_t as_array(); -#endif - - /// dtor - virtual ~Tensor(){} - - /// Reset contents w/ new larcv3::ImageMeta - void reset(const ImageMeta&); - - - /// Size of data, equivalent of # rows x # columns x ... - size_t size() const { return _img.size(); } - /// Specific pixel value getter - float pixel(const std::vector & coords) const; - /// Specific pixel value getter - float pixel(size_t index) const; - /// larcv3::ImageMeta const reference getter - const ImageMeta& meta() const { return _meta; } - - /// Mem-copy: insert num_pixel many data from src 1D array @ data index starting from (row,col) - void copy(const std::vector & coords, const float* src, size_t num_pixel); - /// Mem-copy: insert num_pixel many data from src 1D array @ data index starting from (row,col) - void copy(const std::vector & coords, const std::vector& src, size_t num_pixel=0); - /// Fake mem-copy (loop element-wise copy): insert num_pixel many data from src 1D array @ data index starting from (row,col) - void copy(const std::vector & coords, const short* src, size_t num_pixel); - /// Fake mem-copy (loop element-wise copy): insert num_pixel many data from src 1D array @ data index starting from (row,col) - void copy(const std::vector & coords, const std::vector& src, size_t num_pixel=0); - /// Same as copy, but perform in reverse direction of rows (useful when src is not in the same order) - void reverse_copy(const std::vector & coords, const std::vector& src, size_t nskip=0, size_t num_pixel=0); - /// Same as copy, but perform in reverse direction of rows (useful when src is not in the same order) - void reverse_copy(const std::vector & coords, const std::vector& src, size_t nskip=0, size_t num_pixel=0); - // /// Crop specified region via crop_meta to generate a new larcv3::Image2D - // Image2D crop(const ImageMeta& crop_meta) const; - /// 1D const reference array getter - const std::vector& as_vector() const - { return _img; } - // /// Re-size the 1D data array w/ updated # rows and # columns - // void resize( const std::vector & counts, float fillval=0.0 ); - /// Set pixel value via row/col specification - void set_pixel( const std::vector & coords, float value ); - /// Set pixel value via index specification - void set_pixel( size_t index, float value ); - /// Paint all pixels with a specified value - void paint(float value); - /// Apply threshold: pixels lower than "thres" are all overwritten by lower_overwrite value - void threshold(float thresh, bool lower); - /// Apply threshold: make all pixels to take only 2 values, lower_overwrite or upper_overwrite - void binarize(float thresh, float lower_overwrite, float upper_overwrite); - /// Clear data contents - void clear_data(); - - // Return a new tensor that is this one, but compressed/downsampled - // Accepts either an array of values, one per dimension, or a single value - Tensor compress(std::array compression, PoolType_t) const; - Tensor compress(size_t compression, PoolType_t) const; - - // /// Overlay with another Image2D: overlapped pixel region is merged - // void overlay(const Image2D&, CompressionModes_t mode=kSum); - /// Move data contents out - std::vector&& move(); - /// Move data contents in - void move(std::vector&&); - - inline Tensor& operator+=(const float val) - { for(auto& v : _img) v+= val; return (*this);} - inline Tensor operator+(const float val) const - { Tensor res = (*this); res+=val; return res; } - inline Tensor& operator-=(const float val) - { for(auto& v : _img) v-= val; return (*this);} - inline Tensor operator-(const float val) const - { Tensor res = (*this); res-=val; return res; } - inline Tensor& operator*=(const float val) - { for(auto& v : _img) v*= val; return (*this);} - inline Tensor operator*(const float val) const - { Tensor res = (*this); res*=val; return res; } - inline Tensor& operator/=(const float val) - { for(auto& v : _img) v/= val; return (*this);} - inline Tensor operator/(const float val) const - { Tensor res = (*this); res/=val; return res; } - - Tensor& operator +=(const std::vector& rhs); - Tensor& operator -=(const std::vector& rhs); - Tensor& operator +=(const larcv3::Tensor& rhs); - - - - - /// Element-wise pixel value multiplication - void eltwise( const Tensor& rhs ); - /// Element-wise multiplication w/ 1D array data - void eltwise(const std::vector& arr,bool allow_longer=false); - - // The following functions were deprecated for larcv3. - // Implementations are here in the source code until a later cleanup, in case they - // need to be un deprecated: - - /* - /// attribute move ctor - Image2D(ImageMeta&&, std::vector&&); - - /// Move origin position - void reset_origin(double x, double y) {_meta.reset_origin(x,y);} - - /// Compress image2D data and returns compressed data 1D array - std::vector copy_compress(size_t row_count, size_t col_count, CompressionModes_t mode=kSum) const; - - /// Paint a row of pixels with a specified value - void paint_row( int row, float value ); - /// Paint a column of pixels with a specified value - void paint_col( int col, float value ); - /// Call copy_compress internally and set itself to the result - void compress(size_t row_count, size_t col_count, CompressionModes_t mode=kSum); - - // Matrix Multiplication - /// Matrix multiplicaition - Image2D multiRHS( const Image2D& rhs ) const; - - - // /// uniry operator for matrix multiplicaition - // Image2D& operator*=( const Image2D& rhs ); - // /// binary operator for matrix multiplication - // Image2D operator*(const Image2D& rhs) const; - - */ - private: - std::vector _img; - ImageMeta _meta; - void clear(); - }; - - typedef Tensor<1> Tensor1D; - typedef Tensor<2> Image2D; - typedef Tensor<3> Tensor3D; - typedef Tensor<4> Tensor4D; - -} - -#ifdef LARCV_INTERNAL - -template -void init_tensor_base(pybind11::module m); - -void init_tensor(pybind11::module m); -#endif - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/larcv3/core/dataformat/Vertex.h b/larcv/include/larcv3/core/dataformat/Vertex.h deleted file mode 100644 index 1fcb7e43..00000000 --- a/larcv/include/larcv3/core/dataformat/Vertex.h +++ /dev/null @@ -1,107 +0,0 @@ -/** - * \file Vertex.h - * - * \ingroup DataFormat - * - * \brief Class def header for a class larcv3::Vertex - * - * @author cadams, - */ - -/** \addtogroup DataFormat - - @{*/ - -#ifndef __LARCV3DATAFORMAT_VERTEX_H__ -#define __LARCV3DATAFORMAT_VERTEX_H__ - -#include "larcv3/core/dataformat/DataFormatTypes.h" -#include "larcv3/core/dataformat/Point.h" - -namespace larcv3 { - - class Vertex { - public: - /// Particle ID default constructor - Vertex() = default; - Vertex(double x, double y, double z, double t); - - /// Reset function - void reset(); - - /// Reset function for x, y, z, t - void reset(double x, double y, double z, double t); - - /// Convert to point - const larcv3::Point2D as_point2d(larcv3::PointType_t point_type) const; - const larcv3::Point3D as_point3d() const; - void as_point(larcv3::PointType_t point_type, double * x, double * y, double * z); - - inline double x() const { return _x; } - inline double y() const { return _y; } - inline double z() const { return _z; } - inline double t() const { return _t; } - - /// Default destructor - // The virtual destructor must be removed to make the data layout standard in C++ specifications - // virtual ~Vertex(){}; - - inline bool operator== (const Vertex& rhs) const - { - return ( _x == rhs._x && _y == rhs._y && _z == rhs._z && _t == rhs._t ); - } - - inline bool operator!= (const Vertex& rhs) const - { - return !((*this) == rhs); - } - - inline bool operator< (const Vertex& rhs) const - { - if( _x < rhs._x ) return true; - if( rhs._x < _x ) return false; - if( _y < rhs._y ) return true; - if( rhs._y < _y ) return false; - if( _z < rhs._z ) return true; - if( rhs._z < _z ) return false; - if( _t < rhs._t ) return true; - if( rhs._t < _t ) return false; - - return false; - } - - std::string dump() const; - - public: - - double _x, _y, _z, _t; - - // What does this function do? - // void approx(); - - - public: - static hid_t get_datatype() { - hid_t datatype; - datatype = H5Tcreate (H5T_COMPOUND, sizeof (Vertex)); - H5Tinsert (datatype, "x", - HOFFSET (Vertex, _x), larcv3::get_datatype()); - H5Tinsert (datatype, "y", - HOFFSET (Vertex, _y), larcv3::get_datatype()); - H5Tinsert (datatype, "z", - HOFFSET (Vertex, _z), larcv3::get_datatype()); - H5Tinsert (datatype, "t", - HOFFSET (Vertex, _t), larcv3::get_datatype()); - return datatype; - } - - - - }; -} -#ifdef LARCV_INTERNAL -#include -void init_vertex(pybind11::module m); -#endif - -#endif diff --git a/larcv/include/larcv3/core/dataformat/Voxel.h b/larcv/include/larcv3/core/dataformat/Voxel.h deleted file mode 100644 index 5e217496..00000000 --- a/larcv/include/larcv3/core/dataformat/Voxel.h +++ /dev/null @@ -1,439 +0,0 @@ -/** - * \file Voxel.h - * - * \ingroup DataFormat - * - * \brief Class def header for a class larcv3::Voxel - * - * @author cadams, kazuhiro - */ - -/** \addtogroup DataFormat - - @{*/ -#ifndef __LARCV3DATAFORMAT_VOXEL_H -#define __LARCV3DATAFORMAT_VOXEL_H - -#include "larcv3/core/dataformat/DataFormatTypes.h" -#include "larcv3/core/dataformat/ImageMeta.h" -#include "larcv3/core/dataformat/Tensor.h" - -#ifdef LARCV_INTERNAL -#include -#include -#endif - -namespace larcv3 { - - /** - \class Voxel - @brief voxel definition element class consisting of ID and stored value - */ - class Voxel { - - public: - - /// Default constructor - Voxel(VoxelID_t id = kINVALID_VOXELID, float value = kINVALID_FLOAT); - /// Default destructor - ~Voxel() {} - - /// ID getter - inline VoxelID_t id() const { return _id; } - /// Value getter - inline float value() const { return _value; } - - /// Value setter - inline void set(VoxelID_t id, float value) { _id = id; _value = value; } - - // - // uniry operators - // - /// Add - inline Voxel& operator += (float value) - { _value += value; return (*this); } - inline Voxel& operator -= (float value) - { _value -= value; return (*this); } - inline Voxel& operator *= (float factor) - { _value *= factor; return (*this); } - inline Voxel& operator /= (float factor) - { _value /= factor; return (*this); } - - // - // binary operators - // - inline bool operator == (const Voxel& rhs) const - { return (_id == rhs._id); } - inline bool operator < (const Voxel& rhs) const - { - if ( _id < rhs._id) return true; - if ( _id > rhs._id) return false; - return false; - } - inline bool operator <= (const Voxel& rhs) const - { return ((*this) == rhs || (*this) < rhs); } - inline bool operator > (const Voxel& rhs) const - { return !((*this) <= rhs); } - inline bool operator >= (const Voxel& rhs) const - { return !((*this) < rhs); } - - inline bool operator == (const float& rhs) const - { return _value == rhs; } - inline bool operator < (const float& rhs) const - { return _value < rhs; } - inline bool operator <= (const float& rhs) const - { return _value <= rhs; } - inline bool operator > (const float& rhs) const - { return _value > rhs; } - inline bool operator >= (const float& rhs) const - { return _value >= rhs; } - - protected: - VoxelID_t _id; ///< voxel id - float _value; ///< Pixel Value - - - public: - static hid_t get_datatype() { - - hid_t datatype; - datatype = H5Tcreate (H5T_COMPOUND, sizeof (Voxel)); - H5Tinsert (datatype, "id", - HOFFSET (Voxel, _id), larcv3::get_datatype()); - H5Tinsert (datatype, "value", - HOFFSET (Voxel, _value), larcv3::get_datatype()); - return datatype; - } - - - }; - - - class kINVALID_VOXEL : public Voxel - { - public: - static kINVALID_VOXEL& getInstance() - { - static kINVALID_VOXEL instance; // Guaranteed to be destroyed. - // Instantiated on first use. - return instance; - } - private: - kINVALID_VOXEL() {} // Constructor? (the {} brackets) are needed here. - - // // C++ 03 - // // ======== - // // Don't forget to declare these two. You want to make sure they - // // are unacceptable otherwise you may accidentally get copies of - // // your singleton appearing. - // kINVALID_VOXEL(kINVALID_VOXEL const&); // Don't Implement - // void operator=(kINVALID_VOXEL const&); // Don't implement - - // C++ 11 - // ======= - // We can use the better technique of deleting the methods - // we don't want. - public: - kINVALID_VOXEL(kINVALID_VOXEL const&) = delete; - void operator=(kINVALID_VOXEL const&) = delete; - - // Note: Scott Meyers mentions in his Effective Modern - // C++ book, that deleted functions should generally - // be public as it results in better error messages - // due to the compilers behavior to check accessibility - // before deleted status - }; - - - // static const larcv3::Voxel kINVALID_VOXEL(kINVALID_VOXELID,0.); - - - /** - \class VoxelSet - @brief Container of multiple voxels consisting of ordered sparse vector and meta data - */ - class VoxelSet { - public: - /// Default ctor - VoxelSet() {_id=0;} - - // VoxelSet(pybind11::array_t values, pybind11::array_t indexes); - - /// Default dtor - virtual ~VoxelSet() {} - - // - // Read-access - // - /// InstanceID_t getter - inline InstanceID_t id() const { return _id; } - /// Access as a raw vector - inline const std::vector& as_vector() const { return _voxel_v; } - /// Returns a const reference to a voxel with specified id. if not present, invalid voxel is returned. - const Voxel& find(VoxelID_t id) const; - /// Sum of contained voxel values - inline float sum() const { float res=0.; for(auto const& vox : _voxel_v) res+=vox.value(); return res;} - /// Mean of contained voxel values - inline float mean() const { return (_voxel_v.empty() ? 0. : sum() / (float)(_voxel_v.size())); } - /// Max of contained voxel values - float max() const; - /// Min of contained voxel values - float min() const; - /// Size (count) of voxels - inline size_t size() const { return _voxel_v.size(); } - - -// These functions only appear in larcv proper, not in includes: -#ifdef LARCV_INTERNAL - /// Get the value of all voxels in this set - pybind11::array_t values() const; - - /// Get the index of all voxels in this set - pybind11::array_t indexes() const; -#endif - - /// Get the value of all voxels in this set - std::vector values_vec() const; - - /// Get the index of all voxels in this set - std::vector indexes_vec() const; - - - // - // Write-access - // - /// Clear everything - inline virtual void clear_data() { _voxel_v.clear(); } - /// Reserve - inline void reserve(size_t num) { _voxel_v.reserve(num); } - /// Thresholding voxels by an upper and lower end values - void threshold(float min, float max); - /// Thresholding by only lower end value - void threshold_min(float min); - /// Thresholding by only upper end value - void threshold_max(float max); - - /// Add a new voxel. If another voxel instance w/ same VoxelID exists, value is added - void add(const Voxel& vox); - /// Set a voxel. If another voxel instance w/ same VoxelID exists, value is set - void insert(const Voxel& vox); - /// Emplace a new voxel. Same logic as VoxelSet::add but consumes removable reference. - void emplace(Voxel&& vox, const bool add); - /// Emplace a new voxel from id & value - inline void emplace(VoxelID_t id, float value, const bool add) - { emplace(Voxel(id,value),add); } - /// InstanceID_t setter - inline void id(const InstanceID_t id) { _id = id; } - -#ifdef LARCV_INTERNAL - - void set(pybind11::array_t indexes, pybind11::array_t values); -#endif - - // - // Uniry operations - // - inline VoxelSet& operator += (float value) - { for(auto& vox : _voxel_v) vox += value; return (*this); } - inline VoxelSet& operator -= (float value) - { for(auto& vox : _voxel_v) vox -= value; return (*this); } - inline VoxelSet& operator *= (float factor) - { for(auto& vox : _voxel_v) vox *= factor; return (*this); } - inline VoxelSet& operator /= (float factor) - { for(auto& vox : _voxel_v) vox /= factor; return (*this); } - - protected: - /// Instance ID - InstanceID_t _id; - /// Ordered sparse vector of voxels - std::vector _voxel_v; - }; - - /** - \class VoxelSetArray - @brief Container of multiple VoxelSet (i.e. container w/ InstanceID_t & VoxelSet pairs) - */ - class VoxelSetArray { - public: - /// Default ctor - VoxelSetArray() {} - /// Default dtor - virtual ~VoxelSetArray() {} - - // - // Read-access - // - /// Get # of VoxelSet - inline size_t size() const { return _voxel_vv.size(); } - /// Access specific VoxelSet - const larcv3::VoxelSet& voxel_set(InstanceID_t id) const; - /// Access all VoxelSet as a vector - inline const std::vector& as_vector() const - { return _voxel_vv; } - float sum() const; - /// Mean of contained voxel values - float mean() const; - /// Max of contained voxel values - float max() const; - /// Min of contained voxel values - float min() const; - - // - // Write-access - // - /// Thresholding voxels by an upper and lower end values - inline void threshold(float min, float max) - { for(auto& vox_s : _voxel_vv) vox_s.threshold(min,max); } - /// Thresholding by only lower end value - inline void threshold_min(float min) - { for(auto& vox_s : _voxel_vv) vox_s.threshold_min(min); } - /// Thresholding by only upper end value - inline void threshold_max(float max) - { for(auto& vox_s : _voxel_vv) vox_s.threshold_max(max); } - /// Clear everything - inline void clear_data() { _voxel_vv.clear(); } - /// Resize voxel array - inline void resize(const size_t num) - { _voxel_vv.resize(num); for(size_t i=0; i&& voxel_vv); - /// Set an array of VoxelSet. Each element's InstanceID_t gets updated - // void insert(const std::vector& voxel_vv); - /// Move a VoxelSet into a collection. The InstanceID_t is respected. - void emplace(larcv3::VoxelSet&& voxel_v); - /// Set a VoxelSet into a collection. The InstanceID_t is respected. - void insert(const larcv3::VoxelSet& voxel_v); - /// Mover - void move(larcv3::VoxelSetArray&& orig) - { _voxel_vv = std::move(orig._voxel_vv); } - - private: - std::vector _voxel_vv; - }; - - /** - \class SparseTensor - @brief Container of multiple voxel set array - */ - template - class SparseTensor : public VoxelSet { - public: - /// Default ctor - SparseTensor() {} - SparseTensor(VoxelSet&& vs, ImageMeta meta); - - /// Default dtor - virtual ~SparseTensor() {} - SparseTensor& operator= (const VoxelSet& rhs) - { *((VoxelSet*)this) = rhs; this->meta(this->meta()); return *this;} - - // - // Read-access - // - /// Access ImageMeta of specific projection - inline const larcv3::ImageMeta& meta() const { return _meta; } - -#ifdef LARCV_INTERNAL - // Take this sparseTensor and return it as a dense numpy array - pybind11::array_t dense(); -#endif - - larcv3::Tensor to_tensor(); - - // Return a new sparse tensor that is this one, but compressed/downsampled - // Accepts either an array of values, one per dimension, or a single value - SparseTensor compress(std::array compression, PoolType_t) const; - SparseTensor compress(size_t compression, PoolType_t) const; - - // - // Write-access - // - /// Create & add/set a single voxel - void emplace(const larcv3::Voxel & vox, const bool add=true); - - /// Emplace the whole voxel set w/ meta - inline void emplace(VoxelSet&& vs, const ImageMeta& meta) - {*((VoxelSet*)this) = std::move(vs); this->meta(meta);} - - /// Set the whole voxel set w/ meta - inline void set(const VoxelSet& vs, const ImageMeta& meta) - {*((VoxelSet*)this) = vs; this->meta(meta);} - - /// Clear everything - inline void clear_data() { VoxelSet::clear_data(); _meta = ImageMeta(); } - - /// Meta setter - void meta(const larcv3::ImageMeta& meta, bool check = true); - - // Tensor as_tensor(); - - private: - larcv3::ImageMeta _meta; - - }; - - /** - \class SparseCluster - @brief Container of multiple (-projected) voxel set array - */ - template - class SparseCluster : public VoxelSetArray { - public: - /// Default ctor - SparseCluster() {} - SparseCluster(VoxelSetArray&& vsa, ImageMeta meta); - - /// Default dtor - virtual ~SparseCluster() {} - - // - // Read-access - // - /// Access ImageMeta of specific projection - inline const larcv3::ImageMeta& meta() const { return _meta; } - - // - // Write-access - // - /// Clear everything - inline void clear_data() { VoxelSetArray::clear_data(); _meta = ImageMeta(); } - /// set VoxelSetArray - inline void set(VoxelSetArray&& vsa, const ImageMeta& meta) - { *((VoxelSetArray*)this) = std::move(vsa); this->meta(meta); } - /// emplace VoxelSetArray - // inline void emplace(const VoxelSetArray& vsa, const ImageMeta& meta) - // { *((VoxelSetArray*)this) = vsa; this->meta(meta); } - /// Meta setter - void meta(const larcv3::ImageMeta& meta); - - private: - larcv3::ImageMeta _meta; - }; - - -// Define typedefs to specify sparse objects: -typedef SparseTensor<2> SparseTensor2D; -typedef SparseTensor<3> SparseTensor3D; -typedef SparseCluster<2> SparseCluster2D; -typedef SparseCluster<3> SparseCluster3D; - -} - -#ifdef LARCV_INTERNAL -#include -#include -void init_voxel_core(pybind11::module m); - -template -void init_sparse_tensor(pybind11::module m); - -template -void init_sparse_cluster(pybind11::module m); - -void init_voxel(pybind11::module m); -#endif - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/larcv3/core/dataformat/dataformat.h b/larcv/include/larcv3/core/dataformat/dataformat.h deleted file mode 100644 index 87b1b7b4..00000000 --- a/larcv/include/larcv3/core/dataformat/dataformat.h +++ /dev/null @@ -1,46 +0,0 @@ -/** - * \file larbys.h - * - * \ingroup DataFormat - * - * \brief Class def header for exception classes for larcv3 framework - * - * @author cadams - */ - -/** \addtogroup DataFormat - - @{*/ -#ifndef __LARCV3DATAFORMAT_DATAFORMAT_H__ -#define __LARCV3DATAFORMAT_DATAFORMAT_H__ - - -#include "DataFormatTypes.h" -#include "BBox.h" -// #include "DataProductFactory.h" -#include "EventBase.h" -#include "EventID.h" -#include "EventParticle.h" -#include "EventSparseCluster.h" -#include "EventSparseTensor.h" -#include "EventTensor.h" -#include "EventBBox.h" -#include "ImageMeta.h" -#include "IOManager.h" -#include "Particle.h" -#include "Point.h" -#include "Tensor.h" -#include "Vertex.h" -#include "Voxel.h" - -#ifndef LARCV_NO_PYBIND -#ifdef LARCV_INTERNAL -#include -__attribute__ ((visibility ("default"))) void init_dataformat(pybind11::module m); -#endif -// bindings -#endif - - -// include guards -#endif diff --git a/larcv/include/larcv3/core/processor/ProcessBase.h b/larcv/include/larcv3/core/processor/ProcessBase.h deleted file mode 100644 index 0fb654b6..00000000 --- a/larcv/include/larcv3/core/processor/ProcessBase.h +++ /dev/null @@ -1,100 +0,0 @@ -/** - * \file ProcessBase.h - * - * \ingroup core_Processor - * - * \brief Class def header for a class larcv3::ProcessBase - * - * @author drinkingkazu - */ - -/** \addtogroup core_Processor - - @{*/ -#ifndef __LARCV3PROCESSOR_PROCESSBASE_H -#define __LARCV3PROCESSOR_PROCESSBASE_H - -#include "larcv3/core/base/Watch.h" -#include "larcv3/core/dataformat/IOManager.h" -#include "larcv3/core/processor/ProcessorTypes.h" - -namespace larcv3 { - - class ProcessDriver; - class ProcessFactory; - /** - \class ProcessBase - @brief A base class for "process module" to be run by larcv3::ProcessDriver - @detail Inherited class must implment 4 pure virtual functions that are called by larcv3::ProcessDriver instance.\n - ProcessBase::configure(const larcv3::PSet) is called first with the argument passing the configuration parameters.\n - ProcessBase::initialize() is called after configure. This is where you may want to initialize variables.\n - ProcessBase::process(larcv3::IOManager&) is called for every event. The argument provides an access to event data.\n - ProcessBase::finalize() is called after larcv3::ProcessDriver finished looping over all events.\n - */ - class ProcessBase : public larcv_base { - friend class ProcessDriver; - friend class ProcessFactory; - - public: - - /// Default constructor - ProcessBase(const std::string name="ProcessBase"); - - /// Default destructor - virtual ~ProcessBase(){} - - // - // Four pure virtual functions that larcv3::ProcessDriver calls and need implementation. - // - /// Called first with the argument passing the configuration parameters. - virtual void configure(const json&) = 0; - /// Called after configure, this is where you should initialize variables to be stored in an output analysis file. - virtual void initialize() = 0; - /// Called per-event, this is where you should implement your per-event action/analysis. - virtual bool process(IOManager& mgr) = 0; - /// Called after event loop is over. This is where you can store your histograms etc. to an output analysis file. - virtual void finalize() = 0; - - // - // Following functions are - // - /// Only for experts: allows a loose grouping for a set of ProcessBase inherit classes via true/false return to a "question". - virtual bool is(const std::string question) const; - - /** - * @brief Default configuration - * - * @return JSON default config - */ - static json default_config(){ - json c = { - {"ProcessName", ""}, - {"ProcessType", ""}, - }; - return c; - } - - - private: - - void _configure_(const json&); - - bool _process_(IOManager& mgr); - - bool _event_creator; ///< special flag to mark this algorithm an event creator - larcv3::Watch _watch; ///< algorithm profile stopwatch - double _proc_time; ///< algorithm execution time record (cumulative) - size_t _proc_count; ///< algorithm execution counter (cumulative) - - larcv3::ProcessID_t _id; ///< unique algorithm identifier - bool _profile; ///< measure process time if profile flag is on - std::string _typename; ///< process type from factory - }; -} -#ifdef LARCV_INTERNAL -#include -void init_processbase(pybind11::module m); -#endif - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/larcv3/core/processor/ProcessDriver.h b/larcv/include/larcv3/core/processor/ProcessDriver.h deleted file mode 100644 index 9954fee1..00000000 --- a/larcv/include/larcv3/core/processor/ProcessDriver.h +++ /dev/null @@ -1,140 +0,0 @@ -/** - * \file ProcessDriver.h - * - * \ingroup core_Processor - * - * \brief Class def header for a class larcv3::ProcessDriver - * - * @author drinkingkazu, cadams - */ - -/** \addtogroup core_Processor - - @{*/ -#ifndef __LARCV3PROCESSOR_PROCESSDRIVER_H -#define __LARCV3PROCESSOR_PROCESSDRIVER_H - -#include -#include "larcv3/core/dataformat/IOManager.h" -#include "larcv3/core/processor/ProcessBase.h" - -namespace larcv3 { - /** - \class ProcessDriver - @brief Analysis event-loop driver that executes larcv3::ProcessBase inherit "process modules". - It uses larcv3::IOManager behind the scene to run the event loop.\n - Responsible for propagating a structured configuration parameter sets to configure each process module.\n - The configuration of larcv3::ProcessDriver itself can contain larcv3::IOManager configuration. - */ - class ProcessDriver : public larcv_base { - - public: - - /// Default constructor - ProcessDriver(std::string name="ProcessDriver"); - /// Default destructor - ~ProcessDriver(){} - - // - // Configuration setter/modifiers - // - /// Configure itself (mainly larcv3::IOManager) and also attached process modules. - void configure(const json& cfg); - - /// Get the current configuration - const json & get_config() const {return config;} - - /// When needs to override the list of input files from what's specified in the configuration - void override_input_file(const std::vector& flist); - /// When needs to override the name of output data file from what's specified in the configuration - void override_output_file(const std::string fname); - /// When needs to override the randomized event access in IO from what's specified in the configuration - void random_access(int flag) { config["RandomAccess"] = flag; } - - // - // Process flow execution methods - // - /// Resets the states & all variables. Attached process modules would be removed. - void reset(); - /// Must be called after configure. This initializes larcv3::IOManager (open files) and initialize attached process modules. - void initialize(int color=0); - /// Processes the "next entry" automatically (you don't have to control the counter to specify which entry) - bool process_entry(); - /// Processes multiple entries (specified in the 2nd argument) from a specified entry (1st argument) - void batch_process(size_t start_entry=0, size_t num_entries=0); - /** - @brief Processes a specific entry specified in the argument. - If calling this function with the same entry twice, the 2nd bloolean can be used to force re-loading data from disk. - */ - bool process_entry(size_t entry,bool force_reload=false); - /// Must be called after initialize() or process_entry/batch_process. Closes IO and calls finalize method of process modules. - void finalize(); - - inline void clear_entry(){_io.clear_entry();} - - // - // Information setter method - // - /// A method to force re-set the run/subrun/event ID of a currently processed event, useful when "creating an event". - void set_id(size_t run, size_t subrun, size_t event) - { _io.set_id(run,subrun,event); } - // - // Information access methods - // - /// Returns larcv3::EventBase object that contains an "ID" (run/event integers) - inline const EventID& event_id() const { return _io.event_id(); } - - /// Returns a unique ID (integer) assigned for a process module (provide the module's name in argument) - ProcessID_t process_id(std::string name) const; - /// Returns the set of process modules' name - std::vector process_names() const; - /// Returns a mapping between process modules' name and their unique process ID number - const std::map& process_map() const; - /// Returns an attached process module's pointer given a unique ID in the argument - const ProcessBase* process_ptr(ProcessID_t id) const; - /// Returns read-only larcv3::IOManager instance - const IOManager& io() const { return _io; } - /// When run in random-access IO mode, returns original event entry number for a randomized index number - size_t get_tree_index( size_t entry ) const; - /// Returns true if after any entry is processed (process_entry/batch_process) but not yet finalized - inline bool processing() const { return _processing; } - - /// Returns the default configuration for Process Driver - static json default_config(){ - json c = { - {"Verbosity", logger::default_level()}, - {"IOManager", IOManager::default_config()}, - {"ProcessType", std::vector()}, - {"ProcessName", std::vector()}, - {"ProcessList", json()}, - {"EnableFilter", false}, - {"RandomAccess", false}, - {"RandomSeed", NULL}, - {"StartEntry", 0}, - {"NumEntries", 0}, - }; - return c; - } - - protected: - - json config; - - bool _process_entry_(); - size_t _batch_start_entry; - size_t _batch_num_entry; - size_t _current_entry; - std::vector _access_entry_v; - IOManager _io; - std::map _proc_m; - std::vector _proc_v; - bool _processing; - }; -} -#ifdef LARCV_INTERNAL -#include -void init_processdriver(pybind11::module m); -#endif - -#endif -/** @} */ // end of doxygen group diff --git a/larcv/include/larcv3/core/processor/ProcessFactory.h b/larcv/include/larcv3/core/processor/ProcessFactory.h deleted file mode 100644 index 5c333776..00000000 --- a/larcv/include/larcv3/core/processor/ProcessFactory.h +++ /dev/null @@ -1,90 +0,0 @@ -/** - * \file ProcessFactory.h - * - * \ingroup core_Processor - * - * \brief Class def header for a class larcv3::ProcessFactory - * - * @author kazuhiro - */ - -/** \addtogroup core_Processor - - @{*/ -#ifndef __LARCV3PROCESSOR_PROCESSFACTORY_H -#define __LARCV3PROCESSOR_PROCESSFACTORY_H - -#include -#include -#include "larcv3/core/base/larcv_base.h" -#include "larcv3/core/processor/ProcessBase.h" - -#include - -static std::mutex __procfactory_mtx; - -namespace larcv3 { - - /** - \class ProcessFactoryBase - \brief Abstract base class for factory (to be implemented per process) - */ - class ProcessFactoryBase { - public: - /// Default ctor - ProcessFactoryBase(){} - /// Default dtor (virtual) - virtual ~ProcessFactoryBase(){} - /// Abstract constructor method - virtual ProcessBase* create(const std::string instance_name) = 0; - }; - - /** - \class ProcessFactory - \brief Factory class for instantiating process instance - This factory class can instantiate a specified process instance w/ provided instance name. \n - The actual factory core (to which each algorithm must register creation factory instance) is \n - a static std::map. Use static method to get a static instance (larcv3::ProcessFactory::get) \n - to access a factory. - */ - class ProcessFactory : public larcv_base { - - public: - /// Default ctor, shouldn't be used - ProcessFactory() : larcv_base("ProcessFactory") - {} - /// Default dtor - ~ProcessFactory() {_factory_map.clear();} - /// Static sharable instance getter - inline static ProcessFactory& get() - { - __procfactory_mtx.lock(); - if(!_me) _me = new ProcessFactory; - __procfactory_mtx.unlock(); - return *_me; - } - /// Factory registration method (should be called by global factory instance in algorithm header) - void add_factory(const std::string name, larcv3::ProcessFactoryBase* factory) - { _factory_map[name] = factory; } - /// Factory creation method (should be called by clients, possibly you!) - ProcessBase* create(const std::string name, const std::string instance_name) { - auto iter = _factory_map.find(name); - if(iter == _factory_map.end() || !((*iter).second)) { - LARCV_ERROR() << "Found no registered class " << name << std::endl; - return nullptr; - } - auto ptr = (*iter).second->create(instance_name); - ptr->_typename = name; - return ptr; - } - - private: - /// Static factory container - std::map _factory_map; - /// Static self - static ProcessFactory* _me; - }; -} -#endif -/** @} */ // end of doxygen group - diff --git a/larcv/include/larcv3/core/processor/ProcessorTypes.h b/larcv/include/larcv3/core/processor/ProcessorTypes.h deleted file mode 100644 index 75f1903f..00000000 --- a/larcv/include/larcv3/core/processor/ProcessorTypes.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __LARCV3PROCESSOR_PROCESSORTYPES_H__ -#define __LARCV3PROCESSOR_PROCESSORTYPES_H__ - -namespace larcv3 { - - typedef size_t ProcessID_t; ///< A unique identifier for an instantiated processes - -} -#endif diff --git a/larcv/include/larcv3/core/processor/processor.h b/larcv/include/larcv3/core/processor/processor.h deleted file mode 100644 index 86446642..00000000 --- a/larcv/include/larcv3/core/processor/processor.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * \file larbys.h - * - * \ingroup core_Base - * - * \brief Class def header for exception classes for larcv3 framework - * - * @author cadams - */ - -/** \addtogroup core_Base - - @{*/ -#ifndef __LARCV3PROCESSOR_PROCESSOR_H__ -#define __LARCV3PROCESSOR_PROCESSOR_H__ - - -#include "ProcessBase.h" -#include "ProcessDriver.h" - - -#ifndef LARCV_NO_PYBIND -#ifdef LARCV_INTERNAL -#include -__attribute__ ((visibility ("default"))) void init_processor(pybind11::module m); -#endif - -// bindings -#endif - - -// include guards -#endif