19 : m_start_time(0.0*units::
ns)
20 , m_readout_time(5.0*units::
ms)
21 , m_tick(0.5*units::
us)
22 , m_drift_speed(1.0*units::
mm/units::us)
28 Gen::DepoZipper::~DepoZipper()
34 auto anode_tn = get<string>(
cfg,
"anode",
"");
35 m_anode = Factory::find_tn<IAnodePlane>(anode_tn);
37 m_nsigma = get<double>(
cfg,
"nsigma", m_nsigma);
38 bool fluctuate = get<bool>(
cfg,
"fluctuate",
false);
41 auto rng_tn = get<string>(
cfg,
"rng",
"");
42 m_rng = Factory::find_tn<IRandom>(rng_tn);
45 m_readout_time = get<double>(
cfg,
"readout_time", m_readout_time);
46 m_tick = get<double>(
cfg,
"tick", m_tick);
47 m_start_time = get<double>(
cfg,
"start_time", m_start_time);
48 m_drift_speed = get<double>(
cfg,
"drift_speed", m_drift_speed);
49 m_frame_count = get<int>(
cfg,
"first_frame_number", m_frame_count);
51 auto jpirs = cfg[
"pirs"];
52 if (jpirs.isNull() or jpirs.empty()) {
53 THROW(
ValueError() <<
errmsg{
"Gen::Ductor: must configure with some plane impact response components"});
56 for (
auto jpir : jpirs) {
57 auto tn = jpir.asString();
58 auto pir = Factory::find_tn<IPlaneImpactResponse>(tn);
59 m_pirs.push_back(pir);
69 put(cfg,
"nsigma", m_nsigma);
72 put(cfg,
"fluctuate",
false);
76 put(cfg,
"start_time", m_start_time);
80 put(cfg,
"readout_time", m_readout_time);
83 put(cfg,
"tick", m_tick);
86 put(cfg,
"drift_speed", m_drift_speed);
89 put(cfg,
"first_frame_number", m_frame_count);
92 put(cfg,
"anode",
"");
97 cfg[
"pirs"] = Json::arrayValue;
107 cerr <<
"Gen::DepoZipper: EOS\n";
111 auto depos = in->depos();
113 Binning tbins(m_readout_time/m_tick, m_start_time, m_start_time+m_readout_time);
115 for (
auto face : m_anode->faces()) {
119 auto bb = face->sensitive();
121 cerr <<
"Gen::DepoZipper anode:" << m_anode->ident() <<
" face:" << face->ident()
122 <<
" is marked insensitive, skipping\n";
126 for (
auto depo : (*
depos)) {
127 if (bb.inside(depo->pos())) {
128 face_depos.push_back(depo);
131 dropped_depos.push_back(depo);
135 if (face_depos.size()) {
136 auto ray = bb.bounds();
137 cerr <<
"Gen::Ductor: anode:" << m_anode->ident() <<
" face:" << face->ident()
138 <<
": processing " << face_depos.size() <<
" depos spanning: t:[" 139 << face_depos.front()->time()/
units::ms <<
", " 140 << face_depos.back()->time()/
units::ms <<
"]ms, bb: " 143 if (dropped_depos.size()) {
144 auto ray = bb.bounds();
145 cerr <<
"Gen::Ductor: anode:" << m_anode->ident() <<
" face:" << face->ident()
146 <<
": dropped " << dropped_depos.size()<<
" depos spanning: t:[" 147 << dropped_depos.front()->time()/
units::ms <<
", " 148 << dropped_depos.back()->time()/
units::ms <<
"]ms, outside bb: " 154 for (
auto plane : face->planes()) {
160 m_start_time+m_readout_time);
163 for (
auto depo : face_depos) {
164 bindiff.
add(depo, depo->extent_long() / m_drift_speed, depo->extent_tran());
167 auto& wires = plane->wires();
169 auto pir = m_pirs.at(iplane);
173 for (
int iwire=0; iwire<
nwires; ++iwire) {
177 if (
mm.first == (
int)wave.size()) {
181 int chid = wires[iwire]->channel();
187 auto trace = make_shared<SimpleTrace>(chid, tbin, charge);
188 traces.push_back(trace);
193 auto frame = make_shared<SimpleFrame>(m_frame_count, m_start_time, traces, m_tick);
194 cerr <<
"Gen::DepoZipper: make frame " << m_frame_count <<
"\n";
boost::error_info< struct tag_errmsg, std::string > errmsg
bool add(IDepo::pointer deposition, double sigma_time, double sigma_pitch)
const Binning & region_binning() const
void put(Configuration &cfg, const std::string &dotpath, const T &val)
Put value in configuration at the dotted path.
std::vector< pointer > vector
Binning tbins(nticks, t0, t0+readout_time)
std::shared_ptr< const IDepoSet > input_pointer
std::shared_ptr< const IFrame > output_pointer
Thrown when a wrong value has been encountered.
Pimpos pimpos(nwires, min_wire_pitch, max_wire_pitch)
Json::Value Configuration
WIRECELL_FACTORY(DepoZipper, WireCell::Gen::DepoZipper, WireCell::IDepoFramer, WireCell::IConfigurable) using namespace WireCell
Waveform::realseq_t waveform(int wire) const
std::vector< float > ChargeSequence
Sequential collection of charge.