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

24  {
25  fSorted.clear();
26  fUnsorted.clear();
27  fUnused.clear();
28  }
std::list< KHitGroup > fUnused
Unused KHitGroup objects.
std::list< KHitGroup > fUnsorted
Unsorted KHitGroup objects.
std::list< KHitGroup > fSorted
Sorted KHitGroup objects.
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 100 of file KHitContainer.cxx.

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

Definition at line 70 of file KHitContainer.h.

71  {
72  return fSorted;
73  }
std::list< KHitGroup > fSorted
Sorted KHitGroup objects.
std::list<KHitGroup>& trkf::KHitContainer::getSorted ( )
inline

Sorted list.

Definition at line 88 of file KHitContainer.h.

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

Definition at line 75 of file KHitContainer.h.

76  {
77  return fUnsorted;
78  }
std::list< KHitGroup > fUnsorted
Unsorted KHitGroup objects.
std::list<KHitGroup>& trkf::KHitContainer::getUnsorted ( )
inline

Unsorted list.

Definition at line 93 of file KHitContainer.h.

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

Definition at line 80 of file KHitContainer.h.

81  {
82  return fUnused;
83  }
std::list< KHitGroup > fUnused
Unused KHitGroup objects.
std::list<KHitGroup>& trkf::KHitContainer::getUnused ( )
inline

Unused list.

Definition at line 98 of file KHitContainer.h.

void trkf::KHitContainer::reset ( )

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

Definition at line 32 of file KHitContainer.cxx.

33  {
34  fUnsorted.splice(fUnsorted.end(), fSorted);
35  fUnsorted.splice(fUnsorted.end(), fUnused);
36  }
std::list< KHitGroup > fUnused
Unused KHitGroup objects.
std::list< KHitGroup > fUnsorted
Unsorted KHitGroup objects.
std::list< KHitGroup > fSorted
Sorted KHitGroup objects.
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 48 of file KHitContainer.cxx.

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

Member Data Documentation

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

Sorted KHitGroup objects.

Definition at line 121 of file KHitContainer.h.

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

Unsorted KHitGroup objects.

Definition at line 122 of file KHitContainer.h.

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

Unused KHitGroup objects.

Definition at line 123 of file KHitContainer.h.


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