LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
TrackCreationBookKeeper.h
Go to the documentation of this file.
1 #ifndef TRACKCREATIONBOOKKEEPER_H
2 #define TRACKCREATIONBOOKKEEPER_H
3 
8 
9 namespace trkmkr {
10 
26  using namespace recob;
30 
32  public:
34  TrackCreationBookKeeper(std::vector<art::Ptr<Hit> >& outhits, OptionalOutputs& optionals, int tkID, int pdgHyp, bool hasMomenta, int nfitpars = 4)
35  : ttcbk_(outhits, hasMomenta), tkID_(tkID), pdgHyp_(pdgHyp), totChi2_(0), opts(&optionals), nfittedpars(nfitpars)
36  {
37  opts->reset();
38  }
39  //
44  TrackCreationBookKeeper& operator=(const TrackCreationBookKeeper&) = delete;
45  TrackCreationBookKeeper& operator=(TrackCreationBookKeeper&& ) = delete;
47  //
49  void addPoint(const Point_t& point, const Vector_t& vect, art::Ptr<Hit> hit, const PointFlags_t& flag, double chi2) {
51  ttcbk_.addPoint(point, vect, hit, flag);
52  chi2v.push_back(chi2);
53  totChi2_+=chi2;
54  }
55  void addPoint(const Point_t& point, const Vector_t& vect, art::Ptr<Hit> hit, const PointFlags_t& flag, double chi2, OptionalPointElement& ope) {
56  addPoint(point, vect, hit, flag, chi2);
57  opts->addPoint(ope);
58  }
59  void addPoint(Point_t&& point, Vector_t&& vect, art::Ptr<Hit> hit, PointFlags_t&& flag, double chi2) {
60  ttcbk_.addPoint(std::move(point), std::move(vect), hit, std::move(flag));
61  chi2v.push_back(chi2);
62  totChi2_+=chi2;
63  }
64  void addPoint(Point_t&& point, Vector_t&& vect, art::Ptr<Hit> hit, PointFlags_t&& flag, double chi2, OptionalPointElement& ope) {
65  addPoint(std::move(point), std::move(vect), hit, std::move(flag), chi2);
66  opts->addPoint(ope);
67  }
69  //
71  void setTotChi2(double totChi2) { totChi2_ = totChi2; }
72  //
74  Track finalizeTrack(const tracking::SMatrixSym55& covStart, const tracking::SMatrixSym55& covEnd) {
76  return Track(ttcbk_.finalizeTrackTrajectory(),pdgHyp_,totChi2_,int(chi2v.size())-nfittedpars,
77  tracking::SMatrixSym55(covStart),tracking::SMatrixSym55(covEnd),tkID_);
78  }
80  return Track(ttcbk_.finalizeTrackTrajectory(),pdgHyp_,totChi2_,int(chi2v.size())-nfittedpars,
81  std::move(covStart),std::move(covEnd),tkID_);
82  }
84  private:
86  int tkID_;
87  int pdgHyp_;
88  double totChi2_;
90  std::vector<double> chi2v;
91  int nfittedpars; // hits are 1D measurement, i.e. each hit is one d.o.f.; no B field: 4 fitted parameters by default
92  //
93  };
94 
95 }
96 #endif
recob::TrajectoryPointFlags PointFlags_t
Type for flags of a point/hit.
tracking::Point_t Point_t
void setTotChi2(double totChi2)
Set the total chi2 value.
Reconstruction base classes.
ROOT::Math::SMatrix< Double32_t, 5, 5, ROOT::Math::MatRepSym< Double32_t, 5 > > SMatrixSym55
Definition: TrackingTypes.h:85
trkmkr::TrackTrajectoryCreationBookKeeper ttcbk_
void addPoint(Point_t &&point, Vector_t &&vect, art::Ptr< Hit > hit, PointFlags_t &&flag, double chi2)
Add a single point; different version of the functions are provided using const references or rvalue ...
recob::tracking::Point_t Point_t
void addPoint(const Point_t &point, const Vector_t &vect, art::Ptr< Hit > hit, const PointFlags_t &flag, double chi2)
Add a single point; different version of the functions are provided using const references or rvalue ...
tracking::Vector_t Vector_t
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
Provides recob::Track data product.
void addPoint(Point_t &&point, Vector_t &&vect, art::Ptr< Hit > hit, PointFlags_t &&flag, double chi2, OptionalPointElement &ope)
Add a single point; different version of the functions are provided using const references or rvalue ...
TrackCreationBookKeeper(std::vector< art::Ptr< Hit > > &outhits, OptionalOutputs &optionals, int tkID, int pdgHyp, bool hasMomenta, int nfitpars=4)
Constructor: needs reference to output hit vector, optional outputs struct, and other parameters need...
Helper class to aid the creation of a recob::TrackTrajectory, keeping data vectors in sync...
Struct holding point-by-point elements used in OptionalOutputs.
Definition: TrackMaker.h:32
Track finalizeTrack(tracking::SMatrixSym55 &&covStart, tracking::SMatrixSym55 &&covEnd)
Get the finalized recob::Track; needs the start and end covariance matrices.
Detector simulation of raw signals on wires.
void addPoint(const Point_t &point, const Vector_t &vect, art::Ptr< Hit > hit, const PointFlags_t &flag, double chi2, OptionalPointElement &ope)
Add a single point; different version of the functions are provided using const references or rvalue ...
recob::tracking::SMatrixSym55 SMatrixSym55
Helper class to aid the creation of a recob::Track, keeping data vectors in sync. ...
TrackCollectionProxyElement< TrackCollProxy > Track
Proxy to an element of a proxy collection of recob::Track objects.
Definition: Track.h:1035
recob::tracking::Vector_t Vector_t
Definition: fwd.h:25
Struct holding optional TrackMaker outputs.
Definition: TrackMaker.h:73
Set of flags pertaining a point of the track.
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
Definition: Track.h:52