EDM4eic
EIC data model
Loading...
Searching...
No Matches
Track.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_Track_H
4#define EDM4EIC_Track_H
5
6#include "edm4eic/TrackObj.h"
7
8#include "edm4eic/Cov6f.h"
10#include "edm4hep/Vector3f.h"
11#include "podio/RelationRange.h"
12#include <cstdint>
13#include <vector>
14
15#include "podio/utilities/MaybeSharedPtr.h"
16#include "podio/detail/OrderKey.h"
17
18#include <ostream>
19#include <cstdint>
20
21#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
22#include "nlohmann/json_fwd.hpp"
23#endif
24
25// forward declarations
26namespace edm4eic {
27class TrackCollection;
28class Trajectory;
29class MutableTrajectory;
30}
31
32
33namespace podio::detail {
34// Internal function used in less comparison operators of the datatypes and interface types
35OrderKey getOrderKey(const edm4eic::Track& obj);
36};
37
38namespace edm4eic {
39
40class MutableTrack;
41class TrackCollection;
42class TrackCollectionData;
43
44/** @class Track
45 * Track information at the vertex
46 * @author: S. Joosten, J. Osborn
47 */
48class Track {
49
50 friend class MutableTrack;
51 friend class TrackCollection;
54 friend podio::detail::OrderKey podio::detail::getOrderKey(const Track & obj);
55
56public:
59
60 /// default constructor
61 Track();
62
63 /// Constructor initializing all members
64 Track(std::int32_t type, edm4hep::Vector3f position, edm4hep::Vector3f momentum, edm4eic::Cov6f positionMomentumCovariance, float time, float timeError, float charge, float chi2, std::uint32_t ndf, std::int32_t pdg);
65
66 /// copy constructor
67 Track(const Track& other) = default;
68
69 /// copy-assignment operator
70 Track& operator=(Track other);
71
72 /// create a mutable deep-copy of the object with identical relations
73 /// if cloneRelations=false, the relations are not cloned and will be empty
74 MutableTrack clone(bool cloneRelations=true) const;
75
76 /// destructor
77 ~Track() = default;
78
79 /// converting constructor from mutable object
80 Track(const MutableTrack& other);
81
82 static Track makeEmpty();
83
84public:
85
86 static constexpr auto typeName = "edm4eic::Track";
87
88 /// Access the Flag that defines the type of track
89 std::int32_t getType() const;
90
91 /// Access the Track 3-position at the vertex
92 const edm4hep::Vector3f& getPosition() const;
93
94 /// Access the Track 3-momentum at the vertex [GeV]
95 const edm4hep::Vector3f& getMomentum() const;
96
97 /// Access the Covariance matrix in basis [x,y,z,px,py,pz]
99
100 /// Access the Track time at the vertex [ns]
101 float getTime() const;
102
103 /// Access the Error on the track vertex time
104 float getTimeError() const;
105
106 /// Access the Particle charge
107 float getCharge() const;
108
109 /// Access the Total chi2
110 float getChi2() const;
111
112 /// Access the Number of degrees of freedom
113 std::uint32_t getNdf() const;
114
115 /// Access the PDG particle ID hypothesis
116 std::int32_t getPdg() const;
117
118
119 /// Access the Trajectory of this track
121
122 std::size_t measurements_size() const;
123 edm4eic::Measurement2D getMeasurements(std::size_t) const;
124 std::vector<edm4eic::Measurement2D>::const_iterator measurements_begin() const;
125 std::vector<edm4eic::Measurement2D>::const_iterator measurements_end() const;
126 podio::RelationRange<edm4eic::Measurement2D> getMeasurements() const;
127 std::size_t tracks_size() const;
128 edm4eic::Track getTracks(std::size_t) const;
129 std::vector<edm4eic::Track>::const_iterator tracks_begin() const;
130 std::vector<edm4eic::Track>::const_iterator tracks_end() const;
131 podio::RelationRange<edm4eic::Track> getTracks() const;
132
133
134 /// check whether the object is actually available
135 bool isAvailable() const;
136 /// disconnect from TrackObj instance
137 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackObj>{nullptr}; }
138
139 bool operator==(const Track& other) const { return m_obj == other.m_obj; }
140 bool operator==(const MutableTrack& other) const;
141
142 bool operator!=(const Track& other) const { return !(*this == other); }
143 bool operator!=(const MutableTrack& other) const { return !(*this == other); }
144
145 // less comparison operator, so that objects can be e.g. stored in sets.
146 bool operator<(const Track& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
147
148 podio::ObjectID id() const { return getObjectID(); }
149
150 const podio::ObjectID getObjectID() const;
151
152 friend void swap(Track& a, Track& b) {
153 using std::swap;
154 swap(a.m_obj, b.m_obj); // swap out the internal pointers
155 }
156
157private:
158 /// constructor from existing TrackObj
159 explicit Track(podio::utils::MaybeSharedPtr<TrackObj> obj);
160 Track(TrackObj* obj);
161
162 podio::utils::MaybeSharedPtr<TrackObj> m_obj{nullptr};
163};
164
165std::ostream& operator<<(std::ostream& o, const Track& value);
166
167#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
168void to_json(nlohmann::json& j, const Track& value);
169#endif
170
171
172} // namespace edm4eic
173
174
175#endif
Definition Cov6f.h:19
Definition Measurement2D.h:46
Definition MutableTrack.h:40
Definition TrackCollectionData.h:32
Definition TrackCollection.h:91
Definition TrackCollection.h:36
Definition Track.h:48
bool operator==(const Track &other) const
Definition Track.h:139
friend class MutableTrack
Definition Track.h:50
const edm4hep::Vector3f & getPosition() const
Access the Track 3-position at the vertex.
Definition Track.cc:88
std::int32_t getType() const
Access the Flag that defines the type of track.
Definition Track.cc:87
void unlink()
disconnect from TrackObj instance
Definition Track.h:137
Track & operator=(Track other)
copy-assignment operator
Definition Track.cc:38
float getChi2() const
Access the Total chi2.
Definition Track.cc:94
const edm4hep::Vector3f & getMomentum() const
Access the Track 3-momentum at the vertex [GeV].
Definition Track.cc:89
podio::RelationRange< edm4eic::Track > getTracks() const
Definition Track.cc:162
bool operator!=(const Track &other) const
Definition Track.h:142
MutableTrack clone(bool cloneRelations=true) const
Definition Track.cc:43
std::vector< edm4eic::Measurement2D >::const_iterator measurements_end() const
Definition Track.cc:113
podio::ObjectID id() const
Definition Track.h:148
std::vector< edm4eic::Track >::const_iterator tracks_end() const
Definition Track.cc:145
~Track()=default
destructor
std::int32_t getPdg() const
Access the PDG particle ID hypothesis.
Definition Track.cc:96
friend void swap(Track &a, Track &b)
Definition Track.h:152
podio::RelationRange< edm4eic::Measurement2D > getMeasurements() const
Definition Track.cc:130
Track(const Track &other)=default
copy constructor
bool operator<(const Track &other) const
Definition Track.h:146
bool operator!=(const MutableTrack &other) const
Definition Track.h:143
float getTime() const
Access the Track time at the vertex [ns].
Definition Track.cc:91
std::vector< edm4eic::Track >::const_iterator tracks_begin() const
Definition Track.cc:139
std::size_t measurements_size() const
Definition Track.cc:119
const podio::ObjectID getObjectID() const
Definition Track.cc:178
std::uint32_t getNdf() const
Access the Number of degrees of freedom.
Definition Track.cc:95
std::size_t tracks_size() const
Definition Track.cc:151
const edm4eic::Cov6f & getPositionMomentumCovariance() const
Access the Covariance matrix in basis [x,y,z,px,py,pz].
Definition Track.cc:90
static Track makeEmpty()
Definition Track.cc:83
float getCharge() const
Access the Particle charge.
Definition Track.cc:93
const edm4eic::Trajectory getTrajectory() const
Access the Trajectory of this track.
Definition Track.cc:98
float getTimeError() const
Access the Error on the track vertex time.
Definition Track.cc:92
bool isAvailable() const
check whether the object is actually available
Definition Track.cc:174
Track()
default constructor
Definition Track.cc:21
std::vector< edm4eic::Measurement2D >::const_iterator measurements_begin() const
Definition Track.cc:107
static constexpr auto typeName
Definition Track.h:86
friend class TrackCollection
Definition Track.h:51
Definition TrackObj.h:24
Definition Trajectory.h:47
Definition CalorimeterHit.cc:17
std::ostream & operator<<(std::ostream &o, const CalorimeterHit &value)
Definition CalorimeterHit.cc:103
Definition CalorimeterHit.h:31
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:150