PlaneImpactResponse.h
Go to the documentation of this file.
1 #ifndef WIRECELLGEN_PLANEIMPACTRESPONSE
2 #define WIRECELLGEN_PLANEIMPACTRESPONSE
3 
6 
8 #include "WireCellUtil/Units.h"
9 #include "WireCellUtil/Logging.h"
10 
11 namespace WireCell {
12 
13  namespace Gen {
14 
15  /** The information about detector response at a particular impact
16  * position (discrete position along the pitch direction of a
17  * plane on which a response function is defined). Note,
18  * different physical positions may share the same ImpactResponse.
19  */
21  int m_impact;
25 
29 
30  public:
31  ImpactResponse(int impact, const Waveform::realseq_t& wf, int waveform_pad, const Waveform::realseq_t& long_wf, int long_waveform_pad)
32  : m_impact(impact), m_waveform(wf), m_waveform_pad(waveform_pad)
33  , m_long_waveform(long_wf), m_long_waveform_pad(long_waveform_pad)
34  {}
35 
36  /// Frequency-domain spectrum of response
38  const Waveform::realseq_t& waveform() const {return m_waveform;};
39  int waveform_pad() const {return m_waveform_pad;};
40 
44 
45 
46 
47  /// Corresponding impact number
48  int impact() const { return m_impact; }
49 
50  };
51 
52  /** Collection of all impact responses for a plane */
54  public:
55 
56  /** Create a PlaneImpactResponse.
57 
58  Field response is assumed to be normalized in units of current.
59 
60  Pre-amplifier gain and peaking time is that of the FE
61  electronics. The preamp gain should be in units
62  consistent with the field response. If 0.0 then no
63  electronics response will be convolved.
64 
65  A flat post-FEE amplifier gain can also be given to
66  provide a global scaling of the output of the electronics.
67 
68  Fixme: field response should be provided by a component.
69  */
70  PlaneImpactResponse(int plane_ident = 0,
71  size_t nbins = 10000,
72  double tick = 0.5*units::us);
74 
75  // IConfigurable interface
76  virtual void configure(const WireCell::Configuration& cfg);
77  virtual WireCell::Configuration default_configuration() const;
78 
79  /// Return the response at the impact position closest to
80  /// the given relative pitch location (measured relative
81  /// to the wire of interest).
82  virtual IImpactResponse::pointer closest(double relpitch) const;
83 
84  /// Return the two responses which are associated with the
85  /// impact positions on either side of the given pitch
86  /// location (measured relative to the wire of interest).
87  virtual TwoImpactResponses bounded(double relpitch) const;
88 
89  double pitch_range() const { return 2.0*m_half_extent; }
90  double pitch() const { return m_pitch; }
91  double impact() const { return m_impact; }
92 
93  int nwires() const { return m_bywire.size(); }
94 
95  size_t nbins() const { return m_nbins; }
96 
97  /// not in the interface
98  int nimp_per_wire() const { return m_bywire[0].size(); }
99  typedef std::vector<int> region_indices_t;
100  typedef std::vector<region_indices_t> wire_region_indicies_t;
101  const wire_region_indicies_t& bywire_map() const { return m_bywire; }
102  std::pair<int,int> closest_wire_impact(double relpitch) const;
103 
104 
105  private:
107  std::vector<std::string> m_short;
109  std::vector<std::string> m_long;
111 
113  size_t m_nbins;
114  double m_tick;
115 
116  wire_region_indicies_t m_bywire;
117 
118  std::vector<IImpactResponse::pointer> m_ir;
119  double m_half_extent, m_pitch, m_impact;
120 
122 
123  void build_responses();
124 
125  };
126 
127 }}
128 
129 #endif
130 
int nwires() const
The number of wires that span the pitch range.
Sequence< real_t > realseq_t
Definition: Waveform.h:31
std::vector< region_indices_t > wire_region_indicies_t
Waveform::compseq_t m_long_spectrum
std::string string
Definition: nybbler.cc:12
const wire_region_indicies_t & bywire_map() const
const Waveform::compseq_t & spectrum()
Frequency-domain spectrum of response.
cfg
Definition: dbjson.py:29
const Waveform::realseq_t & waveform() const
Time-domain waveform of the response.
const double tick
def configure(cfg)
Definition: cuda.py:34
std::pair< IImpactResponse::pointer, IImpactResponse::pointer > TwoImpactResponses
std::shared_ptr< Interface > pointer
Definition: Interface.h:16
const Waveform::compseq_t & long_aux_spectrum()
Waveform::realseq_t m_long_waveform
std::shared_ptr< spdlog::logger > logptr_t
Definition: Logging.h:24
std::vector< std::string > m_short
Definition: Main.h:22
const Waveform::realseq_t & long_aux_waveform() const
std::vector< std::string > m_long
std::vector< IImpactResponse::pointer > m_ir
int nimp_per_wire() const
not in the interface
Json::Value Configuration
Definition: Configuration.h:50
static const double us
Definition: Units.h:105
Sequence< complex_t > compseq_t
A complex-valued sequence, eg for discrete spectrum powers.
Definition: Waveform.h:34
ImpactResponse(int impact, const Waveform::realseq_t &wf, int waveform_pad, const Waveform::realseq_t &long_wf, int long_waveform_pad)
int impact() const
Corresponding impact number.