20 int resolution,
double gain,
21 std::
vector<
double> fullscale, std::
vector<
double> baselines)
23 , m_resolution(resolution)
25 , m_fullscale(fullscale)
26 , m_baselines(baselines)
32 Gen::Digitizer::~Digitizer()
44 for (
int ind=0; ind<2; ++ind) {
47 cfg[
"fullscale"] = fs;
50 for (
int ind=0; ind<3; ++ind) {
53 cfg[
"baselines"] = bl;
71 ss <<
"Gen::Digitizer: " 73 <<
"resolution="<<m_resolution<<
" bits, " 75 <<
"gain=" <<
m_gain <<
", " 94 return relvoltage*adcmaxval;
100 log->debug(
"Gen::Digitizer: EOS");
108 if (vtraces.empty()) {
109 log->error(
"Gen::Digitizer: no traces in input frame {}", vframe->ident());
117 auto chend = std::unique(chbeg,
channels.end());
120 const size_t ncols = tbinmm.second-tbinmm.first;
130 for (
size_t irow=0; irow <
nrows; ++irow) {
134 log->warn(
"Gen::Digitizer, got invalid WPID for channel {}: {}, skipping", ch, wpid);
140 for (
size_t icol=0; icol < ncols; ++icol) {
141 double voltage =
m_gain*arr(irow, icol) + baseline;
142 const float adcf =
digitize(voltage);
143 adcwave[icol] = adcf;
145 adctraces[irow] = make_shared<SimpleTrace>(ch, tbinmm.first, adcwave);
147 auto sframe = make_shared<SimpleFrame>(vframe->ident(), vframe->time(), adctraces,
148 vframe->tick(), vframe->masks());
virtual bool operator()(const input_pointer &inframe, output_pointer &outframe)
The calling signature:
void put(Configuration &cfg, const std::string &dotpath, const T &val)
Put value in configuration at the dotted path.
std::vector< pointer > vector
double digitize(double voltage)
std::vector< pointer > vector
Vector of shared pointers.
std::shared_ptr< const IFrame > input_pointer
std::vector< double > m_fullscale
virtual void configure(const WireCell::Configuration &config)
Accept a configuration.
WIRECELL_FACTORY(Digitizer, WireCell::Gen::Digitizer, WireCell::IFrameFilter, WireCell::IConfigurable) using namespace std
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
virtual WireCell::Configuration default_configuration() const
Optional, override to return a hard-coded default configuration.
std::shared_ptr< const IFrame > output_pointer
logptr_t logger(std::string name)
bool valid() const
return true if valid
void log(source_loc source, level::level_enum lvl, const char *fmt, const Args &...args)
Json::Value Configuration
unsigned nrows(sqlite3 *db, std::string const &tablename)
IAnodePlane::pointer m_anode
std::vector< double > m_baselines
std::vector< float > ChargeSequence
Sequential collection of charge.
int index() const
Layer as index number (0,1 or 2). -1 if unknown.
Eigen::ArrayXXf array_xxf
A real, 2D array.