LArSoft  v06_85_00
Liquid Argon Software toolkit - http://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  :
24  fPlane(-1),
25  fHasPath(has_path),
26  fPath(path)
27  {}
bool fHasPath
Path flag.
Definition: KHitGroup.h:87
int fPlane
Plane index of measurements.
Definition: KHitGroup.h:85
double fPath
Estimated path distance.
Definition: KHitGroup.h:88
trkf::KHitGroup::~KHitGroup ( )
virtual

Destructor.

Definition at line 30 of file KHitGroup.cxx.

31  {}

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 39 of file KHitGroup.cxx.

References fHits, fPlane, and fSurf.

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

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

Clear the collection.

Definition at line 67 of file KHitGroup.h.

References addHit(), and fHits.

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

Path flag.

Definition at line 59 of file KHitGroup.h.

References fHasPath.

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

Measurement collection accessor.

Definition at line 56 of file KHitGroup.h.

References fHits.

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

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

Estimated path distance.

Definition at line 62 of file KHitGroup.h.

References fPath.

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

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

Plane index.

Definition at line 53 of file KHitGroup.h.

References fPlane.

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

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

Surface accessor.

Definition at line 50 of file KHitGroup.h.

References fSurf.

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

50 {return fSurf;}
std::shared_ptr< const Surface > fSurf
Common surface.
Definition: KHitGroup.h:84
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 107 of file KHitGroup.cxx.

References fHasPath, and fPath.

Referenced by setPath().

108  {
109  bool result = false;
110  if(fHasPath != obj.fHasPath)
111  throw cet::exception("KHitGroup") << "Attempt to compare incomparable objects.\n";
112  if(fHasPath)
113  result = fPath < obj.fPath;
114  return result;
115  }
bool fHasPath
Path flag.
Definition: KHitGroup.h:87
double fPath
Estimated path distance.
Definition: KHitGroup.h:88
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 86 of file KHitGroup.cxx.

References fHasPath, and fPath.

Referenced by setPath().

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

Set path flag and estimated path distance.

Definition at line 73 of file KHitGroup.h.

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

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

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

Member Data Documentation

bool trkf::KHitGroup::fHasPath
private

Path flag.

Definition at line 87 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 86 of file KHitGroup.h.

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

double trkf::KHitGroup::fPath
private

Estimated path distance.

Definition at line 88 of file KHitGroup.h.

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

int trkf::KHitGroup::fPlane
private

Plane index of measurements.

Definition at line 85 of file KHitGroup.h.

Referenced by addHit(), and getPlane().

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

Common surface.

Definition at line 84 of file KHitGroup.h.

Referenced by addHit(), and getSurface().


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