19 : m_threshold (p.
get<unsigned
int> (
"Threshold" , 10)),
20 m_useSignalKill (p.
get<
bool> (
"UseSignalKill" , true)),
21 m_signalKillLookahead(p.
get<short> (
"SignalKillLookahead" , 5)),
22 m_signalKillThreshold(p.
get<short> (
"SignalKillThreshold" , 15)),
23 m_signalKillNContig (p.
get<short> (
"SignalKillNContig" , 1)),
24 m_frugalNContig (p.
get<short> (
"FrugalPedestalNContig", 10)),
25 m_doFiltering (p.
get<
bool> (
"DoFiltering" , true)),
26 m_downsampleFactor (p.
get<unsigned
int> (
"DownsampleFactor" , 1)),
27 m_filterTaps (p.
get<
std::
vector<short>>(
"FilterCoeffs" , {2, 9, 23, 31, 23, 9, 2})),
45 std::vector<short> waveform;
47 waveform.push_back(orig[i]);
79 std::transform(filtered.begin(), filtered.end(),
88 std::vector<RunningSumTPFinderTool::Hit>& hits,
97 for(
size_t isample=0; isample<waveform.size()-1; ++isample){
99 short adc = waveform[isample];
101 if(is_hit && !was_hit) {
106 if(is_hit && was_hit) {
110 if(!is_hit && was_hit) {
118 std::vector<RunningSumTPFinderTool::Hit>
120 const std::vector<std::vector<short>>& collection_samples) {
122 auto hits = std::vector<RunningSumTPFinderTool::Hit>();
123 std::cout <<
"findHits called with " << collection_samples.size()
124 <<
" channels. First chan has " << collection_samples[0].size() <<
" samples" <<
std::endl;
126 for(
size_t ich=0; ich<collection_samples.size(); ++ich){
127 const std::vector<short>& waveformOrig = collection_samples[ich];
129 std::vector<short> waveform =
downSample (waveformOrig);
131 std::vector<short> pedsub(waveform.size(), 0);
132 for(
size_t i=0; i<pedsub.size(); ++i)
133 pedsub[i]=waveform[i]-pedestal[i];
134 std::vector<short> filtered =
filter(pedsub);
135 hitFinding(filtered, hits, channel_numbers[ich]);
137 std::cout <<
"Returning " << hits.size() <<
" hits" <<
std::endl;
138 std::cout <<
"hits/channel=" <<
float(hits.size())/collection_samples .
size() <<
std::endl;
139 std::cout <<
"hits/tick=" <<
float(hits.size())/collection_samples[0].
size() <<
std::endl;
std::vector< short > filter(const std::vector< short > &orig)
RunningSumTPFinderPass2(fhicl::ParameterSet const &p)
void hitFinding(const std::vector< short > &waveform, std::vector< RunningSumTPFinderTool::Hit > &hits, int channel)
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
std::vector< short > downSample(const std::vector< short > &orig)
short m_signalKillNContig
short m_signalKillLookahead
std::vector< short > apply_fir_filter(const std::vector< short > &input, const size_t ntaps, const short *taps)
std::vector< short > findPedestal(const std::vector< short > &orig)
std::vector< short > frugal_pedestal_sigkill(const std::vector< short > &raw_in, const int lookahead, const int threshold, const int ncontig)
virtual std::vector< RunningSumTPFinderTool::Hit > findHits(const std::vector< unsigned int > &channel_numbers, const std::vector< std::vector< short >> &collection_samples)
std::vector< short > m_filterTaps
auto const & get(AssnsNode< L, R, D > const &r)
short m_signalKillThreshold
std::vector< short > frugal_pedestal(const std::vector< short > &raw_in, const int ncontig)
unsigned int m_downsampleFactor
QTextStream & endl(QTextStream &s)