LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
trkf::FeatureTracker Class Reference
Inheritance diagram for trkf::FeatureTracker:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Types

using ModuleType = EDProducer
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 FeatureTracker (fhicl::ParameterSet const &pset)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
void fillProductDescriptions ()
 
void registerProducts (ProductDescriptions &productsToRegister)
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
std::unique_ptr< Worker > makeWorker (WorkerParams const &wp)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Protected Member Functions

ConsumesCollector & consumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Private Member Functions

void produce (art::Event &evt) override
 
void GetProjectedEnds (detinfo::DetectorPropertiesData const &detProp, geo::Point_t const &xyz, std::vector< double > &uvw, std::vector< double > &t)
 
std::map< int, std::vector< double > > ExtractEndPointTimes (std::vector< recob::EndPoint2D > EndPoints)
 
std::vector< recob::SpacePointGet3DFeaturePoints (detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, std::vector< recob::EndPoint2D > const &EndPoints, art::PtrVector< recob::Hit > const &Hits)
 
std::vector< recob::SeedGetValidLines (detinfo::DetectorPropertiesData const &detProp, std::vector< recob::SpacePoint > &sps, bool ApplyFilter=true)
 
void RemoveDuplicatePaths (std::vector< recob::Seed > &Seeds, std::vector< int > &ConnectionPoint1, std::vector< int > &ConnectionPoint2)
 

Private Attributes

trkf::SpacePointAlg fSP
 
corner::CornerFinderAlg fCorner
 
std::string fHitModuleLabel
 
std::string fCalDataModuleLabel
 
double fLineIntFraction
 
double fLineIntThreshold
 
std::map< int, std::vector< double > > fEndPointTimes
 
art::ServiceHandle< geo::Geometry const > fGeometryHandle
 

Detailed Description

Definition at line 34 of file FeatureTracker_module.cc.

Member Typedef Documentation

Definition at line 17 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::detail::Producer::Table = Modifier::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 26 of file Producer.h.

Constructor & Destructor Documentation

trkf::FeatureTracker::FeatureTracker ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 76 of file FeatureTracker_module.cc.

References fCalDataModuleLabel, fCorner, fHitModuleLabel, fLineIntFraction, fLineIntThreshold, and fSP.

77  : EDProducer{pset}
78  , fSP(pset.get<fhicl::ParameterSet>("SpacepointPset"))
79  , fCorner(pset.get<fhicl::ParameterSet>("CornerPset"))
80  , fHitModuleLabel{pset.get<std::string>("HitModuleLabel")}
81  , fCalDataModuleLabel{pset.get<std::string>("CornerPset.CalDataModuleLabel")}
82  , fLineIntFraction{pset.get<double>("LineIntFraction")}
83  , fLineIntThreshold{pset.get<double>("LineIntThreshold")}
84  {
85  produces<std::vector<recob::Seed>>();
86  }
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.cc:6
trkf::SpacePointAlg fSP
corner::CornerFinderAlg fCorner

Member Function Documentation

template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::consumes ( InputTag const &  tag)
protectedinherited

Definition at line 61 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumes().

