17 , m_fluctuate(fluctuate)
18 , m_calcstrat(calcstrat)
28 const double center_time = depo->time();
36 double eff_nsigma = sigma_time>0?
m_nsigma:0;
37 if (nmin_sigma > eff_nsigma || nmax_sigma < -eff_nsigma) {
52 double nmin_sigma = pitch_desc.
distance(ibins.min());
53 double nmax_sigma = pitch_desc.
distance(ibins.max());
55 double eff_nsigma = sigma_pitch>0?
m_nsigma:0;
56 if (nmin_sigma > eff_nsigma || nmax_sigma < -eff_nsigma) {
69 int bin_end =
std::min(ibins.bin(center_pitch + sigma_pitch*m_nsigma)+1, ibins.nbins());
75 auto gd = std::make_shared<GaussianDiffusion>(depo, time_desc, pitch_desc);
76 for (
int bin = bin_beg;
bin < bin_end; ++
bin) {
89 idptr = std::make_shared<ImpactData>(
bin);
97 auto mm = idptr->span();
98 cerr <<
"Gen::BinnedDiffusion: add: " 99 <<
" poffoset="<<gd->poffset_bin()
100 <<
" toffoset="<<gd->toffset_bin()
101 <<
" charge=" << gd->depo()->charge()/
units::eplus <<
" eles" 110 for (
int bin=begin_impact_number;
bin<end_impact_number; ++
bin) {
119 if (! ib.inbounds(bin)) {
127 auto idptr = it->second;
130 for (
auto diff : idptr->diffusions()) {
141 std::pair<double,double>
gausdesc_range(
const std::vector<Gen::GausDesc> gds,
double nsigma)
144 double vmin=0, vmax=0;
145 for (
auto gd : gds) {
148 const double lvmin = gd.center - gd.sigma*nsigma;
149 const double lvmax = gd.center + gd.sigma*nsigma;
158 return std::make_pair(vmin,vmax);
163 std::vector<Gen::GausDesc> gds;
165 gds.push_back(diff->pitch_desc());
174 return std::make_pair(
std::max(ibins.bin(
mm.first), 0),
175 std::min(ibins.bin(
mm.second)+1, ibins.nbins()));
180 std::vector<Gen::GausDesc> gds;
182 gds.push_back(diff->time_desc());
std::shared_ptr< const IDepo > pointer
double distance(double x)
Return the distance in number of sigma that x is from the center.
static const double eplus
ImpactDataCalculationStrategy
Useful to client code to mark a calculation strategy.
bool add(IDepo::pointer deposition, double sigma_time, double sigma_pitch)
double distance(const Point &pt, int axis=2) const
std::pair< double, double > pitch_range(double nsigma=0.0) const
void erase(int begin_impact_index, int end_impact_index)
Binning tbins(nticks, t0, t0+readout_time)
const Binning & impact_binning() const
IRandom::pointer m_fluctuate
int bin(double val) const
static std::pair< double, double > gausdesc_range(const std::vector< Gen::GausDesc > gds, double nsigma)
std::shared_ptr< Interface > pointer
ImpactDataCalculationStrategy m_calcstrat
static int max(int a, int b)
ImpactData::pointer impact_data(int bin) const
std::shared_ptr< const ImpactData > pointer
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Pimpos pimpos(nwires, min_wire_pitch, max_wire_pitch)
QTextStream & bin(QTextStream &s)
std::set< std::shared_ptr< GaussianDiffusion > > m_diffs
std::pair< double, double > time_range(double nsigma=0.0) const
std::shared_ptr< ImpactData > mutable_pointer
std::map< int, ImpactData::mutable_pointer > m_impacts
std::pair< int, int > impact_bin_range(double nsigma=0.0) const
std::pair< int, int > time_bin_range(double nsigma=0.0) const