LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
reco3d::IntersectionCache Class Reference

Public Member Functions

 IntersectionCache (geo::WireReadoutGeom const *cmAlg, geo::TPCID tpc)
 
std::optional< geo::WireIDIntersection > const & operator() (raw::ChannelID_t a, raw::ChannelID_t b)
 

Private Types

using key_t = std::pair< raw::ChannelID_t, raw::ChannelID_t >
 

Private Member Functions

std::optional< geo::WireIDIntersectionISect (raw::ChannelID_t chanA, raw::ChannelID_t chanB) const
 

Private Attributes

const geo::WireReadoutGeomwireReadoutGeom
 
std::map< key_t, std::optional< geo::WireIDIntersection > > fPtMap
 
geo::TPCID fTPC
 

Detailed Description

Definition at line 73 of file TripletFinder.cxx.

Member Typedef Documentation

Definition at line 107 of file TripletFinder.cxx.

Constructor & Destructor Documentation

reco3d::IntersectionCache::IntersectionCache ( geo::WireReadoutGeom const *  cmAlg,
geo::TPCID  tpc 
)
inline

Definition at line 75 of file TripletFinder.cxx.

76  : wireReadoutGeom{cmAlg}, fTPC(tpc)
77  {}
const geo::WireReadoutGeom * wireReadoutGeom

Member Function Documentation

std::optional<geo::WireIDIntersection> reco3d::IntersectionCache::ISect ( raw::ChannelID_t  chanA,
raw::ChannelID_t  chanB 
) const
inlineprivate

Definition at line 90 of file TripletFinder.cxx.

References geo::WireReadoutGeom::ChannelToWire(), pt, geo::WireReadoutGeom::WireIDsIntersect(), and reco3d::TripletFinder::wireReadoutGeom.

92  {
93  for (geo::WireID awire : wireReadoutGeom->ChannelToWire(chanA)) {
94  if (geo::TPCID(awire) != fTPC) continue;
95  for (geo::WireID bwire : wireReadoutGeom->ChannelToWire(chanB)) {
96  if (geo::TPCID(bwire) != fTPC) continue;
97 
98  if (auto pt = wireReadoutGeom->WireIDsIntersect(awire, bwire)) return pt;
99  }
100  }
101 
102  return std::nullopt;
103  }
TMarker * pt
Definition: egs.C:25
const geo::WireReadoutGeom * wireReadoutGeom
The data type to uniquely identify a TPC.
Definition: geo_types.h:306
bool WireIDsIntersect(WireID const &wid1, WireID const &wid2, Point_t &intersection) const
Computes the intersection between two wires.
virtual std::vector< WireID > ChannelToWire(raw::ChannelID_t channel) const =0
std::optional<geo::WireIDIntersection> const& reco3d::IntersectionCache::operator() ( raw::ChannelID_t  a,
raw::ChannelID_t  b 
)
inline

Definition at line 79 of file TripletFinder.cxx.

80  {
81  auto const key = std::make_pair(a, b);
82 
83  auto it = fPtMap.find(key);
84  if (it != fPtMap.end()) { return it->second; }
85 
86  return fPtMap.try_emplace(key, ISect(a, b)).first->second;
87  }
std::optional< geo::WireIDIntersection > ISect(raw::ChannelID_t chanA, raw::ChannelID_t chanB) const
std::map< key_t, std::optional< geo::WireIDIntersection > > fPtMap

Member Data Documentation

std::map<key_t, std::optional<geo::WireIDIntersection> > reco3d::IntersectionCache::fPtMap
private

Definition at line 108 of file TripletFinder.cxx.

geo::TPCID reco3d::IntersectionCache::fTPC
private

Definition at line 110 of file TripletFinder.cxx.

const geo::WireReadoutGeom* reco3d::IntersectionCache::wireReadoutGeom
private

Definition at line 105 of file TripletFinder.cxx.


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