24 m_UseFilter( pset.
get<
bool>(
"UseFilter") ),
28 const string myname =
"DuneDPhaseRoiBuildingService::ctor: ";
41 const string myname =
"DuneDPhaseRoiBuildingService:build: ";
42 if (
m_LogLevel >= 2 ) cout << myname <<
"Building ROIs for channel " 58 signal.resize(sigs.size(),
false);
65 <<
" has no samples." <<
endl;
68 for (
AdcIndex isig=0; isig<sigs.size(); ++isig ) {
77 if ( sig > sighigh ) {
87 cout << myname <<
" ROIs before merge (size = " << rois.size() <<
"):" <<
endl;
88 for (
const AdcRoi& roi : rois ) {
89 cout << myname <<
setw(8) << roi.first <<
" " <<
setw(8) << roi.second <<
endl;
92 cout << myname <<
" ROI count before merge: " << data.
rois.size() <<
endl;
94 if ( rois.size() == 0 )
return 0;
96 unsigned int isig1 = 0;
97 unsigned int isig2 = 0;
98 for (
AdcRoi roi : rois ) {
101 for (
unsigned int isig=isig1; isig<isig2; ++isig ) signal[isig] =
true;
102 isig1 = roi.second + 1;
104 if ( isig2 > nsig ) isig2 = nsig;
105 for (
unsigned int isig=isig1; isig<isig2; ++isig ) signal[isig] =
true;
111 cout << myname <<
" ROIs after merge (size = " << rois.size() <<
"):" <<
endl;
112 for (
const AdcRoi& roi : rois ) {
113 cout << myname <<
setw(8) << roi.first <<
" " <<
setw(8) << roi.second <<
endl;
116 cout << myname <<
" ROI count after merge: " << data.
rois.size() <<
endl;
126 std::vector< TComplex > ch_spectrum(fft->
FFTSize() / 2 + 1);
127 std::vector< float > ch_waveform(fft->
FFTSize(), 0);
129 size_t n_samples = adc.size();
131 std::copy(adc.begin(), adc.end(), ch_waveform.begin());
132 for (
size_t s = n_samples;
s < ch_waveform.
size(); ++
s)
134 ch_waveform[
s] = ch_waveform[
s-1];
136 fft->
DoFFT(ch_waveform, ch_spectrum);
141 fft->
DoInvFFT(ch_spectrum, ch_waveform);
144 std::copy(ch_waveform.begin(), ch_waveform.begin()+n_samples, flt_out.begin());
151 out << prefix <<
"DuneDPhaseRoiBuildingService:" <<
endl;
AdcSignalVector getLowFreqFiltered(const AdcSignalVector &adc) const
DuneDPhaseRoiBuildingService(fhicl::ParameterSet const &pset, art::ActivityRegistry &)
std::vector< float > m_FltCoeffs
std::pair< AdcIndex, AdcIndex > AdcRoi
void DoFFT(std::vector< T > &input, std::vector< TComplex > &output)
double GetDeconNoise(Channel channel) const override
void DoInvFFT(std::vector< TComplex > &input, std::vector< T > &output)
T get(std::string const &key) const
Service to provide DUNE dual-phase signal shaping for simulation (convolution) and reconstruction (de...
Q_EXPORT QTSManip setw(int w)
std::ostream & print(std::ostream &out=std::cout, std::string prefix="") const
std::vector< AdcRoi > AdcRoiVector
std::vector< bool > AdcFilterVector
std::optional< T > get_if_present(std::string const &key) const
std::vector< AdcSignal > AdcSignalVector
int build(AdcChannelData &data) const
auto const & get(AssnsNode< L, R, D > const &r)
QTextStream & endl(QTextStream &s)
#define DEFINE_ART_SERVICE_INTERFACE_IMPL(svc, iface)