ImpactData.h
Go to the documentation of this file.
1 /**
2  ImpactData represents the true charge distribution in time at the
3  point in space where a field response function begins.
4  */
5 
8 
9 #include <memory>
10 #include <vector>
11 
12 #ifndef WIRECELLGEN_IMPACTDATA
13 #define WIRECELLGEN_IMPACTDATA
14 
15 namespace WireCell {
16  namespace Gen {
17  /// Information that has been collected at one impact position
18  class ImpactData {
19  int m_impact;
24 
25  // Record the diffusions and their pitch bin that contribute to this impact position.
26  std::vector<GaussianDiffusion::pointer> m_diffusions;
27 
28  public:
29  typedef std::shared_ptr<ImpactData> mutable_pointer; // for this class
30  typedef std::shared_ptr<const ImpactData> pointer; // for callers
31 
32  /** Create an ImpactData associated with the given
33  * absolute impact position. See impact_number() for
34  * description of the impact.*/
35  ImpactData(int impact);
36 
37  /** Add a (shared) GaussianDiffusion object for
38  * consideration. If any are added which do not overlap
39  * with this ImpactData's impact/pitch sample point then
40  * they will not contribute to the waveform nor spectrum
41  * at this impact. */
43 
44  const std::vector<GaussianDiffusion::pointer>& diffusions() const { return m_diffusions; }
45 
46  /** The `calculate_*()` methods finalize the underlying
47  * waveform data for this slice in time across the
48  * collected GaussianDiffusion object.
49  *
50  * These methods are idempotent and one must be called
51  * before waveform(), spectrum() and weightform() return
52  * valid results.
53  */
54 
55  /** Calculate the impact data assuming a weighting,
56  * linear or constant (all = 0.5),
57  * and honoring the Gaussian distribution (diffusion).
58  */
59  void calculate(int nticks) const;
60 
61 
62 
63  /** Return the time domain waveform of drifted/diffused
64  * charge at this impact position. See `calculate()`. */
66 
67  /** Return the discrete Fourier transform of the above.
68  * See `calculate()`. */
70 
71  /** The "weightform" is a waveform of weights and gives,
72  * for each tick, a measure of where the charge is
73  * "concentrated" (by some measure) along the distance
74  * from the low impact number edge to the high impact
75  * number edge. In general, the weights depend on the
76  * local (microscopic) charge distribution as well as
77  * which `calculate_*()` method was used.
78  */
81 
82  /** Return the associated impact number. This provides a
83  sample count along the pitch direction starting from some
84  externally defined pitch origin. */
85  int impact_number() const { return m_impact; }
86 
87  /** Return the max time range spanned by the difussions
88  * that cover this impact including a width expressed as a
89  * factor multiplied by the sigma of the time Gaussian.
90  * Set to 0.0 gives collective span of centers.*/
91  std::pair<double,double> span(double nsigma = 0.0) const;
92 
93  /** Return the smallest, half-open range of tick indices
94  * which have only zero values outside. */
95  //std::pair<int,int> strip() const;
96  };
97 
98  }
99 }
100 
101 #endif
std::vector< GaussianDiffusion::pointer > m_diffusions
Definition: ImpactData.h:26
Sequence< real_t > realseq_t
Definition: Waveform.h:31
Waveform::compseq_t m_weight_spectrum
Definition: ImpactData.h:23
Waveform::realseq_t & weightform() const
Definition: ImpactData.cxx:27
Waveform::compseq_t & spectrum() const
Definition: ImpactData.cxx:22
Waveform::realseq_t & waveform() const
Definition: ImpactData.cxx:17
const int nticks
G4bool diffusion
Definition: NestAlg.cxx:40
void calculate(int nticks) const
Definition: ImpactData.cxx:37
const std::vector< GaussianDiffusion::pointer > & diffusions() const
Definition: ImpactData.h:44
Waveform::realseq_t m_weights
Definition: ImpactData.h:22
int impact_number() const
Definition: ImpactData.h:85
void add(GaussianDiffusion::pointer diffusion)
Definition: ImpactData.cxx:12
std::pair< double, double > span(double nsigma=0.0) const
Definition: ImpactData.cxx:89
Definition: Main.h:22
std::shared_ptr< const ImpactData > pointer
Definition: ImpactData.h:30
Waveform::realseq_t m_waveform
Definition: ImpactData.h:20
Waveform::compseq_t & weight_spectrum() const
Definition: ImpactData.cxx:32
std::shared_ptr< ImpactData > mutable_pointer
Definition: ImpactData.h:29
Sequence< complex_t > compseq_t
A complex-valued sequence, eg for discrete spectrum powers.
Definition: Waveform.h:34
Information that has been collected at one impact position.
Definition: ImpactData.h:18
std::shared_ptr< GaussianDiffusion > pointer
Waveform::compseq_t m_spectrum
Definition: ImpactData.h:21