18 : m_LogLevel(ps.
get<
int>(
"LogLevel"))
19 , m_BaseSampleBins(ps.
get<
int>(
"BaseSampleBins"))
20 , m_BaseVarCut(ps.
get<
float>(
"BaseVarCut")) {
21 const string myname =
"SubtractBaseline::ctor: ";
23 cout << myname <<
"Parameters:" <<
endl;
33 const string myname =
"SubtractBaseline::view: ";
40 std::vector<float>
base(nBasePts, 0.);
44 unsigned short nfilld = 0;
45 for(
unsigned short ii = 0; ii < nBasePts; ++ii) {
50 for(
unsigned short bin = loBin;
bin < hiBin; ++
bin) {
52 sum += samples[
bin] * samples[
bin];
55 float var = (sum - fbins * ave * ave) / (fbins - 1.);
64 if(nfilld < nBasePts && nfilld > nBasePts / 2) {
68 unsigned short ii1 = 0;
69 for(
unsigned short ii = 1; ii < nBasePts; ++ii) {
75 unsigned short ii2 = 0;
76 for(
unsigned short ii = ii1 + 1; ii < nBasePts; ++ii) {
84 float slp = (base[ii2] - base[ii1]) / (
float)(ii2 - ii1);
85 base[0] = base[ii1] - slp * ii1;
91 if(baseOK && base[nBasePts] == 0) {
92 unsigned short ii2 = 0;
93 for(
unsigned short ii = nBasePts - 1; ii > 0; --ii) {
100 unsigned short ii1 = 0;
102 for(
unsigned short ii = ii2 - 1; ii > 0; --ii) {
111 float slp = (base[ii2] - base[ii1]) / (
float)(ii2 - ii1);
112 base[nBasePts] = base[ii2] + slp * (nBasePts - ii2);
116 for(
unsigned short ii = 1; ii < nBasePts - 1; ++ii) {
119 for(
unsigned short jj = ii + 1; jj < nBasePts; ++jj) {
121 float slp = (base[jj] - base[ii - 1]) / (jj - ii + 1);
122 base[ii] = base[ii - 1] + slp;
133 short lastRegion = 0;
134 for(
unsigned short bin = 0;
bin < samples.size(); ++
bin) {
137 if(region > lastRegion) {
143 samples[
bin] -= base[region] + (
bin - bof) * slp;
Service to provide microboone-specific signal shaping for simulation (convolution) and reconstruction...
DataMap update(AdcChannelData &acd) const override
static constexpr double ps
SubtractBaseline(fhicl::ParameterSet const &ps)
QTextStream & bin(QTextStream &s)
std::vector< AdcSignal > AdcSignalVector
auto const & get(AssnsNode< L, R, D > const &r)
QTextStream & endl(QTextStream &s)