LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
hit::RegionAboveThresholdFinder Class Reference

#include "RegionAboveThresholdFinder.h"

Public Member Functions

 RegionAboveThresholdFinder (float threshold)
 
void FillStartAndEndTicks (const std::vector< float > &signal, std::vector< unsigned int > &start_ticks, std::vector< unsigned int > &end_ticks)
 

Private Attributes

float fThreshold
 

Detailed Description

Definition at line 19 of file RegionAboveThresholdFinder.h.

Constructor & Destructor Documentation

hit::RegionAboveThresholdFinder::RegionAboveThresholdFinder ( float  threshold)
inline

Definition at line 22 of file RegionAboveThresholdFinder.h.

References FillStartAndEndTicks(), and fThreshold.

Member Function Documentation

void hit::RegionAboveThresholdFinder::FillStartAndEndTicks ( const std::vector< float > &  signal,
std::vector< unsigned int > &  start_ticks,
std::vector< unsigned int > &  end_ticks 
)

Title: RegionAboveThresholdFinder Class Author: Wes Ketchum (wketc.nosp@m.hum@.nosp@m.lanl..nosp@m.gov)

Description: Class that finds a region above threshold in which to do hit-finding.

Input: Vector of floats (like a recob::Wire vector) Output: Vector of begin times, and vector of end times.

Definition at line 15 of file RegionAboveThresholdFinder.cxx.

References fThreshold.

Referenced by RegionAboveThresholdFinder().

18 {
19 
20  start_ticks.clear();
21  end_ticks.clear();
22 
23  bool in_RAT = false;
24  for (unsigned int i_tick = 0; i_tick < signal.size(); i_tick++) {
25 
26  if (!in_RAT && signal[i_tick] >= fThreshold) {
27  start_ticks.push_back(i_tick);
28  in_RAT = true;
29  }
30  else if (in_RAT && signal[i_tick] < fThreshold) {
31  end_ticks.push_back(i_tick);
32  in_RAT = false;
33  }
34  }
35 
36  if (in_RAT) end_ticks.push_back(signal.size());
37 
38  if (end_ticks.size() != start_ticks.size())
39  throw std::runtime_error(
40  "ERROR in RegionAboveThresholdFinder: start and end tick vectors not equal.");
41 }

Member Data Documentation

float hit::RegionAboveThresholdFinder::fThreshold
private

The documentation for this class was generated from the following files: