LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
trkf::KHitWireX Class Referenceabstract

#include "KHitWireX.h"

Inheritance diagram for trkf::KHitWireX:
trkf::KHit< 1 > trkf::KHitBase

Public Member Functions

 KHitWireX (const art::Ptr< recob::Hit > &hit, const std::shared_ptr< const Surface > &psurf)
 Constructor from Hit. More...
 
 KHitWireX (const geo::WireID &wireid, double x, double xerr)
 Constructor from wire id (mainly for testing). More...
 
virtual ~KHitWireX ()
 Destructor. More...
 
const art::Ptr< recob::Hit > & getHit () const
 Get original hit. More...
 
virtual bool subpredict (const KETrack &tre, KVector< 1 >::type &pvec, KSymMatrix< 1 >::type &perr, KHMatrix< 1 >::type &hmatrix) const
 
void setMeasVector (const typename KVector< N >::type &mvec)
 Set measurement vector. More...
 
void setMeasError (const typename KSymMatrix< N >::type &merr)
 Set measurement error. More...
 
const KVector< N >::type & getMeasVector () const
 Measurement vector. More...
 
const KSymMatrix< N >::type & getMeasError () const
 Measurement error matrix. More...
 
const KVector< N >::type & getPredVector () const
 Prediction vector. More...
 
const KSymMatrix< N >::type & getPredError () const
 Prediction matrix. More...
 
const KVector< N >::type & getResVector () const
 Residual vector. More...
 
const KSymMatrix< N >::type & getResError () const
 Residual error matrix. More...
 
const KSymMatrix< N >::type & getResInvError () const
 Residual inv. error matrix. More...
 
const KHMatrix< N >::type & getH () const
 Kalman H-matrix. More...
 
double getChisq () const
 Incremental chisquare. More...
 
bool predict (const KETrack &tre, const Propagator *prop=0, const KTrack *ref=0) const
 Prediction method (return false if fail). More...
 
void update (KETrack &tre) const
 Update track method. More...
 
virtual bool subpredict (const KETrack &tre, typename KVector< N >::type &pvec, typename KSymMatrix< N >::type &perr, typename KHMatrix< N >::type &hmatrix) const =0
 Calculate prediction function (return via arguments). More...
 
virtual std::ostream & Print (std::ostream &out, bool doTitle=true) const
 Printout. More...
 
const std::shared_ptr< const Surface > & getPredSurface () const
 Predition surface. More...
 
double getPredDistance () const
 Prediction distance. More...
 
const std::shared_ptr< const Surface > & getMeasSurface () const
 Measurement surface. More...
 
int getMeasPlane () const
 Measurement plane index. More...
 
int getID () const
 Unique id. More...
 
void setMeasSurface (const std::shared_ptr< const Surface > &psurf)
 Measurement surface. More...
 
void setMeasPlane (int plane)
 Measurement plane. More...
 

Protected Attributes

std::shared_ptr< const SurfacefPredSurf
 Prediction surface. More...
 
double fPredDist
 Prediction distance. More...
 
int fID
 Unique id. More...
 

Private Attributes

art::Ptr< recob::HitfHit
 

Detailed Description

Definition at line 30 of file KHitWireX.h.

Constructor & Destructor Documentation

trkf::KHitWireX::KHitWireX ( const art::Ptr< recob::Hit > &  hit,
const std::shared_ptr< const Surface > &  psurf 
)

Constructor from Hit.

Constructor.

Arguments:

hit - Hit. psurf - Measurement surface (can be null).

The measurement surface is only a suggestion. It is allowed to be specified to allow measurements to whare surfaces to save memory.

Definition at line 31 of file KHitWireX.cxx.

