LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
reco_tool::CandHitStandard Class Reference
Inheritance diagram for reco_tool::CandHitStandard:
reco_tool::ICandidateHitFinder

Public Member Functions

 CandHitStandard (const fhicl::ParameterSet &pset)
 
void findHitCandidates (const recob::Wire::RegionsOfInterest_t::datarange_t &, const size_t, const size_t, const size_t, HitCandidateVec &) const override
 
void MergeHitCandidates (const recob::Wire::RegionsOfInterest_t::datarange_t &, const HitCandidateVec &, MergeHitCandidateVec &) const override
 

Private Types

using HitCandidateVec = std::vector< HitCandidate >
 
using MergeHitCandidateVec = std::vector< HitCandidateVec >
 
using Waveform = std::vector< float >
 

Private Member Functions

void findHitCandidates (std::vector< float >::const_iterator, std::vector< float >::const_iterator, const size_t, const size_t, HitCandidateVec &) const
 

Private Attributes

const float fRoiThreshold
 minimum maximum to minimum peak distance More...
 
const geo::GeometryCorefGeometry = lar::providerFrom<geo::Geometry>()
 

Detailed Description

Definition at line 16 of file CandHitStandard_tool.cc.

Member Typedef Documentation

Definition at line 37 of file ICandidateHitFinder.h.

Definition at line 38 of file ICandidateHitFinder.h.

using reco_tool::ICandidateHitFinder::Waveform = std::vector<float>
inherited

Definition at line 40 of file ICandidateHitFinder.h.

Constructor & Destructor Documentation

reco_tool::CandHitStandard::CandHitStandard ( const fhicl::ParameterSet pset)
explicit

Definition at line 45 of file CandHitStandard_tool.cc.

46  : fRoiThreshold(pset.get<float>("RoiThreshold", 5.))
47  {}
const float fRoiThreshold
minimum maximum to minimum peak distance
T get(std::string const &key) const
Definition: ParameterSet.h:314

Member Function Documentation

void reco_tool::CandHitStandard::findHitCandidates ( const recob::Wire::RegionsOfInterest_t::datarange_t &  dataRange,
const size_t  roiStartTick,
const size_t  channel,
const size_t  ,
HitCandidateVec hitCandidateVec 
) const
overridevirtual

Implements reco_tool::ICandidateHitFinder.

Definition at line 49 of file CandHitStandard_tool.cc.

References geo::GeometryCore::ChannelToWire(), and fGeometry.

Referenced by findHitCandidates().

55  {
56  // Recover the actual waveform
57  const Waveform& waveform = dataRange.data();
58 
59  // Recover the plane index for this method
60  std::vector<geo::WireID> wids = fGeometry->ChannelToWire(channel);
61  const size_t plane = wids[0].Plane;
62 
63  // Use the recursive version to find the candidate hits
64  findHitCandidates(waveform.begin(), waveform.end(), roiStartTick, plane, hitCandidateVec);
65 
66  return;
67  }
std::vector< WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
void findHitCandidates(const recob::Wire::RegionsOfInterest_t::datarange_t &, const size_t, const size_t, const size_t, HitCandidateVec &) const override
const geo::GeometryCore * fGeometry
void reco_tool::CandHitStandard::findHitCandidates ( std::vector< float >::const_iterator  startItr,
std::vector< float >::const_iterator  stopItr,
const size_t  roiStartTick,
const size_t  planeIdx,
HitCandidateVec hitCandidateVec 
) const
private

Definition at line 69 of file CandHitStandard_tool.cc.

References findHitCandidates(), fRoiThreshold, reco_tool::ICandidateHitFinder::HitCandidate::hitCenter, reco_tool::ICandidateHitFinder::HitCandidate::hitHeight, reco_tool::ICandidateHitFinder::HitCandidate::hitSigma, reco_tool::ICandidateHitFinder::HitCandidate::maxDerivative, reco_tool::ICandidateHitFinder::HitCandidate::maxTick, reco_tool::ICandidateHitFinder::HitCandidate::minDerivative, reco_tool::ICandidateHitFinder::HitCandidate::minTick, reco_tool::ICandidateHitFinder::HitCandidate::startTick, and reco_tool::ICandidateHitFinder::HitCandidate::stopTick.

