#include <AdcNoiseSignalFinder.h>
Definition at line 54 of file AdcNoiseSignalFinder.h.
Definition at line 26 of file AdcNoiseSignalFinder_tool.cc.
37 const string myname =
"AdcNoiseSignalFinder::ctor: ";
39 cout << myname <<
"Configuration parameters:" <<
endl;
float m_ThresholdRatioTol
static constexpr double ps
unsigned int m_BinsBefore
QTextStream & endl(QTextStream &s)
Reimplemented from AdcChannelTool.
Definition at line 55 of file AdcNoiseSignalFinder_tool.cc.
56 const string myname =
"AdcNoiseSignalFinder::update: ";
68 cout << myname <<
"ERROR: No samples found in channel " << acd.
channel() <<
endl;
82 float thrTooHigh = 1.e20;
90 acd.
signal.resize(nsam,
false);
91 for (
AdcIndex isam=0; isam<nsam; ++isam ) {
96 AdcIndex jsam1 = isam > nsamlo ? isam - nsamlo : 0;
97 if ( jsam1 < isamUnknown ) jsam1 = isamUnknown;
99 if ( jsam2 > nsam ) jsam2 = nsam;
100 if (
m_LogLevel >= 5 ) cout << myname <<
"Trigger: " << isam <<
", range: [" 101 << jsam1 <<
", " << jsam2 <<
")" <<
endl;
102 for (
AdcIndex jsam=jsam1; jsam<jsam2; ++jsam ) acd.
signal[jsam] =
true;
110 for (
AdcIndex isam=0; isam<nsam; ++isam ) {
119 noise = nnsg ? sqrt(ssqsum/nnsg) : 0.0;
120 sigfrac =
float(nsig)/nsam;
124 cout << myname <<
" Loop " << nloop <<
endl;
125 cout << myname <<
" Threshold: " << thr <<
endl;
126 cout << myname <<
" Noise: " << noise <<
endl;
127 cout << myname <<
" Thr/noise: " << (noise > 0.0 ? thr/noise : -999) << endl;
128 cout << myname <<
" # ticks above threshold: " << nsamAbove <<
endl;
129 cout << myname <<
" SigFrac: " << sigfrac <<
endl;
131 cout << myname <<
" # ROI: " << acd.
rois.size() <<
endl;
134 cout << myname <<
"WARNING: Channel " << acd.
channel() <<
" exiting after " 135 << nloop <<
" loops." <<
endl;
139 float thrtgt = trtgt*noise;
140 float thrmin = trmin*noise;
141 float thrmax = trmax*noise;
148 float thrEst = thrtgt > thr ? 2.0*thrtgt : 2.0*
thr;
149 if ( thrEst < thrTooHigh ) thr = thrEst;
150 else thr = 0.5*(thr + thrTooHigh);
153 }
else if ( thrmax >= thr ) {
160 if ( thrtgt > thrTooLow ) thr = thrtgt;
161 else thr = 0.5*(thr + thrTooLow);
163 float dthrmax = 0.001*thrOld;
165 if ( fabs(thr - thrOld) < dthrmax ) {
168 string schstat = chstat==0 ?
"Good" :
170 chstat==2 ?
"Noisy" :
"UnkownStatus";
171 cout << myname <<
"WARNING: " << schstat <<
" channel " << acd.
channel()
172 <<
" exiting prematurely due to threshold convergence." <<
endl;
179 ret.
setFloat(
"nsfSigFrac", sigfrac);
182 ret.
setInt(
"nsfLoopCount", nloop);
185 acd.
metadata[
"nsfSigFrac"] = sigfrac;
188 acd.
metadata[
"nsfLoopCount"] = nloop;
void setFloat(Name name, float val)
DataMap & setStatus(int stat)
void print(std::ostream *pout) const
float m_ThresholdRatioTol
void setInt(Name name, int val)
unsigned int m_BinsBefore
Index channelStatus() const
QTextStream & endl(QTextStream &s)
unsigned int AdcNoiseSignalFinder::m_BinsAfter |
|
private |
unsigned int AdcNoiseSignalFinder::m_BinsBefore |
|
private |
bool AdcNoiseSignalFinder::m_FlagNegative |
|
private |
bool AdcNoiseSignalFinder::m_FlagPositive |
|
private |
int AdcNoiseSignalFinder::m_LogLevel |
|
private |
unsigned int AdcNoiseSignalFinder::m_MaxLoop |
|
private |
float AdcNoiseSignalFinder::m_SigFracMax |
|
private |
float AdcNoiseSignalFinder::m_ThresholdMin |
|
private |
float AdcNoiseSignalFinder::m_ThresholdRatio |
|
private |
float AdcNoiseSignalFinder::m_ThresholdRatioTol |
|
private |
The documentation for this class was generated from the following files: