11 #include <boost/range.hpp> 23 if (lhs->time() == rhs->time()) {
24 if (lhs->pos().x() == lhs->pos().x()) {
25 return lhs.get() < rhs.get();
27 return lhs->pos().x() < lhs->pos().x();
29 return lhs->time() < rhs->time();
40 auto ja = cfg[
"anode"];
41 auto jr = cfg[
"response"];
42 auto jc = cfg[
"cathode"];
43 if (ja.isNull()) { ja = jr; }
44 if (jr.isNull()) { jr = ja; }
45 anode = ja.asDouble();
89 cfg[
"xregions"] = Json::arrayValue;
107 auto jxregions = cfg[
"xregions"];
108 if (jxregions.empty()) {
109 l->critical(
"no xregions given so I can do nothing");
112 for (
auto jone : jxregions) {
115 l->debug(
"Drifter: time offset: {} ms, drift speed: {} mm/us",
128 const double Qi = depo->charge();
150 respx = xrit->response;
157 respx = xrit->response;
170 double dL = depo->extent_long();
171 double dT = depo->extent_tran();
176 const double absorbprob = 1 - exp(-dt/
m_lifetime);
178 double dQ = Qi * absorbprob;
191 dL = sqrt(2.0*
m_DL*dt + dL*dL);
192 dT = sqrt(2.0*
m_DT*dt + dT*dT);
195 auto newdepo = make_shared<SimpleDepo>(depo->time() +
direction*dt +
m_toffset,
pos, Qf, depo, dL, dT);
196 xrit->depos.insert(newdepo);
202 return lhs->time() < rhs->time();
209 l->debug(
"xregion: anode: {} mm, response: {} mm, cathode: {} mm, flushing {}",
212 outq.insert(outq.end(), xr.depos.begin(), xr.depos.end());
215 std::sort(outq.begin(), outq.end(),
by_time);
216 outq.push_back(
nullptr);
224 if (xr.depos.empty()) {
230 while (depoit != depo_end) {
231 if ((*depoit)->time() <
now) {
237 if (depoit == depo_beg) {
241 outq.insert(outq.end(), depo_beg, depoit);
242 xr.depos.erase(depo_beg, depoit);
247 std::sort(outq.begin(), outq.end(),
by_time);
255 l->error(
"illegal drift speed: {}",
m_speed);
std::shared_ptr< const IDepo > pointer
bool by_time(const IDepo::pointer &lhs, const IDepo::pointer &rhs)
bool inside_bulk(double x) const
boost::error_info< struct tag_errmsg, std::string > errmsg
std::vector< Xregion > m_xregions
std::deque< output_pointer > output_queue
void flush_ripe(output_queue &outq, double now)
bool insert(const input_pointer &depo)
bool inside_response(double x) const
void flush(output_queue &outq)
logptr_t logger(std::string name)
Thrown when a wrong value has been encountered.
virtual bool operator()(const input_pointer &depo, output_queue &outq)
The calling signature:
std::shared_ptr< IDrifter > pointer
Json::Value Configuration
std::shared_ptr< const IDepo > input_pointer
virtual WireCell::Configuration default_configuration() const
Optional, override to return a hard-coded default configuration.
WIRECELL_FACTORY(Drifter, WireCell::Gen::Drifter, WireCell::IDrifter, WireCell::IConfigurable) using namespace std
second_as<> second
Type of time stored in seconds, in double precision.
virtual void configure(const WireCell::Configuration &config)
WireCell::IConfigurable interface.
static const double centimeter2