LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
Track3DKalmanHitAlg.cxx
Go to the documentation of this file.
1 
11 #include <algorithm>
12 #include <cassert>
13 #include <cmath>
14 
15 #include "TMath.h"
16 
18 
21 #include "cetlib_except/exception.h"
22 #include "fhiclcpp/ParameterSet.h"
23 
39 
40 #include <type_traits>
41 #include <utility>
42 #include <vector>
43 
45 
46 // Local functions.
47 
48 namespace {
49  inline double calcMagnitude(const double* x)
50  {
51  return std::hypot(x[0], x[1], x[2]);
52  }
53 
54  //----------------------------------------------------------------------------
55  // Filter a collection of hits (set difference).
56  //
57  // Arguments:
58  //
59  // hits - Hit collection from which hits should be removed.
60  // used_hits - Hits to remove.
61  //
62  void filterHits(trkf::Hits& hits, trkf::Hits& used_hits)
63  {
64  if (used_hits.size() > 0) {
65  // Make sure both hit collections are sorted.
66  std::stable_sort(hits.begin(), hits.end());
67  std::stable_sort(used_hits.begin(), used_hits.end());
68 
69  // Do set difference operation.
70  trkf::Hits::iterator it = std::set_difference(
71  hits.begin(), hits.end(), used_hits.begin(), used_hits.end(), hits.begin());
72 
73  // Truncate hit collection.
74  hits.erase(it, hits.end());
75  }
76  }
77 
78 }
79 //----------------------------------------------------------------------------
81 
83  : fDoDedx{pset.get<bool>("DoDedx")}
84  , fSelfSeed{pset.get<bool>("SelfSeed")}
85  , fMaxTcut{pset.get<double>("MaxTcut")}
86  , fLineSurface{pset.get<bool>("LineSurface")}
87  , fMinSeedHits{pset.get<size_t>("MinSeedHits")}
88  , fMinSeedChopHits{pset.get<int>("MinSeedChopHits")}
89  , fMaxChopHits{pset.get<int>("MaxChopHits")}
90  , fMaxSeedChiDF{pset.get<double>("MaxSeedChiDF")}
91  , fMinSeedSlope{pset.get<double>("MinSeedSlope")}
92  , fInitialMomentum{pset.get<double>("InitialMomentum")}
93  , fKFAlg(pset.get<fhicl::ParameterSet>("KalmanFilterAlg"))
94  , fSeedFinderAlg(pset.get<fhicl::ParameterSet>("SeedFinderAlg"))
95  , fNumTrack(0)
96 {
97  mf::LogInfo("Track3DKalmanHitAlg") << "Track3DKalmanHitAlg instantiated.";
98 }
99 
100 //----------------------------------------------------------------------------
101 //makeTracks
102 std::vector<trkf::KalmanOutput> trkf::Track3DKalmanHitAlg::makeTracks(
103  detinfo::DetectorClocksData const& clockData,
104  detinfo::DetectorPropertiesData const& detProp,
105  KalmanInputs& inputs)
106 {
107  std::vector<KalmanOutput> outputs(inputs.size());
108  // Loop over input vectors.
109  for (size_t i = 0; i < inputs.size(); ++i) {
110  Hits& hits = inputs[i].hits;
111  // The hit collection "hits" (just filled), initially containing all
112  // hits, represents hits available for making tracks. Now we will
113  // fill a second hit collection called "unusedhits", also initially
114  // containing all hits, which will represent hits available for
115  // making track seeds. These collections are not necessarily the
116  // same, since hits that are not suitable for seeds may still be
117  // suitable for tracks.
118  Hits unusedhits = hits;
119  // Start of loop.
120  bool first = true;
121  while (true) {
122  std::vector<Hits> hitsperseed;
123  std::vector<recob::Seed> seeds;
124  // On the first trip through this loop, try to use pfparticle-associated seeds.
125  // Do this, provided the list of pfparticle-associated seeds and associated
126  // hits are not empty.
127  bool pfseed = false;
128  auto const seedsize = inputs[i].seeds.size();
129  if (first && seedsize > 0 && inputs[i].seedhits.size() > 0) {
130  seeds.reserve(seedsize);
131  fetchPFParticleSeeds(inputs[i].seeds, inputs[i].seedhits, seeds, hitsperseed);
132  pfseed = true;
133  }
134  else {
135  // On subsequent trips, or if there were no usable pfparticle-associated seeds,
136  // attempt to generate our own seeds.
137  if (unusedhits.size() > 0) {
138  if (fSelfSeed) {
139  // Self seed - convert all hits into one big seed.
140  seeds.emplace_back(makeSeed(detProp, unusedhits));
141  hitsperseed.emplace_back();
142  hitsperseed.back().insert(
143  hitsperseed.back().end(), unusedhits.begin(), unusedhits.end());
144  }
145  else
146  seeds =
147  fSeedFinderAlg.GetSeedsFromUnSortedHits(clockData, detProp, unusedhits, hitsperseed);
148  }
149  }
150 
151  assert(seeds.size() == hitsperseed.size());
152  first = false;
153 
154  if (empty(seeds)) break;
155 
156  growSeedsIntoTracks(detProp, pfseed, seeds, hitsperseed, unusedhits, hits, outputs[i].tracks);
157  }
158  }
159  return outputs;
160 }
161 
162 //----------------------------------------------------------------------------
164 
166  const std::vector<Hits>& pfseedhits,
167  std::vector<recob::Seed>& seeds,
168  std::vector<Hits>& hitsperseed) const
169 {
170  for (const auto& pseed : pfseeds) {
171  seeds.push_back(*pseed);
172  }
173  hitsperseed.insert(hitsperseed.end(), pfseedhits.begin(), pfseedhits.end());
174 }
175 
176 //----------------------------------------------------------------------------
178 
180  const bool pfseed,
181  const std::vector<recob::Seed>& seeds,
182  const std::vector<Hits>& hitsperseed,
183  Hits& unusedhits,
184  Hits& hits,
185  std::deque<KGTrack>& kgtracks)
186 {
187  // check for size of both containers
188  if (seeds.size() != hitsperseed.size()) {
189  throw cet::exception("Track3DKalmanHitAlg")
190  << "Different size containers for Seeds and Hits/Seed.\n";
191  }
192  for (size_t i = 0; i < seeds.size(); ++i) {
193  growSeedIntoTracks(detProp, pfseed, seeds[i], hitsperseed[i], unusedhits, hits, kgtracks);
194  }
195 }
196 
197 //----------------------------------------------------------------------------
199  const bool pfseed,
200  const recob::Seed& seed,
201  const Hits& hpsit,
202  Hits& unusedhits,
203  Hits& hits,
204  std::deque<KGTrack>& kgtracks)
205 {
206  Hits trimmedhits;
207  // Chop a couple of hits off each end of the seed.
208  chopHitsOffSeeds(hpsit, pfseed, trimmedhits);
209 
210  // Filter hits used by (chopped) seed from hits available to make future seeds.
211  // No matter what, we will never use these hits for another seed.
212  // This eliminates the possibility of an infinite loop.
213 
214  size_t initial_unusedhits = unusedhits.size();
215  filterHits(unusedhits, trimmedhits);
216 
217  // Require that this seed be fully disjoint from existing tracks.
218  //SS: replace this test with a method with appropriate name
219  if (!(trimmedhits.size() + unusedhits.size() == initial_unusedhits)) return;
220 
221  // Convert seed into initial KTracks on surface located at seed point,
222  // and normal to seed direction.
223  double dir[3];
224  std::shared_ptr<Surface> psurf = makeSurface(seed, dir);
225 
226  // Cut on the seed slope dx/ds.
227  //SS: replace test name with a reasonable name
228  if (!testSeedSlope(dir)) return;
229 
230  // Make one or two initial KTracks for forward and backward directions.
231  // The build_both flag specifies whether we should attempt to make
232  // tracks from all both FORWARD and BACKWARD initial tracks,
233  // or alternatively, whether we
234  // should declare victory and quit after getting a successful
235  // track from one initial track.
236  const bool build_both = fDoDedx;
237  const int ninit = 2;
238 
239  auto ntracks = kgtracks.size(); // Remember original track count.
240  bool ok = makeKalmanTracks(detProp, psurf, Surface::FORWARD, trimmedhits, hits, kgtracks);
241  if ((!ok || build_both) && ninit == 2) {
242  makeKalmanTracks(detProp, psurf, Surface::BACKWARD, trimmedhits, hits, kgtracks);
243  }
244 
245  // Loop over newly added tracks and remove hits contained on
246  // these tracks from hits available for making additional
247  // tracks or track seeds.
248  for (unsigned int itrk = ntracks; itrk < kgtracks.size(); ++itrk) {
249  const KGTrack& trg = kgtracks[itrk];
250  filterHitsOnKalmanTrack(trg, hits, unusedhits);
251  }
252 }
253 
254 //----------------------------------------------------------------------------
256 
257 std::shared_ptr<trkf::Surface> trkf::Track3DKalmanHitAlg::makeSurface(const recob::Seed& seed,
258  double* dir) const
259 {
260  double xyz[3];
261  double err[3]; // Dummy.
262  seed.GetPoint(xyz, err);
263  seed.GetDirection(dir, err);
264  if (mf::isDebugEnabled()) {
265  mf::LogDebug("Track3DKalmanHit")
266  //<< "Seed found with " << seedhits.size() <<" hits.\n"
267  << "(x,y,z) = " << xyz[0] << ", " << xyz[1] << ", " << xyz[2] << "\n"
268  << "(dx,dy,dz) = " << dir[0] << ", " << dir[1] << ", " << dir[2] << "\n";
269  } // if debug
270 
271  return std::make_shared<SurfXYZPlane>(xyz[0], xyz[1], xyz[2], dir[0], dir[1], dir[2]);
272 }
273 
274 //----------------------------------------------------------------------------
275 
277  const std::shared_ptr<trkf::Surface> psurf,
278  const Surface::TrackDirection trkdir,
279  Hits& seedhits,
280  Hits& hits,
281  std::deque<KGTrack>& kgtracks)
282 {
283  const int pdg = 13; //SS: FIXME another constant?
284  // SS: FIXME
285  // It is a contant value inside a loop so I took it out
286  // revisit the linear algebra stuff used here (use of ublas)
287  // make a lambda here ... const TrackVector
288  //
289  TrackVector vec(5);
290  vec(0) = 0.;
291  vec(1) = 0.;
292  vec(2) = 0.;
293  vec(3) = 0.;
294  vec(4) = (fInitialMomentum != 0. ? 1. / fInitialMomentum : 2.);
295 
296  KTrack initial_track(psurf, vec, trkdir, pdg);
297 
298  // Fill hit container with current seed hits.
299  // KHitContainer may not be cheaply movabale thats why unique_ptr
300  std::unique_ptr<KHitContainer> pseedcont = fillHitContainer(detProp, seedhits);
301 
302  // Set the preferred plane to be the one with the most hits.
303  unsigned int prefplane = pseedcont->getPreferredPlane();
304  fKFAlg.setPlane(prefplane);
305  if (mf::isDebugEnabled())
306  mf::LogDebug("Track3DKalmanHit") << "Preferred plane = " << prefplane << "\n";
307 
308  PropAny const propagator{detProp, fMaxTcut, fDoDedx};
309 
310  // Build and smooth seed track.
311  KGTrack trg0(prefplane);
312  bool ok =
313  fKFAlg.buildTrack(initial_track, trg0, propagator, Propagator::FORWARD, *pseedcont, fSelfSeed);
314  if (ok) ok = smoothandextendTrack(detProp, propagator, trg0, hits, prefplane, kgtracks);
315 
316  if (mf::isDebugEnabled())
317  mf::LogDebug("Track3DKalmanHit")
318  << (ok ? "Find track succeeded." : "Find track failed.") << "\n";
319  return ok;
320 }
321 
322 //----------------------------------------------------------------------------
323 
325 {
326  return std::abs(dir[0]) >= fMinSeedSlope * calcMagnitude(dir);
327 }
328 
329 //----------------------------------------------------------------------------
332  Hits& hits,
333  Hits& seederhits) const
334 {
335  Hits track_used_hits;
336  std::vector<unsigned int> hittpindex;
337  trg.fillHits(track_used_hits, hittpindex);
338  filterHits(hits, track_used_hits);
339  filterHits(seederhits, track_used_hits);
340 }
341 
342 //----------------------------------------------------------------------------
344 std::unique_ptr<trkf::KHitContainer> trkf::Track3DKalmanHitAlg::fillHitContainer(
345  detinfo::DetectorPropertiesData const& detProp,
346  const Hits& hits) const
347 {
348  std::unique_ptr<KHitContainer> hitcont(fLineSurface ?
349  static_cast<KHitContainer*>(new KHitContainerWireLine) :
350  static_cast<KHitContainer*>(new KHitContainerWireX));
351  hitcont->fill(detProp, hits, -1);
352  return hitcont;
353 }
354 
355 //----------------------------------------------------------------------------
357 // not sure if this function will be a candidate for generic interface
358 
360 {
361  double mom0[3];
362  double mom1[3];
363  trg0.startTrack().getMomentum(mom0);
364  trg0.endTrack().getMomentum(mom1);
365 
366  double dxds0 = mom0[0] / calcMagnitude(mom0);
367  double dxds1 = mom1[0] / calcMagnitude(mom1);
368 
369  return (std::abs(dxds0) > fMinSeedSlope && std::abs(dxds1) > fMinSeedSlope);
370 }
371 
372 //----------------------------------------------------------------------------
374 // Seems like seeds often end at delta rays, Michel electrons,
375 // or other pathologies.
376 
377 // Don't chop pfparticle seeds or self seeds.
378 
380  bool pfseed,
381  Hits& seedhits) const
382 {
383  const int nchopmax =
384  (pfseed || fSelfSeed) ? 0 : std::max(0, int((hpsit.size() - fMinSeedChopHits) / 2));
385  //SS: FIXME
386 
387  const int nchop = std::min(nchopmax, fMaxChopHits);
388  Hits::const_iterator itb = hpsit.begin();
389  Hits::const_iterator ite = hpsit.end();
390  itb += nchop;
391  ite -= nchop;
392  seedhits.reserve(hpsit.size());
393  for (Hits::const_iterator it = itb; it != ite; ++it)
394  seedhits.push_back(*it);
395 }
396 
397 //----------------------------------------------------------------------------
400  Propagator const& propagator,
401  KGTrack& trg0,
402  const Hits hits,
403  unsigned int prefplane,
404  std::deque<KGTrack>& kalman_tracks)
405 {
406  KGTrack trg1(prefplane);
407  bool ok = fKFAlg.smoothTrack(trg0, &trg1, propagator);
408  if (!ok) return ok;
409 
410  // Now we have the seed track in the form of a KGTrack.
411  // Do additional quality cuts.
412 
413  auto const n = trg1.numHits();
414  auto const chisq = n * fMaxSeedChiDF;
415 
416  ok = n >= fMinSeedHits && trg1.startTrack().getChisq() <= chisq &&
417  trg1.endTrack().getChisq() <= chisq && trg0.startTrack().getChisq() <= chisq &&
418  trg0.endTrack().getChisq() <= chisq && qualityCutsOnSeedTrack(trg0);
419 
420  if (!ok) return ok;
421 
422  // Make a copy of the original hit collection of all
423  // available track hits.
424  Hits trackhits = hits;
425 
426  // Do an extend + smooth loop here.
427  // Exit after two consecutive failures to extend (i.e. from each end),
428  // or if the iteration count reaches the maximum.
429  if (ok) ok = extendandsmoothLoop(detProp, propagator, trg1, prefplane, trackhits);
430 
431  // Do a final smooth.
432  if (!ok) return false;
433 
434  ok = fKFAlg.smoothTrack(trg1, 0, propagator);
435  if (!ok) return false;
436 
437  // Skip momentum estimate for constant-momentum tracks.
438 
439  if (fDoDedx) { fitnupdateMomentum(propagator, trg1, trg1); }
440  // Save this track.
441  ++fNumTrack;
442  kalman_tracks.push_back(trg1);
443  return true;
444 }
445 
446 //----------------------------------------------------------------------------
448 
450  Propagator const& propagator,
451  KGTrack& trg1,
452  unsigned int prefplane,
453  Hits& trackhits) const
454 {
455  bool ok = true;
456  const int niter = 6;
457  int nfail = 0; // Number of consecutive extend fails.
458  for (int ix = 0; ok && ix < niter && nfail < 2; ++ix) {
459 
460  // Fill a collection of hits from the last good track
461  // (initially the seed track).
462  Hits goodhits;
463  std::vector<unsigned int> hittpindex;
464  trg1.fillHits(goodhits, hittpindex);
465 
466  // Filter hits already on the track out of the available hits.
467  filterHits(trackhits, goodhits);
468 
469  // Fill hit container using filtered hits.
470  std::unique_ptr<KHitContainer> ptrackcont = fillHitContainer(detProp, trackhits);
471 
472  // Extend the track. It is not an error for the
473  // extend operation to fail, meaning that no new hits
474  // were added.
475 
476  if (fKFAlg.extendTrack(trg1, propagator, *ptrackcont))
477  nfail = 0;
478  else
479  ++nfail;
480 
481  // Smooth the extended track, and make a new
482  // unidirectionally fit track in the opposite
483  // direction.
484 
485  KGTrack trg2(prefplane);
486  ok = fKFAlg.smoothTrack(trg1, &trg2, propagator);
487  if (ok) {
488  // Skip momentum estimate for constant-momentum tracks.
489  if (fDoDedx) { fitnupdateMomentum(propagator, trg1, trg2); }
490  trg1 = trg2;
491  }
492  }
493  return ok;
494 }
495 //----------------------------------------------------------------------------
498  KGTrack& trg1,
499  KGTrack& trg2) const
500 {
501  KETrack tremom;
502  if (fKFAlg.fitMomentum(trg1, propagator, tremom)) {
503  fKFAlg.updateMomentum(tremom, propagator, trg2);
504  }
505 }
506 
507 //----------------------------------------------------------------------------
510  const Hits& hits) const
511 {
513 
514  // Do a linear 3D least squares for of y and z vs. x.
515  // y = y0 + ay*(x-x0)
516  // z = z0 + az*(x-x0)
517  // Here x0 is the global average x coordinate of all hits in all planes.
518  // Parameters y0, z0, ay, and az are determined by a simultaneous least squares
519  // fit in all planes.
520 
521  // First, determine x0 by looping over every hit.
522 
523  double x0 = 0.;
524  int n = 0;
525  for (auto const& phit : hits) {
526  const recob::Hit& hit = *phit;
527  geo::WireID wire_id = hit.WireID();
528  double time = hit.PeakTime();
529  double x = detProp.ConvertTicksToX(time, wire_id);
530  x0 += x;
531  ++n;
532  }
533 
534  // If there are no hits, return invalid seed.
535 
536  if (n == 0) return recob::Seed();
537 
538  // Find the average x.
539 
540  x0 /= n;
541 
542  // Now do the least squares fit proper.
543 
544  KSymMatrix<4>::type sm(4);
545  KVector<4>::type sv(4);
546  sm.clear();
547  sv.clear();
548 
549  // Loop over hits (again).
550 
551  for (auto const& phit : hits) {
552  const recob::Hit& hit = *phit;
553 
554  // Extract the angle, w and x coordinates from hit.
555 
556  geo::WireID wire_id = hit.WireID();
557  const geo::WireGeo& wgeom = geom->Wire(wire_id);
558  auto const xyz = wgeom.GetCenter();
559 
560  // Phi convention is the one documented in SurfYZPlane.h.
561 
562  double phi = TMath::PiOver2() - wgeom.ThetaZ();
563  double sphi = std::sin(phi);
564  double cphi = std::cos(phi);
565  double w = -xyz.Y() * sphi + xyz.Z() * cphi;
566 
567  double time = hit.PeakTime();
568  double x = detProp.ConvertTicksToX(time, wire_id);
569 
570  // Accumulate data for least squares fit.
571 
572  double dx = x - x0;
573 
574  sm(0, 0) += sphi * sphi;
575  sm(1, 0) -= sphi * cphi;
576  sm(1, 1) += cphi * cphi;
577  sm(2, 0) += sphi * sphi * dx;
578  sm(2, 1) -= sphi * cphi * dx;
579  sm(2, 2) += sphi * sphi * dx * dx;
580  sm(3, 0) -= sphi * cphi * dx;
581  sm(3, 1) += cphi * cphi * dx;
582  sm(3, 2) -= sphi * cphi * dx * dx;
583  sm(3, 3) += cphi * cphi * dx * dx;
584 
585  sv(0) -= sphi * w;
586  sv(1) += cphi * w;
587  sv(2) -= sphi * w * dx;
588  sv(3) += cphi * w * dx;
589  }
590 
591  // Solve.
592 
593  bool ok = syminvert(sm);
594  if (!ok) return recob::Seed();
595  KVector<4>::type par(4);
596  par = prod(sm, sv);
597 
598  double y0 = par(0);
599  double z0 = par(1);
600  double dydx = par(2);
601  double dzdx = par(3);
602 
603  // Make seed.
604 
605  double dsdx = std::hypot(1., std::hypot(dydx, dzdx));
606 
607  double pos[3] = {x0, y0, z0};
608  double dir[3] = {1. / dsdx, dydx / dsdx, dzdx / dsdx};
609  double poserr[3] = {0., 0., 0.};
610  double direrr[3] = {0., 0., 0.};
611 
612  recob::Seed result(pos, dir, poserr, direrr);
613 
614  return result;
615 }
Float_t x
Definition: compare.C:6
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane...
Definition: WireGeo.h:114
void growSeedIntoTracks(detinfo::DetectorPropertiesData const &detProp, const bool pfseed, const recob::Seed &seed, const Hits &hpsit, Hits &unusedhits, Hits &hits, std::deque< KGTrack > &kgtracks)
void reserve(size_type n)
Definition: PtrVector.h:337
TrackDirection
Track direction enum.
Definition: Surface.h:54
Basic Kalman filter track class, plus one measurement on same surface.
Point_t const & GetCenter() const
Returns the world coordinate of the center of the wire [cm].
Definition: WireGeo.h:221
typename data_t::iterator iterator
Definition: PtrVector.h:54
Utilities related to art service access.
void fillHits(art::PtrVector< recob::Hit > &hits, std::vector< unsigned int > &hittpindex) const
Fill a PtrVector of Hits.
Definition: KGTrack.cxx:216
General planar surface.
A KHitContainer for KHitWireLine type measurements.
A KHitContainer for KHitWireX type measurements.
const KHitTrack & endTrack() const
Track at end point.
Definition: KGTrack.cxx:40
size_t fMinSeedHits
Minimum number of hits per track seed.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
iterator begin()
Definition: PtrVector.h:217
Declaration of signal hit object.
void filterHitsOnKalmanTrack(const KGTrack &trg, Hits &hits, Hits &seederhits) const
Filter hits that are on kalman tracks.
void GetPoint(double *Pt, double *Err) const
Definition: Seed.cxx:89
iterator erase(iterator position)
Definition: PtrVector.h:504
constexpr auto abs(T v)
Returns the absolute value of the argument.
std::vector< trkf::KalmanOutput > makeTracks(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, KalmanInputs &kalman_inputs)
bool fDoDedx
Global dE/dx enable flag.
geo::WireID const & WireID() const
Initial tdc tick for hit.
Definition: Hit.h:280
double fMaxSeedChiDF
Maximum seed track chisquare/dof.
Track3DKalmanHitAlg(const fhicl::ParameterSet &pset)
Constructor.
WireGeo const & Wire(WireID const &wireid) const
Returns the specified wire.
int fMinSeedChopHits
Potentially chop seeds that exceed this length.
Track3DKalmanHit Algorithm.
double ThetaZ() const
Returns angle of wire with respect to z axis in the Y-Z plane in radians.
Definition: WireGeo.h:248
ublas::symmetric_matrix< double, ublas::lower, ublas::row_major, ublas::bounded_array< double, N *(N+1)/2 > > type
void chopHitsOffSeeds(Hits const &hpsit, bool pfseed, Hits &seedhits) const
Chop hits off of the end of seeds.
double fInitialMomentum
Initial (or constant) momentum.
recob::Seed makeSeed(detinfo::DetectorPropertiesData const &detProp, const Hits &hits) const
Make seed method.
bool makeKalmanTracks(detinfo::DetectorPropertiesData const &detProp, const std::shared_ptr< trkf::Surface > psurf, const Surface::TrackDirection trkdir, Hits &seedhits, Hits &hits, std::deque< KGTrack > &kalman_tracks)
void hits()
Definition: readHits.C:15
typename data_t::const_iterator const_iterator
Definition: PtrVector.h:55
bool buildTrack(const KTrack &trk, KGTrack &trg, const Propagator &prop, const Propagator::PropDirection dir, KHitContainer &hits, bool linear) const
Make a new track.
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:435
long seed
Definition: chem4.cc:67
void growSeedsIntoTracks(detinfo::DetectorPropertiesData const &detProp, const bool pfseed, const std::vector< recob::Seed > &seeds, const std::vector< Hits > &hitsperseed, Hits &unusedhits, Hits &hits, std::deque< KGTrack > &kalman_tracks)
Grow Seeds method.
ublas::vector< double, ublas::bounded_array< double, N > > type
bool syminvert(ublas::symmetric_matrix< T, TRI, L, A > &m)
T get(std::string const &key) const
Definition: ParameterSet.h:314
bool extendTrack(KGTrack &trg, const Propagator &prop, KHitContainer &hits) const
Add hits to existing track.
iterator end()
Definition: PtrVector.h:231
std::unique_ptr< KHitContainer > fillHitContainer(detinfo::DetectorPropertiesData const &detProp, const Hits &hits) const
Fill hit container with either seedhits or filtered hits i.e. recob::Hit.
void fetchPFParticleSeeds(const art::PtrVector< recob::Seed > &pfseeds, const std::vector< Hits > &pfseedhits, std::vector< recob::Seed > &seeds, std::vector< Hits > &hitsperseed) const
Fetch Seeds method.
bool isDebugEnabled()
KVector< 5 >::type TrackVector
Track state vector, dimension 5.
Definition of data types for geometry description.
bool smoothTrack(KGTrack &trg, KGTrack *trg1, const Propagator &prop) const
Smooth track.
KalmanFilterAlg fKFAlg
Kalman filter algorithm.
Kalman filter linear algebra typedefs.
bool smoothandextendTrack(detinfo::DetectorPropertiesData const &detProp, Propagator const &propagator, KGTrack &trg0, const Hits hits, unsigned int prefplane, std::deque< KGTrack > &kalman_tracks)
SMooth and extend track.
size_type size() const
Definition: PtrVector.h:302
Detector simulation of raw signals on wires.
std::vector< recob::Seed > GetSeedsFromUnSortedHits(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, art::PtrVector< recob::Hit > const &, std::vector< art::PtrVector< recob::Hit >> &, unsigned int StopAfter=0) const
Encapsulate the geometry of a wire.
double ConvertTicksToX(double ticks, int p, int t, int c) const
std::vector< TrajPoint > seeds
Definition: DataStructs.cxx:14
void fitnupdateMomentum(Propagator const &propagator, KGTrack &trg1, KGTrack &trg2) const
fit and update method, used twice.
float PeakTime() const
Time of the signal peak, in tick units.
Definition: Hit.h:220
Contains all timing reference information for the detector.
TDirectory * dir
Definition: macro.C:5
int fNumTrack
Number of tracks produced.
bool testSeedSlope(const double *dir) const
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
void getMomentum(double mom[3]) const
Get momentum vector of track.
Definition: KTrack.cxx:201
void setPlane(int plane)
Set preferred view plane.
bool fLineSurface
Line surface flag.
size_t numHits() const
Number of measurements in track.
Definition: KGTrack.h:57
SeedFinderAlgorithm fSeedFinderAlg
Seed finder.
Char_t n[5]
Basic Kalman filter track class, with error.
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:46
bool qualityCutsOnSeedTrack(const KGTrack &trg0) const
Quality cuts on seed track.
int fMaxChopHits
Maximum number of hits to chop from each end of seed.
bool fitMomentum(const KGTrack &trg, const Propagator &prop, KETrack &tremom) const
Estimate track momentum using either range or multiple scattering.
Float_t w
Definition: plot.C:20
bool updateMomentum(const KETrack &tremom, const Propagator &prop, KGTrack &trg) const
Set track momentum at each track surface.
std::vector< KalmanInput > KalmanInputs
Basic Kalman filter track class, without error.
void GetDirection(double *Dir, double *Err) const
Definition: Seed.cxx:80
double getChisq() const
Fit chisquare.
Definition: KFitTrack.h:62
bool fSelfSeed
Self seed flag.
const KHitTrack & startTrack() const
Track at start point.
Definition: KGTrack.cxx:30
art framework interface to geometry description
double fMinSeedSlope
Minimum seed slope (dx/dz).
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition: StdUtils.h:109
bool extendandsmoothLoop(detinfo::DetectorPropertiesData const &detProp, Propagator const &propagator, KGTrack &trg1, unsigned int prefplane, Hits &trackhits) const
SMooth and extend a track in a loop.
double fMaxTcut
Maximum delta ray energy in MeV for restricted dE/dx.
std::shared_ptr< Surface > makeSurface(const recob::Seed &seed, double *dir) const
method to return a seed to surface.