LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
trkf::KHitGroup Class Reference

#include "KHitGroup.h"

Public Member Functions

 KHitGroup (bool has_path=false, double path=0.)
 Default constructor. More...
 
virtual ~KHitGroup ()
 Destructor. More...
 
const std::shared_ptr< const Surface > & getSurface () const
 Surface accessor. More...
 
int getPlane () const
 Plane index. More...
 
const std::vector< std::shared_ptr< const KHitBase > > & getHits () const
 Measurement collection accessor. More...
 
bool getHasPath () const
 Path flag. More...
 
double getPath () const
 Estimated path distance. More...
 
void clear ()
 Clear the collection. More...
 
void addHit (const std::shared_ptr< const KHitBase > &hit)
 Add a mesaurement into the colleciton. More...
 
void setPath (bool has_path, double path)
 Set path flag and estimated path distance. More...
 
bool operator== (const KHitGroup &obj) const
 Equivalance operator. More...
 
bool operator< (const KHitGroup &obj) const
 Less than operator. More...
 

Private Attributes

std::shared_ptr< const SurfacefSurf
 Common surface. More...
 
int fPlane
 Plane index of measurements. More...
 
std::vector< std::shared_ptr< const KHitBase > > fHits
 Measuement collection. More...
 
bool fHasPath
 Path flag. More...
 
double fPath
 Estimated path distance. More...
 

Detailed Description

Definition at line 37 of file KHitGroup.h.

Constructor & Destructor Documentation

trkf::KHitGroup::KHitGroup ( bool  has_path = false,
double  path = 0. 
)

Default constructor.

Default Constructor.

Arguments:

has_path - Path flag (optional). path - Estimated path distance (optional).

Definition at line 23 of file KHitGroup.cxx.

23 : fPlane(-1), fHasPath(has_path), fPath(path) {}
bool fHasPath
Path flag.
Definition: KHitGroup.h:88
int fPlane
Plane index of measurements.
Definition: KHitGroup.h:86
double fPath
Estimated path distance.
Definition: KHitGroup.h:89
trkf::KHitGroup::~KHitGroup ( )
virtual

Destructor.

Definition at line 26 of file KHitGroup.cxx.

26 {}

Member Function Documentation

void trkf::KHitGroup::addHit ( const std::shared_ptr< const KHitBase > &  hit)

Add a mesaurement into the colleciton.

Add a mesaurement into the colleciton.

Arguments:

hit - Measurement to add.

Definition at line 34 of file KHitGroup.cxx.

References fHits, fPlane, and fSurf.

Referenced by clear(), trkf::KHitContainerWireLine::fill(), and trkf::KHitContainerWireX::fill().

35  {
36  // Make sure that the measurement pointer is not null (throw exception if null).
37 
38  if (hit.get() == 0) throw cet::exception("KHitGroup") << "Attempt to add null measurement.\n";
39 
40  // If the stored common surface pointer has not yet been initialized,
41  // initialize it now.
42  // Otherwise, make sure that the new measurement surface matches
43  // the common surface (pointer to same surface object).
44  // Throw exception if the new surface doesn't match.
45 
46  if (hit->getMeasPlane() < 0)
47  throw cet::exception("KHitGroup")
48  << __func__ << ": invalid hit plane " << hit->getMeasPlane() << "\n";
49 
50  if (fSurf.get() == 0) {
51  fSurf = hit->getMeasSurface();
52  fPlane = hit->getMeasPlane();
53  }
54  else {
55  if (fSurf.get() != hit->getMeasSurface().get())
56  throw cet::exception("KHitGroup") << "Attempt to add non-matching measurement.\n";
57  if (hit->getMeasPlane() != fPlane) {
58  throw cet::exception("KHitGroup") << __func__ << ": hit plane mismatch, "
59  << hit->getMeasPlane() << " vs. " << fPlane << "\n";
60  }
61  if (fPlane < 0)
62  throw cet::exception("KHitGroup") << __func__ << ": invalid plane " << fPlane << "\n";
63  }
64 
65  // Everything OK. Add the measurement.
66 
67  fHits.push_back(hit);
68  }
std::shared_ptr< const Surface > fSurf
Common surface.
Definition: KHitGroup.h:85
int fPlane
Plane index of measurements.
Definition: KHitGroup.h:86
Detector simulation of raw signals on wires.
std::vector< std::shared_ptr< const KHitBase > > fHits
Measuement collection.
Definition: KHitGroup.h:87
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void trkf::KHitGroup::clear ( )
inline

Clear the collection.

Definition at line 65 of file KHitGroup.h.

References addHit(), and fHits.