62  {
63  return collector_.consumes<T, BT>(tag);
64  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ProductToken< T > consumes(InputTag const &)
ConsumesCollector & art::ModuleBase::consumesCollector ( )
protectedinherited

Definition at line 57 of file ModuleBase.cc.

References art::ModuleBase::collector_.

58  {
59  return collector_;
60  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::consumesMany ( )
protectedinherited

Definition at line 75 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesMany().

76  {
77  collector_.consumesMany<T, BT>();
78  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::consumesView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::consumesView ( InputTag const &  tag)
inherited

Definition at line 68 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesView().

69  {
70  return collector_.consumesView<T, BT>(tag);
71  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > consumesView(InputTag const &)
void art::detail::Producer::doBeginJob ( SharedResources const &  resources)
inherited

Definition at line 22 of file Producer.cc.

References art::detail::Producer::beginJobWithFrame(), and art::detail::Producer::setupQueues().

23  {
24  setupQueues(resources);
25  ProcessingFrame const frame{ScheduleID{}};
26  beginJobWithFrame(frame);
27  }
virtual void setupQueues(SharedResources const &)=0
virtual void beginJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Producer::doBeginRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 65 of file Producer.cc.

References art::detail::Producer::beginRunWithFrame(), art::RangeSet::forRun(), art::RunPrincipal::makeRun(), r, art::RunPrincipal::runID(), and art::ModuleContext::scheduleID().

66  {
67  auto r = rp.makeRun(mc, RangeSet::forRun(rp.runID()));
68  ProcessingFrame const frame{mc.scheduleID()};
69  beginRunWithFrame(r, frame);
70  r.commitProducts();
71  return true;
72  }
TRandom r
Definition: spectrum.C:23
virtual void beginRunWithFrame(Run &, ProcessingFrame const &)=0
static RangeSet forRun(RunID)
Definition: RangeSet.cc:51
bool art::detail::Producer::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 85 of file Producer.cc.

References art::detail::Producer::beginSubRunWithFrame(), art::RangeSet::forSubRun(), art::SubRunPrincipal::makeSubRun(), art::ModuleContext::scheduleID(), and art::SubRunPrincipal::subRunID().

86  {
87  auto sr = srp.makeSubRun(mc, RangeSet::forSubRun(srp.subRunID()));
88  ProcessingFrame const frame{mc.scheduleID()};
89  beginSubRunWithFrame(sr, frame);
90  sr.commitProducts();
91  return true;
92  }
virtual void beginSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
static RangeSet forSubRun(SubRunID)
Definition: RangeSet.cc:57
void art::detail::Producer::doEndJob ( )
inherited

Definition at line 30 of file Producer.cc.

References art::detail::Producer::endJobWithFrame().

31  {
32  ProcessingFrame const frame{ScheduleID{}};
33  endJobWithFrame(frame);
34  }
virtual void endJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Producer::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 75 of file Producer.cc.

References art::detail::Producer::endRunWithFrame(), art::RunPrincipal::makeRun(), r, art::ModuleContext::scheduleID(), and art::Principal::seenRanges().

76  {
77  auto r = rp.makeRun(mc, rp.seenRanges());
78  ProcessingFrame const frame{mc.scheduleID()};
79  endRunWithFrame(r, frame);
80  r.commitProducts();
81  return true;
82  }
TRandom r
Definition: spectrum.C:23
virtual void endRunWithFrame(Run &, ProcessingFrame const &)=0
bool art::detail::Producer::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 95 of file Producer.cc.

References art::detail::Producer::endSubRunWithFrame(), art::SubRunPrincipal::makeSubRun(), art::ModuleContext::scheduleID(), and art::Principal::seenRanges().

96  {
97  auto sr = srp.makeSubRun(mc, srp.seenRanges());
98  ProcessingFrame const frame{mc.scheduleID()};
99  endSubRunWithFrame(sr, frame);
100  sr.commitProducts();
101  return true;
102  }
virtual void endSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
bool art::detail::Producer::doEvent ( EventPrincipal ep,
ModuleContext const &  mc,
std::atomic< std::size_t > &  counts_run,
std::atomic< std::size_t > &  counts_passed,
std::atomic< std::size_t > &  counts_failed 
)
inherited

Definition at line 105 of file Producer.cc.

References art::detail::Producer::checkPutProducts_, e, art::EventPrincipal::makeEvent(), art::detail::Producer::produceWithFrame(), and art::ModuleContext::scheduleID().

110  {
111  auto e = ep.makeEvent(mc);
112  ++counts_run;
113  ProcessingFrame const frame{mc.scheduleID()};
114  produceWithFrame(e, frame);
115  e.commitProducts(checkPutProducts_, &expectedProducts<InEvent>());
116  ++counts_passed;
117  return true;
118  }
bool const checkPutProducts_
Definition: Producer.h:70
Float_t e
Definition: plot.C:35
virtual void produceWithFrame(Event &, ProcessingFrame const &)=0
void art::detail::Producer::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited

Definition at line 44 of file Producer.cc.

References art::detail::Producer::respondToCloseInputFileWithFrame().

45  {
46  ProcessingFrame const frame{ScheduleID{}};
48  }
virtual void respondToCloseInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToCloseOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 58 of file Producer.cc.

References art::detail::Producer::respondToCloseOutputFilesWithFrame().

59  {
60  ProcessingFrame const frame{ScheduleID{}};
62  }
virtual void respondToCloseOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToOpenInputFile ( FileBlock const &  fb)
inherited

Definition at line 37 of file Producer.cc.

References art::detail::Producer::respondToOpenInputFileWithFrame().

38  {
39  ProcessingFrame const frame{ScheduleID{}};
41  }
virtual void respondToOpenInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToOpenOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 51 of file Producer.cc.

References art::detail::Producer::respondToOpenOutputFilesWithFrame().

52  {
53  ProcessingFrame const frame{ScheduleID{}};
55  }
virtual void respondToOpenOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
std::map< int, std::vector< double > > trkf::FeatureTracker::ExtractEndPointTimes ( std::vector< recob::EndPoint2D EndPoints)
private

Definition at line 130 of file FeatureTracker_module.cc.

Referenced by produce().

132  {
133  std::map<int, std::vector<double>> EndPointTimesInPlane;
134  for (size_t i = 0; i != EndPoints.size(); ++i) {
135  EndPointTimesInPlane[EndPoints.at(i).View()].push_back(EndPoints.at(i).DriftTime());
136  }
137 
138  for (std::map<int, std::vector<double>>::iterator itEpTime = EndPointTimesInPlane.begin();
139  itEpTime != EndPointTimesInPlane.end();
140  ++itEpTime) {
141  std::sort(itEpTime->second.begin(), itEpTime->second.end());
142  }
143  return EndPointTimesInPlane;
144  }
void art::Modifier::fillProductDescriptions ( )
inherited

Definition at line 10 of file Modifier.cc.

References art::ProductRegistryHelper::fillDescriptions(), and art::ModuleBase::moduleDescription().

11  {
13  }
void fillDescriptions(ModuleDescription const &md)
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
std::vector< recob::SpacePoint > trkf::FeatureTracker::Get3DFeaturePoints ( detinfo::DetectorClocksData const &  clockData,
detinfo::DetectorPropertiesData const &  detProp,
std::vector< recob::EndPoint2D > const &  EndPoints,
art::PtrVector< recob::Hit > const &  Hits 
)
private

Definition at line 296 of file FeatureTracker_module.cc.

References art::PtrVector< T >::begin(), detinfo::DetectorPropertiesData::ConvertXToTicks(), DEFINE_ART_MODULE, art::PtrVector< T >::end(), fEndPointTimes, fSP, trkf::SpacePointAlg::makeSpacePoints(), and art::PtrVector< T >::push_back().

Referenced by produce().

301  {
302 
303  art::PtrVector<recob::Hit> HitsForEndPoints;
304 
305  // Loop through the hits looking for the ones which match corners
306  for (std::vector<recob::EndPoint2D>::const_iterator itEP = EndPoints.begin();
307  itEP != EndPoints.end();
308  ++itEP) {
309  int EPMatchCount = 0;
310 
311  for (art::PtrVector<recob::Hit>::const_iterator itHit = Hits.begin(); itHit != Hits.end();
312  ++itHit) {
313 
314  if ((itEP->View() == (*itHit)->View()) &&
315  (itEP->WireID().Wire == (*itHit)->WireID().Wire)) {
316  HitsForEndPoints.push_back(*itHit);
317  EPMatchCount++;
318  }
319  }
320  }
321  std::vector<recob::SpacePoint> spts;
322  fSP.makeSpacePoints(clockData, detProp, HitsForEndPoints, spts);
323 
324  for (size_t i = 0; i != spts.size(); ++i) {
325  for (size_t p = 0; p != 3; ++p) {
326  double Closest = 100000;
327  double spt_t = detProp.ConvertXToTicks(spts.at(i).XYZ()[0], p, 0, 0);
328  for (size_t epTime = 0; epTime != fEndPointTimes[p].size(); ++epTime) {
329  if (fabs(fEndPointTimes[p].at(epTime) - spt_t) < Closest) {
330  Closest = fabs(fEndPointTimes[p].at(epTime) - spt_t);
331  }
332  }
333  }
334  }
335  return spts;
336  }
iterator begin()
Definition: PtrVector.h:217
trkf::SpacePointAlg fSP
intermediate_table::const_iterator const_iterator
typename data_t::const_iterator const_iterator
Definition: PtrVector.h:55
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:435
void makeSpacePoints(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const art::PtrVector< recob::Hit > &hits, std::vector< recob::SpacePoint > &spts) const
iterator end()
Definition: PtrVector.h:231
std::map< int, std::vector< double > > fEndPointTimes
std::array< std::vector< ProductInfo >, NumBranchTypes > const & art::ModuleBase::getConsumables ( ) const
inherited

Definition at line 43 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::getConsumables().

44  {
45  return collector_.getConsumables();
46  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables() const
void trkf::FeatureTracker::GetProjectedEnds ( detinfo::DetectorPropertiesData const &  detProp,
geo::Point_t const &  xyz,
std::vector< double > &  uvw,
std::vector< double > &  t 
)
private

Definition at line 275 of file FeatureTracker_module.cc.

References detinfo::DetectorPropertiesData::ConvertXToTicks(), geo::GeometryCore::NearestWireID(), geo::TPCGeo::Nplanes(), and geo::GeometryCore::TPC().

Referenced by GetValidLines().

279  {
281 
282  constexpr geo::TPCID tpcID{0, 0};
283  unsigned int NPlanes = geo->TPC(tpcID).Nplanes();
284 
285  uvw.resize(NPlanes);
286  t.resize(NPlanes);
287 
288  for (unsigned int plane = 0; plane != NPlanes; plane++) {
289  uvw[plane] = geo->NearestWireID(xyz, geo::PlaneID{tpcID, plane}).Wire;
290  t[plane] = detProp.ConvertXToTicks(xyz.X(), geo::PlaneID{tpcID, plane});
291  }
292  }
unsigned int Nplanes() const
Number of planes in this tpc.
Definition: TPCGeo.h:137
The data type to uniquely identify a Plane.
Definition: geo_types.h:463
TPCGeo const & TPC(TPCID const &tpcid=tpc_zero) const
Returns the specified TPC.
Definition: GeometryCore.h:722
The data type to uniquely identify a TPC.
Definition: geo_types.h:381
WireID NearestWireID(Point_t const &point, PlaneID const &planeid) const
Returns the ID of wire closest to position in the specified TPC.
Namespace collecting geometry-related classes utilities.
std::vector< recob::Seed > trkf::FeatureTracker::GetValidLines ( detinfo::DetectorPropertiesData const &  detProp,
std::vector< recob::SpacePoint > &  sps,
bool  ApplyFilter = true 
)
private

Definition at line 148 of file FeatureTracker_module.cc.

References fCorner, fLineIntFraction, fLineIntThreshold, GetProjectedEnds(), corner::CornerFinderAlg::GetWireDataHist(), corner::CornerFinderAlg::line_integral(), and RemoveDuplicatePaths().

Referenced by produce().

152  {
153  std::vector<recob::Seed> SeedsToReturn;
154 
155  std::vector<int> ConnectionPoint1;
156  std::vector<int> ConnectionPoint2;
157  std::map<int, std::vector<int>> SeedConnections;
158 
159  for (size_t i = 0; i != spts.size(); ++i) {
160  for (size_t j = 0; j != i; ++j) {
161 
162  auto const& xyz_i = spts[i].position();
163  auto const& xyz_j = spts[j].position();
164 
165  std::vector<double> t_i, t_j;
166  std::vector<double> uvw_i, uvw_j;
167 
168  GetProjectedEnds(detProp, xyz_i, uvw_i, t_i);
169  GetProjectedEnds(detProp, xyz_j, uvw_j, t_j);
170 
171  bool ThisLineGood = true;
172 
173  for (size_t p = 0; p != uvw_i.size(); ++p) {
174  TH2F const& RawHist = fCorner.GetWireDataHist(p);
175 
176  double lineint = fCorner.line_integral(
177  RawHist, uvw_i.at(p), t_i.at(p), uvw_j.at(p), t_j.at(p), fLineIntThreshold);
178 
179  if (lineint < fLineIntFraction) { ThisLineGood = false; }
180  }
181  if (ThisLineGood) {
182  double Err[3] = {};
183  double Pos[3] = {0.5 * (xyz_i.X() + xyz_j.X()),
184  0.5 * (xyz_i.Y() + xyz_j.Y()),
185  0.5 * (xyz_i.Z() + xyz_j.Z())};
186  double Dir[3] = {0.5 * (xyz_i.X() - xyz_j.X()),
187  0.5 * (xyz_i.Y() - xyz_j.Y()),
188  0.5 * (xyz_i.Z() - xyz_j.Z())};
189 
190  ConnectionPoint1.push_back(i);
191  ConnectionPoint2.push_back(j);
192 
193  SeedsToReturn.push_back(recob::Seed(Pos, Dir, Err, Err));
194  }
195  }
196  }
197 
198  if (ApplyFilter) {
199  RemoveDuplicatePaths(SeedsToReturn, ConnectionPoint1, ConnectionPoint2);
200  mf::LogInfo("FeatureTracker")
201  << "Seeds after filter " << SeedsToReturn.size() << " seeds" << std::endl;
202  }
203 
204  return SeedsToReturn;
205  }
void RemoveDuplicatePaths(std::vector< recob::Seed > &Seeds, std::vector< int > &ConnectionPoint1, std::vector< int > &ConnectionPoint2)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
TH2F const & GetWireDataHist(unsigned int) const
float line_integral(TH2F const &hist, int x1, float y1, int x2, float y2, float threshold) const
void GetProjectedEnds(detinfo::DetectorPropertiesData const &detProp, geo::Point_t const &xyz, std::vector< double > &uvw, std::vector< double > &t)
corner::CornerFinderAlg fCorner
std::unique_ptr< Worker > art::ModuleBase::makeWorker ( WorkerParams const &  wp)
inherited

Definition at line 37 of file ModuleBase.cc.

References art::ModuleBase::doMakeWorker(), and art::NumBranchTypes.

38  {
39  return doMakeWorker(wp);
40  }
virtual std::unique_ptr< Worker > doMakeWorker(WorkerParams const &wp)=0
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::mayConsume ( InputTag const &  tag)
protectedinherited

Definition at line 82 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsume().

83  {
84  return collector_.mayConsume<T, BT>(tag);
85  }
ProductToken< T > mayConsume(InputTag const &)
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::mayConsumeMany ( )
protectedinherited

Definition at line 96 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeMany().

97  {
98  collector_.mayConsumeMany<T, BT>();
99  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::mayConsumeView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::mayConsumeView ( InputTag const &  tag)
inherited

Definition at line 89 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeView().

90  {
91  return collector_.mayConsumeView<T, BT>(tag);
92  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > mayConsumeView(InputTag const &)
ModuleDescription const & art::ModuleBase::moduleDescription ( ) const
inherited

Definition at line 13 of file ModuleBase.cc.

References art::errors::LogicError.

Referenced by art::OutputModule::doRespondToOpenInputFile(), art::OutputModule::doWriteEvent(), art::Modifier::fillProductDescriptions(), art::OutputModule::makePlugins_(), art::OutputWorker::OutputWorker(), reco::shower::LArPandoraModularShowerCreation::produce(), art::Modifier::registerProducts(), and art::OutputModule::registerProducts().

14  {
15  if (md_.has_value()) {
16  return *md_;
17  }
18 
20  "There was an error while calling moduleDescription().\n"}
21  << "The moduleDescription() base-class member function cannot be called\n"
22  "during module construction. To determine which module is "
23  "responsible\n"
24  "for calling it, find the '<module type>:<module "
25  "label>@Construction'\n"
26  "tag in the message prefix above. Please contact artists@fnal.gov\n"
27  "for guidance.\n";
28  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
void trkf::FeatureTracker::produce ( art::Event evt)
overrideprivatevirtual

Implements art::EDProducer.

Definition at line 88 of file FeatureTracker_module.cc.

References ExtractEndPointTimes(), fCalDataModuleLabel, fCorner, fEndPointTimes, fGeometryHandle, fHitModuleLabel, Get3DFeaturePoints(), corner::CornerFinderAlg::get_feature_points(), art::ProductRetriever::getByLabel(), GetValidLines(), corner::CornerFinderAlg::GrabWires(), art::PtrVector< T >::push_back(), art::Event::put(), and tca::seeds.

89  {
90 
91  // Extract hits PtrVector from event
93  evt.getByLabel(fHitModuleLabel, hith);
94 
96  for (unsigned int i = 0; i < hith->size(); ++i) {
97  art::Ptr<recob::Hit> prod(hith, i);
98  hitvec.push_back(prod);
99  }
100 
101  //We need to grab out the wires.
103  evt.getByLabel(fCalDataModuleLabel, wireHandle);
104  std::vector<recob::Wire> const& wireVec(*wireHandle);
105 
106  //First, have it process the wires.
107  fCorner.GrabWires(wireVec, *fGeometryHandle);
108 
109  std::vector<recob::EndPoint2D> EndPoints;
111 
113 
114  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
115  auto const detProp =
117  std::vector<recob::SpacePoint> sps = Get3DFeaturePoints(clockData, detProp, EndPoints, hitvec);
118  std::vector<recob::Seed> SeedsToStore = GetValidLines(detProp, sps, true);
119 
120  std::unique_ptr<std::vector<recob::Seed>> seeds(new std::vector<recob::Seed>);
121 
122  for (size_t i = 0; i != SeedsToStore.size(); ++i)
123  seeds->push_back(SeedsToStore.at(i));
124 
125  evt.put(std::move(seeds));
126  }
std::vector< recob::SpacePoint > Get3DFeaturePoints(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, std::vector< recob::EndPoint2D > const &EndPoints, art::PtrVector< recob::Hit > const &Hits)
void get_feature_points(std::vector< recob::EndPoint2D > &, geo::Geometry const &)
std::map< int, std::vector< double > > ExtractEndPointTimes(std::vector< recob::EndPoint2D > EndPoints)
art::ServiceHandle< geo::Geometry const > fGeometryHandle
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: Event.h:77
void GrabWires(std::vector< recob::Wire > const &wireVec, geo::Geometry const &)
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:435
std::map< int, std::vector< double > > fEndPointTimes
std::vector< TrajPoint > seeds
Definition: DataStructs.cxx:14
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
std::vector< recob::Seed > GetValidLines(detinfo::DetectorPropertiesData const &detProp, std::vector< recob::SpacePoint > &sps, bool ApplyFilter=true)
corner::CornerFinderAlg fCorner
void art::Modifier::registerProducts ( ProductDescriptions productsToRegister)
inherited

Definition at line 16 of file Modifier.cc.

References art::ModuleBase::moduleDescription(), and art::ProductRegistryHelper::registerProducts().

17  {
18  ProductRegistryHelper::registerProducts(productsToRegister,
20  }
void registerProducts(ProductDescriptions &productsToRegister, ModuleDescription const &md)
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
void trkf::FeatureTracker::RemoveDuplicatePaths ( std::vector< recob::Seed > &  Seeds,
std::vector< int > &  ConnectionPoint1,
std::vector< int > &  ConnectionPoint2 
)
private

Definition at line 209 of file FeatureTracker_module.cc.

Referenced by GetValidLines().

212  {
213 
214  std::map<int, bool> MarkedForRemoval;
215 
216  std::map<int, std::vector<int>> SeedsSharingPoint;
217  for (size_t i = 0; i != Seeds.size(); ++i) {
218  SeedsSharingPoint[ConnectionPoint1[i]].push_back(i);
219  SeedsSharingPoint[ConnectionPoint2[i]].push_back(i);
220  }
221 
222  for (size_t s = 0; s != Seeds.size(); ++s) {
223 
224  int StartPt = ConnectionPoint1.at(s);
225  int EndPt = ConnectionPoint2.at(s);
226  int MidPt = -1;
227 
228  for (size_t SeedsWithThisStart = 0; SeedsWithThisStart != SeedsSharingPoint[StartPt].size();
229  SeedsWithThisStart++) {
230  int i = SeedsSharingPoint[StartPt].at(SeedsWithThisStart);
231  if (ConnectionPoint1.at(i) == StartPt)
232  MidPt = ConnectionPoint2.at(i);
233  else if (ConnectionPoint2.at(i) == StartPt)
234  MidPt = ConnectionPoint1.at(i);
235 
236  for (size_t SeedsWithThisMid = 0; SeedsWithThisMid != SeedsSharingPoint[MidPt].size();
237  SeedsWithThisMid++) {
238  int j = SeedsSharingPoint[MidPt].at(SeedsWithThisMid);
239  if ((ConnectionPoint1.at(j) == EndPt) || (ConnectionPoint2.at(j) == EndPt)) {
240 
241  double Lengthi = Seeds.at(i).GetLength();
242  double Lengthj = Seeds.at(j).GetLength();
243  double Lengths = Seeds.at(s).GetLength();
244 
245  if ((Lengths > Lengthi) && (Lengths > Lengthj)) {
246  MarkedForRemoval[i] = true;
247  MarkedForRemoval[j] = true;
248  }
249 
250  if ((Lengthi > Lengths) && (Lengthi > Lengthj)) {
251  MarkedForRemoval[s] = true;
252  MarkedForRemoval[j] = true;
253  }
254  if ((Lengthj > Lengthi) && (Lengthj > Lengths)) {
255  MarkedForRemoval[s] = true;
256  MarkedForRemoval[i] = true;
257  }
258  }
259  }
260  }
261  }
262  for (std::map<int, bool>::reverse_iterator itrem = MarkedForRemoval.rbegin();
263  itrem != MarkedForRemoval.rend();
264  ++itrem) {
265  if (itrem->second == true) {
266  Seeds.erase(Seeds.begin() + itrem->first);
267  ConnectionPoint1.erase(ConnectionPoint1.begin() + itrem->first);
268  ConnectionPoint2.erase(ConnectionPoint2.begin() + itrem->first);
269  }
270  }
271  }
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  md)
inherited

Definition at line 31 of file ModuleBase.cc.

References art::ModuleBase::md_.

32  {
33  md_ = md;
34  }
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited

Definition at line 49 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::sortConsumables().

50  {
51  // Now that we know we have seen all the consumes declarations,
52  // sort the results for fast lookup later.
53  collector_.sortConsumables(current_process_name);
54  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
void sortConsumables(std::string const &current_process_name)

Member Data Documentation

std::string trkf::FeatureTracker::fCalDataModuleLabel
private

Definition at line 67 of file FeatureTracker_module.cc.

Referenced by FeatureTracker(), and produce().

corner::CornerFinderAlg trkf::FeatureTracker::fCorner
private

Definition at line 64 of file FeatureTracker_module.cc.

Referenced by FeatureTracker(), GetValidLines(), and produce().

std::map<int, std::vector<double> > trkf::FeatureTracker::fEndPointTimes
private

Definition at line 72 of file FeatureTracker_module.cc.

Referenced by Get3DFeaturePoints(), and produce().

art::ServiceHandle<geo::Geometry const> trkf::FeatureTracker::fGeometryHandle
private

Definition at line 73 of file FeatureTracker_module.cc.

Referenced by produce().

std::string trkf::FeatureTracker::fHitModuleLabel
private

Definition at line 66 of file FeatureTracker_module.cc.

Referenced by FeatureTracker(), and produce().

double trkf::FeatureTracker::fLineIntFraction
private

Definition at line 69 of file FeatureTracker_module.cc.

Referenced by FeatureTracker(), and GetValidLines().

double trkf::FeatureTracker::fLineIntThreshold
private

Definition at line 70 of file FeatureTracker_module.cc.

Referenced by FeatureTracker(), and GetValidLines().

trkf::SpacePointAlg trkf::FeatureTracker::fSP
private

Definition at line 63 of file FeatureTracker_module.cc.

Referenced by FeatureTracker(), and Get3DFeaturePoints().


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