EDM4eic
EIC data model
Loading...
Searching...
No Matches
MutableTrack.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_MutableTrack_H
4#define EDM4EIC_MutableTrack_H
5
6#include "edm4eic/TrackObj.h"
7// Make the immutable class available from its mutable version but not vice versa
8#include "edm4eic/Track.h"
9
10#include "edm4eic/Cov6f.h"
12#include "edm4hep/Vector3f.h"
13#include "podio/RelationRange.h"
14#include <cstdint>
15#include <vector>
16
17#include "podio/utilities/MaybeSharedPtr.h"
18
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 edm4eic {
34
35
36/** @class MutableTrack
37 * Track information at the vertex
38 * @author: S. Joosten, J. Osborn
39 */
41
42 friend class TrackCollection;
44 friend class Track;
45
46public:
49
50 /// default constructor
52
53 /// Constructor initializing all members
54 MutableTrack(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);
55
56 /// copy constructor
57 MutableTrack(const MutableTrack& other) = default;
58
59 /// copy-assignment operator
61
62 /// create a mutable deep-copy of the object with identical relations
63 /// if cloneRelations=false, the relations are not cloned and will be empty
64 MutableTrack clone(bool cloneRelations=true) const;
65
66 /// destructor
67 ~MutableTrack() = default;
68
69
70public:
71
72 /// Access the Flag that defines the type of track
73 std::int32_t getType() const;
74
75 /// Access the Track 3-position at the vertex
76 const edm4hep::Vector3f& getPosition() const;
77
78 /// Access the Track 3-momentum at the vertex [GeV]
79 const edm4hep::Vector3f& getMomentum() const;
80
81 /// Access the Covariance matrix in basis [x,y,z,px,py,pz]
83
84 /// Access the Track time at the vertex [ns]
85 float getTime() const;
86
87 /// Access the Error on the track vertex time
88 float getTimeError() const;
89
90 /// Access the Particle charge
91 float getCharge() const;
92
93 /// Access the Total chi2
94 float getChi2() const;
95
96 /// Access the Number of degrees of freedom
97 std::uint32_t getNdf() const;
98
99 /// Access the PDG particle ID hypothesis
100 std::int32_t getPdg() const;
101
102
103 /// Access the Trajectory of this track
105
106 /// Set the Flag that defines the type of track
107 void setType(std::int32_t value);
108 /// Get mutable reference to Flag that defines the type of track
109 std::int32_t& getType();
110 /// Get reference to Flag that defines the type of track
111 [[deprecated("use getType instead")]]
112 std::int32_t& type();
113
114 /// Set the Track 3-position at the vertex
115 void setPosition(edm4hep::Vector3f value);
116 /// Get mutable reference to Track 3-position at the vertex
117 edm4hep::Vector3f& getPosition();
118 /// Get reference to Track 3-position at the vertex
119 [[deprecated("use getPosition instead")]]
120 edm4hep::Vector3f& position();
121
122 /// Set the Track 3-momentum at the vertex [GeV]
123 void setMomentum(edm4hep::Vector3f value);
124 /// Get mutable reference to Track 3-momentum at the vertex [GeV]
125 edm4hep::Vector3f& getMomentum();
126 /// Get reference to Track 3-momentum at the vertex [GeV]
127 [[deprecated("use getMomentum instead")]]
128 edm4hep::Vector3f& momentum();
129
130 /// Set the Covariance matrix in basis [x,y,z,px,py,pz]
132 /// Get mutable reference to Covariance matrix in basis [x,y,z,px,py,pz]
134 /// Get reference to Covariance matrix in basis [x,y,z,px,py,pz]
135 [[deprecated("use getPositionMomentumCovariance instead")]]
137
138 /// Set the Track time at the vertex [ns]
139 void setTime(float value);
140 /// Get mutable reference to Track time at the vertex [ns]
141 float& getTime();
142 /// Get reference to Track time at the vertex [ns]
143 [[deprecated("use getTime instead")]]
144 float& time();
145
146 /// Set the Error on the track vertex time
147 void setTimeError(float value);
148 /// Get mutable reference to Error on the track vertex time
149 float& getTimeError();
150 /// Get reference to Error on the track vertex time
151 [[deprecated("use getTimeError instead")]]
152 float& timeError();
153
154 /// Set the Particle charge
155 void setCharge(float value);
156 /// Get mutable reference to Particle charge
157 float& getCharge();
158 /// Get reference to Particle charge
159 [[deprecated("use getCharge instead")]]
160 float& charge();
161
162 /// Set the Total chi2
163 void setChi2(float value);
164 /// Get mutable reference to Total chi2
165 float& getChi2();
166 /// Get reference to Total chi2
167 [[deprecated("use getChi2 instead")]]
168 float& chi2();
169
170 /// Set the Number of degrees of freedom
171 void setNdf(std::uint32_t value);
172 /// Get mutable reference to Number of degrees of freedom
173 std::uint32_t& getNdf();
174 /// Get reference to Number of degrees of freedom
175 [[deprecated("use getNdf instead")]]
176 std::uint32_t& ndf();
177
178 /// Set the PDG particle ID hypothesis
179 void setPdg(std::int32_t value);
180 /// Get mutable reference to PDG particle ID hypothesis
181 std::int32_t& getPdg();
182 /// Get reference to PDG particle ID hypothesis
183 [[deprecated("use getPdg instead")]]
184 std::int32_t& pdg();
185
186
187 /// Set the Trajectory of this track
188 void setTrajectory(const edm4eic::Trajectory& value);
189
191 std::size_t measurements_size() const;
192 edm4eic::Measurement2D getMeasurements(std::size_t) const;
193 std::vector<edm4eic::Measurement2D>::const_iterator measurements_begin() const;
194 std::vector<edm4eic::Measurement2D>::const_iterator measurements_end() const;
195 podio::RelationRange<edm4eic::Measurement2D> getMeasurements() const;
196 void addToTracks(const edm4eic::Track&);
197 std::size_t tracks_size() const;
198 edm4eic::Track getTracks(std::size_t) const;
199 std::vector<edm4eic::Track>::const_iterator tracks_begin() const;
200 std::vector<edm4eic::Track>::const_iterator tracks_end() const;
201 podio::RelationRange<edm4eic::Track> getTracks() const;
202
203
204
205 /// check whether the object is actually available
206 bool isAvailable() const;
207 /// disconnect from TrackObj instance
208 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackObj>{nullptr}; }
209
210 bool operator==(const MutableTrack& other) const { return m_obj == other.m_obj; }
211 bool operator==(const Track& other) const;
212
213 bool operator!=(const MutableTrack& other) const { return !(*this == other); }
214 bool operator!=(const Track& other) const { return !(*this == other); }
215
216 // less comparison operator, so that objects can be e.g. stored in sets.
217 bool operator<(const MutableTrack& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
218
219 podio::ObjectID id() const { return getObjectID(); }
220
221 const podio::ObjectID getObjectID() const;
222
223 friend void swap(MutableTrack& a, MutableTrack& b) {
224 using std::swap;
225 swap(a.m_obj, b.m_obj); // swap out the internal pointers
226 }
227
228private:
229 /// constructor from existing TrackObj
230 explicit MutableTrack(podio::utils::MaybeSharedPtr<TrackObj> obj);
231
232 podio::utils::MaybeSharedPtr<TrackObj> m_obj{nullptr};
233};
234
235#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
236void to_json(nlohmann::json& j, const MutableTrack& value);
237#endif
238
239
240} // namespace edm4eic
241
242
243#endif
Definition Cov6f.h:19
Definition Measurement2D.h:46
Definition MutableTrack.h:40
void setTrajectory(const edm4eic::Trajectory &value)
Set the Trajectory of this track.
Definition MutableTrack.cc:107
~MutableTrack()=default
destructor
podio::ObjectID id() const
Definition MutableTrack.h:219
std::int32_t & pdg()
Get reference to PDG particle ID hypothesis.
Definition MutableTrack.cc:105
void setPdg(std::int32_t value)
Set the PDG particle ID hypothesis.
Definition MutableTrack.cc:103
std::int32_t getPdg() const
Access the PDG particle ID hypothesis.
Definition MutableTrack.cc:66
float & charge()
Get reference to Particle charge.
Definition MutableTrack.cc:96
friend void swap(MutableTrack &a, MutableTrack &b)
Definition MutableTrack.h:223
void setTime(float value)
Set the Track time at the vertex [ns].
Definition MutableTrack.cc:88
const edm4eic::Trajectory getTrajectory() const
Access the Trajectory of this track.
Definition MutableTrack.cc:68
const podio::ObjectID getObjectID() const
Definition MutableTrack.cc:193
void setType(std::int32_t value)
Set the Flag that defines the type of track.
Definition MutableTrack.cc:76
std::int32_t & type()
Get reference to Flag that defines the type of track.
Definition MutableTrack.cc:78
float & chi2()
Get reference to Total chi2.
Definition MutableTrack.cc:99
bool operator<(const MutableTrack &other) const
Definition MutableTrack.h:217
void setTimeError(float value)
Set the Error on the track vertex time.
Definition MutableTrack.cc:91
bool operator!=(const Track &other) const
Definition MutableTrack.h:214
std::int32_t getType() const
Access the Flag that defines the type of track.
Definition MutableTrack.cc:57
float getChi2() const
Access the Total chi2.
Definition MutableTrack.cc:64
void setPosition(edm4hep::Vector3f value)
Set the Track 3-position at the vertex.
Definition MutableTrack.cc:79
std::size_t measurements_size() const
Definition MutableTrack.cc:129
std::vector< edm4eic::Track >::const_iterator tracks_end() const
Definition MutableTrack.cc:159
podio::RelationRange< edm4eic::Measurement2D > getMeasurements() const
Definition MutableTrack.cc:140
MutableTrack()
default constructor
Definition MutableTrack.cc:19
MutableTrack clone(bool cloneRelations=true) const
Definition MutableTrack.cc:41
edm4hep::Vector3f & position()
Get reference to Track 3-position at the vertex.
Definition MutableTrack.cc:81
const edm4hep::Vector3f & getMomentum() const
Access the Track 3-momentum at the vertex [GeV].
Definition MutableTrack.cc:59
bool operator!=(const MutableTrack &other) const
Definition MutableTrack.h:213
void setMomentum(edm4hep::Vector3f value)
Set the Track 3-momentum at the vertex [GeV].
Definition MutableTrack.cc:82
podio::RelationRange< edm4eic::Track > getTracks() const
Definition MutableTrack.cc:176
float getTimeError() const
Access the Error on the track vertex time.
Definition MutableTrack.cc:62
void addToTracks(const edm4eic::Track &)
Definition MutableTrack.cc:148
MutableTrack & operator=(MutableTrack other)
copy-assignment operator
Definition MutableTrack.cc:36
void unlink()
disconnect from TrackObj instance
Definition MutableTrack.h:208
edm4eic::Cov6f & positionMomentumCovariance()
Get reference to Covariance matrix in basis [x,y,z,px,py,pz].
Definition MutableTrack.cc:87
std::vector< edm4eic::Track >::const_iterator tracks_begin() const
Definition MutableTrack.cc:153
edm4hep::Vector3f & momentum()
Get reference to Track 3-momentum at the vertex [GeV].
Definition MutableTrack.cc:84
std::size_t tracks_size() const
Definition MutableTrack.cc:165
MutableTrack(const MutableTrack &other)=default
copy constructor
float getCharge() const
Access the Particle charge.
Definition MutableTrack.cc:63
const edm4eic::Cov6f & getPositionMomentumCovariance() const
Access the Covariance matrix in basis [x,y,z,px,py,pz].
Definition MutableTrack.cc:60
std::uint32_t & ndf()
Get reference to Number of degrees of freedom.
Definition MutableTrack.cc:102
bool isAvailable() const
check whether the object is actually available
Definition MutableTrack.cc:189
void addToMeasurements(const edm4eic::Measurement2D &)
Definition MutableTrack.cc:112
friend class Track
Definition MutableTrack.h:44
float & timeError()
Get reference to Error on the track vertex time.
Definition MutableTrack.cc:93
void setNdf(std::uint32_t value)
Set the Number of degrees of freedom.
Definition MutableTrack.cc:100
void setPositionMomentumCovariance(edm4eic::Cov6f value)
Set the Covariance matrix in basis [x,y,z,px,py,pz].
Definition MutableTrack.cc:85
std::uint32_t getNdf() const
Access the Number of degrees of freedom.
Definition MutableTrack.cc:65
const edm4hep::Vector3f & getPosition() const
Access the Track 3-position at the vertex.
Definition MutableTrack.cc:58
bool operator==(const MutableTrack &other) const
Definition MutableTrack.h:210
void setChi2(float value)
Set the Total chi2.
Definition MutableTrack.cc:97
float & time()
Get reference to Track time at the vertex [ns].
Definition MutableTrack.cc:90
void setCharge(float value)
Set the Particle charge.
Definition MutableTrack.cc:94
float getTime() const
Access the Track time at the vertex [ns].
Definition MutableTrack.cc:61
friend class TrackCollection
Definition MutableTrack.h:42
std::vector< edm4eic::Measurement2D >::const_iterator measurements_end() const
Definition MutableTrack.cc:123
std::vector< edm4eic::Measurement2D >::const_iterator measurements_begin() const
Definition MutableTrack.cc:117
Definition TrackCollection.h:91
Definition Track.h:48
Definition TrackCollection.h:62
Definition Trajectory.h:47
Definition CalorimeterHit.cc:17
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:150