All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrackCreationBookKeeper.h
Go to the documentation of this file.
1 #ifndef TRACKCREATIONBOOKKEEPER_H
2 #define TRACKCREATIONBOOKKEEPER_H
3 
10 
11 namespace trkmkr {
12 
13  /**
14  * @file larreco/RecoAlg/TrackCreationBookKeeper.h
15  * @class trkmkr::TrackCreationBookKeeper
16  *
17  * @brief Helper class to aid the creation of a recob::Track, keeping data vectors in sync.
18  *
19  * Helper class to aid the creation of a recob::Track, keeping output data (vectors of recob::tracking::Point_t, recob::tracking::Vector_t, recob::TrackTrajectory::PointFlags_t, recob::Hit, and trkmkr::OptionalOutputs struct) in sync.
20  * It internally stores and uses a trkmkr::TrackTrajectoryCreationBookKeeper object. Elements of those vectors are added sequentially using the addPoint functions.
21  * Once all points have been added a call to the function finalizeTrack, builds the track moving the content of the vectors.
22  *
23  * @author G. Cerati (FNAL, MicroBooNE)
24  * @date 2017
25  * @version 1.0
26  */
27 
31 
33  public:
34  /// Constructor: needs reference to output hit vector, optional outputs struct, and other parameters needed when creating the track object
35  TrackCreationBookKeeper(std::vector<art::Ptr<recob::Hit> >& outhits, OptionalOutputs& optionals, int tkID, int pdgHyp, bool hasMomenta, int nfitpars = 4)
36  : ttcbk_(outhits, hasMomenta), tkID_(tkID), pdgHyp_(pdgHyp), totChi2_(0), opts(&optionals), nfittedpars(nfitpars)
37  {
38  opts->reset();
39  }
40  //
41  //@{
42  /// Avoid copies of this object
47  //@}
48  //
49  //@{
50  /// Add a single point; different version of the functions are provided using const references or rvalue references, with and without an OptionalPointElement argument.
51  void addPoint(const Point_t& point, const Vector_t& vect, art::Ptr<recob::Hit> hit, const PointFlags_t& flag, double chi2) {
52  ttcbk_.addPoint(point, vect, hit, flag);
53  if (chi2>=0) {
54  chi2v.push_back(chi2);
55  totChi2_+=chi2;
56  }
57  }
58  void addPoint(const Point_t& point, const Vector_t& vect, art::Ptr<recob::Hit> hit, const PointFlags_t& flag, double chi2, OptionalPointElement& ope) {
59  addPoint(point, vect, hit, flag, chi2);
60  opts->addPoint(ope);
61  }
62  void addPoint(Point_t&& point, Vector_t&& vect, art::Ptr<recob::Hit> hit, PointFlags_t&& flag, double chi2) {
63  ttcbk_.addPoint(std::move(point), std::move(vect), hit, std::move(flag));
64  if (chi2>=0) {
65  chi2v.push_back(chi2);
66  totChi2_+=chi2;
67  }
68  }
69  void addPoint(Point_t&& point, Vector_t&& vect, art::Ptr<recob::Hit> hit, PointFlags_t&& flag, double chi2, OptionalPointElement& ope) {
70  addPoint(std::move(point), std::move(vect), hit, std::move(flag), chi2);
71  opts->addPoint(ope);
72  }
73  //@}
74  //
75  /// Set the total chi2 value
76  void setTotChi2(double totChi2) { totChi2_ = totChi2; }
77  //
78  //@{
79  /// Get the finalized recob::Track; needs the start and end covariance matrices.
83  }
86  std::move(covStart),std::move(covEnd),tkID_);
87  }
88  //@}
89  private:
91  int tkID_;
92  int pdgHyp_;
93  double totChi2_;
95  std::vector<double> chi2v;
96  int nfittedpars; // hits are 1D measurement, i.e. each hit is one d.o.f.; no B field: 4 fitted parameters by default
97  //
98  };
99 
100 }
101 #endif
recob::TrajectoryPointFlags PointFlags_t
Type for flags of a point/hit.
void addPoint(const Point_t &point, const Vector_t &vect, art::Ptr< recob::Hit > hit, const PointFlags_t &flag, double chi2)
Add a single point; different version of the functions are provided using const references or rvalue ...
void setTotChi2(double totChi2)
Set the total chi2 value.
TrackCreationBookKeeper & operator=(const TrackCreationBookKeeper &)=delete
then echo unknown compiler flag
ROOT::Math::SMatrix< Double32_t, 5, 5, ROOT::Math::MatRepSym< Double32_t, 5 > > SMatrixSym55
Definition: TrackingTypes.h:85
Declaration of signal hit object.
TrackCreationBookKeeper(std::vector< art::Ptr< recob::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...
recob::TrackTrajectory finalizeTrackTrajectory()
Get the finalized recob::TrackTrajectory object; internal data vectors are moved so no more points sh...
trkmkr::TrackTrajectoryCreationBookKeeper ttcbk_
void addPoint(const Point_t &point, const Vector_t &vect, art::Ptr< recob::Hit > hit, const PointFlags_t &flag)
Add a single point; different version of the functions are provided using const references or rvalue ...
process_name hit
Definition: cheaterreco.fcl:51
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< Coord_t >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space. See recob::tracking::Coord_t for more details on the ...
Definition: TrackingTypes.h:29
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:47
recob::tracking::Vector_t Vector_t
Provides recob::Track data product.
recob::Track finalizeTrack(recob::tracking::SMatrixSym55 &&covStart, recob::tracking::SMatrixSym55 &&covEnd)
void reset()
reset the stored vectors
Definition: TrackMaker.h:148
void addPoint(const Point_t &point, const Vector_t &vect, art::Ptr< recob::Hit > hit, const PointFlags_t &flag, double chi2, OptionalPointElement &ope)
void addPoint(OptionalPointElement &ope)
add one OptionalPointElement
Definition: TrackMaker.h:131
Helper class to aid the creation of a recob::Track, keeping data vectors in sync. ...
void addPoint(Point_t &&point, Vector_t &&vect, art::Ptr< recob::Hit > hit, PointFlags_t &&flag, double chi2, OptionalPointElement &ope)
recob::Track finalizeTrack(const recob::tracking::SMatrixSym55 &covStart, const recob::tracking::SMatrixSym55 &covEnd)
Get the finalized recob::Track; needs the start and end covariance matrices.
TrackCollectionProxyElement< TrackCollProxy > Track
Proxy to an element of a proxy collection of recob::Track objects.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< Coord_t >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space. See recob::tracking::Coord_t for more detai...
Definition: TrackingTypes.h:26
void addPoint(Point_t &&point, Vector_t &&vect, art::Ptr< recob::Hit > hit, PointFlags_t &&flag, double chi2)
Struct holding optional TrackMaker outputs.
Definition: TrackMaker.h:125
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 &quot;fitted&quot; track:
recob::tracking::Point_t Point_t