References recob::Hit::Channel(), detinfo::DetectorProperties::ConvertTicksToX(), geo::CryostatID::Cryostat, trkf::KHitBase::fID, detinfo::DetectorProperties::GetXTicksCoefficient(), trkf::SurfYZPlane::isEqual(), recob::Hit::PeakTime(), geo::PlaneID::Plane, recob::Hit::RMS(), trkf::KHit< 1 >::setMeasError(), trkf::KHitBase::setMeasPlane(), trkf::KHitBase::setMeasSurface(), trkf::KHit< 1 >::setMeasVector(), geo::TPCID::TPC, recob::Hit::WireID(), and x.

32  :
33  KHit(psurf),
34  fHit(hit)
35  {
36  // Get services.
38 
39  // Extract wire id.
40  geo::WireID wireid = hit->WireID();
41 
42  // Check the surface (determined by wire id). If the
43  // surface pointer is null, make a new SurfWireX surface and
44  // update the base class appropriately. Otherwise, just check
45  // that the specified surface agrees with the wire id.
46 
47  if(psurf.get() == 0) {
48  std::shared_ptr<const Surface> new_psurf(new SurfWireX(wireid));
49  setMeasSurface(new_psurf);
50  }
51  else {
52  SurfWireX check_surf(wireid);
53  if(!check_surf.isEqual(*psurf))
54  throw cet::exception("KHitWireX") << "Measurement surface doesn't match wire id.\n";
55  }
56 
57  setMeasPlane(hit->WireID().Plane);
58 
59  // Extract time information from hit.
60 
61  double t = hit->PeakTime();
62  double terr = hit->RMS(); //hit->SigmaPeakTime();
63 
64  // Don't let the time error be less than 1./sqrt(12.) ticks.
65  // This should be removed when hit errors are fixed.
66 
67  if(terr < 1./std::sqrt(12.))
68  terr = 1./std::sqrt(12.);
69 
70  // Calculate position and error.
71 
72  double x = detprop->ConvertTicksToX(t, hit->WireID().Plane, hit->WireID().TPC, hit->WireID().Cryostat);
73  double xerr = terr * detprop->GetXTicksCoefficient();
74 
75  // Update measurement vector and error matrix.
76 
77  trkf::KVector<1>::type mvec(1, x);
78  setMeasVector(mvec);
79 
81  merr(0,0) = xerr * xerr;
82  setMeasError(merr);
83 
84  // Set the unique id from a combination of the channel number and the time.
85 
86  fID = (hit->Channel() % 200000) * 10000 + (int(std::abs(t)) % 10000);
87  }
void setMeasSurface(const std::shared_ptr< const Surface > &psurf)
Measurement surface.
Definition: KHitBase.h:92
Float_t x
Definition: compare.C:6
ublas::symmetric_matrix< double, ublas::lower, ublas::row_major, ublas::bounded_array< double, N *(N+1)/2 > > type
geo::WireID WireID() const
Initial tdc tick for hit.
Definition: Hit.h:234
float RMS() const
RMS of the hit shape, in tick units.
Definition: Hit.h:221
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:130
KHit()
Default constructor.
void setMeasVector(const typename KVector< N >::type &mvec)
Set measurement vector.
Definition: KHit.h:94
virtual double GetXTicksCoefficient(int t, int c) const =0
ublas::vector< double, ublas::bounded_array< double, N > > type
void setMeasError(const typename KSymMatrix< N >::type &merr)
Set measurement error.
Definition: KHit.h:97
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:258
int fID
Unique id.
Definition: KHitBase.h:118
art::Ptr< recob::Hit > fHit
Definition: KHitWireX.h:61
virtual double ConvertTicksToX(double ticks, int p, int t, int c) const =0
float PeakTime() const
Time of the signal peak, in tick units.
Definition: Hit.h:219
void setMeasPlane(int plane)
Measurement plane.
Definition: KHitBase.h:95
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:203
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
trkf::KHitWireX::KHitWireX ( const geo::WireID wireid,
double  x,
double  xerr 
)

Constructor from wire id (mainly for testing).

Constructor.

Arguments:

wireid - Wire id. x - X coordinate. xerr - X error.

Definition at line 97 of file KHitWireX.cxx.

