Belle II Software development
EclConfigurationPure::signalsamplepure_t Struct Reference

a struct for a signal sample for the pure CsI calorimeter More...

#include <EclConfigurationPure.h>

Public Member Functions

void InitSample (const TH1F *, const TH1F *)
 initialisation of signal sample
 
double Accumulate (const double a, const double t0, double *s) const
 

Public Attributes

double m_sumscale
 energy deposit in fitting window scale factor
 
double m_ft [m_nlPure *m_ns]
 Simulated signal shape.
 
double m_ft1 [m_nlPure *m_ns]
 Simulated signal shape.
 

Detailed Description

a struct for a signal sample for the pure CsI calorimeter

Definition at line 55 of file EclConfigurationPure.h.

Member Function Documentation

◆ Accumulate()

double Accumulate ( const double  a,
const double  t0,
double *  s 
) const
Parameters
[in]aSignal amplitude
[in]t0Signal offset
[out]sOutput array with added signal
Returns
Energy deposition in ADC units

Definition at line 54 of file EclConfigurationPure.cc.

55{
56 // input parameters
57 // a -- signal amplitude
58 // t -- signal offset
59 // output parameter
60 // s -- output array with added signal
61 const double itick = 1 / getTickPure(); // reciprocal to avoid division in usec^-1 (has to be evaluated at compile time)
62 const double tlen = m_nlPure - 1.0 / m_ns; // length of the sampled signal in ADC clocks units
63 const double tmax = m_tmin + m_nsmp - 1; // upper range of the fit region
64
65 double t = t0 * itick; // rescale time in usec to ADC clocks
66 double x0 = t, x1 = t + tlen;
67
68 if (x0 > tmax) return 0; // signal starts after the upper range of output array -- do nothing
69 if (x0 < m_tmin) {
70 if (x1 < m_tmin) return 0; // signal ends before lower range of output array -- do nothing
71 x0 = m_tmin; // adjust signal with range of output array
72 }
73
74 int imax = m_nsmp; // length of sampled signal is long enough so
75 // the last touched element is the last element
76 // of the output array
77 if (x1 < tmax) { // if initial time is too early we need to adjust
78 // the last touched element of output array to avoid
79 // out-of-bound situation in m_ft
80 imax = x1 - m_tmin; // imax is always positive so floor can be
81 // replace by simple typecast
82 imax += 1; // like s.end()
83 }
84
85 double epsilon = 1.0 / m_ns / 10.;
86 double imind = ceil(x0 - m_tmin + epsilon); // store result in double to avoid int->double conversion below
87 // the ceil function today at modern CPUs is surprisingly fast (before it was horribly slow)
88 int imin = imind; // starting point to fill output array
89 double w = ((m_tmin - t) + imind - 1) * double(m_ns);
90 int jmin = w ; // starting point in sampled signal array
91 w -= jmin;
92
93 // use linear interpolation between samples. Since signal samples
94 // are aligned with output samples only two weights are need to
95 // calculate to fill output array
96 const double w1 = a * w, w0 = a - w1;
97 double sum = 0;
98 //cout <<"Filling energy: " << a << " time " << t << endl;
99 //cout <<"imin: " << imin << " imax: " << imax << endl;
100 for (int i = imin, j = jmin; i < imax; i++, j += m_ns) {
101 double amp = 0;
102 if (j >= 0) amp = w0 * m_ft[j] + w1 * m_ft[j + 1];
103 //double amp = a * m_ft[j];
104 // cout << i << ":" << j << " " << m_ft[j] << " " << w * m_ft[j] + (1-w) * m_ft[j+1] << endl;
105 s[i] += amp;
106 sum += amp;
107 }
108 //cout << endl;
109 return sum * m_sumscale;
110}
static constexpr double m_tmin
lower range of the signal fitting region in ADC clocks
static double getTickPure()
Getter for m_tickPure.
static constexpr int m_ns
number of samples per ADC clock
static constexpr int m_nlPure
length of samples signal in number of ADC clocks
static constexpr int m_nsmp
number of ADC measurements for signal fitting
double m_ft[m_nlPure *m_ns]
Simulated signal shape.
double m_sumscale
energy deposit in fitting window scale factor

◆ InitSample()

void InitSample ( const TH1F *  sampledfun,
const TH1F *  sampledfunDerivative 
)

initialisation of signal sample

Definition at line 26 of file EclConfigurationPure.cc.

27{
28 const int N = m_ns * m_nlPure;
29 double r1 = 32 / m_ns;
31
32 ECLSampledShaper dsp(sampledfun, round(r1 / r2));
33 dsp.fillarray(N, m_ft);
34 double maxval = * max_element(m_ft, m_ft + N);
35
36 for_each(m_ft1, m_ft1 + N, [maxval](double & a) { a /= maxval; });
37 double maxval2 = * max_element(m_ft, m_ft + N);
38 assert(maxval2 - 1.0 < 0.001);
39 double sum = 0;
40 for (int i = 0; i < N; i++) sum += m_ft[i];
41 m_sumscale = m_ns / sum;
42 // for (int i = 0; i < N; ++i) m_ft1[i] = sampledfunDerivative->GetBinContent(i + 1);
43 ECLSampledShaper dsp1(sampledfunDerivative, round(r1 / r2));
44 dsp1.fillarray(N, m_ft1);
45 for_each(m_ft1, m_ft1 + N, [r1, r2, maxval](double & a) { a *= (r1 / r2) / maxval; });
46}
static double getTick()
See m_tick.
static constexpr int m_ntrg
number of trigger counts per ADC clock tick
double m_ft1[m_nlPure *m_ns]
Simulated signal shape.

Member Data Documentation

◆ m_ft

double m_ft[m_nlPure *m_ns]

Simulated signal shape.

Definition at line 57 of file EclConfigurationPure.h.

◆ m_ft1

double m_ft1[m_nlPure *m_ns]

Simulated signal shape.

Definition at line 58 of file EclConfigurationPure.h.

◆ m_sumscale

double m_sumscale

energy deposit in fitting window scale factor

Definition at line 56 of file EclConfigurationPure.h.


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