47 const double dE = depo[
"q"].asDouble();
48 return (*m_model)(dE);
57 const double dE = depo[
"q"].asDouble();
58 const double dX = depo[
"s"].asDouble();
59 return (*m_model)(dE, dX);
68 : m_adapter(nullptr), m_eos(false)
98 cfg[
"jsonpath"] =
"depos";
99 cfg[
"model"] =
"electrons";
107 const double q = (*m_adapter)(jdepo);
108 auto idepo = std::make_shared<SimpleDepo>(
110 Point(
get(jdepo,
"x", 0.0),
111 get(jdepo,
"y", 0.0),
112 get(jdepo,
"z", 0.0)),
129 if (model_type ==
"electrons") {
130 double scale =
get(
cfg,
"scale",1.0);
131 cerr <<
"Sio::JsonDepoSource: using electrons with scale=" << scale <<
endl;
135 auto model = Factory::lookup_tn<IRecombinationModel>(model_tn);
137 cerr <<
"Sio::JsonDepoSource::configure: unknown recombination model: \"" << model_tn <<
"\"\n";
140 if (model_type ==
"MipRecombination") {
143 if (model_type ==
"BirksRecombination" || model_type ==
"BoxRecombination") {
150 string dotpath = get<string>(
cfg,
"jsonpath",
"depos");
151 if (filename.empty()) {
152 cerr <<
"JsonDepoSource::configure: no JSON filename given" <<
endl;
158 auto jdepos =
branch(top, dotpath);
159 for (
auto jdepo : jdepos) {
162 qtot += idepo->charge();
165 cerr <<
"Sio::JsonDepoSource::configure: " 166 <<
"slurped in " <<
m_depos.size() <<
" depositions, " IRecombinationModel::pointer m_model
std::shared_ptr< const IDepo > pointer
JsonRecombinationAdaptor * m_adapter
static const double eplus
std::shared_ptr< IRecombinationModel > pointer
Access subclass facet by pointer.
virtual ~ElectronsAdapter()
D3Vector< double > Point
A 3D Cartesian point in double precision.
virtual double operator()(Json::Value depo) const =0
IDepo::pointer jdepo2idepo(Json::Value jdepo)
virtual double operator()(Json::Value depo) const
virtual double operator()(Json::Value depo) const
StepAdapter(IRecombinationModel::pointer model)
ElectronsAdapter(double scale=1.0)
virtual ~JsonDepoSource()
Configuration branch(Configuration cfg, const std::string &dotpath)
Follow a dot.separated.path and return the branch there.
virtual double operator()(Json::Value depo) const
virtual bool operator()(IDepo::pointer &out)
IDepoSource.
IRecombinationModel::pointer m_model
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Json::Value load(const std::string &filename, const externalvars_t &extvar=externalvars_t(), const externalvars_t &extcode=externalvars_t())
WIRECELL_FACTORY(JsonDepoSource, WireCell::Sio::JsonDepoSource, WireCell::IDepoSource, WireCell::IConfigurable) using namespace WireCell
WireCell::IDepo::vector m_depos
bool descending_time(const WireCell::IDepo::pointer &lhs, const WireCell::IDepo::pointer &rhs)
Compare two IDepo::pointers for by time, descending. x is used to break tie.
virtual ~JsonRecombinationAdaptor()
Json::Value Configuration
PointAdapter(IRecombinationModel::pointer model)
std::vector< std::string > split(const std::string &in, const std::string &delim=":")
virtual WireCell::Configuration default_configuration() const
IConfigurable.
QTextStream & endl(QTextStream &s)
virtual void configure(const WireCell::Configuration &config)
Accept a configuration.