NominalChannelResponse.cxx
Go to the documentation of this file.
4 
6 
7 WIRECELL_FACTORY(NominalChannelResponse,
10 
11 using namespace WireCell;
13  double shaping,
14  const Binning& binning)
15  : m_gain(gain)
16  , m_shaping(shaping)
17  , m_bins(binning)
18 {
19 }
20 
21 SigProc::NominalChannelResponse::~NominalChannelResponse()
22 {
23 }
24 
25 WireCell::Configuration SigProc::NominalChannelResponse::default_configuration() const
26 {
28  cfg["gain"] = m_gain;
29  cfg["shaping"] = m_shaping;
30  cfg["nbins"] = m_bins.nbins();
31  cfg["tmin"] = m_bins.min();
32  cfg["tmax"] = m_bins.max();
33  return cfg;
34 }
35 
37 {
38  m_gain = get(cfg,"gain",m_gain);
39  m_shaping = get(cfg,"shaping",m_shaping);
40  int nbins = get(cfg,"nbins", m_bins.nbins());
41  double tmin = get(cfg,"tmin",m_bins.min());
42  double tmax = get(cfg,"tmax",m_bins.max());
43  Response::ColdElec ce(m_gain, m_shaping);
44  m_bins = Binning(nbins, tmin, tmax);
45  m_cr = ce.generate(m_bins);
46  if (m_cr.empty()) {
47  THROW(ValueError() << errmsg{"Failed to generate any nominal channel response"});
48  }
49 }
50 
51 
52 const Waveform::realseq_t& SigProc::NominalChannelResponse::channel_response(int channel_ident) const
53 {
54  return m_cr;
55 }
56 
57 Binning SigProc::NominalChannelResponse::channel_response_binning() const
58 {
59  return m_bins;
60 }
Sequence< real_t > realseq_t
Definition: Waveform.h:31
boost::error_info< struct tag_errmsg, std::string > errmsg
Definition: Exceptions.h:54
cfg
Definition: dbjson.py:29
A functional object caching gain and shape.
Definition: Response.h:165
def configure(cfg)
Definition: cuda.py:34
WireCell::Waveform::realseq_t generate(const WireCell::Waveform::Domain &domain, int nsamples)
FIXME: eradicate Domain in favor of Binning.
Definition: Response.cxx:303
#define THROW(e)
Definition: Exceptions.h:25
WIRECELL_FACTORY(NominalChannelResponse, WireCell::SigProc::NominalChannelResponse, WireCell::IChannelResponse, WireCell::IConfigurable) using namespace WireCell
Thrown when a wrong value has been encountered.
Definition: Exceptions.h:37
Definition: Main.h:22
Json::Value Configuration
Definition: Configuration.h:50
def channel_ident(G, wire)
Definition: apa.py:445