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

Public Member Functions

 CandHitStandard (const fhicl::ParameterSet &pset)
 
 ~CandHitStandard ()
 
void configure (const fhicl::ParameterSet &pset) override
 
void findHitCandidates (const std::vector< float > &, size_t, size_t, size_t, HitCandidateVec &) const override
 
void MergeHitCandidates (const std::vector< float > &, const HitCandidateVec &, MergeHitCandidateVec &) const override
 

Private Types

using HitCandidate_t = struct HitCandidate{size_t startTick
 
using HitCandidateVec = std::vector< HitCandidate_t >
 
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, size_t, size_t, HitCandidateVec &) const
 

Private Attributes

int fPlane
 Plane we are meant to work with. More...
 
float fRoiThreshold
 minimum maximum to minimum peak distance More...
 
const geo::GeometryCorefGeometry = lar::providerFrom<geo::Geometry>()
 
size_t stopTick
 
size_t maxTick
 
size_t minTick
 
float maxDerivative
 
float minDerivative
 
float hitCenter
 
float hitSigma
 
float hitHeight
 

Detailed Description

Definition at line 21 of file CandHitStandard_tool.cc.

Member Typedef Documentation

using reco_tool::ICandidateHitFinder::HitCandidate_t = struct HitCandidate { size_t startTick
inherited

Definition at line 30 of file ICandidateHitFinder.h.

Definition at line 41 of file ICandidateHitFinder.h.

Definition at line 42 of file ICandidateHitFinder.h.

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

Definition at line 44 of file ICandidateHitFinder.h.

Constructor & Destructor Documentation

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

Definition at line 57 of file CandHitStandard_tool.cc.

References configure().

58 {
59  configure(pset);
60 }
void configure(const fhicl::ParameterSet &pset) override
reco_tool::CandHitStandard::~CandHitStandard ( )

Definition at line 62 of file CandHitStandard_tool.cc.

63 {
64 }

Member Function Documentation

void reco_tool::CandHitStandard::configure ( const fhicl::ParameterSet pset)
overridevirtual

Implements reco_tool::ICandidateHitFinder.

Definition at line 66 of file CandHitStandard_tool.cc.

References fPlane, fRoiThreshold, and fhicl::ParameterSet::get().

Referenced by CandHitStandard().

67 {
68  // Start by recovering the parameters
69  fPlane = pset.get< int >("Plane", 0);
70  fRoiThreshold = pset.get< float >("RoiThreshold", 5.);
71 
72  return;
73 }
int fPlane
Plane we are meant to work with.
T get(std::string const &key) const
Definition: ParameterSet.h:231
float fRoiThreshold
minimum maximum to minimum peak distance
void reco_tool::CandHitStandard::findHitCandidates ( const std::vector< float > &  waveform,
size_t  roiStartTick,
size_t  channel,
size_t  eventCount,
HitCandidateVec hitCandidateVec 
) const
overridevirtual

Implements reco_tool::ICandidateHitFinder.

Definition at line 75 of file CandHitStandard_tool.cc.

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

Referenced by findHitCandidates().

80 {
81  // Recover the plane index for this method
82  std::vector<geo::WireID> wids = fGeometry->ChannelToWire(channel);
83  size_t plane = wids[0].Plane;
84 
85  // Use the recursive version to find the candidate hits
86  findHitCandidates(waveform.begin(),waveform.end(),roiStartTick,plane,hitCandidateVec);
87 
88  return;
89 }
void findHitCandidates(const std::vector< float > &, size_t, size_t, 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,
size_t  roiStartTick,
size_t  planeIdx,
HitCandidateVec hitCandidateVec 
) const
private

Definition at line 91 of file CandHitStandard_tool.cc.

References findHitCandidates(), fRoiThreshold, and max.

96 {
97  // Need a minimum number of ticks to do any work here
98  if (std::distance(startItr,stopItr) > 4)
99  {
100  // Find the highest peak in the range given
101  auto maxItr = std::max_element(startItr, stopItr);
102 
103  float maxValue = *maxItr;
104  int maxTime = std::distance(startItr,maxItr);
105 
106  if (maxValue > fRoiThreshold)
107  {
108  // backwards to find first bin for this candidate hit
109  auto firstItr = std::distance(startItr,maxItr) > 2 ? maxItr - 1 : startItr;
110 
111  while(firstItr != startItr)
112  {
113  // Check for pathology where waveform goes too negative
114  if (*firstItr < -fRoiThreshold) break;
115 
116  // Check both sides of firstItr and look for min/inflection point
117  if (*firstItr < *(firstItr+1) && *firstItr <= *(firstItr-1)) break;
118 
119  firstItr--;
120  }
121 
122  int firstTime = std::distance(startItr,firstItr);
123 
124  // Recursive call to find all candidate hits earlier than this peak
125  findHitCandidates(startItr, firstItr + 1, roiStartTick, planeIdx, hitCandidateVec);
126 
127  // forwards to find last bin for this candidate hit
128  auto lastItr = std::distance(maxItr,stopItr) > 2 ? maxItr + 1 : stopItr - 1;
129 
130  while(lastItr != stopItr - 1)
131  {
132  // Check for pathology where waveform goes too negative
133  if (*lastItr < -fRoiThreshold) break;
134 
135  // Check both sides of firstItr and look for min/inflection point
136  if (*lastItr <= *(lastItr+1) && *lastItr < *(lastItr-1)) break;
137 
138  lastItr++;
139  }
140 
141  int lastTime = std::distance(startItr,lastItr);
142 
143  // Now save this candidate's start and max time info
144  HitCandidate hitCandidate;
145  hitCandidate.startTick = roiStartTick + firstTime;
146  hitCandidate.stopTick = roiStartTick + lastTime;
147  hitCandidate.maxTick = roiStartTick + firstTime;
148  hitCandidate.minTick = roiStartTick + lastTime;
149  hitCandidate.maxDerivative = *(startItr + firstTime);
150  hitCandidate.minDerivative = *(startItr + lastTime);
151  hitCandidate.hitCenter = roiStartTick + maxTime;
152  hitCandidate.hitSigma = std::max(2.,float(lastTime - firstTime) / 6.);
153  hitCandidate.hitHeight = maxValue;
154 
155  hitCandidateVec.push_back(hitCandidate);
156 
157  // Recursive call to find all candidate hits later than this peak
158  findHitCandidates(lastItr + 1, stopItr, roiStartTick + std::distance(startItr,lastItr + 1), planeIdx, hitCandidateVec);
159  }
160  }
161 
162  return;
163 }
void findHitCandidates(const std::vector< float > &, size_t, size_t, size_t, HitCandidateVec &) const override
Int_t max
Definition: plot.C:27
float fRoiThreshold
minimum maximum to minimum peak distance
void reco_tool::CandHitStandard::MergeHitCandidates ( const std::vector< float > &  signalVec,
const HitCandidateVec hitCandidateVec,
MergeHitCandidateVec mergedHitsVec 
) const
overridevirtual

Implements reco_tool::ICandidateHitFinder.

Definition at line 165 of file CandHitStandard_tool.cc.

References DEFINE_ART_CLASS_TOOL.

168 {
169  // If no hits then nothing to do here
170  if (hitCandidateVec.empty()) return;
171 
172  // The idea is to group hits that "touch" so they can be part of common fit, those that
173  // don't "touch" are fit independently. So here we build the output vector to achieve that
174  HitCandidateVec groupedHitVec;
175  int lastTick = hitCandidateVec.front().stopTick;
176 
177  // Step through the input hit candidates and group them by proximity
178  for(const auto& hitCandidate : hitCandidateVec)
179  {
180  // Check condition that we have a new grouping
181  if (int(hitCandidate.startTick) - lastTick > 1)
182  {
183  mergedHitsVec.emplace_back(groupedHitVec);
184 
185  groupedHitVec.clear();
186  }
187 
188  // Add the current hit to the current group
189  groupedHitVec.emplace_back(hitCandidate);
190 
191  lastTick = hitCandidate.stopTick;
192  }
193 
194  // Check end condition
195  if (!groupedHitVec.empty()) mergedHitsVec.emplace_back(groupedHitVec);
196 
197  return;
198 }
std::vector< HitCandidate_t > HitCandidateVec

Member Data Documentation

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

Definition at line 52 of file CandHitStandard_tool.cc.

Referenced by findHitCandidates().

int reco_tool::CandHitStandard::fPlane
private

Plane we are meant to work with.

Definition at line 49 of file CandHitStandard_tool.cc.

Referenced by configure().

float reco_tool::CandHitStandard::fRoiThreshold
private

minimum maximum to minimum peak distance

Definition at line 50 of file CandHitStandard_tool.cc.

Referenced by configure(), and findHitCandidates().

float reco_tool::ICandidateHitFinder::hitCenter
inherited

Definition at line 36 of file ICandidateHitFinder.h.

float reco_tool::ICandidateHitFinder::hitHeight
inherited

Definition at line 38 of file ICandidateHitFinder.h.

float reco_tool::ICandidateHitFinder::hitSigma
inherited

Definition at line 37 of file ICandidateHitFinder.h.

float reco_tool::ICandidateHitFinder::maxDerivative
inherited

Definition at line 34 of file ICandidateHitFinder.h.

size_t reco_tool::ICandidateHitFinder::maxTick
inherited

Definition at line 32 of file ICandidateHitFinder.h.

float reco_tool::ICandidateHitFinder::minDerivative
inherited

Definition at line 35 of file ICandidateHitFinder.h.

size_t reco_tool::ICandidateHitFinder::minTick
inherited

Definition at line 33 of file ICandidateHitFinder.h.

size_t reco_tool::ICandidateHitFinder::stopTick
inherited

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