81 const string myname =
"AdcMultiThreshSignalFinder:build: ";
82 if (
m_LogLevel >= 2 ) cout << myname <<
"Building ROIs for channel " 88 res.setInt(
"Test", 0);
98 signal.resize(sigs.size(),
false);
107 if (
m_LogLevel >= 2 ) cout << myname <<
"Channel " <<
data.channel()
108 <<
" has no samples." <<
endl;
116 cout << myname <<
"Channel "<<
data.channel()
117 <<
" pedestal "<<ped<<
" "<<pedrms <<
endl;
123 cout << myname <<
" Channel "<<
data.channel()
124 <<
" pedestal is not valid" <<
endl;
130 if( pedrms == 0 ) pedrms = 0.1;
140 cout << myname <<
" sigth1: " << sigth1 <<
endl;
141 cout << myname <<
" sigth2: " << sigth2 <<
endl;
142 cout << myname <<
" sigthmax: " << sigthmax <<
endl;
143 cout << myname <<
" sigthmin: " << sigthmin <<
endl;
146 ROICandidate_t roiCandidate;
152 for(
AdcIndex isig=0; isig<nsig; ++isig )
158 if( !roiCandidate.isRoi )
160 roiCandidate.isRoi =
true;
161 roiCandidate.StartRoi = isig;
164 if( sig > roiCandidate.MaxValue )
165 roiCandidate.MaxValue = sig;
167 roiCandidate.NsaTh1++;
168 roiCandidate.EndRoi = isig;
174 if( nsaTh2 > roiCandidate.NsaTh2 )
175 roiCandidate.NsaTh2 = nsaTh2;
179 if( nsaTh2 > roiCandidate.NsaTh2 )
180 roiCandidate.NsaTh2 = nsaTh2;
185 if( sig >= sigthmax )
188 if( nsaTh3 > roiCandidate.NsaTh3 )
189 roiCandidate.NsaTh3 = nsaTh3;
193 if( nsaTh3 > roiCandidate.NsaTh3 )
194 roiCandidate.NsaTh3 = nsaTh3;
202 if( roiCandidate.isRoi )
205 bool ok = (( roiCandidate.NsaTh1 >=
m_NsaAbove1 ) &&
207 ( roiCandidate.NsaTh3 >= 1 ));
214 cout<< myname <<
" Candidate: " 215 <<roiCandidate.NsaTh1<<
" " 216 <<roiCandidate.NsaTh2<<
" " 217 <<roiCandidate.NsaTh3<<
" " 218 <<roiCandidate.MaxValue<<
endl;
223 int istart = (
int)roiCandidate.StartRoi;
224 for(
int ii=istart; ii>=0; --ii )
227 if( roiCandidate.StartRoi>0 ) roiCandidate.StartRoi--;
229 for(
AdcIndex ii = roiCandidate.EndRoi; ii < nsig; ++ii)
232 roiCandidate.EndRoi++;
240 if( roiCandidate.EndRoi >= nsig )
241 roiCandidate.EndRoi = nsig - 1;
244 for(
AdcIndex isigroi = roiCandidate.StartRoi;
245 isigroi <= roiCandidate.EndRoi; ++isigroi)
247 signal[isigroi] =
true;
254 nsaTh2 = 0; nsaTh3 = 0;
259 data.roisFromSignal();
264 cout << myname <<
" ROIs (size = " << rois.size() <<
"):" <<
endl;
265 for (
const AdcRoi& roi : rois ) {
266 cout << myname <<
setw(8) << roi.first <<
" " <<
setw(8) << roi.second <<
endl;
271 cout << myname <<
" ROI count: " <<
data.rois.size() <<
endl;
std::pair< AdcIndex, AdcIndex > AdcRoi
Q_EXPORT QTSManip setw(int w)
std::vector< AdcRoi > AdcRoiVector
std::vector< bool > AdcFilterVector
std::vector< AdcSignal > AdcSignalVector
QTextStream & endl(QTextStream &s)