References geo::PlaneID::Plane, trkf::KHit< 1 >::setMeasError(), trkf::KHitBase::setMeasPlane(), and trkf::KHit< 1 >::setMeasVector().

97  :
98  KHit(std::shared_ptr<const Surface>(new SurfWireX(wireid)))
99  {
100  // Get services.
101 
103 
104  // Get plane number.
105 
106  setMeasPlane(wireid.Plane);
107 
108  // Update measurement vector and error matrix.
109 
110  trkf::KVector<1>::type mvec(1, x);
111  setMeasVector(mvec);
112 
114  merr(0,0) = xerr * xerr;
115  setMeasError(merr);
116  }
Float_t x
Definition: compare.C:6
ublas::symmetric_matrix< double, ublas::lower, ublas::row_major, ublas::bounded_array< double, N *(N+1)/2 > > type
KHit()
Default constructor.
void setMeasVector(const typename KVector< N >::type &mvec)
Set measurement vector.
Definition: KHit.h:94
ublas::vector< double, ublas::bounded_array< double, N > > type
void setMeasError(const typename KSymMatrix< N >::type &merr)
Set measurement error.
Definition: KHit.h:97
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:258
void setMeasPlane(int plane)
Measurement plane.
Definition: KHitBase.h:95
trkf::KHitWireX::~KHitWireX ( )
virtual

Destructor.

Definition at line 119 of file KHitWireX.cxx.

120  {}

Member Function Documentation

double trkf::KHit< N >::getChisq ( ) const
inlinevirtualinherited

Incremental chisquare.

Implements trkf::KHitBase.

Definition at line 126 of file KHit.h.

References trkf::KHit< N >::fChisq, trkf::KHit< N >::predict(), trkf::KHit< N >::Print(), trkf::KHit< N >::subpredict(), and trkf::KHit< N >::update().

126 {return fChisq;}
double fChisq
Incremental chisquare.
Definition: KHit.h:160
const KHMatrix<N>::type& trkf::KHit< N >::getH ( ) const
inlineinherited

Kalman H-matrix.

Definition at line 123 of file KHit.h.

References trkf::KHit< N >::fH.

123 {return fH;}
KHMatrix< N >::type fH
Kalman H-matrix.
Definition: KHit.h:159
const art::Ptr<recob::Hit>& trkf::KHitWireX::getHit ( ) const
inline

Get original hit.

Definition at line 47 of file KHitWireX.h.

References fHit, and subpredict().

Referenced by trkf::SpacePointAlg::fillSpacePoints().

47 {return fHit;}
art::Ptr< recob::Hit > fHit
Definition: KHitWireX.h:61
int trkf::KHitBase::getID ( ) const
inlineinherited
const KSymMatrix<N>::type& trkf::KHit< N >::getMeasError ( ) const
inlineinherited

Measurement error matrix.

Definition at line 105 of file KHit.h.

References trkf::KHit< N >::fMerr.

105 {return fMerr;}
KSymMatrix< N >::type fMerr
Measurement error matrix.
Definition: KHit.h:153
int trkf::KHitBase::getMeasPlane ( ) const
inlineinherited

Measurement plane index.

Definition at line 84 of file KHitBase.h.

References trkf::KHitBase::fMeasPlane.

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

84 {return fMeasPlane;}
int fMeasPlane
Measurement plane index.
Definition: KHitBase.h:123
const std::shared_ptr<const Surface>& trkf::KHitBase::getMeasSurface ( ) const
inlineinherited

Measurement surface.

Definition at line 81 of file KHitBase.h.

References trkf::KHitBase::fMeasSurf.

Referenced by trkf::KHit< N >::predict(), subpredict(), and trkf::KHitWireLine::subpredict().

81 {return fMeasSurf;}
std::shared_ptr< const Surface > fMeasSurf
Measurement surface.
Definition: KHitBase.h:122
const KVector<N>::type& trkf::KHit< N >::getMeasVector ( ) const
inlineinherited

Measurement vector.

Definition at line 102 of file KHit.h.

References trkf::KHit< N >::fMvec.

