19 : m_stepsize(stepsize)
26 Gen::TrackDepos::~TrackDepos()
35 cfg[
"tracks"] = Json::arrayValue;
36 cfg[
"group_time"] = -1;
50 for (
auto track : cfg[
"tracks"]) {
51 double time = get<double>(track,
"time", 0.0);
52 double charge = get<double>(track,
"charge", -1.0);
53 Ray ray = get<Ray>(track,
"ray");
56 double gt = get<double>(
cfg,
"group_time", -1);
57 if (
m_depos.empty() or gt <= 0.0) {
61 std::deque<WireCell::IDepo::pointer> grouped;
63 double end = now +
gt;
65 if (depo->time() <
end) {
66 grouped.push_back(depo);
69 grouped.push_back(
nullptr);
72 grouped.push_back(depo);
74 grouped.push_back(
nullptr);
87 l->debug(
"add_track({} us, ({} -> {})cm, {})",
98 charge_per_depo = -charge / (length /
m_stepsize);
100 else if (charge <= 0) {
101 charge_per_depo = charge;
104 while (step < length) {
128 l->debug(
"EOS at call {}",
m_count);
std::pair< Point, Point > Ray
A line segment running from a first (tail) to a second (head) point.
std::shared_ptr< const IDepo > pointer
static const double eplus
void add_track(double time, const WireCell::Ray &ray, double dedx=-1.0)
virtual bool operator()(IDepo::pointer &out)
ISourceNode.
static const double clight
std::vector< pointer > vector
std::shared_ptr< const IDepo > output_pointer
A producer of depositions created from some number of simple, linear tracks.
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
double ray_length(const Ray &ray)
std::deque< WireCell::IDepo::pointer > m_depos
virtual void configure(const WireCell::Configuration &config)
Accept a configuration.
WireCell::IDepo::vector depos()
Vector ray_unit(const Ray &ray)
std::vector< track_t > m_tracks
logptr_t logger(std::string name)
bool ascending_time(const WireCell::IDepo::pointer &lhs, const WireCell::IDepo::pointer &rhs)
Compare two IDepo::pointer by time (ascending). x is used to break tie.
Json::Value Configuration
static std::string dump(IDepo::pointer d)
virtual WireCell::Configuration default_configuration() const
Optional, override to return a hard-coded default configuration.
WIRECELL_FACTORY(TrackDepos, WireCell::Gen::TrackDepos, WireCell::IDepoSource, WireCell::IConfigurable) using namespace std
std::tuple< double, Ray, double > track_t