LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
trkf::KHitContainer Class Referenceabstract

#include "KHitContainer.h"

Inheritance diagram for trkf::KHitContainer:
trkf::KHitContainerWireLine trkf::KHitContainerWireX

Public Member Functions

virtual ~KHitContainer ()=default
 
virtual void fill (detinfo::DetectorPropertiesData const &clock_data, const art::PtrVector< recob::Hit > &hits, int only_plane)=0
 
const std::list< KHitGroup > & getSorted () const
 
const std::list< KHitGroup > & getUnsorted () const
 
const std::list< KHitGroup > & getUnused () const
 
std::list< KHitGroup > & getSorted ()
 Sorted list. More...
 
std::list< KHitGroup > & getUnsorted ()
 Unsorted list. More...
 
std::list< KHitGroup > & getUnused ()
 Unused list. More...
 
void clear ()
 Clear all lists. More...
 
void reset ()
 Move all objects to unsorted list (from sorted and unused lists). More...
 
void sort (const KTrack &trk, bool addUnsorted, const Propagator &prop, Propagator::PropDirection dir=Propagator::UNKNOWN)
 (Re)sort objects in unsorted and sorted lists. More...
 
unsigned int getPreferredPlane () const
 Return the plane with the most KHitGroups in the unsorted list. More...
 

Private Attributes

std::list< KHitGroupfSorted
 Sorted KHitGroup objects. More...
 
std::list< KHitGroupfUnsorted
 Unsorted KHitGroup objects. More...
 
std::list< KHitGroupfUnused
 Unused KHitGroup objects. More...
 

Detailed Description

Definition at line 61 of file KHitContainer.h.

Constructor & Destructor Documentation

virtual trkf::KHitContainer::~KHitContainer ( )
virtualdefault

Member Function Documentation

void trkf::KHitContainer::clear ( )

Clear all lists.

Definition at line 20 of file KHitContainer.cxx.

References fSorted, fUnsorted, and fUnused.

21  {
22  fSorted.clear();
23  fUnsorted.clear();
24  fUnused.clear();
25  }
std::list< KHitGroup > fUnused
Unused KHitGroup objects.
Definition: KHitContainer.h:99
std::list< KHitGroup > fUnsorted
Unsorted KHitGroup objects.
Definition: KHitContainer.h:98
std::list< KHitGroup > fSorted
Sorted KHitGroup objects.
Definition: KHitContainer.h:97
virtual void trkf::KHitContainer::fill ( detinfo::DetectorPropertiesData const &  clock_data,
const art::PtrVector< recob::Hit > &  hits,
int  only_plane 
)
pure virtual
unsigned int trkf::KHitContainer::getPreferredPlane ( ) const

Return the plane with the most KHitGroups in the unsorted list.

Definition at line 94 of file KHitContainer.cxx.

References fUnsorted, and trkf::KHitGroup::getPlane().

95  {
96  // Count hits in each plane.
97 
98  std::vector<unsigned int> planehits(3, 0);
99 
100  // Loop over KHitGroups in the unsorted list.
101 
102  for (std::list<KHitGroup>::const_iterator igr = fUnsorted.begin(); igr != fUnsorted.end();
103  ++igr) {
104 
105  const KHitGroup& gr = *igr;
106 
107  // Get plane of this KHitGroup.
108 
109  int plane = gr.getPlane();
110  ++planehits.at(plane);
111  }
112 
113  // Figure out which plane has the most hits.
114 
115  unsigned int prefplane = 0;
116  for (unsigned int i = 0; i < planehits.size(); ++i) {
117  if (planehits[i] >= planehits[prefplane]) prefplane = i;
118  }
119  return prefplane;
120  }
intermediate_table::const_iterator const_iterator
std::list< KHitGroup > fUnsorted
Unsorted KHitGroup objects.
Definition: KHitContainer.h:98
const std::list<KHitGroup>& trkf::KHitContainer::getSorted ( ) const
inline

Definition at line 69 of file KHitContainer.h.

Referenced by trkf::KalmanFilterAlg::buildTrack(), and trkf::KalmanFilterAlg::extendTrack().

69 { return fSorted; }
std::list< KHitGroup > fSorted
Sorted KHitGroup objects.
Definition: KHitContainer.h:97
std::list<KHitGroup>& trkf::KHitContainer::getSorted ( )
inline

Sorted list.

Definition at line 75 of file KHitContainer.h.

const std::list<KHitGroup>& trkf::KHitContainer::getUnsorted ( ) const
inline

Definition at line 70 of file KHitContainer.h.

Referenced by trkf::KalmanFilterAlg::buildTrack(), trkf::KalmanFilterAlg::extendTrack(), trkf::KHitContainerWireLine::fill(), and trkf::KHitContainerWireX::fill().