102 {return fMvec;}
KVector< N >::type fMvec
Measurement vector.
Definition: KHit.h:152
double trkf::KHitBase::getPredDistance ( ) const
inlineinherited

Prediction distance.

Definition at line 78 of file KHitBase.h.

References trkf::KHitBase::fPredDist.

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

78 {return fPredDist;}
double fPredDist
Prediction distance.
Definition: KHitBase.h:117
const KSymMatrix<N>::type& trkf::KHit< N >::getPredError ( ) const
inlineinherited

Prediction matrix.

Definition at line 111 of file KHit.h.

References trkf::KHit< N >::fPerr.

111 {return fPerr;}
KSymMatrix< N >::type fPerr
Prediction error matrix.
Definition: KHit.h:155
const std::shared_ptr<const Surface>& trkf::KHitBase::getPredSurface ( ) const
inlineinherited

Predition surface.

Definition at line 75 of file KHitBase.h.

References trkf::KHitBase::fPredSurf.

Referenced by trkf::KHitMulti::update(), and trkf::KHit< N >::update().

75 {return fPredSurf;}
std::shared_ptr< const Surface > fPredSurf
Prediction surface.
Definition: KHitBase.h:116
const KVector<N>::type& trkf::KHit< N >::getPredVector ( ) const
inlineinherited

Prediction vector.

Definition at line 108 of file KHit.h.

References trkf::KHit< N >::fPvec.

108 {return fPvec;}
KVector< N >::type fPvec
Prediction vector.
Definition: KHit.h:154
const KSymMatrix<N>::type& trkf::KHit< N >::getResError ( ) const
inlineinherited

Residual error matrix.

Definition at line 117 of file KHit.h.

References trkf::KHit< N >::fRerr.

117 {return fRerr;}
KSymMatrix< N >::type fRerr
Residual error matrix.
Definition: KHit.h:157
const KSymMatrix<N>::type& trkf::KHit< N >::getResInvError ( ) const
inlineinherited

Residual inv. error matrix.

Definition at line 120 of file KHit.h.

References trkf::KHit< N >::fRinv.

120 {return fRinv;}
KSymMatrix< N >::type fRinv
Residual inverse error matrix.
Definition: KHit.h:158
const KVector<N>::type& trkf::KHit< N >::getResVector ( ) const
inlineinherited

Residual vector.

Definition at line 114 of file KHit.h.

References trkf::KHit< N >::fRvec.

114 {return fRvec;}
KVector< N >::type fRvec
Residual vector.
Definition: KHit.h:156
bool trkf::KHit< N >::predict ( const KETrack tre,
const Propagator prop = 0,
const KTrack ref = 0 
) const
virtualinherited

Prediction method (return false if fail).

Prediction method.

Arguments;

tre - Track prediction. prop - Propagator. ref - Reference track.

Implements trkf::KHitBase.

virtual std::ostream& trkf::KHit< N >::Print ( std::ostream &  out,
bool  doTitle = true 
) const
virtualinherited

Printout.

Reimplemented from trkf::KHitBase.

void trkf::KHit< N >::setMeasError ( const typename KSymMatrix< N >::type &  merr)
inlineinherited

Set measurement error.

Definition at line 97 of file KHit.h.

References trkf::KHit< N >::fMerr.

Referenced by trkf::KHitWireLine::KHitWireLine(), and KHitWireX().

97 {fMerr = merr;}
KSymMatrix< N >::type fMerr
Measurement error matrix.
Definition: KHit.h:153
void trkf::KHitBase::setMeasPlane ( int  plane)
inlineinherited

Measurement plane.

Definition at line 95 of file KHitBase.h.

References trkf::KHitBase::fMeasPlane, trkf::KHitBase::getChisq(), trkf::KHitBase::predict(), trkf::KHitBase::Print(), and trkf::KHitBase::update().

Referenced by trkf::KHitWireLine::KHitWireLine(), and KHitWireX().

