ElecResponse.cxx
Go to the documentation of this file.
2 
5 
6 #include <iostream>
7 
10 
11 using namespace std;
12 using namespace WireCell;
13 
14 Gen::ElecResponse::ElecResponse(int nticks, double t0, double gain, double shaping, double postgain, double tick)
15 {
16  m_cfg["gain"] = gain;
17  m_cfg["shaping"] = shaping;
18  m_cfg["postgain"] = postgain;
19  m_cfg["start"] = t0;
20  m_cfg["tick"] = tick;
21  m_cfg["nticks"] = nticks;
22 }
23 WireCell::Configuration Gen::ElecResponse::default_configuration() const
24 {
25  return m_cfg;
26 }
28 {
29  m_cfg = cfg;
30 
31  Response::ColdElec ce(m_cfg["gain"].asDouble(), m_cfg["shaping"].asDouble());
32  const int nbins = m_cfg["nticks"].asInt();
33  const double t0 = waveform_start();
34  const double tick = waveform_period();
35  Binning bins(nbins, t0, t0+nbins*tick);
36  m_wave = ce.generate(bins);
37  Waveform::scale(m_wave, m_cfg["postgain"].asDouble());
38 }
39 
41 {
42  return m_cfg["start"].asDouble();
43 }
44 
46 {
47  return m_cfg["tick"].asDouble();
48 }
49 
51 {
52  return m_wave;
53 }
54 
code to link reconstructed objects back to the MC truth information
virtual double waveform_period() const
STL namespace.
cfg
Definition: dbjson.py:29
A functional object caching gain and shape.
Definition: Response.h:165
const double tick
virtual void configure(const WireCell::Configuration &cfg)
Accept a configuration.
const int nticks
std::vector< float > sequence_type
Definition: IWaveform.h:17
const double t0
WIRECELL_FACTORY(ElecResponse, WireCell::Gen::ElecResponse, WireCell::IWaveform, WireCell::IConfigurable) using namespace std
WireCell::Waveform::realseq_t generate(const WireCell::Waveform::Domain &domain, int nsamples)
FIXME: eradicate Domain in favor of Binning.
Definition: Response.cxx:303
Definition: Main.h:22
virtual double waveform_start() const
void scale(Sequence< Val > &seq, Val scalar)
Scale (multiply) sequence values by scalar.
Definition: Waveform.h:146
virtual const sequence_type & waveform_samples() const
Json::Value Configuration
Definition: Configuration.h:50