LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
hit::RFFHitFinderAlg Class Reference

#include "RFFHitFinderAlg.h"

Public Member Functions

 RFFHitFinderAlg (fhicl::ParameterSet const &)
 
void SetFitterParamsVectors (unsigned int num_planes)
 
void Run (std::vector< recob::Wire > const &, std::vector< recob::Hit > &, geo::WireReadoutGeom const &)
 

Private Member Functions

void SetFitterParams (unsigned int)
 
void EmplaceHit (std::vector< recob::Hit > &, recob::Wire const &, float const &, raw::TDCtick_t const &, raw::TDCtick_t const &, geo::SigType_t const &, geo::WireID const &)
 

Private Attributes

const float SQRT_TWO_PI = 2.506628
 
std::vector< float > fMatchThresholdVec
 
std::vector< unsigned int > fMergeMultiplicityVec
 
std::vector< float > fAmpThresholdVec
 
RFFHitFitter fFitter
 

Detailed Description

Definition at line 31 of file RFFHitFinderAlg.h.

Constructor & Destructor Documentation

hit::RFFHitFinderAlg::RFFHitFinderAlg ( fhicl::ParameterSet const &  p)

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

Description: Class that runs the RFF HitFinder. Implements an RFFHitFitter, and takes the result and stores it in recob::Hit objects.

Input: recob::Wire Output: recob::Hit

Definition at line 21 of file RFFHitFinderAlg.cxx.

References fAmpThresholdVec, fMatchThresholdVec, fMergeMultiplicityVec, and fhicl::ParameterSet::get().

22 {
23  fMatchThresholdVec = p.get<std::vector<float>>("MeanMatchThreshold");
24  fMergeMultiplicityVec = p.get<std::vector<unsigned int>>("MinMergeMultiplicity");
25  fAmpThresholdVec = p.get<std::vector<float>>("AmplitudeThreshold", std::vector<float>(1, 0.0));
26 }
std::vector< float > fAmpThresholdVec
std::vector< float > fMatchThresholdVec
std::vector< unsigned int > fMergeMultiplicityVec

Member Function Documentation

void hit::RFFHitFinderAlg::EmplaceHit ( std::vector< recob::Hit > &  hitVector,
recob::Wire const &  wire,
float const &  summedADCTotal,
raw::TDCtick_t const &  startTick,
raw::TDCtick_t const &  endTick,
geo::SigType_t const &  sigtype,
geo::WireID const &  wireID 
)
private

Definition at line 79 of file RFFHitFinderAlg.cxx.

References hit::RFFHitFitter::AmplitudeErrorVector(), hit::RFFHitFitter::AmplitudeVector(), recob::Wire::Channel(), fFitter, hit::RFFHitFitter::MeanErrorVector(), hit::RFFHitFitter::MeanVector(), hit::RFFHitFitter::NHits(), hit::RFFHitFitter::SigmaErrorVector(), hit::RFFHitFitter::SigmaVector(), SQRT_TWO_PI, and recob::Wire::View().

Referenced by Run().

