LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
trkf::KHitContainerWireLine Class Reference

#include "KHitContainerWireLine.h"

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

Public Member Functions

 KHitContainerWireLine ()
 Default constructor. More...
 
virtual ~KHitContainerWireLine ()
 Destructor. More...
 
void fill (const art::PtrVector< recob::Hit > &hits, int only_plane) override
 Fill container. More...
 
const std::list< KHitGroup > & getSorted () const
 Sorted list. More...
 
std::list< KHitGroup > & getSorted ()
 Sorted list. More...
 
const std::list< KHitGroup > & getUnsorted () const
 Unsorted list. More...
 
std::list< KHitGroup > & getUnsorted ()
 Unsorted list. More...
 
const std::list< KHitGroup > & getUnused () const
 Unused 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...
 

Detailed Description

Definition at line 25 of file KHitContainerWireLine.h.

Constructor & Destructor Documentation

trkf::KHitContainerWireLine::KHitContainerWireLine ( )

Default constructor.

Default Constructor.

Definition at line 23 of file KHitContainerWireLine.cxx.

24  {}
trkf::KHitContainerWireLine::~KHitContainerWireLine ( )
virtual

Destructor.

Definition at line 27 of file KHitContainerWireLine.cxx.

28  {}

Member Function Documentation

void trkf::KHitContainer::clear ( )
inherited

Clear all lists.

Definition at line 29 of file KHitContainer.cxx.

References trkf::KHitContainer::fSorted, trkf::KHitContainer::fUnsorted, and trkf::KHitContainer::fUnused.

Referenced by trkf::KHitContainer::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
void trkf::KHitContainerWireLine::fill ( const art::PtrVector< recob::Hit > &  hits,
int  only_plane 
)
overridevirtual

Fill container.

Fill container.

Arguments:

hits - RecoBase/Hit collection. only_plane - Choose hits from this plane if >= 0.

This method converts the hits in the input collection into KHitWireLine objects and inserts them into the base class.

Implements trkf::KHitContainer.

Definition at line 40 of file KHitContainerWireLine.cxx.

References trkf::KHitGroup::addHit(), art::PtrVector< T >::begin(), recob::Hit::Channel(), art::PtrVector< T >::end(), trkf::KHitGroup::getSurface(), trkf::KHitContainer::getUnsorted(), geo::PlaneID::Plane, and recob::Hit::WireID().

42  {
43  // Get services.
44 
46 
47  // Loop over hits.
48 
50  ihit != hits.end(); ++ihit) {
51  const recob::Hit& hit = **ihit;
52 
53  // Extract the wireid from the Hit.
54  geo::WireID hitWireID = hit.WireID();
55 
56  uint32_t channel = hit.Channel();
57 
58  // Choose plane.
59  if(only_plane >= 0 && hitWireID.Plane != (unsigned int)(only_plane))
60  continue;
61 
62  // Make a new KHitGroup for each hit.
63 
64  getUnsorted().push_back(KHitGroup());
65  KHitGroup* pgr = &(getUnsorted().back());
66  if (!pgr) {
67  throw cet::exception("KHitContainerWireLine")
68  << __func__ << ": no group map for channel " << channel << "\n";
69  }
70 
71  // Get surface from KHitGroup (initially a null pointer).
72 
73  const std::shared_ptr<const Surface>& psurf = pgr->getSurface();
74 
75  // Construct KHitWireLine object.
76 
77  std::shared_ptr<const KHitBase> phit(new KHitWireLine(*ihit, psurf));
78 
79  // Insert hit into KHitGroup.
80 
81  pgr->addHit(phit);
82  }
83  }
geo::WireID WireID() const
Initial tdc tick for hit.
Definition: Hit.h:234
iterator begin()
Definition: PtrVector.h:223
iterator end()
Definition: PtrVector.h:237
const std::list< KHitGroup > & getUnsorted() const
Unsorted list.
Definition: KHitContainer.h:72
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:258
Detector simulation of raw signals on wires.
data_t::const_iterator const_iterator
Definition: PtrVector.h:61
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:49
raw::ChannelID_t Channel() const
ID of the readout channel the hit was extracted from.
Definition: Hit.h:231
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
unsigned int trkf::KHitContainer::getPreferredPlane ( ) const
inherited

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

Definition at line 107 of file KHitContainer.cxx.

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

Referenced by trkf::KHitContainer::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
inlineinherited

Sorted list.

Definition at line 71 of file KHitContainer.h.

References trkf::KHitContainer::fSorted.

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

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

Sorted list.

Definition at line 77 of file KHitContainer.h.

References trkf::KHitContainer::fSorted.

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

Unsorted list.

Definition at line 78 of file KHitContainer.h.

References trkf::KHitContainer::fUnsorted.

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

Unused list.

Definition at line 73 of file KHitContainer.h.

References trkf::KHitContainer::fUnused.

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

std::list<KHitGroup>& trkf::KHitContainer::getUnused ( )
inlineinherited
void trkf::KHitContainer::reset ( )
inherited

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

Definition at line 37 of file KHitContainer.cxx.

References trkf::KHitContainer::fSorted, trkf::KHitContainer::fUnsorted, and trkf::KHitContainer::fUnused.

Referenced by trkf::KHitContainer::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 
)
inherited

(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 trkf::KHitContainer::fSorted, trkf::KHitContainer::fUnsorted, trkf::KHitGroup::getSurface(), trkf::KHitGroup::setPath(), and trkf::Propagator::vec_prop().

Referenced by trkf::KalmanFilterAlg::buildTrack(), trkf::KalmanFilterAlg::extendTrack(), and trkf::KHitContainer::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

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