15 #include <TFitResult.h> 16 #include <TFitResultPtr.h> 17 #include <TVirtualFitter.h> 61 std::vector<double>
sg_smooth(
const std::vector<double> &
v,
const int w,
const int deg);
62 std::vector<double>
sg_derivative(
const std::vector<double> &
v,
const int w,
const int deg,
const double h = 1.0);
66 static void Smooth(
size_t nsamples,
double*
in,
double*
out,
const int w,
const int deg);
67 static void Derivative(
size_t nsamples,
double* in,
double* out,
const int w,
const int deg,
const double h = 1.0);
74 _HitCollection.clear();
75 _RawHitLogicNanosec.clear();
78 _DiscriminationThresholdInADC = 0;
79 _WaveformADCNanosec.clear();
82 _NonfilterWaveformADCNanosec.clear();
88 void SetWaveform(std::vector<uint16_t>& waveform,
unsigned int channelNo, uint32_t
timestamp);
89 void SetParams(
const std::map<CFDParams, double>& paramSet);
97 inline const std::map<T, hit_t<T> >&
GetHitCollection()
const {
return _HitCollection; }
106 void SetChannel(
unsigned int channelNo);
107 void SetTimestamp(uint32_t timestamp);
127 virtual void FindPedestal();
128 virtual void FindRawHitLogic();
129 virtual void FindCFDHits();
130 virtual bool BackwardFindingOfHitStart(
size_t hitPeakTimeIndex,
T hitPeakValue,
T& hitStartTimeIndex,
T& hitRiseTimeInIndex);
131 virtual bool ForwardFindingOfHitFallTime(
size_t hitPeakTimeIndex,
T& hitFallTimeInIndex);
132 virtual T IntegrateWaveformInADC(
size_t hitStartTimeIndex,
size_t hitEndTimeIndex);
133 virtual T FindHitWidth(
size_t hitPeakTimeIndex,
T hitPeakValueADC);
134 virtual T FindPeakValue(
size_t hitPeakTimeIndex,
T &hitPeakValue);
137 _HitCollection.clear();
138 _RawHitLogicNanosec.clear();
140 _NoiseSigmaInADC = 0;
141 _DiscriminationThresholdInADC = 0;
142 _WaveformADCNanosec.clear();
143 _ChannelNumber = 993;
145 _NonfilterWaveformADCNanosec.clear();
157 SetChannel(channelNo);
158 SetTimestamp(timestamp);
165 for (
auto itr = waveform.begin(); itr != waveform.end(); itr++) {
166 _NonfilterWaveformADCNanosec.push_back((
T)(*itr) * polaritySignFactor);
167 nonfilterwaveform[itr - waveform.begin()] = (
T)(*itr) * polaritySignFactor;
170 if (_FilterType ==
"GS" || _FilterType ==
"gs") {
176 }
else if (_FilterType ==
"Kalman" || _FilterType ==
"kalman" || _FilterType ==
"KALMAN") {
185 }
else if (_FilterType ==
"" || _FilterType ==
"None" || _FilterType ==
"none" || _FilterType ==
"NONE") {
187 for (
auto itr = waveform.begin(); itr != waveform.end(); itr++) {
188 filterwaveform[itr - waveform.begin()] = (
T)(*itr) * polaritySignFactor;
193 <<
"Unknown raw hit finder filter type: " << _FilterType <<
"." <<
std::endl;
197 _WaveformADCNanosec.push_back(*(filterwaveform +
i));
200 free(nonfilterwaveform);
201 free(filterwaveform);
211 for (
auto & itr : paramSet) {
212 SetParam(itr.first, itr.second);
218 _ChannelNumber = channelNo;
228 _InterpolationType =
type;
233 _DiscriminationType =
type;
260 while (TMath::Abs(Pedestal - OldPedestal) >= 2) {
263 size_t countSamples = 0;
264 for (
typename std::vector<T>::iterator itr = _NonfilterWaveformADCNanosec.begin(); itr != _NonfilterWaveformADCNanosec.end(); itr++) {
265 if ((*itr <= Pedestal + NoiseBand) && (*itr >= Pedestal - NoiseBand)) {
270 average = average / (
T)countSamples;
271 for (
typename std::vector<T>::iterator itr = _NonfilterWaveformADCNanosec.begin(); itr != _NonfilterWaveformADCNanosec.end(); itr++) {
272 if ((*itr <= Pedestal + NoiseBand) && (*itr >= Pedestal - NoiseBand)) {
273 stdDev += TMath::Power((*itr) - average, 2);
278 OldPedestal = Pedestal;
283 _PedestalInADC = Pedestal;
284 _NoiseSigmaInADC = NoiseBand;
291 for (
size_t i = 0;
i < _WaveformADCNanosec.size();
i++) {
292 _RawHitLogicNanosec.push_back(_WaveformADCNanosec.at(
i) < rawHitThreshold);
295 for (
size_t i = 1;
i < _RawHitLogicNanosec.size() - 1;
i++) {
296 if ((not _RawHitLogicNanosec.at(
i - 1)) and _RawHitLogicNanosec.at(
i)) {
297 size_t countDuration = 0;
298 for (
size_t j =
i;
j < _RawHitLogicNanosec.size() - 1;
j++) {
299 if (_RawHitLogicNanosec.at(
j)) countDuration++;
300 if (not(_RawHitLogicNanosec.at(
j + 1)))
break;
304 for (
size_t j =
i;
j <
i + countDuration;
j++) {
305 _RawHitLogicNanosec.at(
j) =
false;
311 for (
size_t i = 1;
i < _RawHitLogicNanosec.size() - 1;
i++) {
312 if (_RawHitLogicNanosec.at(
i - 1) && not(_RawHitLogicNanosec.at(
i))) {
313 size_t countDuration = 0;
314 for (
size_t j =
i;
j < _RawHitLogicNanosec.size() - 1;
j++) {
315 if (not(_RawHitLogicNanosec.at(
j))) countDuration++;
316 if (_RawHitLogicNanosec.at(
j + 1))
break;
320 for (
size_t j =
i;
j <
i + countDuration;
j++) {
321 _RawHitLogicNanosec.at(
j) =
true;
331 std::vector<T> hitPeakValueVector; hitPeakValueVector.clear();
332 std::vector<size_t> hitPeakTimeIndexVector; hitPeakTimeIndexVector.clear();
333 std::vector<T> hitPeakTimeInNanoSecVector; hitPeakTimeInNanoSecVector.clear();
334 std::vector<T> hitStartTimeIndexVector; hitStartTimeIndexVector.clear();
335 std::vector<T> hitRiseTimeInIndexVector; hitRiseTimeInIndexVector.clear();
336 std::vector<T> hitFallTimeInIndexVector; hitFallTimeInIndexVector.clear();
337 std::vector<T> hitWidthValueVector; hitWidthValueVector.clear();
338 std::vector<bool> isHitContainedVector; isHitContainedVector.clear();
340 bool logicFallingPart =
true;
341 for (
size_t i = 1;
i < _RawHitLogicNanosec.size() - 1;
i++) {
342 T hitPeakValue = 1E10;
343 size_t hitPeakTimeIndex = 0;
344 if (_RawHitLogicNanosec.at(
i) && !(_RawHitLogicNanosec.at(
i - 1)) && logicFallingPart) {
345 logicFallingPart =
false;
346 for (
size_t j =
i;
j < _RawHitLogicNanosec.size() - 1;
j++) {
347 hitPeakValue = hitPeakValue > _WaveformADCNanosec.at(
j) ? (
T) _WaveformADCNanosec.at(
j) : hitPeakValue;
348 hitPeakTimeIndex = hitPeakValue == _WaveformADCNanosec.at(
j) ?
j : hitPeakTimeIndex;
349 if (((_RawHitLogicNanosec.at(
j) && !(_RawHitLogicNanosec.at(
j + 1))) || ((_RawHitLogicNanosec.size() -
j) < _CFDParamSet[
kRawHitFinderTicksFromEnd])) && !logicFallingPart) {
350 logicFallingPart =
true;
351 T hitStartTimeIndex = (
T)hitPeakTimeIndex;
352 T hitRiseTimeInIndex = (
T)hitPeakTimeIndex;
353 T hitFallTimeInIndex = (
T)hitPeakTimeIndex;
354 T hitPeakTimeInNanoSec = FindPeakValue(hitPeakTimeIndex, hitPeakValue);
355 T hitWidthInTicks = FindHitWidth(hitPeakTimeIndex, hitPeakValue);
356 bool containedFromRisingEdge = BackwardFindingOfHitStart(hitPeakTimeIndex, hitPeakValue, hitStartTimeIndex, hitRiseTimeInIndex);
357 bool containedFromFallingEdge = ForwardFindingOfHitFallTime(hitPeakTimeIndex, hitFallTimeInIndex);
359 hitPeakValueVector.push_back(hitPeakValue);
360 hitPeakTimeIndexVector.push_back(hitPeakTimeIndex);
361 hitPeakTimeInNanoSecVector.push_back(hitPeakTimeInNanoSec);
362 hitStartTimeIndexVector.push_back(hitStartTimeIndex);
363 hitRiseTimeInIndexVector.push_back(hitRiseTimeInIndex);
364 hitFallTimeInIndexVector.push_back(hitFallTimeInIndex);
365 hitWidthValueVector.push_back(hitWidthInTicks);
366 isHitContainedVector.push_back(containedFromRisingEdge && containedFromFallingEdge);
373 for (
size_t i = 0;
i < hitStartTimeIndexVector.size();
i++) {
386 hitPeakTimeIndexVector.at(
i) + hitFallTimeInIndexVector.at(
i));
389 _HitCollection[hitStartTimeIndexVector.at(
i)] = aHit;
397 T x[7] = { -3, -2, -1, 0, 1, 2, 3 };
399 _WaveformADCNanosec.at(hitPeakTimeIndex - 3),
400 _WaveformADCNanosec.at(hitPeakTimeIndex - 2),
401 _WaveformADCNanosec.at(hitPeakTimeIndex - 1),
402 _WaveformADCNanosec.at(hitPeakTimeIndex),
403 _WaveformADCNanosec.at(hitPeakTimeIndex + 1),
404 _WaveformADCNanosec.at(hitPeakTimeIndex + 2),
405 _WaveformADCNanosec.at(hitPeakTimeIndex + 3)
408 TGraph *gfit =
new TGraph(7, x, y);
411 TVirtualFitter::SetDefaultFitter(
"Minuit2");
412 TFitResultPtr frp = gfit->Fit(
"pol3",
"SFNQ");
413 T p0 = frp->Parameter(0);
414 T p1 = frp->Parameter(1);
415 T p2 = frp->Parameter(2);
416 T p3 = frp->Parameter(3);
418 T disc = p2*p2 - 3.*p1*
p3;
420 hitPeakValue = _WaveformADCNanosec.at(hitPeakTimeIndex);
421 return hitPeakTimeIndex;
425 T hitPeakTime = (-p2 +
sqrt(disc))/(3.*p3);
426 hitPeakValue = p0 + p1*hitPeakTime + p2*hitPeakTime*hitPeakTime + p3*hitPeakTime*hitPeakTime*hitPeakTime;
427 hitPeakTime += (
T)hitPeakTimeIndex;
437 hitStartTimeIndex = hitStartTimeIndex < 0 ? 0 : hitStartTimeIndex;
439 for (
size_t i = hitStartTimeIndex;
i <= hitEndTimeIndex;
i++) {
440 integration = integration + (_WaveformADCNanosec.at(
i) - _PedestalInADC);
444 integration = integration + (_WaveformADCNanosec.at(
i) - _PedestalInADC);
453 bool isThisHitContainedFromTheRisingEdge =
true;
455 if (_DiscriminationType ==
"CFD") {
456 _DiscriminationThresholdInADC = _PedestalInADC - _CFDParamSet[
kDiscriminationThreshold] * (_PedestalInADC - hitPeakValue);
457 }
else if (_DiscriminationType ==
"LE") {
461 <<
"Unknown DiscriminationType: " << _DiscriminationType <<
"." <<
std::endl;
464 size_t tmp_index = hitPeakTimeIndex;
465 while (_WaveformADCNanosec.at(tmp_index) < _DiscriminationThresholdInADC) {
466 if (tmp_index == 2 && _WaveformADCNanosec.at(tmp_index - 1) < _DiscriminationThresholdInADC) {
467 isThisHitContainedFromTheRisingEdge =
false;
470 tmp_index = tmp_index - 1;
473 if ((_InterpolationType ==
"LinearNearest") || (tmp_index < 2)) {
475 T V1 = _WaveformADCNanosec.at(tmp_index);
476 T V2 = _WaveformADCNanosec.at(tmp_index - 1);
477 size_t t1 = tmp_index;
478 size_t t2 = tmp_index - 1;
479 T slope = (V2 - V1) / ((
T)t2 - (
T)t1);
480 hitStartTimeIndex = (_DiscriminationThresholdInADC - V1) / slope + (
T)
t1;
482 if ((_InterpolationType ==
"LinearFit") && (tmp_index >= 2)) {
491 _WaveformADCNanosec.at(tmp_index - 2),
492 _WaveformADCNanosec.at(tmp_index - 1),
493 _WaveformADCNanosec.at(tmp_index),
494 _WaveformADCNanosec.at(tmp_index + 1)
496 TGraph *gfit =
new TGraph(4, x, y);
497 TFitResultPtr frp = gfit->Fit(
"pol1",
"SQNF");
498 double p0 = frp->Parameter(0);
499 double p1 = frp->Parameter(1);
500 T V = p0 + p1 * (
T)tmp_index;
502 hitStartTimeIndex = (
T)t + (_DiscriminationThresholdInADC - V) /
p1;
505 if (!isThisHitContainedFromTheRisingEdge) {
506 hitRiseTimeInIndex = (
T) hitPeakTimeIndex - (
T) tmp_index;
508 tmp_index = hitPeakTimeIndex;
509 while (_WaveformADCNanosec.at(tmp_index) <= _PedestalInADC) {
510 if (tmp_index == 2 && _WaveformADCNanosec.at(tmp_index - 1) < _PedestalInADC) {
511 isThisHitContainedFromTheRisingEdge =
false;
514 tmp_index = tmp_index - 1;
516 hitRiseTimeInIndex = (
T) hitPeakTimeIndex - (
T) tmp_index;
519 return isThisHitContainedFromTheRisingEdge;
524 bool isThisHitContainedFromTheFallingEdge =
true;
525 size_t tmp_index = hitPeakTimeIndex;
526 while (_WaveformADCNanosec.at(tmp_index) < _PedestalInADC) {
527 if (tmp_index == _CFDParamSet[
kNSamplingPoints] - 2 && _WaveformADCNanosec.at(tmp_index + 1) < _PedestalInADC) {
528 isThisHitContainedFromTheFallingEdge =
false;
531 tmp_index = tmp_index + 1;
534 hitFallTimeInIndex = (
T)tmp_index - (
T)hitPeakTimeIndex;
535 return isThisHitContainedFromTheFallingEdge;
543 T halfMax = _PedestalInADC - (_PedestalInADC - hitPeakValueADC)/2.;
545 T halfMaxLeft = 9993;
546 T halfMaxRight = 9993;
549 for (
size_t i=hitPeakTimeIndex;
i>0;
i--) {
550 if (_WaveformADCNanosec.at(
i) == halfMax) {
553 }
else if (_WaveformADCNanosec.at(
i) > halfMax) {
555 T y1 = _WaveformADCNanosec.at(
i);
556 T y2 = _WaveformADCNanosec.at(
i + 1);
559 T slope = (y2 -
y1) / ((
T)t2 - (
T)t1);
560 halfMaxLeft = (halfMax -
y1) / slope + (
T)
t1;
567 if (_WaveformADCNanosec.at(
i) == halfMax) {
570 }
else if (_WaveformADCNanosec.at(
i) > halfMax) {
572 T y1 = _WaveformADCNanosec.at(
i - 1);
573 T y2 = _WaveformADCNanosec.at(
i);
576 T slope = (y2 -
y1) / ((
T)t2 - (
T)t1);
577 halfMaxRight = (halfMax -
y1) / slope + (
T)
t1;
582 T widthInTicks = halfMaxRight - halfMaxLeft;
588 if (_WaveformADCNanosec.size() == 0)
return;
663 size_t nr_cols(
void)
const {
return front().size(); };
672 for (
unsigned int i = 0;
i <
rows; ++
i) {
673 (*this)[
i].resize(cols, defval);
675 if ((rows < 1) || (cols < 1)) {
678 sprintf(buffer,
"cannot build matrix with %d rows and %d columns\n",
679 (
int)rows, (
int)cols);
687 float_mat::iterator inew = begin();
688 float_mat::const_iterator iold = m.begin();
689 for (; iold < m.end(); ++inew, ++iold) {
690 const size_t oldsz = iold->size();
701 const size_t oldsz = v.size();
702 front().resize(oldsz);
722 if (
i[j] != idx[j]) {
725 for (k = j+1; k < A.
nr_rows(); ++k) {
755 unsigned int pivot =
row;
756 double piv_elem = fabs(A[idx[row]][col]) * scale[idx[
row]];
760 for (j = row + 1; j < A.
nr_rows(); ++
j) {
762 const double tmp = fabs(A[idx[j]][col]) * scale[idx[
j]];
765 if (tmp > piv_elem) {
778 idx[
row] = idx[pivot];
797 for (r = (A.
nr_rows() - 1); r >= 0; --
r) {
798 for (c = (A.
nr_cols() - 1); c >
r; --
c) {
799 for (k = 0; k < A.
nr_cols(); ++k) {
800 a[
r][k] -= A[
r][
c] * a[
c][k];
804 for (k = 0; k < A.
nr_cols(); ++k) {
820 unsigned int r, k,
c;
822 for(c = 0; c <
r; ++
c) {
823 for (k = 0; k < A.
nr_cols(); ++k) {
824 a[
r][k] -= A[
r][
c] * a[
c][k];
828 for (k = 0; k < A.
nr_cols(); ++k) {
860 if (fabs(A[i][j]) > maxval)
861 maxval = fabs(A[i][j]);
867 scale[
i] = 1.0 / maxval;
872 for (c = 0; c < A.
nr_cols() ; ++
c) {
875 int lim = (r <
c) ? r : c;
876 for (j = 0; j < lim; ++
j) {
877 A[idx[
r]][
c] -= A[idx[
r]][
j] * A[idx[
j]][
c];
880 A[idx[
r]][
c] /= A[idx[
c]][
c];
915 const int n = A.size();
920 for (i = 0; i <
n; ++
i) {
955 for (k = 0; k < a.
nr_cols(); ++k) {
956 sum += a[
i][k] * b[k][
j];
968 const size_t rows(b.size());
969 const size_t cols(deg + 1);
975 for (i = 0; i <
rows; ++
i) {
976 for (j = 0; j <
cols; ++
j) {
977 A[
i][
j] =
pow(
double(i),
double(j));
983 for (i = 0; i < b.size(); ++
i) {
985 for (j = 1; j <=
deg; ++
j) {
986 res[
i] += c[
j][0] *
pow(
double(i),
double(j));
1003 if ((width < 1) || (deg < 0) || ((
int)v.size() < (2 * width + 2))) {
1008 const int window = 2 * width + 1;
1009 const int endidx = v.size() - 1;
1015 #if defined(_OPENMP) 1016 #pragma omp parallel for private(i,j) schedule(static) 1018 for (i = 0; i < (
int)width; ++
i) {
1019 const double scale = 1.0/double(i+1);
1021 for (j = 0; j <=
i; ++
j) {
1022 res[
i] += c1[
j] * v[
j];
1023 res[endidx -
i] += c1[
j] * v[endidx -
j];
1028 const double scale = 1.0/double(window);
1030 #if defined(_OPENMP) 1031 #pragma omp parallel for private(i,j) schedule(static) 1033 for (i = 0; i <= (
int) (v.size() -
window); ++
i) {
1034 for (j = 0; j < (
int)window; ++
j) {
1035 res[i + width] += c2[
j] * v[i +
j];
1042 #if defined(_OPENMP) 1043 #pragma omp parallel for private(i,j) schedule(static) 1045 for (i = 0; i < (
int) width; ++
i) {
1050 for (j = 0; j < (
int) window; ++
j) {
1051 res[
i] += c1[
j] * v[
j];
1052 res[endidx -
i] += c1[
j] * v[endidx -
j];
1061 #if defined(_OPENMP) 1062 #pragma omp parallel for private(i,j) schedule(static) 1064 for (i = 0; i <= (
int) (v.size() -
window); ++
i) {
1065 for (j = 0; j < (
int) window; ++
j) {
1066 res[i + width] += c2[
j] * v[i +
j];
1076 const int rows(b.size());
1077 const int cols(deg + 1);
1084 for (j = 0; j < (
int) cols; ++
j) {
1085 A[
i][
j] =
pow(
double(i),
double(j));
1091 for (i = 0; i < (
int) b.size(); ++
i) {
1093 for (j = 1; j < (
int) deg; ++
j) {
1094 res[
i] += c[j + 1][0] * double(j+1)
1095 *
pow(
double(i),
double(j));
1110 const int deg,
const double h)
1113 if ((width < 1) || (deg < 1) || ((
int) v.size() < (2 * width + 2))) {
1118 const int window = 2 * width + 1;
1125 for (i = 0; i < (
int) window; ++
i) {
1129 for (j = 0; j <= (
int) width; ++
j) {
1133 for (i = 0; i < (
int) window; ++
i) {
1134 b[
i] = v[v.size() - 1 -
i] /
h;
1137 for (i = 0; i <= (
int) width; ++
i) {
1138 res[v.size() - 1 -
i] = -d[
i];
1143 #if defined(_OPENMP) 1144 #pragma omp parallel for private(i,j) schedule(static) 1146 for (i = 1; i < (
int) (v.size() -
window); ++
i) {
1147 for (j = 0; j < (
int) window; ++
j) {
1148 b[
j] = v[i +
j] /
h;
1156 std::vector<double> in_vec;
1157 for (
size_t idx = 0; idx < nsamples; idx++) {
1158 in_vec.push_back(*(in + idx));
1161 std::vector<double> out_vec =
sg_smooth(in_vec, w, deg);
1163 for (
size_t idx = 0; idx < nsamples; idx++) {
1164 *(out +
idx) = out_vec.at(idx);
1169 std::vector<double> in_vec;
1170 for (
size_t idx = 0; idx < nsamples; idx++) {
1171 in_vec.push_back(*(in + idx));
1174 std::vector<double> out_vec =
sg_derivative(in_vec, w, deg, h);
1176 for (
size_t idx = 0; idx < nsamples; idx++) {
1177 *(out +
idx) = out_vec.at(idx);
void SetFilterType(const std::string type)
static const double TINY_FLOAT
default convergence
std::map< T, hit_t< T > > _HitCollection
static float_vect lsqr_fprime(const float_vect &b, const int deg)
const std::string GetInterpolationType() const
static int partial_pivot(float_mat &A, const size_t row, const size_t col, float_vect &scale, int_vect &idx, double tol)
Implicit partial pivoting.
static constexpr Double_t deg
const std::map< T, hit_t< T > > & GetHitCollection() const
static void lu_backsubst(float_mat &A, float_mat &a, bool diag=false)
Perform backward substitution.
std::vector< T > _WaveformADCNanosec
virtual bool BackwardFindingOfHitStart(size_t hitPeakTimeIndex, T hitPeakValue, T &hitStartTimeIndex, T &hitRiseTimeInIndex)
void permute(float_mat &A, int_vect &idx)
permute() orders the rows of A to match the integers in the index array.
Float_t y1[n_points_granero]
static void Smooth(size_t nsamples, double *in, double *out, const int w, const int deg)
static float_mat lin_solve(const float_mat &A, const float_mat &a, double tol=TINY_FLOAT)
Solve a system of linear equations. Solves the inhomogeneous matrix problem with lu-decomposition. Note that inversion may be accomplished by setting a to the identity_matrix.
two dimensional floating point array
T _DiscriminationThresholdInADC
std::map< CFDParams, T > _CFDParamSet
const T & GetDiscriminationThreshold() const
T IntegratedChargeInADCNanoSec
const std::string GetFilterType() const
std::vector< double > float_vect
comfortable array of doubles
unsigned int _ChannelNumber
static int lu_factorize(float_mat &A, int_vect &idx, double tol=TINY_FLOAT)
Performs LU factorization in place.
::xsd::cxx::tree::buffer< char > buffer
Module that kips a configurable number of events between each that it allows through. Note that this module really skips (N-1) events, it uses a simple modular division as its critera. This module will cut down the data sample to 1/N of its original size.
void SetParams(const std::map< CFDParams, double > ¶mSet)
static void lu_forwsubst(float_mat &A, float_mat &a, bool diag=true)
Perform forward substitution.
virtual void FindPedestal()
#define P(a, b, c, d, e, x)
void SetInterpolationType(const std::string type)
virtual T FindPeakValue(size_t hitPeakTimeIndex, T &hitPeakValue)
void SetChannel(unsigned int channelNo)
std::vector< double > sg_derivative(const std::vector< double > &v, const int w, const int deg, const double h=1.0)
float_mat operator*(const float_mat &a, const float_mat &b)
matrix multiplication.
T IntegratedChargeInADCTimeTicks
std::string _DiscriminationType
double GetFilteredValue(double measurement)
size_t nr_rows(void) const
use default destructor
const XML_Char int const XML_Char * value
const std::string GetDiscriminationType() const
virtual T FindHitWidth(size_t hitPeakTimeIndex, T hitPeakValueADC)
virtual bool ForwardFindingOfHitFallTime(size_t hitPeakTimeIndex, T &hitFallTimeInIndex)
virtual T IntegrateWaveformInADC(size_t hitStartTimeIndex, size_t hitEndTimeIndex)
void SetWaveform(std::vector< uint16_t > &waveform, unsigned int channelNo, uint32_t timestamp)
virtual void FindRawHitLogic()
static float_vect sg_coeff(const float_vect &b, const size_t deg)
calculate savitzky golay coefficients.
std::vector< double > sg_smooth(const std::vector< double > &v, const int w, const int deg)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
size_t nr_cols(void) const
get size
virtual void FindCFDHits()
void SetParam(CFDParams param, T value)
Var Sqrt(const Var &v)
Use to take sqrt of a var.
std::vector< T > _NonfilterWaveformADCNanosec
static void Derivative(size_t nsamples, double *in, double *out, const int w, const int deg, const double h=1.0)
const T & GetNoiseSigma() const
std::vector< int > int_vect
comfortable array of ints;
unsigned int DigitizerChannel
std::string _InterpolationType
void SetDiscriminationType(const std::string type)
const T & GetPedestal() const
static float_mat transpose(const float_mat &a)
returns the transposed matrix.
void SetTimestamp(uint32_t timestamp)
float_mat()
disable the default constructor
static float_mat invert(const float_mat &A)
Returns the inverse of a matrix using LU-decomposition.
std::vector< bool > _RawHitLogicNanosec