23 Sio::NumpyDepoSaver::~NumpyDepoSaver()
36 cfg[
"filename"] =
"wct-frame.npz";
53 auto prior = depo->prior();
62 for (
auto depo : depos) {
74 m_depos.push_back(indepo);
79 const size_t ndepos = m_depos.size();
81 std::cerr <<
"NumpyDepoSaver: warning: EOS and no depos seen.\n";
86 const size_t nfdepos = fdepos.size();
92 const size_t ninfo = 4;
94 for (
size_t idepo=0; idepo != nfdepos; ++idepo) {
95 auto depogc = fdepos[idepo];
96 auto depo = std::get<0>(depogc);
97 auto gen = std::get<1>(depogc);
98 auto child = std::get<2>(depogc);
99 data(idepo, 0) = depo->time();
100 data(idepo, 1) = depo->charge();
101 data(idepo, 2) = depo->pos().x();
102 data(idepo, 3) = depo->pos().y();
103 data(idepo, 4) = depo->pos().z();
104 data(idepo, 5) = depo->extent_long();
105 data(idepo, 6) = depo->extent_tran();
106 info(idepo, 0) = depo->id();
107 info(idepo, 1) = depo->pdg();
108 info(idepo, 2) = gen;
109 info(idepo, 3) = child;
116 cnpy::npz_save(fname, data_name, data.data(), {ndata, ndepos}, mode);
117 cnpy::npz_save(fname, info_name, info.data(), {ninfo, ndepos}, mode);
static depos_with_prior flatten_depos(std::vector< WireCell::IDepo::pointer > depos)
std::shared_ptr< const IDepo > pointer
static void push_depo(depos_with_prior &dp, WireCell::IDepo::pointer depo, size_t gen=0, size_t childid=0)
void npz_save(std::string zipname, std::string fname, const T *data, const std::vector< size_t > &shape, std::string mode="w")
std::vector< depo_gen_child > depos_with_prior
std::tuple< IDepo::pointer, size_t, size_t > depo_gen_child
Json::Value Configuration
Eigen::Array< int, Eigen::Dynamic, Eigen::Dynamic > array_xxi
Integer.
Eigen::ArrayXXf array_xxf
A real, 2D array.
WIRECELL_FACTORY(NumpyDepoSaver, WireCell::Sio::NumpyDepoSaver, WireCell::IDepoFilter, WireCell::IConfigurable) using namespace WireCell