21 virtual std::vector<TriggerPrimitiveFinderTool::Hit>
22 findHits(
const std::vector<unsigned int>& channel_numbers,
23 const std::vector<std::vector<short>>& collection_samples);
28 void hitFinding(
const std::vector<short>& waveform,
29 const std::vector<short>& iqr,
30 std::vector<TriggerPrimitiveFinderTool::Hit>& hits,
42 std::cout <<
"Threshold in sigma is " <<
m_sigmaThreshold <<
" (ignore the Threshold = 10 on previous line)\n";
47 const std::vector<short>& iqr,
48 std::vector<TriggerPrimitiveFinderTool::Hit>& hits,
57 for(
size_t isample=0; isample<waveform.size()-1; ++isample){
60 short adc=waveform[isample];
62 if(is_hit && !was_hit){
68 if(is_hit && was_hit){
72 if(!is_hit && was_hit){
82 std::vector<TriggerPrimitiveFinderTool::Hit>
84 const std::vector<std::vector<short>>& collection_samples)
86 auto hits=std::vector<TriggerPrimitiveFinderTool::Hit>();
87 std::cout <<
"findHits called with " << collection_samples.size()
88 <<
" channels. First chan has " << collection_samples[0].size() <<
" samples" <<
std::endl;
93 for(
size_t ich=0; ich<collection_samples.size(); ++ich){
94 const std::vector<short>& waveformOrig=collection_samples[ich];
95 std::vector<short> waveform=
downSample(waveformOrig);
97 std::vector<short> pedsub(waveform.size(), 0);
98 for(
size_t i=0; i<pedsub.size(); ++i){
99 pedsub[i]=waveform[i]-pedestal[i];
102 std::vector<short> filtered=
filter(pedsub);
103 hitFinding(filtered, iqr, hits, channel_numbers[ich]);
105 std::cout <<
"Returning " << hits.size() <<
" hits" <<
std::endl;
106 std::cout <<
"hits/channel=" <<
float(hits.size())/collection_samples.size() <<
std::endl;
107 std::cout <<
"hits/tick=" <<
float(hits.size())/collection_samples[0].
size() <<
std::endl;
std::vector< short > downSample(const std::vector< short > &orig)
std::vector< short > findPedestal(const std::vector< short > &orig)
unsigned int m_downsampleFactor
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
std::vector< short > filter(const std::vector< short > &orig)
virtual std::vector< TriggerPrimitiveFinderTool::Hit > findHits(const std::vector< unsigned int > &channel_numbers, const std::vector< std::vector< short >> &collection_samples)
std::vector< short > frugal_iqr(const std::vector< short > &raw_in, const std::vector< short > &median, const int ncontig)
void hitFinding(const std::vector< short > &waveform, const std::vector< short > &iqr, std::vector< TriggerPrimitiveFinderTool::Hit > &hits, int channel)
auto const & get(AssnsNode< L, R, D > const &r)
TriggerPrimitiveFinderPass2(fhicl::ParameterSet const &p)
QTextStream & endl(QTextStream &s)