-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1st push, inheriting lots from uboonecode where this had been developed
- Loading branch information
drinkingkazu
committed
Oct 23, 2017
0 parents
commit 685d4e4
Showing
102 changed files
with
11,026 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
*.out | ||
*.depend | ||
*.png | ||
*.jpg | ||
*.jpeg | ||
*.pcm | ||
*cmake | ||
*CMakeFiles | ||
*Dict.cxx | ||
*Dict.h | ||
*Dict.cc | ||
*Cint.cxx | ||
*Cint.h | ||
*Cint.cc | ||
*.root | ||
*.json | ||
*.db | ||
*.log | ||
*.dat | ||
CMakeLists.txt | ||
!experiments/*/CMakeLists.txt | ||
FMWKInterface.* | ||
*.txt | ||
*.bin | ||
*.root | ||
build | ||
app/PlayGround/* | ||
app/Supera/APILArLite/Cropper.* | ||
app/Supera/APILArLite/MCParticleTree.* | ||
app/Supera/APILArLite/SuperaTypes.h | ||
app/Supera/APILArLite/SuperaUtils.* | ||
app/Supera/APILArLite/SuperaCore.* | ||
app/Supera/APILArSoft/Cropper.* | ||
app/Supera/APILArSoft/MCParticleTree.* | ||
app/Supera/APILArSoft/SuperaTypes.h | ||
app/Supera/APILArSoft/SuperaUtils.* | ||
app/Supera/APILArSoft/SuperaCore.* | ||
app/Supera/APILArSoft/supera.fcl | ||
*~ | ||
*.pyc | ||
.ipynb_checkpoints | ||
*.ipynb | ||
.DS_Store | ||
*.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#ifndef __IMAGEMETAFROMCONFIG_CXX__ | ||
#define __IMAGEMETAFROMCONFIG_CXX__ | ||
|
||
#include "ImageMetaFromConfig.h" | ||
|
||
namespace supera { | ||
|
||
void ImageMetaFromConfig::configure(const supera::Config_t& cfg) | ||
{ | ||
ImageMetaMakerBase::configure(cfg); | ||
auto min_time = cfg.get<double>("MinTime"); | ||
auto min_wire = cfg.get<double>("MinWire"); | ||
auto image_rows = cfg.get<std::vector<size_t> >("EventImageRows"); | ||
auto image_cols = cfg.get<std::vector<size_t> >("EventImageCols"); | ||
|
||
auto const& comp_rows = RowCompressionFactor(); | ||
auto const& comp_cols = ColCompressionFactor(); | ||
|
||
if(image_rows.size() != comp_rows.size()) { | ||
std::cerr << "EventImageRows size != EventCompRows..." << std::endl; | ||
throw std::exception(); | ||
} | ||
|
||
if(image_rows.size() != image_cols.size()) { | ||
std::cerr << "EventImageRows size != EventImageCols..." << std::endl; | ||
throw std::exception(); | ||
} | ||
|
||
// construct meta | ||
for(size_t plane=0; plane<image_rows.size(); ++plane) { | ||
|
||
larcv::ImageMeta meta(image_cols[plane] * comp_cols[plane], image_rows[plane] * comp_rows[plane], | ||
image_rows[plane] * comp_rows[plane], image_cols[plane] * comp_cols[plane], | ||
min_wire, min_time + image_rows[plane] * comp_rows[plane], | ||
plane); | ||
|
||
LARCV_INFO() << "Created meta " << meta.dump(); | ||
|
||
_meta_v.emplace_back(std::move(meta)); | ||
} | ||
|
||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* \file ImageMetaFromConfig.h | ||
* | ||
* \ingroup Package_Name | ||
* | ||
* \brief Class def header for a class ImageMetaFromConfig | ||
* | ||
* @author kazuhiro | ||
*/ | ||
|
||
/** \addtogroup Package_Name | ||
@{*/ | ||
#ifndef __IMAGEMETAFROMCONFIG_H__ | ||
#define __IMAGEMETAFROMCONFIG_H__ | ||
|
||
#include "FMWKInterface.h" | ||
#include "ImageMetaMakerBase.h" | ||
|
||
namespace supera { | ||
|
||
/** | ||
\class ImageMetaFromConfig | ||
User defined class ImageMetaFromConfig ... these comments are used to generate | ||
doxygen documentation! | ||
*/ | ||
class ImageMetaFromConfig : public ImageMetaMakerBase { | ||
|
||
public: | ||
|
||
/// Default constructor | ||
ImageMetaFromConfig() : ImageMetaMakerBase("ImageMetaFromConfig") | ||
{} | ||
|
||
/// Default destructor | ||
~ImageMetaFromConfig(){} | ||
|
||
void configure(const supera::Config_t&); | ||
|
||
const std::vector<larcv::ImageMeta>& Meta() const | ||
{ return _meta_v; } | ||
|
||
private: | ||
|
||
std::vector<larcv::ImageMeta> _meta_v; | ||
|
||
}; | ||
|
||
} | ||
|
||
#endif | ||
/** @} */ // end of doxygen group | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#ifndef IMAGEMETAMAKER_CXX | ||
#define IMAGEMETAMAKER_CXX | ||
|
||
#include "ImageMetaMaker.h" | ||
#include "ImageMetaMakerFactory.h" | ||
namespace supera { | ||
|
||
ImageMetaMakerBase* ImageMetaMaker::_shared_meta_maker = nullptr; | ||
|
||
void ImageMetaMaker::configure(const supera::Config_t& cfg) | ||
{ | ||
if(_meta_maker) { delete _meta_maker; } | ||
_meta_maker = supera::CreateImageMetaMaker(cfg); | ||
} | ||
|
||
const std::vector<larcv::ImageMeta>& ImageMetaMaker::Meta() const | ||
{ | ||
if(_meta_maker) return _meta_maker->Meta(); | ||
auto sptr = SharedMetaMaker(); | ||
if(sptr) return sptr->Meta(); | ||
|
||
std::cerr << "MetaMaker does not exist!" << std::endl; | ||
throw std::exception(); | ||
} | ||
|
||
const std::vector<size_t>& ImageMetaMaker::RowCompressionFactor() const | ||
{ | ||
if(_meta_maker) return _meta_maker->RowCompressionFactor(); | ||
auto sptr = SharedMetaMaker(); | ||
if(sptr) return sptr->RowCompressionFactor(); | ||
|
||
std::cerr << "MetaMaker does not exist!" << std::endl; | ||
throw std::exception(); | ||
} | ||
|
||
const std::vector<size_t>& ImageMetaMaker::ColCompressionFactor() const | ||
{ | ||
if(_meta_maker) return _meta_maker->ColCompressionFactor(); | ||
auto sptr = SharedMetaMaker(); | ||
if(sptr) return sptr->ColCompressionFactor(); | ||
|
||
std::cerr << "MetaMaker does not exist!" << std::endl; | ||
throw std::exception(); | ||
} | ||
|
||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/** | ||
* \file ImageMetaMaker.h | ||
* | ||
* \ingroup MeatSlicer | ||
* | ||
* \brief Class def header for a class ImageMetaMaker | ||
* | ||
* @author kazuhiro | ||
*/ | ||
|
||
/** \addtogroup MeatSlicer | ||
@{*/ | ||
#ifndef __IMAGEMETAMAKER_H__ | ||
#define __IMAGEMETAMAKER_H__ | ||
|
||
#include "ImageMetaMakerBase.h" | ||
|
||
namespace larcv { | ||
class SuperaMetaMaker; | ||
} | ||
|
||
namespace supera { | ||
|
||
/** | ||
\class ImageMetaMaker | ||
User defined class ImageMetaMaker ... these comments are used to generate | ||
doxygen documentation! | ||
*/ | ||
class ImageMetaMaker{ | ||
|
||
friend class larcv::SuperaMetaMaker; | ||
|
||
public: | ||
|
||
/// Default constructor | ||
ImageMetaMaker() : _meta_maker(nullptr) | ||
{} | ||
|
||
/// Default destructor | ||
virtual ~ImageMetaMaker(){ delete _meta_maker; } | ||
|
||
virtual void configure(const supera::Config_t&); | ||
|
||
const std::vector<larcv::ImageMeta>& Meta() const; | ||
|
||
const std::vector<size_t>& RowCompressionFactor() const; | ||
|
||
const std::vector<size_t>& ColCompressionFactor() const; | ||
|
||
inline ImageMetaMakerBase* MetaMakerPtr() | ||
{ return _meta_maker; } | ||
|
||
private: | ||
|
||
ImageMetaMakerBase* _meta_maker; | ||
|
||
static ImageMetaMakerBase* _shared_meta_maker; | ||
inline static ImageMetaMakerBase* SharedMetaMaker() { return _shared_meta_maker; } | ||
inline static void SetSharedMetaMaker(ImageMetaMakerBase* ptr) { _shared_meta_maker = ptr; } | ||
|
||
}; | ||
} | ||
#endif | ||
/** @} */ // end of doxygen group | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef __IMAGEMETAMAKERBASE_CXX__ | ||
#define __IMAGEMETAMAKERBASE_CXX__ | ||
|
||
#include "ImageMetaMakerBase.h" | ||
|
||
namespace supera { | ||
|
||
void ImageMetaMakerBase::configure(const Config_t& cfg) | ||
{ | ||
_comp_rows = cfg.get<std::vector<size_t> >("EventCompRows"); | ||
_comp_cols = cfg.get<std::vector<size_t> >("EventCompCols"); | ||
|
||
if(_comp_rows.size() != _comp_cols.size()) { | ||
std::cerr << "EventCompRows size != EventCompCols size" << std::endl; | ||
throw std::exception(); | ||
} | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/** | ||
* \file ImageMetaMakerBase.h | ||
* | ||
* \ingroup Package_Name | ||
* | ||
* \brief Class def header for a class ImageMetaMakerBase | ||
* | ||
* @author kazuhiro | ||
*/ | ||
|
||
/** \addtogroup Package_Name | ||
@{*/ | ||
#ifndef __IMAGEMETAMAKERBASE_H__ | ||
#define __IMAGEMETAMAKERBASE_H__ | ||
|
||
#include "larcv/core/Base/larcv_base.h" | ||
#include "larcv/core/DataFormat/ImageMeta.h" | ||
#include "FMWKInterface.h" | ||
|
||
namespace supera { | ||
|
||
/** | ||
\class ImageMetaMakerBase | ||
User defined class ImageMetaMakerBase ... these comments are used to generate | ||
doxygen documentation! | ||
*/ | ||
class ImageMetaMakerBase : public larcv::larcv_base { | ||
|
||
public: | ||
|
||
/// Default constructor | ||
ImageMetaMakerBase(std::string name="NoName") | ||
: larcv_base(name) | ||
{} | ||
|
||
/// Default destructor | ||
virtual ~ImageMetaMakerBase(){} | ||
|
||
virtual void configure(const supera::Config_t&); | ||
|
||
virtual const std::vector<larcv::ImageMeta>& Meta() const = 0; | ||
const std::vector<size_t>& RowCompressionFactor() const { return _comp_rows; } | ||
const std::vector<size_t>& ColCompressionFactor() const { return _comp_cols; } | ||
|
||
private: | ||
|
||
std::vector<size_t> _comp_rows; | ||
std::vector<size_t> _comp_cols; | ||
}; | ||
|
||
} | ||
|
||
#endif | ||
/** @} */ // end of doxygen group | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#ifndef __IMAGEMETAMAKERFACTORY_CXX__ | ||
#define __IMAGEMETAMAKERFACTORY_CXX__ | ||
|
||
#include "larcv/core/Base/larcv_logger.h" | ||
#include "ImageMetaMakerFactory.h" | ||
#include "ImageMetaFromConfig.h" | ||
#include "PulledPork3DSlicer.h" | ||
|
||
namespace supera { | ||
|
||
ImageMetaMakerBase* CreateImageMetaMaker(const supera::Config_t& cfg) | ||
{ | ||
ImageMetaMakerBase* maker = nullptr; | ||
try{ | ||
LARCV_SINFO() << "Attempting to construct supera::ImageMetaFromConfig... " << std::endl; | ||
auto const& meta_cfg = cfg.get<supera::Config_t>("MetaConfig"); | ||
maker = new ImageMetaFromConfig(); | ||
maker->configure(meta_cfg); | ||
LARCV_SINFO() << "Successfully made supera::ImageMetaFromConfig! " << std::endl; | ||
}catch(...){ | ||
if(maker) delete maker; | ||
} | ||
if(!maker) { | ||
try{ | ||
LARCV_SINFO() << "Attempting to construct supera::PuledPork3DSlicer..." << std::endl; | ||
auto const& meta_cfg = cfg.get<supera::Config_t>("PulledPork"); | ||
maker = new PulledPork3DSlicer(); | ||
maker->configure(meta_cfg); | ||
LARCV_SINFO() << "Successfully made supera::PulledPork3DSlicer! " << std::endl; | ||
}catch(...){ | ||
if(maker) delete maker; | ||
} | ||
} | ||
LARCV_SINFO() << "Returning supera::ImageMetaMakerBase: " << maker << std::endl; | ||
return maker; | ||
} | ||
|
||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#ifndef __IMAGEMETAMAKERFACTORY_H__ | ||
#define __IMAGEMETAMAKERFACTORY_H__ | ||
|
||
#include "ImageMetaMakerBase.h" | ||
|
||
namespace supera { | ||
|
||
ImageMetaMakerBase* CreateImageMetaMaker(const supera::Config_t& cfg); | ||
|
||
} | ||
#endif |
Oops, something went wrong.