All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
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 Member Functions

void findHitCandidates (std::vector< float >::const_iterator, std::vector< float >::const_iterator, const size_t, const size_t, HitCandidateVec &) const
 
- Private Member Functions inherited from reco_tool::ICandidateHitFinder
virtual ~ICandidateHitFinder () noexcept=default
 

Private Attributes

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

Additional Inherited Members

- Private Types inherited from reco_tool::ICandidateHitFinder
using HitCandidateVec = std::vector< HitCandidate >
 
using MergeHitCandidateVec = std::vector< HitCandidateVec >
 
using Waveform = std::vector< float >
 

Detailed Description

Definition at line 16 of file CandHitStandard_tool.cc.

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

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  eventCount,
HitCandidateVec hitCandidateVec 
) const
overridevirtual

Implements reco_tool::ICandidateHitFinder.

Definition at line 50 of file CandHitStandard_tool.cc.

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  }
void findHitCandidates(const recob::Wire::RegionsOfInterest_t::datarange_t &, const size_t, const size_t, const size_t, HitCandidateVec &) const override
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
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 70 of file CandHitStandard_tool.cc.

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

Implements reco_tool::ICandidateHitFinder.

Definition at line 145 of file CandHitStandard_tool.cc.

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

const float reco_tool::CandHitStandard::fRoiThreshold
private

minimum maximum to minimum peak distance

Definition at line 38 of file CandHitStandard_tool.cc.


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