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;
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(const std::int32_t type, const edm4hep::Vector3f& position, const edm4hep::Vector3f& momentum, const edm4eic::Cov6f& positionMomentumCovariance, const float time, const float timeError, const float charge, const float chi2, const std::uint32_t ndf, const std::int32_t pdg);
55
56 /// copy constructor
57 MutableTrack(const MutableTrack& other) = default;
58
59 /// copy-assignment operator
60 MutableTrack& operator=(MutableTrack other) &; // Rebind this to other's internal object
61 MutableTrack& operator=(MutableTrack other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
62
63 /// create a mutable deep-copy of the object with identical relations
64 /// if cloneRelations=false, the relations are not cloned and will be empty
65 MutableTrack clone(bool cloneRelations=true) const;
66
67 /// destructor
68 ~MutableTrack() = default;
69
70
71public:
72
73 /// Access the Flag that defines the type of track
74 std::int32_t getType() const;
75
76 /// Access the Track 3-position at the vertex
77 const edm4hep::Vector3f& getPosition() const;
78
79 /// Access the Track 3-momentum at the vertex [GeV]
80 const edm4hep::Vector3f& getMomentum() const;
81
82 /// Access the Covariance matrix in basis [x,y,z,px,py,pz]
84
85 /// Access the Track time at the vertex [ns]
86 float getTime() const;
87
88 /// Access the Error on the track vertex time
89 float getTimeError() const;
90
91 /// Access the Particle charge
92 float getCharge() const;
93
94 /// Access the Total chi2
95 float getChi2() const;
96
97 /// Access the Number of degrees of freedom
98 std::uint32_t getNdf() const;
99
100 /// Access the PDG particle ID hypothesis
101 std::int32_t getPdg() const;
102
103
104 /// Access the Trajectory of this track
106
107 /// Set the Flag that defines the type of track
108 void setType(const std::int32_t type);
109 /// Get mutable reference to Flag that defines the type of track
110 std::int32_t& getType();
111 /// Get reference to Flag that defines the type of track
112 [[deprecated("use getType instead")]]
113 std::int32_t& type();
114
115 /// Set the Track 3-position at the vertex
116 void setPosition(const edm4hep::Vector3f& position);
117 /// Get mutable reference to Track 3-position at the vertex
118 edm4hep::Vector3f& getPosition();
119 /// Get reference to Track 3-position at the vertex
120 [[deprecated("use getPosition instead")]]
121 edm4hep::Vector3f& position();
122
123 /// Set the Track 3-momentum at the vertex [GeV]
124 void setMomentum(const edm4hep::Vector3f& momentum);
125 /// Get mutable reference to Track 3-momentum at the vertex [GeV]
126 edm4hep::Vector3f& getMomentum();
127 /// Get reference to Track 3-momentum at the vertex [GeV]
128 [[deprecated("use getMomentum instead")]]
129 edm4hep::Vector3f& momentum();
130
131 /// Set the Covariance matrix in basis [x,y,z,px,py,pz]
133 /// Get mutable reference to Covariance matrix in basis [x,y,z,px,py,pz]
135 /// Get reference to Covariance matrix in basis [x,y,z,px,py,pz]
136 [[deprecated("use getPositionMomentumCovariance instead")]]
138
139 /// Set the Track time at the vertex [ns]
140 void setTime(const float time);
141 /// Get mutable reference to Track time at the vertex [ns]
142 float& getTime();
143 /// Get reference to Track time at the vertex [ns]
144 [[deprecated("use getTime instead")]]
145 float& time();
146
147 /// Set the Error on the track vertex time
148 void setTimeError(const float timeError);
149 /// Get mutable reference to Error on the track vertex time
150 float& getTimeError();
151 /// Get reference to Error on the track vertex time
152 [[deprecated("use getTimeError instead")]]
153 float& timeError();
154
155 /// Set the Particle charge
156 void setCharge(const float charge);
157 /// Get mutable reference to Particle charge
158 float& getCharge();
159 /// Get reference to Particle charge
160 [[deprecated("use getCharge instead")]]
161 float& charge();
162
163 /// Set the Total chi2
164 void setChi2(const float chi2);
165 /// Get mutable reference to Total chi2
166 float& getChi2();
167 /// Get reference to Total chi2
168 [[deprecated("use getChi2 instead")]]
169 float& chi2();
170
171 /// Set the Number of degrees of freedom
172 void setNdf(const std::uint32_t ndf);
173 /// Get mutable reference to Number of degrees of freedom
174 std::uint32_t& getNdf();
175 /// Get reference to Number of degrees of freedom
176 [[deprecated("use getNdf instead")]]
177 std::uint32_t& ndf();
178
179 /// Set the PDG particle ID hypothesis
180 void setPdg(const std::int32_t pdg);
181 /// Get mutable reference to PDG particle ID hypothesis
182 std::int32_t& getPdg();
183 /// Get reference to PDG particle ID hypothesis
184 [[deprecated("use getPdg instead")]]
185 std::int32_t& pdg();
186
187
188 /// Set the Trajectory of this track
189 void setTrajectory(const edm4eic::Trajectory& value);
190
192 std::size_t measurements_size() const;
193 edm4eic::Measurement2D getMeasurements(std::size_t) const;
194 std::vector<edm4eic::Measurement2D>::const_iterator measurements_begin() const;
195 std::vector<edm4eic::Measurement2D>::const_iterator measurements_end() const;
196 podio::RelationRange<edm4eic::Measurement2D> getMeasurements() const;
197 void addToTracks(const edm4eic::Track&);
198 std::size_t tracks_size() const;
199 edm4eic::Track getTracks(std::size_t) const;
200 std::vector<edm4eic::Track>::const_iterator tracks_begin() const;
201 std::vector<edm4eic::Track>::const_iterator tracks_end() const;
202 podio::RelationRange<edm4eic::Track> getTracks() const;
203
204
205
206 /// check whether the object is actually available
207 bool isAvailable() const;
208 /// disconnect from TrackObj instance
209 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackObj>{nullptr}; }
210
211 bool operator==(const MutableTrack& other) const { return m_obj == other.m_obj; }
212 bool operator==(const Track& other) const;
213
214 bool operator!=(const MutableTrack& other) const { return !(*this == other); }
215 bool operator!=(const Track& other) const { return !(*this == other); }
216
217 // less comparison operator, so that objects can be e.g. stored in sets.
218 bool operator<(const MutableTrack& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
219
220 podio::ObjectID id() const { return getObjectID(); }
221
222 const podio::ObjectID getObjectID() const;
223
224 friend std::hash<MutableTrack>;
225
226 friend void swap(MutableTrack& a, MutableTrack& b) {
227 using std::swap;
228 swap(a.m_obj, b.m_obj); // swap out the internal pointers
229 }
230
231private:
232 /// constructor from existing TrackObj
233 explicit MutableTrack(podio::utils::MaybeSharedPtr<TrackObj> obj);
234
235 podio::utils::MaybeSharedPtr<TrackObj> m_obj{nullptr};
236};
237
238#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
239void to_json(nlohmann::json& j, const MutableTrack& value);
240#endif
241
242
243} // namespace edm4eic
244
245
246
247template<>
248struct std::hash<edm4eic::MutableTrack> {
249 std::size_t operator()(const edm4eic::MutableTrack& obj) const {
250 return std::hash<edm4eic::TrackObj*>{}(obj.m_obj.get());
251 }
252};
253
254
255#endif
Definition Cov6f.h:19
Definition Measurement2D.h:46
Definition MutableTrack.h:40
void setTimeError(const float timeError)
Set the Error on the track vertex time.
Definition MutableTrack.cc:91
void setNdf(const std::uint32_t ndf)
Set the Number of degrees of freedom.
Definition MutableTrack.cc:100
void setTrajectory(const edm4eic::Trajectory &value)
Set the Trajectory of this track.
Definition MutableTrack.cc:107
~MutableTrack()=default
destructor
friend class TrackMutableCollectionIterator
Definition MutableTrack.h:43
podio::ObjectID id() const
Definition MutableTrack.h:220
std::int32_t & pdg()
Get reference to PDG particle ID hypothesis.
Definition MutableTrack.cc:105
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:226
const edm4eic::Trajectory getTrajectory() const
Access the Trajectory of this track.
Definition MutableTrack.cc:68
const podio::ObjectID getObjectID() const
Definition MutableTrack.cc:193
std::int32_t & type()
Get reference to Flag that defines the type of track.
Definition MutableTrack.cc:78
void setPdg(const std::int32_t pdg)
Set the PDG particle ID hypothesis.
Definition MutableTrack.cc:103
Track object_type
Definition MutableTrack.h:47
float & chi2()
Get reference to Total chi2.
Definition MutableTrack.cc:99
bool operator<(const MutableTrack &other) const
Definition MutableTrack.h:218
bool operator!=(const Track &other) const
Definition MutableTrack.h:215
void setCharge(const float charge)
Set the Particle charge.
Definition MutableTrack.cc:94
std::int32_t getType() const
Access the Flag that defines the type of track.
Definition MutableTrack.cc:57
void setTime(const float time)
Set the Track time at the vertex [ns].
Definition MutableTrack.cc:88
float getChi2() const
Access the Total chi2.
Definition MutableTrack.cc:64
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 & operator=(MutableTrack other) &&=delete
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:214
void setPosition(const edm4hep::Vector3f &position)
Set the Track 3-position at the vertex.
Definition MutableTrack.cc:79
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
void unlink()
disconnect from TrackObj instance
Definition MutableTrack.h:209
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
TrackCollection collection_type
Definition MutableTrack.h:48
edm4hep::Vector3f & momentum()
Get reference to Track 3-momentum at the vertex [GeV].
Definition MutableTrack.cc:84
void setType(const std::int32_t type)
Set the Flag that defines the type of track.
Definition MutableTrack.cc:76
std::size_t tracks_size() const
Definition MutableTrack.cc:165
MutableTrack(const MutableTrack &other)=default
copy constructor
void setMomentum(const edm4hep::Vector3f &momentum)
Set the Track 3-momentum at the vertex [GeV].
Definition MutableTrack.cc:82
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
void setChi2(const float chi2)
Set the Total chi2.
Definition MutableTrack.cc:97
friend class Track
Definition MutableTrack.h:44
float & timeError()
Get reference to Error on the track vertex time.
Definition MutableTrack.cc:93
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:211
float & time()
Get reference to Track time at the vertex [ns].
Definition MutableTrack.cc:90
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
MutableTrack & operator=(MutableTrack other) &
copy-assignment operator
Definition MutableTrack.cc:36
std::vector< edm4eic::Measurement2D >::const_iterator measurements_begin() const
Definition MutableTrack.cc:117
void setPositionMomentumCovariance(const edm4eic::Cov6f &positionMomentumCovariance)
Set the Covariance matrix in basis [x,y,z,px,py,pz].
Definition MutableTrack.cc:85
Definition MutableTrajectory.h:39
Definition TrackCollection.h:137
Definition Track.h:48
Definition Trajectory.h:47
Definition CalorimeterHit.cc:17
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:150
std::size_t operator()(const edm4eic::MutableTrack &obj) const
Definition MutableTrack.h:249