LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
RegionAboveThresholdFinder.cxx
Go to the documentation of this file.
1 
13 #include <stdexcept>
14 
15 void hit::RegionAboveThresholdFinder::FillStartAndEndTicks(const std::vector<float>& signal,
16  std::vector<unsigned int>& start_ticks,
17  std::vector<unsigned int>& end_ticks)
18 {
19 
20  start_ticks.clear(); end_ticks.clear();
21 
22  bool in_RAT = false;
23  for(unsigned int i_tick=0; i_tick<signal.size(); i_tick++){
24 
25  if(!in_RAT && signal[i_tick]>=fThreshold){
26  start_ticks.push_back(i_tick);
27  in_RAT = true;
28  }
29  else if(in_RAT && signal[i_tick]<fThreshold){
30  end_ticks.push_back(i_tick);
31  in_RAT = false;
32  }
33 
34  }
35 
36  if(in_RAT)
37  end_ticks.push_back(signal.size());
38 
39  if(end_ticks.size()!=start_ticks.size())
40  throw std::runtime_error("ERROR in RegionAboveThresholdFinder: start and end tick vectors not equal.");
41 
42 }
void FillStartAndEndTicks(const std::vector< float > &signal, std::vector< unsigned int > &start_ticks, std::vector< unsigned int > &end_ticks)