70 { return fUnsorted; }
std::list< KHitGroup > fUnsorted
Unsorted KHitGroup objects.
Definition: KHitContainer.h:98
std::list<KHitGroup>& trkf::KHitContainer::getUnsorted ( )
inline

Unsorted list.

Definition at line 76 of file KHitContainer.h.

const std::list<KHitGroup>& trkf::KHitContainer::getUnused ( ) const
inline

Definition at line 71 of file KHitContainer.h.

Referenced by trkf::KalmanFilterAlg::buildTrack(), and trkf::KalmanFilterAlg::extendTrack().

71 { return fUnused; }
std::list< KHitGroup > fUnused
Unused KHitGroup objects.
Definition: KHitContainer.h:99
std::list<KHitGroup>& trkf::KHitContainer::getUnused ( )
inline

Unused list.

Definition at line 77 of file KHitContainer.h.

References clear(), dir, and lar_content::UNKNOWN.

void trkf::KHitContainer::reset ( )

Move all objects to unsorted list (from sorted and unused lists).

Definition at line 28 of file KHitContainer.cxx.

References fSorted, fUnsorted, and fUnused.

29  {
30  fUnsorted.splice(fUnsorted.end(), fSorted);
31  fUnsorted.splice(fUnsorted.end(), fUnused);
32  }
std::list< KHitGroup > fUnused
Unused KHitGroup objects.
Definition: KHitContainer.h:99
std::list< KHitGroup > fUnsorted
Unsorted KHitGroup objects.
Definition: KHitContainer.h:98
std::list< KHitGroup > fSorted
Sorted KHitGroup objects.
Definition: KHitContainer.h:97
void trkf::KHitContainer::sort ( const KTrack trk,
bool  addUnsorted,
const Propagator prop,
Propagator::PropDirection  dir = Propagator::UNKNOWN 
)

(Re)sort objects in unsorted and sorted lists.

(Re)sort objects in unsorted and sorted lists.

Arguments:

trk - Track to be propagated. addUnsorted - If true, include unsorted objects in sort. prop - Propagator. dir - Propagation direction.

Definition at line 43 of file KHitContainer.cxx.

References larg4::dist(), fSorted, fUnsorted, trkf::KHitGroup::getSurface(), trkf::KHitGroup::setPath(), and trkf::Propagator::vec_prop().

Referenced by trkf::KalmanFilterAlg::buildTrack(), and trkf::KalmanFilterAlg::extendTrack().

47  {
48  // Maybe transfer all objects in unsorted list to the sorted list.
49 
50  if (addUnsorted) fSorted.splice(fSorted.end(), fUnsorted);
51 
52  // Loop over objects in sorted list.
53 
54  for (std::list<KHitGroup>::iterator igr = fSorted.begin(); igr != fSorted.end();) {
55 
56  KHitGroup& gr = *igr;
57 
58  // Get destination surface.
59 
60  const std::shared_ptr<const Surface>& psurf = gr.getSurface();
61 
62  // Make a fresh copy of the track and propagate it to
63  // the destination surface.
64 
65  KTrack trkp = trk;
66  std::optional<double> dist = prop.vec_prop(trkp, psurf, dir, false, 0, 0);
67  if (!dist) {
68 
69  // If propagation failed, reset the path flag for this surface
70  // and move the KHitGroup to the unsorted list. Be careful to
71  // keep the list iterator valid.
72 
73  gr.setPath(false, 0.);
75  ++igr;
76  fUnsorted.splice(fUnsorted.end(), fSorted, it);
77  }
78  else {
79 
80  // Otherwise (if propagation succeeded), set the path distance
81  // and advance the iterator to the next KHitGroup.
82 
83  gr.setPath(true, *dist);
84  ++igr;
85  }
86  }
87 
88  // Finally, sort the sorted list in order of path distance.
89 
90  fSorted.sort();
91  }
intermediate_table::iterator iterator
std::list< KHitGroup > fUnsorted
Unsorted KHitGroup objects.
Definition: KHitContainer.h:98
TDirectory * dir
Definition: macro.C:5
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
std::list< KHitGroup > fSorted
Sorted KHitGroup objects.
Definition: KHitContainer.h:97

Member Data Documentation

std::list<KHitGroup> trkf::KHitContainer::fSorted
private

Sorted KHitGroup objects.

Definition at line 97 of file KHitContainer.h.

Referenced by clear(), reset(), and sort().

std::list<KHitGroup> trkf::KHitContainer::fUnsorted
private

Unsorted KHitGroup objects.

Definition at line 98 of file KHitContainer.h.

Referenced by clear(), getPreferredPlane(), reset(), and sort().

std::list<KHitGroup> trkf::KHitContainer::fUnused
private

Unused KHitGroup objects.

Definition at line 99 of file KHitContainer.h.

Referenced by clear(), and reset().


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