Public Types | Public Member Functions | Private Attributes | List of all members
WireCell::Gen::ImpactData Class Reference

Information that has been collected at one impact position. More...

#include <ImpactData.h>

Public Types

typedef std::shared_ptr< ImpactDatamutable_pointer
 
typedef std::shared_ptr< const ImpactDatapointer
 

Public Member Functions

 ImpactData (int impact)
 
void add (GaussianDiffusion::pointer diffusion)
 
const std::vector< GaussianDiffusion::pointer > & diffusions () const
 
void calculate (int nticks) const
 
Waveform::realseq_twaveform () const
 
Waveform::compseq_tspectrum () const
 
Waveform::realseq_tweightform () const
 
Waveform::compseq_tweight_spectrum () const
 
int impact_number () const
 
std::pair< double, double > span (double nsigma=0.0) const
 

Private Attributes

int m_impact
 
Waveform::realseq_t m_waveform
 
Waveform::compseq_t m_spectrum
 
Waveform::realseq_t m_weights
 
Waveform::compseq_t m_weight_spectrum
 
std::vector< GaussianDiffusion::pointerm_diffusions
 

Detailed Description

Information that has been collected at one impact position.

Definition at line 18 of file ImpactData.h.

Member Typedef Documentation

Definition at line 29 of file ImpactData.h.

typedef std::shared_ptr<const ImpactData> WireCell::Gen::ImpactData::pointer

Definition at line 30 of file ImpactData.h.

Constructor & Destructor Documentation

Gen::ImpactData::ImpactData ( int  impact)

Create an ImpactData associated with the given absolute impact position. See impact_number() for description of the impact.

Definition at line 8 of file ImpactData.cxx.

9  : m_impact(impact)
10 {
11 }

Member Function Documentation

void Gen::ImpactData::add ( GaussianDiffusion::pointer  diffusion)

Add a (shared) GaussianDiffusion object for consideration. If any are added which do not overlap with this ImpactData's impact/pitch sample point then they will not contribute to the waveform nor spectrum at this impact.

Definition at line 12 of file ImpactData.cxx.

13 {
14  m_diffusions.push_back(diffusion);
15 }
std::vector< GaussianDiffusion::pointer > m_diffusions
Definition: ImpactData.h:26
G4bool diffusion
Definition: NestAlg.cxx:40
void Gen::ImpactData::calculate ( int  nticks) const

The calculate_*() methods finalize the underlying waveform data for this slice in time across the collected GaussianDiffusion object.

These methods are idempotent and one must be called before waveform(), spectrum() and weightform() return valid results. Calculate the impact data assuming a weighting, linear or constant (all = 0.5), and honoring the Gaussian distribution (diffusion).

Definition at line 37 of file ImpactData.cxx.

38 {
39  if (m_waveform.size() > 0) {
40  return;
41  }
42  m_waveform.resize(nticks, 0.0);
43  m_weights.resize(nticks, 0.0);
44 
45  for (auto diff : m_diffusions) {
46 
47  const auto patch = diff->patch();
48  const auto qweight = diff->weights();
49 
50  const int poffset_bin = diff->poffset_bin();
51  const int pbin = m_impact - poffset_bin;
52  const int np = patch.rows();
53  if (pbin<0 || pbin >= np) {
54  continue;
55  }
56 
57  const int toffset_bin = diff->toffset_bin();
58  const int nt = patch.cols();
59 
60  // std::cout << pbin << " " << poffset_bin << " " << m_impact << std::endl;
61 
62  for (int tbin=0; tbin<nt; ++tbin) {
63  const int absbin = tbin+toffset_bin;
64  m_waveform[absbin] += patch(pbin, tbin);
65 
66  // std::cout << pbin << " " << tbin << " " << patch(pbin,tbin) << std::endl;
67 
68  // for interpolation
69  m_weights[absbin] += qweight[pbin]*patch(pbin, tbin);
70  }
71  }
72 
75 }
std::vector< GaussianDiffusion::pointer > m_diffusions
Definition: ImpactData.h:26
Waveform::compseq_t m_weight_spectrum
Definition: ImpactData.h:23
const int nticks
compseq_t dft(realseq_t seq)
Definition: Waveform.cxx:141
Waveform::realseq_t m_weights
Definition: ImpactData.h:22
Waveform::realseq_t m_waveform
Definition: ImpactData.h:20
Waveform::compseq_t m_spectrum
Definition: ImpactData.h:21
const std::vector<GaussianDiffusion::pointer>& WireCell::Gen::ImpactData::diffusions ( ) const
inline

