58 : m_start_time(0.0*units::
ns)
59 , m_readout_time(5.0*units::
ms)
60 , m_tick(0.5*units::
us)
61 , m_drift_speed(1.0*units::
mm/units::us)
68 Gen::DepoTransform::~DepoTransform()
74 auto anode_tn = get<string>(
cfg,
"anode",
"");
75 m_anode = Factory::find_tn<IAnodePlane>(anode_tn);
77 m_nsigma = get<double>(
cfg,
"nsigma", m_nsigma);
78 bool fluctuate = get<bool>(
cfg,
"fluctuate",
false);
81 auto rng_tn = get<string>(
cfg,
"rng",
"");
82 m_rng = Factory::find_tn<IRandom>(rng_tn);
85 m_readout_time = get<double>(
cfg,
"readout_time", m_readout_time);
86 m_tick = get<double>(
cfg,
"tick", m_tick);
87 m_start_time = get<double>(
cfg,
"start_time", m_start_time);
88 m_drift_speed = get<double>(
cfg,
"drift_speed", m_drift_speed);
89 m_frame_count = get<int>(
cfg,
"first_frame_number", m_frame_count);
91 auto jpirs = cfg[
"pirs"];
92 if (jpirs.isNull() or jpirs.empty()) {
93 std::string msg =
"must configure with some plane impact response components";
98 for (
auto jpir : jpirs) {
99 auto tn = jpir.asString();
100 auto pir = Factory::find_tn<IPlaneImpactResponse>(tn);
101 m_pirs.push_back(pir);
111 put(cfg,
"nsigma", m_nsigma);
114 put(cfg,
"fluctuate",
false);
118 put(cfg,
"start_time", m_start_time);
122 put(cfg,
"readout_time", m_readout_time);
125 put(cfg,
"tick", m_tick);
128 put(cfg,
"drift_speed", m_drift_speed);
131 put(cfg,
"first_frame_number", m_frame_count);
134 put(cfg,
"anode",
"");
139 cfg[
"pirs"] = Json::arrayValue;
152 auto depos = in->depos();
154 Binning tbins(m_readout_time/m_tick, m_start_time, m_start_time+m_readout_time);
156 for (
auto face : m_anode->faces()) {
160 auto bb = face->sensitive();
162 l->debug(
"anode {} face {} is marked insensitive, skipping",
163 m_anode->ident(), face->ident());
167 for (
auto depo : (*
depos)) {
168 if (bb.inside(depo->pos())) {
169 face_depos.push_back(depo);
172 dropped_depos.push_back(depo);
176 if (face_depos.size()) {
177 auto ray = bb.bounds();
178 l->debug(
"anode: {}, face: {}, processing {} depos spanning " 179 "t:[{},{}]ms, bb:[{}-->{}]cm",
180 m_anode->ident(), face->ident(), face_depos.size(),
185 if (dropped_depos.size()) {
186 auto ray = bb.bounds();
187 l->debug(
"anode: {}, face: {}, dropped {} depos spanning " 188 "t:[{},{}]ms, outside bb:[{}-->{}]cm",
189 m_anode->ident(), face->ident(),
190 dropped_depos.size(),
198 for (
auto plane : face->planes()) {
204 m_start_time+m_readout_time);
207 for (
auto depo : face_depos) {
208 depo = modify_depo(plane->planeid(), depo);
209 bindiff.
add(depo, depo->extent_long() / m_drift_speed, depo->extent_tran());
212 auto& wires = plane->wires();
214 auto pir = m_pirs.at(iplane);
218 for (
int iwire=0; iwire<
nwires; ++iwire) {
219 auto wave = transform.
waveform(iwire);
222 if (
mm.first == (
int)wave.size()) {
226 int chid = wires[iwire]->channel();
230 auto trace = make_shared<SimpleTrace>(chid, tbin, charge);
231 traces.push_back(trace);
236 auto frame = make_shared<SimpleFrame>(m_frame_count, m_start_time, traces, m_tick);
void msg(const char *fmt,...)
boost::error_info< struct tag_errmsg, std::string > errmsg
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
tagset_t transform(const tagset_t &ts, const ruleset_t &rs, bool all_rules=true)
Binning tbins(nticks, t0, t0+readout_time)
std::shared_ptr< const IDepoSet > input_pointer
std::shared_ptr< const IFrame > output_pointer
logptr_t logger(std::string name)
Thrown when a wrong value has been encountered.
Pimpos pimpos(nwires, min_wire_pitch, max_wire_pitch)
Json::Value Configuration
std::vector< float > ChargeSequence
Sequential collection of charge.