All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrackTrajectoryCreationBookKeeper.h
Go to the documentation of this file.
1 #ifndef TRACKTRAJECTORYCREATIONBOOKKEEPER_H
2 #define TRACKTRAJECTORYCREATIONBOOKKEEPER_H
3 
4 #include "canvas/Persistency/Common/Ptr.h"
8 
9 #include <utility>
10 #include <vector>
11 
12 namespace trkmkr {
13 
14  /**
15  * @file larreco/RecoAlg/TrackTrajectoryCreationBookKeeper.h
16  * @class trkmkr::TrackTrajectoryCreationBookKeeper
17  *
18  * @brief Helper class to aid the creation of a recob::TrackTrajectory, keeping data vectors in sync.
19  *
20  * Helper class to aid the creation of a recob::TrackTrajectory, keeping data vectors (Point_t, Vector_t, PointFlags_t, Hit) in sync.
21  * Elements of those vectors are added sequentially using the addPoint functions.
22  * Once all points have been added a call to the function finalizeTrackTrajectory, builds the track moving the content of the vectors.
23  *
24  * @author G. Cerati (FNAL, MicroBooNE)
25  * @date 2017
26  * @version 1.0
27  */
28 
32 
34  public:
35  /// Constructor: needs reference to output hit vector, and hasMomenta bool (true if Vector_t are momenta, false if they are directions).
36  TrackTrajectoryCreationBookKeeper(std::vector<art::Ptr<recob::Hit> >& outhits, bool hasMomenta)
37  : hasMomenta_(hasMomenta), hits(&outhits)
38  {
39  hits->clear();
40  }
41  //
42  //@{
43  /// Avoid copies of this object
48  //@}
49  //
50  //@{
51  /// Add a single point; different version of the functions are provided using const references or rvalue references.
52  void addPoint(const Point_t& point, const Vector_t& vect, art::Ptr<recob::Hit> hit, const PointFlags_t& flag) {
53  positions.push_back(point);
54  momenta.push_back(vect);
55  hits->push_back(hit);
56  flags.push_back(flag);
57  }
58  void addPoint(Point_t&& point, Vector_t&& vect, art::Ptr<recob::Hit> hit, PointFlags_t&& flag) {
59  positions.push_back(std::move(point));
60  momenta.push_back(std::move(vect));
61  hits->push_back(hit);
62  flags.push_back(std::move(flag));
63  }
64  //@}
65  //
66  /// Get the finalized recob::TrackTrajectory object; internal data vectors are moved so no more points should be added.
68  return recob::TrackTrajectory(std::move(positions),std::move(momenta),std::move(flags),hasMomenta_);
69  }
70  //
71  private:
73  std::vector<art::Ptr<recob::Hit> >* hits;
74  std::vector<Point_t> positions;
75  std::vector<Vector_t> momenta;
76  std::vector<PointFlags_t> flags;
77  //
78  };
79 
80 }
81 #endif
recob::TrajectoryPointFlags PointFlags_t
Type for flags of a point/hit.
TrackTrajectoryCreationBookKeeper(std::vector< art::Ptr< recob::Hit > > &outhits, bool hasMomenta)
Constructor: needs reference to output hit vector, and hasMomenta bool (true if Vector_t are momenta...
then echo unknown compiler flag
Declaration of signal hit object.
recob::TrackTrajectory finalizeTrackTrajectory()
Get the finalized recob::TrackTrajectory object; internal data vectors are moved so no more points sh...
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
recob::tracking::Point_t Point_t
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
recob::TrackTrajectory::PointFlags_t PointFlags_t
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...
A trajectory in space reconstructed from hits.
recob::tracking::Vector_t Vector_t
Data product for reconstructed trajectory in space.
void addPoint(Point_t &&point, Vector_t &&vect, art::Ptr< recob::Hit > hit, PointFlags_t &&flag)
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
TrackTrajectoryCreationBookKeeper & operator=(const TrackTrajectoryCreationBookKeeper &)=delete
recob::tracking::Vector_t Vector_t
Set of flags pertaining a point of the track.
recob::tracking::Point_t Point_t