Definition at line 44 of file ImpactData.h.

44 { return m_diffusions; }
std::vector< GaussianDiffusion::pointer > m_diffusions
Definition: ImpactData.h:26
int WireCell::Gen::ImpactData::impact_number ( ) const
inline

Return the associated impact number. This provides a sample count along the pitch direction starting from some externally defined pitch origin.

Definition at line 85 of file ImpactData.h.

85 { return m_impact; }
std::pair< double, double > Gen::ImpactData::span ( double  nsigma = 0.0) const

Return the max time range spanned by the difussions that cover this impact including a width expressed as a factor multiplied by the sigma of the time Gaussian. Set to 0.0 gives collective span of centers.

Definition at line 89 of file ImpactData.cxx.

90 {
91  int ncount = -1;
92  double tmin=0, tmax=0;
93  for (auto diff : m_diffusions) {
94  ++ncount;
95 
96  auto td = diff->time_desc();
97 
98  const double ltmin = td.center - td.sigma*nsigma;
99  const double ltmax = td.center + td.sigma*nsigma;
100  if (!ncount) {
101  tmin = ltmin;
102  tmax = ltmax;
103  continue;
104  }
105  tmin = std::min(tmin, ltmin);
106  tmax = std::max(tmax, ltmax);
107  }
108  return std::make_pair(tmin,tmax);
109 }
std::vector< GaussianDiffusion::pointer > m_diffusions
Definition: ImpactData.h:26
static int max(int a, int b)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
Waveform::compseq_t & Gen::ImpactData::spectrum ( ) const

Return the discrete Fourier transform of the above. See calculate().

Definition at line 22 of file ImpactData.cxx.

23 {
24  return m_spectrum;
25 }
Waveform::compseq_t m_spectrum
Definition: ImpactData.h:21
Waveform::realseq_t & Gen::ImpactData::waveform ( ) const

Return the time domain waveform of drifted/diffused charge at this impact position. See calculate().

Definition at line 17 of file ImpactData.cxx.

18 {
19  return m_waveform;
20 }
Waveform::realseq_t m_waveform
Definition: ImpactData.h:20
Waveform::compseq_t & Gen::ImpactData::weight_spectrum ( ) const

Definition at line 32 of file ImpactData.cxx.

33 {
34  return m_weight_spectrum;
35 }
Waveform::compseq_t m_weight_spectrum
Definition: ImpactData.h:23
Waveform::realseq_t & Gen::ImpactData::weightform ( ) const

The "weightform" is a waveform of weights and gives, for each tick, a measure of where the charge is "concentrated" (by some measure) along the distance from the low impact number edge to the high impact number edge. In general, the weights depend on the local (microscopic) charge distribution as well as which calculate_*() method was used.

Definition at line 27 of file ImpactData.cxx.

28 {
29  return m_weights;
30 }
Waveform::realseq_t m_weights
Definition: ImpactData.h:22

Member Data Documentation

std::vector<GaussianDiffusion::pointer> WireCell::Gen::ImpactData::m_diffusions
private

Definition at line 26 of file ImpactData.h.

int WireCell::Gen::ImpactData::m_impact
private

Definition at line 19 of file ImpactData.h.

Waveform::compseq_t WireCell::Gen::ImpactData::m_spectrum
mutableprivate

Definition at line 21 of file ImpactData.h.

Waveform::realseq_t WireCell::Gen::ImpactData::m_waveform
mutableprivate

Definition at line 20 of file ImpactData.h.

Waveform::compseq_t WireCell::Gen::ImpactData::m_weight_spectrum
mutableprivate

Definition at line 23 of file ImpactData.h.

Waveform::realseq_t WireCell::Gen::ImpactData::m_weights
mutableprivate

Definition at line 22 of file ImpactData.h.


The documentation for this class was generated from the following files: