LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
trkf::KHitContainer Class Referenceabstract

#include "KHitContainer.h"

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

Public Member Functions

 KHitContainer ()
 Default constructor. More...
 
virtual ~KHitContainer ()
 Destructor. More...
 
virtual void fill (const art::PtrVector< recob::Hit > &hits, int only_plane)=0
 
const std::list< KHitGroup > & getSorted () const
 Sorted list. More...
 
const std::list< KHitGroup > & getUnsorted () const
 Unsorted list. More...
 
const std::list< KHitGroup > & getUnused () const
 Unused list. More...
 
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 58 of file KHitContainer.h.

Constructor & Destructor Documentation

trkf::KHitContainer::KHitContainer ( )

Default constructor.

Default Constructor.

Definition at line 18 of file KHitContainer.cxx.

19  {}
trkf::KHitContainer::~KHitContainer ( )
virtual

Destructor.

Definition at line 22 of file KHitContainer.cxx.

23  {}

Member Function Documentation

void trkf::KHitContainer::clear ( )

Clear all lists.

Definition at line 29 of file KHitContainer.cxx.

References fSorted, fUnsorted, and fUnused.

Referenced by getUnused().

30  {
31  fSorted.clear();
32  fUnsorted.clear();
33  fUnused.clear();
34  }
std::list< KHitGroup > fUnused
Unused KHitGroup objects.
std::list< KHitGroup > fUnsorted
Unsorted KHitGroup objects.
Definition: KHitContainer.h:99
std::list< KHitGroup > fSorted
Sorted KHitGroup objects.
Definition: KHitContainer.h:98
virtual void trkf::KHitContainer::fill ( 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 107 of file KHitContainer.cxx.

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

Referenced by getUnused().

108  {
109  // Count hits in each plane.
110 
111  std::vector<unsigned int> planehits(3, 0);
112 
113  // Loop over KHitGroups in the unsorted list.
114 
116  igr != fUnsorted.end(); ++igr) {
117 
118  const KHitGroup& gr = *igr;
119 
120  // Get plane of this KHitGroup.
121 
122  int plane = gr.getPlane();
123  ++planehits.at(plane);
124  }
125 
126  // Figure out which plane has the most hits.
127 
128  unsigned int prefplane = 0;
129  for(unsigned int i=0; i<planehits.size(); ++i) {
130  if(planehits[i] >= planehits[prefplane])
131  prefplane = i;
132  }
133  return prefplane;
134  }
intermediate_table::const_iterator const_iterator
std::list< KHitGroup > fUnsorted
Unsorted KHitGroup objects.
Definition: KHitContainer.h:99
const std::list<KHitGroup>& trkf::KHitContainer::getSorted ( ) const
inline

Sorted list.

Definition at line 71 of file KHitContainer.h.

References fSorted.

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

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

Sorted list.

Definition at line 77 of file KHitContainer.h.

References fSorted.

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

Unsorted list.

Definition at line 78 of file KHitContainer.h.

References fUnsorted.

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

Unused list.

Definition at line 73 of file KHitContainer.h.

References fUnused.

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

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

Unused list.

Definition at line 79 of file KHitContainer.h.

References clear(), dir, fUnused, getPreferredPlane(), reset(), sort(), and trkf::Propagator::UNKNOWN.

void trkf::KHitContainer::reset ( )

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

Definition at line 37 of file KHitContainer.cxx.

References fSorted, fUnsorted, and fUnused.

Referenced by getUnused().

38  {
39  fUnsorted.splice(fUnsorted.end(), fSorted);
40  fUnsorted.splice(fUnsorted.end(), fUnused);
41  }
std::list< KHitGroup > fUnused
Unused KHitGroup objects.
std::list< KHitGroup > fUnsorted
Unsorted KHitGroup objects.
Definition: KHitContainer.h:99
std::list< KHitGroup > fSorted
Sorted KHitGroup objects.
Definition: KHitContainer.h:98
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 52 of file KHitContainer.cxx.

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

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

55  {
56  if(!prop)
57  throw cet::exception("KHitContainer") << __func__ << ": no propagator" << "\n";
58 
59  // Maybe transfer all objects in unsorted list to the sorted list.
60 
61  if(addUnsorted)
62  fSorted.splice(fSorted.end(), fUnsorted);
63 
64  // Loop over objects in sorted list.
65 
66  for(std::list<KHitGroup>::iterator igr = fSorted.begin();
67  igr != fSorted.end();) {
68 
69  KHitGroup& gr = *igr;
70 
71  // Get destination surface.
72 
73  const std::shared_ptr<const Surface>& psurf = gr.getSurface();
74 
75  // Make a fresh copy of the track and propagate it to
76  // the destination surface.
77 
78  KTrack trkp = trk;
79  boost::optional<double> dist = prop->vec_prop(trkp, psurf, dir, false, 0, 0);
80  if(!dist) {
81 
82  // If propagation failed, reset the path flag for this surface
83  // and move the KHitGroup to the unsorted list. Be careful to
84  // keep the list iterator valid.
85 
86  gr.setPath(false, 0.);
88  ++igr;
89  fUnsorted.splice(fUnsorted.end(), fSorted, it);
90  }
91  else {
92 
93  // Otherwise (if propagation succeeded), set the path distance
94  // and advance the iterator to the next KHitGroup.
95 
96  gr.setPath(true, *dist);
97  ++igr;
98  }
99  }
100 
101  // Finally, sort the sorted list in order of path distance.
102 
103  fSorted.sort();
104  }
intermediate_table::iterator iterator
std::list< KHitGroup > fUnsorted
Unsorted KHitGroup objects.
Definition: KHitContainer.h:99
TDirectory * dir
Definition: macro.C:5
std::list< KHitGroup > fSorted
Sorted KHitGroup objects.
Definition: KHitContainer.h:98
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33

Member Data Documentation

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

Sorted KHitGroup objects.

Definition at line 98 of file KHitContainer.h.

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

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

Unsorted KHitGroup objects.

Definition at line 99 of file KHitContainer.h.

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

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

Unused KHitGroup objects.

Definition at line 100 of file KHitContainer.h.

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


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