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