74  {
75  // Need a minimum number of ticks to do any work here
76  if (std::distance(startItr, stopItr) > 4) {
77  // Find the highest peak in the range given
78  auto maxItr = std::max_element(startItr, stopItr);
79 
80  float maxValue = *maxItr;
81  int maxTime = std::distance(startItr, maxItr);
82 
83  if (maxValue > fRoiThreshold) {
84  // backwards to find first bin for this candidate hit
85  auto firstItr = std::distance(startItr, maxItr) > 2 ? maxItr - 1 : startItr;
86 
87  while (firstItr != startItr) {
88  // Check for pathology where waveform goes too negative
89  if (*firstItr < -fRoiThreshold) break;
90 
91  // Check both sides of firstItr and look for min/inflection point
92  if (*firstItr < *(firstItr + 1) && *firstItr <= *(firstItr - 1)) break;
93 
94  firstItr--;
95  }
96 
97  int firstTime = std::distance(startItr, firstItr);
98 
99  // Recursive call to find all candidate hits earlier than this peak
100  findHitCandidates(startItr, firstItr + 1, roiStartTick, planeIdx, hitCandidateVec);
101 
102  // forwards to find last bin for this candidate hit
103  auto lastItr = std::distance(maxItr, stopItr) > 2 ? maxItr + 1 : stopItr - 1;
104 
105  while (lastItr != stopItr - 1) {
106  // Check for pathology where waveform goes too negative
107  if (*lastItr < -fRoiThreshold) break;
108 
109  // Check both sides of firstItr and look for min/inflection point
110  if (*lastItr <= *(lastItr + 1) && *lastItr < *(lastItr - 1)) break;
111 
112  lastItr++;
113  }
114 
115  int lastTime = std::distance(startItr, lastItr);
116 
117  // Now save this candidate's start and max time info
118  HitCandidate hitCandidate;
119  hitCandidate.startTick = roiStartTick + firstTime;
120  hitCandidate.stopTick = roiStartTick + lastTime;
121  hitCandidate.maxTick = roiStartTick + firstTime;
122  hitCandidate.minTick = roiStartTick + lastTime;
123  hitCandidate.maxDerivative = *(startItr + firstTime);
124  hitCandidate.minDerivative = *(startItr + lastTime);
125  hitCandidate.hitCenter = roiStartTick + maxTime;
126  hitCandidate.hitSigma = std::max(2., float(lastTime - firstTime) / 6.);
127  hitCandidate.hitHeight = maxValue;
128 
129  hitCandidateVec.push_back(hitCandidate);
130 
131  // Recursive call to find all candidate hits later than this peak
132  findHitCandidates(lastItr + 1,
133  stopItr,
134  roiStartTick + std::distance(startItr, lastItr + 1),
135  planeIdx,
136  hitCandidateVec);
137  }
138  }
139 
140  return;
141  }
void findHitCandidates(const recob::Wire::RegionsOfInterest_t::datarange_t &, const size_t, const size_t, const size_t, HitCandidateVec &) const override
const float fRoiThreshold
minimum maximum to minimum peak distance
void reco_tool::CandHitStandard::MergeHitCandidates ( const recob::Wire::RegionsOfInterest_t::datarange_t &  ,
const HitCandidateVec hitCandidateVec,
MergeHitCandidateVec mergedHitsVec 
) const
overridevirtual

Implements reco_tool::ICandidateHitFinder.

Definition at line 143 of file CandHitStandard_tool.cc.

References DEFINE_ART_CLASS_TOOL.

146  {
147  // If no hits then nothing to do here
148  if (hitCandidateVec.empty()) return;
149 
150  // The idea is to group hits that "touch" so they can be part of common fit, those that
151  // don't "touch" are fit independently. So here we build the output vector to achieve that
152  HitCandidateVec groupedHitVec;
153  int lastTick = hitCandidateVec.front().stopTick;
154 
155  // Step through the input hit candidates and group them by proximity
156  for (const auto& hitCandidate : hitCandidateVec) {
157  // Check condition that we have a new grouping
158  if (int(hitCandidate.startTick) - lastTick > 1) {
159  mergedHitsVec.emplace_back(groupedHitVec);
160 
161  groupedHitVec.clear();
162  }
163 
164  // Add the current hit to the current group
165  groupedHitVec.emplace_back(hitCandidate);
166 
167  lastTick = hitCandidate.stopTick;
168  }
169 
170  // Check end condition
171  if (!groupedHitVec.empty()) mergedHitsVec.emplace_back(groupedHitVec);
172 
173  return;
174  }
std::vector< HitCandidate > HitCandidateVec

Member Data Documentation

const geo::GeometryCore* reco_tool::CandHitStandard::fGeometry = lar::providerFrom<geo::Geometry>()
private

Definition at line 40 of file CandHitStandard_tool.cc.

Referenced by findHitCandidates().

const float reco_tool::CandHitStandard::fRoiThreshold
private

minimum maximum to minimum peak distance

Definition at line 38 of file CandHitStandard_tool.cc.

Referenced by findHitCandidates().


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