TrackTrajectoryCreationBookKeeper.h
Go to the documentation of this file.
1 #ifndef TRACKTRAJECTORYCREATIONBOOKKEEPER_H
2 #define TRACKTRAJECTORYCREATIONBOOKKEEPER_H
3 
8 
9 namespace trkmkr {
10 
11  /**
12  * @file larreco/RecoAlg/TrackTrajectoryCreationBookKeeper.h
13  * @class trkmkr::TrackTrajectoryCreationBookKeeper
14  *
15  * @brief Helper class to aid the creation of a recob::TrackTrajectory, keeping data vectors in sync.
16  *
17  * Helper class to aid the creation of a recob::TrackTrajectory, keeping data vectors (Point_t, Vector_t, PointFlags_t, Hit) in sync.
18  * Elements of those vectors are added sequentially using the addPoint functions.
19  * Once all points have been added a call to the function finalizeTrackTrajectory, builds the track moving the content of the vectors.
20  *
21  * @author G. Cerati (FNAL, MicroBooNE)
22  * @date 2017
23  * @version 1.0
24  */
25 
26  using namespace recob;
27  using Point_t = tracking::Point_t;
30 
32  public:
33  /// Constructor: needs reference to output hit vector, and hasMomenta bool (true if Vector_t are momenta, false if they are directions).
35  : hasMomenta_(hasMomenta), hits(&outhits)
36  {
37  hits->clear();
38  }
39  //
40  //@{
41  /// Avoid copies of this object
46  //@}
47  //
48  //@{
49  /// Add a single point; different version of the functions are provided using const references or rvalue references.
50  void addPoint(const Point_t& point, const Vector_t& vect, art::Ptr<Hit> hit, const PointFlags_t& flag) {
51  positions.push_back(point);
52  momenta.push_back(vect);
53  hits->push_back(hit);
54  flags.push_back(flag);
55  }
56  void addPoint(Point_t&& point, Vector_t&& vect, art::Ptr<Hit> hit, PointFlags_t&& flag) {
57  positions.push_back(std::move(point));
58  momenta.push_back(std::move(vect));
59  hits->push_back(hit);
60  flags.push_back(std::move(flag));
61  }
62  //@}
63  //
64  /// Get the finalized recob::TrackTrajectory object; internal data vectors are moved so no more points should be added.
66  return TrackTrajectory(std::move(positions),std::move(momenta),std::move(flags),hasMomenta_);
67  }
68  //
69  private:
71  std::vector<art::Ptr<Hit> >* hits;
72  std::vector<Point_t> positions;
73  std::vector<Vector_t> momenta;
74  std::vector<PointFlags_t> flags;
75  //
76  };
77 
78 }
79 #endif
recob::TrajectoryPointFlags PointFlags_t
Type for flags of a point/hit.
tracking::Point_t Point_t
void addPoint(Point_t &&point, Vector_t &&vect, art::Ptr< Hit > hit, PointFlags_t &&flag)
Reconstruction base classes.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >> Point_t
struct vector vector
tracking::Vector_t Vector_t
Helper class to aid the creation of a recob::TrackTrajectory, keeping data vectors in sync...
A trajectory in space reconstructed from hits.
def move(depos, offset)
Definition: depos.py:107
TrackTrajectoryCreationBookKeeper(std::vector< art::Ptr< Hit > > &outhits, bool hasMomenta)
Constructor: needs reference to output hit vector, and hasMomenta bool (true if Vector_t are momenta...
Detector simulation of raw signals on wires.
Declaration of signal hit object.
recob::tracking::Vector_t Vector_t
Definition: fwd.h:31
Set of flags pertaining a point of the track.
TrackTrajectory::PointFlags_t PointFlags_t
void addPoint(const Point_t &point, const Vector_t &vect, art::Ptr< Hit > hit, const PointFlags_t &flag)
Add a single point; different version of the functions are provided using const references or rvalue ...
TrackTrajectory finalizeTrackTrajectory()
Get the finalized recob::TrackTrajectory object; internal data vectors are moved so no more points sh...