Public Member Functions | Private Attributes | List of all members
trkf::KHitWireX Class Reference

#include <KHitWireX.h>

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

Public Member Functions

 KHitWireX (const detinfo::DetectorPropertiesData &detProp, 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...
 
const art::Ptr< recob::Hit > & getHit () const
 Get original hit. More...
 
bool subpredict (const KETrack &tre, KVector< 1 >::type &pvec, KSymMatrix< 1 >::type &perr, KHMatrix< 1 >::type &hmatrix) const override
 
- Public Member Functions inherited from trkf::KHit< 1 >
 KHit ()
 Default constructor. More...
 
 KHit (const std::shared_ptr< const Surface > &psurf)
 Initializing Constructor – surface only. More...
 
 KHit (const std::shared_ptr< const Surface > &psurf, const typename KVector< N >::type &mvec, const typename KSymMatrix< N >::type &merr)
 Fully Initializing Constructor. More...
 
virtual ~KHit ()
 Destructor. More...
 
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 >::typegetMeasVector () const
 Measurement vector. More...
 
const KSymMatrix< N >::typegetMeasError () const
 Measurement error matrix. More...
 
const KVector< N >::typegetPredVector () const
 Prediction vector. More...
 
const KSymMatrix< N >::typegetPredError () const
 Prediction matrix. More...
 
const KVector< N >::typegetResVector () const
 Residual vector. More...
 
const KSymMatrix< N >::typegetResError () const
 Residual error matrix. More...
 
const KSymMatrix< N >::typegetResInvError () const
 Residual inv. error matrix. More...
 
const KHMatrix< N >::typegetH () const
 Kalman H-matrix. More...
 
double getChisq () const
 Incremental chisquare. More...
 
bool predict (const KETrack &tre, const Propagator &prop, 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...
 
- Public Member Functions inherited from trkf::KHitBase
 KHitBase ()
 Default constructor. More...
 
 KHitBase (const std::shared_ptr< const Surface > &psurf, int plane=-1)
 Initializing Constructor. More...
 
virtual ~KHitBase ()=default
 Destructor. 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...
 

Private Attributes

art::Ptr< recob::HitfHit
 

Additional Inherited Members

- Protected Attributes inherited from trkf::KHitBase
std::shared_ptr< const SurfacefPredSurf
 Prediction surface. More...
 
double fPredDist
 Prediction distance. More...
 
int fID
 Unique id. More...
 

Detailed Description

Definition at line 34 of file KHitWireX.h.

Constructor & Destructor Documentation

trkf::KHitWireX::KHitWireX ( const detinfo::DetectorPropertiesData detProp,
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 30 of file KHitWireX.cxx.

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

94  : KHit(std::shared_ptr<const Surface>(new SurfWireX(wireid)))
95  {
96  // Get services.
97 
99 
100  // Get plane number.
101 
102  setMeasPlane(wireid.Plane);
103 
104  // Update measurement vector and error matrix.
105 
106  trkf::KVector<1>::type mvec(1, x);
107  setMeasVector(mvec);
108 
110  merr(0, 0) = xerr * xerr;
111  setMeasError(merr);
112  }
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:101
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:493
void setMeasPlane(int plane)
Measurement plane.
Definition: KHitBase.h:121
list x
Definition: train.py:276

Member Function Documentation

const art::Ptr<recob::Hit>& trkf::KHitWireX::getHit ( ) const
inline

Get original hit.

Definition at line 48 of file KHitWireX.h.

49  {
50  return fHit;
51  }
art::Ptr< recob::Hit > fHit
Definition: KHitWireX.h:62
bool trkf::KHitWireX::subpredict ( const KETrack tre,
KVector< 1 >::type pvec,
KSymMatrix< 1 >::type perr,
KHMatrix< 1 >::type hmatrix 
) const
override

Definition at line 115 of file KHitWireX.cxx.

119  {
120  // Make sure that the track surface and the measurement surface are the
121  // same. Throw an exception if they are not.
122 
123  if (!getMeasSurface()->isEqual(*tre.getSurface()))
124  throw cet::exception("KHitWireX") << "Track surface not the same as measurement surface.\n";
125 
126  // Prediction is just u track perameter and error.
127 
128  int size = tre.getVector().size();
129  pvec.resize(1, /* preserve */ false);
130  pvec.clear();
131  pvec(0) = tre.getVector()(0);
132 
133  perr.resize(1, /* preserve */ false);
134  perr.clear();
135  perr(0, 0) = tre.getError()(0, 0);
136 
137  // Update prediction error to include contribution from track slope.
138 
140  double pitch = geom->WirePitch();
141  double slope = tre.getVector()(2);
142  double slopevar = pitch * pitch * slope * slope / 12.;
143  perr(0, 0) += slopevar;
144 
145  // Hmatrix - du/du = 1., all others are zero.
146 
147  hmatrix.resize(1, size, /* preserve */ false);
148  hmatrix.clear();
149  hmatrix(0, 0) = 1.;
150 
151  return true;
152  }
bool isEqual(float x1, float x2)
geo::Length_t WirePitch(geo::PlaneID const &planeid) const
Returns the distance between two consecutive wires.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
const std::shared_ptr< const Surface > & getMeasSurface() const
Measurement surface.
Definition: KHitBase.h:91
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33

Member Data Documentation

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

Definition at line 62 of file KHitWireX.h.


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