86 {
87 
88  float totalArea = 0.0;
89  std::vector<float> areaVector(fFitter.NHits());
90  std::vector<float> areaErrorVector(fFitter.NHits());
91  std::vector<float> areaFracVector(fFitter.NHits());
92 
93  for (size_t ihit = 0; ihit < fFitter.NHits(); ihit++) {
94  areaVector[ihit] = fFitter.AmplitudeVector()[ihit] * fFitter.SigmaVector()[ihit] * SQRT_TWO_PI;
95  areaErrorVector[ihit] =
96  SQRT_TWO_PI * std::sqrt(fFitter.AmplitudeVector()[ihit] * fFitter.SigmaErrorVector()[ihit] *
100  totalArea += areaVector[ihit];
101  }
102 
103  for (size_t ihit = 0; ihit < fFitter.NHits(); ihit++) {
104  areaFracVector[ihit] = areaVector[ihit] / totalArea;
105 
106  hitVector.emplace_back(wire.Channel(),
107  startTick,
108  endTick,
109  fFitter.MeanVector()[ihit] + (float)startTick,
110  fFitter.MeanErrorVector()[ihit],
111  fFitter.SigmaVector()[ihit],
112  fFitter.AmplitudeVector()[ihit],
114  summedADCTotal * areaFracVector[ihit],
115  summedADCTotal * areaFracVector[ihit], //NOT CORRECTLY FILLED
116  areaVector[ihit],
117  areaErrorVector[ihit],
118  fFitter.NHits(),
119  ihit,
120  -999.,
121  -999,
122  wire.View(),
123  sigtype,
124  wireID);
125  }
126 }
const std::vector< float > & AmplitudeVector()
Definition: RFFHitFitter.h:48
const std::vector< float > & MeanVector()
Definition: RFFHitFitter.h:44
const std::vector< float > & SigmaVector()
Definition: RFFHitFitter.h:45
const std::vector< float > & MeanErrorVector()
Definition: RFFHitFitter.h:46
unsigned int NHits()
Definition: RFFHitFitter.h:50
const std::vector< float > & AmplitudeErrorVector()
Definition: RFFHitFitter.h:49
const std::vector< float > & SigmaErrorVector()
Definition: RFFHitFitter.h:47
void hit::RFFHitFinderAlg::Run ( std::vector< recob::Wire > const &  wireVector,
std::vector< recob::Hit > &  hitVector,
geo::WireReadoutGeom const &  wireReadoutGeom 
)

Definition at line 55 of file RFFHitFinderAlg.cxx.

References geo::WireReadoutGeom::ChannelToWire(), EmplaceHit(), fFitter, hit::RFFHitFitter::RunFitter(), SetFitterParams(), and geo::WireReadoutGeom::SignalType().

Referenced by hit::RFFHitFinder::produce().

58 {
59  hitVector.reserve(wireVector.size());
60  for (auto const& wire : wireVector) {
61  geo::SigType_t const& sigtype = wireReadoutGeom.SignalType(wire.Channel());
62  geo::WireID const wireID = wireReadoutGeom.ChannelToWire(wire.Channel()).at(0);
63 
64  SetFitterParams(wire.View());
65 
66  for (auto const& roi : wire.SignalROI().get_ranges()) {
67  fFitter.RunFitter(roi.data());
68 
69  const float summedADCTotal = std::accumulate(roi.data().begin(), roi.data().end(), 0.0);
70  const raw::TDCtick_t startTick = roi.begin_index();
71  const raw::TDCtick_t endTick = roi.begin_index() + roi.size();
72 
73  EmplaceHit(hitVector, wire, summedADCTotal, startTick, endTick, sigtype, wireID);
74  } //end loop over ROIs on wire
75 
76  } //end loop over wires
77 }
void EmplaceHit(std::vector< recob::Hit > &, recob::Wire const &, float const &, raw::TDCtick_t const &, raw::TDCtick_t const &, geo::SigType_t const &, geo::WireID const &)
void RunFitter(const std::vector< float > &signal)
int TDCtick_t
Type representing a TDC tick.
Definition: RawTypes.h:25
enum geo::_plane_sigtype SigType_t
Enumerate the possible plane projections.
void SetFitterParams(unsigned int)
void hit::RFFHitFinderAlg::SetFitterParams ( unsigned int  p)
private

Definition at line 50 of file RFFHitFinderAlg.cxx.

References fAmpThresholdVec, fFitter, fMatchThresholdVec, fMergeMultiplicityVec, and hit::RFFHitFitter::SetFitterParams().

Referenced by Run().

51 {
53 }
void SetFitterParams(float, unsigned int, float)
std::vector< float > fAmpThresholdVec
std::vector< float > fMatchThresholdVec
std::vector< unsigned int > fMergeMultiplicityVec
void hit::RFFHitFinderAlg::SetFitterParamsVectors ( unsigned int  num_planes)

Definition at line 28 of file RFFHitFinderAlg.cxx.

References fAmpThresholdVec, fMatchThresholdVec, and fMergeMultiplicityVec.

Referenced by hit::RFFHitFinder::beginJob().

29 {
30  //If size zero, throw. If size one, assume same for all planes.
31  //If size > 1 but < n_planes, throw. If size = n_plane, good.
32 
33  if (fMatchThresholdVec.size() == 0 || fMergeMultiplicityVec.size() == 0 ||
34  fAmpThresholdVec.size() == 0)
35  throw std::runtime_error("Error in RFFHitFinderAlg: Configured with zero planes.");
36 
37  if ((fMatchThresholdVec.size() > 1 && fMatchThresholdVec.size() < n_planes) ||
38  (fMergeMultiplicityVec.size() > 1 && fMergeMultiplicityVec.size() < n_planes) ||
39  (fAmpThresholdVec.size() > 1 && fAmpThresholdVec.size() < n_planes))
40  throw std::runtime_error("Error in RFFHitFinderAlg: Configured with incorrect n_planes.");
41 
42  if (fMatchThresholdVec.size() == 1) fMatchThresholdVec.resize(n_planes, fMatchThresholdVec[0]);
43 
44  if (fMergeMultiplicityVec.size() == 1)
45  fMergeMultiplicityVec.resize(n_planes, fMergeMultiplicityVec[0]);
46 
47  if (fAmpThresholdVec.size() == 1) fAmpThresholdVec.resize(n_planes, fAmpThresholdVec[0]);
48 }
std::vector< float > fAmpThresholdVec
std::vector< float > fMatchThresholdVec
std::vector< unsigned int > fMergeMultiplicityVec

Member Data Documentation

std::vector<float> hit::RFFHitFinderAlg::fAmpThresholdVec
private

Definition at line 46 of file RFFHitFinderAlg.h.

Referenced by RFFHitFinderAlg(), SetFitterParams(), and SetFitterParamsVectors().

RFFHitFitter hit::RFFHitFinderAlg::fFitter
private

Definition at line 58 of file RFFHitFinderAlg.h.

Referenced by EmplaceHit(), Run(), and SetFitterParams().

std::vector<float> hit::RFFHitFinderAlg::fMatchThresholdVec
private

Definition at line 44 of file RFFHitFinderAlg.h.

Referenced by RFFHitFinderAlg(), SetFitterParams(), and SetFitterParamsVectors().

std::vector<unsigned int> hit::RFFHitFinderAlg::fMergeMultiplicityVec
private

Definition at line 45 of file RFFHitFinderAlg.h.

Referenced by RFFHitFinderAlg(), SetFitterParams(), and SetFitterParamsVectors().

const float hit::RFFHitFinderAlg::SQRT_TWO_PI = 2.506628
private

Definition at line 33 of file RFFHitFinderAlg.h.

Referenced by EmplaceHit().


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