95 {fMeasPlane = plane;}
int fMeasPlane
Measurement plane index.
Definition: KHitBase.h:123
void trkf::KHitBase::setMeasSurface ( const std::shared_ptr< const Surface > &  psurf)
inlineinherited

Measurement surface.

Definition at line 92 of file KHitBase.h.

References trkf::KHitBase::fMeasSurf.

Referenced by trkf::KHitWireLine::KHitWireLine(), and KHitWireX().

92 {fMeasSurf = psurf;}
std::shared_ptr< const Surface > fMeasSurf
Measurement surface.
Definition: KHitBase.h:122
void trkf::KHit< N >::setMeasVector ( const typename KVector< N >::type &  mvec)
inlineinherited

Set measurement vector.

Definition at line 94 of file KHit.h.

References trkf::KHit< N >::fMvec.

Referenced by trkf::KHitWireLine::KHitWireLine(), and KHitWireX().

94 {fMvec = mvec;}
KVector< N >::type fMvec
Measurement vector.
Definition: KHit.h:152
bool trkf::KHitWireX::subpredict ( const KETrack tre,
KVector< 1 >::type &  pvec,
KSymMatrix< 1 >::type &  perr,
KHMatrix< 1 >::type &  hmatrix 
) const
virtual

Definition at line 122 of file KHitWireX.cxx.

References trkf::KETrack::getError(), trkf::KHitBase::getMeasSurface(), trkf::KTrack::getSurface(), trkf::KTrack::getVector(), and geo::GeometryCore::WirePitch().

Referenced by getHit().

126  {
127  // Make sure that the track surface and the measurement surface are the same.
128  // Throw an exception if they are not.
129 
130  if(!getMeasSurface()->isEqual(*tre.getSurface()))
131  throw cet::exception("KHitWireX") << "Track surface not the same as measurement surface.\n";
132 
133  // Prediction is just u track perameter and error.
134 
135  int size = tre.getVector().size();
136  pvec.resize(1, /* preserve */ false);
137  pvec.clear();
138  pvec(0) = tre.getVector()(0);
139 
140  perr.resize(1, /* preserve */ false);
141  perr.clear();
142  perr(0,0) = tre.getError()(0,0);
143 
144  // Update prediction error to include contribution from track slope.
145 
147  double pitch = geom->WirePitch();
148  double slope = tre.getVector()(2);
149  double slopevar = pitch*pitch * slope*slope / 12.;
150  perr(0,0) += slopevar;
151 
152  // Hmatrix - du/du = 1., all others are zero.
153 
154  hmatrix.resize(1, size, /* preserve */ false);
155  hmatrix.clear();
156  hmatrix(0,0) = 1.;
157 
158  return true;
159  }
geo::Length_t WirePitch(geo::PlaneID const &planeid) const
Returns the distance between two consecutive wires.
const std::shared_ptr< const Surface > & getMeasSurface() const
Measurement surface.
Definition: KHitBase.h:81
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
virtual bool trkf::KHit< N >::subpredict ( const KETrack tre,
typename KVector< N >::type &  pvec,
typename KSymMatrix< N >::type &  perr,
typename KHMatrix< N >::type &  hmatrix 
) const
pure virtualinherited

Calculate prediction function (return via arguments).

void trkf::KHit< N >::update ( KETrack tre) const
virtualinherited

Update track method.

Update track method.

Arguments:

tre - Track to be updated.

Implements trkf::KHitBase.

Member Data Documentation

art::Ptr<recob::Hit> trkf::KHitWireX::fHit
private

Definition at line 61 of file KHitWireX.h.

Referenced by getHit().

int trkf::KHitBase::fID
protectedinherited

Unique id.

Definition at line 118 of file KHitBase.h.

Referenced by trkf::KHitBase::getID(), trkf::KHitWireLine::KHitWireLine(), and KHitWireX().

double trkf::KHitBase::fPredDist
mutableprotectedinherited
std::shared_ptr<const Surface> trkf::KHitBase::fPredSurf
mutableprotectedinherited

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