TrackHitMeta.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////////
2 ///
3 /// \file lardataobj/RecoBase/TrackHitMeta.h
4 ///
5 /// \brief Class to keep data related to `recob::Hit` associated with `recob::Track`.
6 ///
7 /// \author R. Sulej
8 ///
9 ////////////////////////////////////////////////////////////////////////////////////
10 
11 #ifndef LARDATAOBJ_RECOBASE_TRACKHITMETA_H
12 #define LARDATAOBJ_RECOBASE_TRACKHITMETA_H
13 
14 #include <iosfwd>
15 
16 // #include "larcoreobj/SimpleTypesAndConstants/geo_vectors.h"
17 
18 namespace recob {
19 
20 /**
21  * \brief Data related to `recob::Hit` associated with `recob::Track`.
22  * \ingroup DataProductRecoBase
23  *
24  * The purpose is to collect several variables that do not work well alone inside
25  * track class and are related to 2D hits along the 3D trajectory. So in the first
26  * place it is the hit index along the trajectory.
27  * There is also dx associated to hit to help dE/dx calculations.
28  *
29  * Please, add other variables that may fit here. One candidate is 3D position.
30  *
31  * PLEASE, remember to add **errors on values** whenever this is possible to calculate.
32  *
33  * The expected association takes the form of:
34  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
35  * art::Assns<recob::Track, recob::Hit, recob::TrackHitMeta>
36  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37  * It is also expected and recommended practice to create the association list
38  * sorted by track, as in the
39  * @ref LArSoftProxyDefinitionOneToManySeqAssn "one-to-many sequential association"
40  * definition.
41  *
42  */
44 {
45 public:
46  /// Default needed by ROOT.
47  TrackHitMeta() = default;
48 
49  /// Constructor with initialization.
50  TrackHitMeta(unsigned int idx, double dx = 0.0)
51  : fIndex(idx), fDx(dx)
52  {}
53 
54  /// Hit index along the track trajectory.
55  unsigned int Index() const { return fIndex; }
56 
57  /**
58  * \brief Length of the track segments associated with the 2D hit.
59  * \return lenth of the track segments [cm]
60  *
61  * The length is the sum of lengths of the two segments: half-distance to the
62  * next hit in the same plane and half-distance to the preceding hit in the
63  * same plane.
64  */
65  double Dx() const { return fDx; }
66 
67  // /// Candidate to keep 3D trajectory point here instead of inside recob::Track
68  //geo::Point_t const & Position3D(void) const { return fPosition3D; }
69 
70 private:
71  unsigned int fIndex = 0U; ///< Stored index of the hit in the sequence.
72  double fDx = 0.0; ///< Stored _dx_ size, in centimeters.
73 
74  //geo::Point_t fPosition3D;
75 }; // class TrackHitMeta
76 
77 
78 inline std::ostream& operator<< (std::ostream& o, const TrackHitMeta & a)
79  { o << a.Index(); return o; }
80 
81 inline bool operator < (const TrackHitMeta & a, const TrackHitMeta & b)
82  { return a.Index() < b.Index(); }
83 
84 
85 } // namespace recob
86 
87 #endif // LARDATAOBJ_RECOBASE_TRACKHITMETA_H
Reconstruction base classes.
bool operator<(Cluster const &a, Cluster const &b)
Definition: Cluster.cxx:196
Data related to recob::Hit associated with recob::Track.The purpose is to collect several variables t...
Definition: TrackHitMeta.h:43
TrackHitMeta(unsigned int idx, double dx=0.0)
Constructor with initialization.
Definition: TrackHitMeta.h:50
const double a
double Dx() const
Length of the track segments associated with the 2D hit.
Definition: TrackHitMeta.h:65
static bool * b
Definition: config.cpp:1043
unsigned int Index() const
Hit index along the track trajectory.
Definition: TrackHitMeta.h:55
double fDx
Stored dx size, in centimeters.
Definition: TrackHitMeta.h:72
unsigned int fIndex
Stored index of the hit in the sequence.
Definition: TrackHitMeta.h:71
std::ostream & operator<<(std::ostream &o, Cluster const &c)
Definition: Cluster.cxx:173
TrackHitMeta()=default
Default needed by ROOT.