65 { fHits.clear(); }
std::vector< std::shared_ptr< const KHitBase > > fHits
Measuement collection.
Definition: KHitGroup.h:87
bool trkf::KHitGroup::getHasPath ( ) const
inline

Path flag.

Definition at line 57 of file KHitGroup.h.

References fHasPath.

57 { return fHasPath; }
bool fHasPath
Path flag.
Definition: KHitGroup.h:88
const std::vector<std::shared_ptr<const KHitBase> >& trkf::KHitGroup::getHits ( ) const
inline

Measurement collection accessor.

Definition at line 54 of file KHitGroup.h.

References fHits.

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

54 { return fHits; }
std::vector< std::shared_ptr< const KHitBase > > fHits
Measuement collection.
Definition: KHitGroup.h:87
double trkf::KHitGroup::getPath ( ) const
inline

Estimated path distance.

Definition at line 60 of file KHitGroup.h.

References fPath.

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

60 { return fPath; }
double fPath
Estimated path distance.
Definition: KHitGroup.h:89
int trkf::KHitGroup::getPlane ( ) const
inline

Plane index.

Definition at line 51 of file KHitGroup.h.

References fPlane.

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

51 { return fPlane; }
int fPlane
Plane index of measurements.
Definition: KHitGroup.h:86
const std::shared_ptr<const Surface>& trkf::KHitGroup::getSurface ( ) const
inline

Surface accessor.

Definition at line 48 of file KHitGroup.h.

References fSurf.

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

48 { return fSurf; }
std::shared_ptr< const Surface > fSurf
Common surface.
Definition: KHitGroup.h:85
bool trkf::KHitGroup::operator< ( const KHitGroup obj) const

Less than operator.

Less than operator.

Objects with path flag false compare equal (return false). Objects with path flag true compare according to estimated path distance. Objects with path flag false are not comparable to objects with path flag true (throw exception).

Arguments:

g - Comparison object.

Returned value: True if less than.

Definition at line 100 of file KHitGroup.cxx.

References fHasPath, and fPath.

Referenced by setPath().

101  {
102  bool result = false;
103  if (fHasPath != obj.fHasPath)
104  throw cet::exception("KHitGroup") << "Attempt to compare incomparable objects.\n";
105  if (fHasPath) result = fPath < obj.fPath;
106  return result;
107  }
bool fHasPath
Path flag.
Definition: KHitGroup.h:88
double fPath
Estimated path distance.
Definition: KHitGroup.h:89
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
bool trkf::KHitGroup::operator== ( const KHitGroup obj) const

Equivalance operator.

Equivalance operator.

Objects with path flag false compare equal. Objects with path flag true compare according to estimated path distance.

Arguments:

g - Comparison object.

Returned value: True if equal.

Definition at line 81 of file KHitGroup.cxx.

References fHasPath, and fPath.

Referenced by setPath().

82  {
83  bool result = (!fHasPath && !obj.fHasPath) || (fHasPath && obj.fHasPath && fPath == obj.fPath);
84  return result;
85  }
bool fHasPath
Path flag.
Definition: KHitGroup.h:88
double fPath
Estimated path distance.
Definition: KHitGroup.h:89
void trkf::KHitGroup::setPath ( bool  has_path,
double  path 
)
inline

Set path flag and estimated path distance.

Definition at line 71 of file KHitGroup.h.

References fHasPath, fPath, operator<(), and operator==().

Referenced by trkf::KHitContainer::sort().

72  {
73  fHasPath = has_path;
74  fPath = path;
75  }
bool fHasPath
Path flag.
Definition: KHitGroup.h:88
double fPath
Estimated path distance.
Definition: KHitGroup.h:89

Member Data Documentation

bool trkf::KHitGroup::fHasPath
private

Path flag.

Definition at line 88 of file KHitGroup.h.

Referenced by getHasPath(), operator<(), operator==(), and setPath().

std::vector<std::shared_ptr<const KHitBase> > trkf::KHitGroup::fHits
private

Measuement collection.

Definition at line 87 of file KHitGroup.h.

Referenced by addHit(), clear(), and getHits().

double trkf::KHitGroup::fPath
private

Estimated path distance.

Definition at line 89 of file KHitGroup.h.

Referenced by getPath(), operator<(), operator==(), and setPath().

int trkf::KHitGroup::fPlane
private

Plane index of measurements.

Definition at line 86 of file KHitGroup.h.

Referenced by addHit(), and getPlane().

std::shared_ptr<const Surface> trkf::KHitGroup::fSurf
private

Common surface.

Definition at line 85 of file KHitGroup.h.

Referenced by addHit(), and getSurface().


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