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) = 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
112 /// Set the Track 3-position at the vertex
113 void setPosition(const edm4hep::Vector3f& position);
114 /// Get mutable reference to Track 3-position at the vertex
115 edm4hep::Vector3f& getPosition();
116
117 /// Set the Track 3-momentum at the vertex [GeV]
118 void setMomentum(const edm4hep::Vector3f& momentum);
119 /// Get mutable reference to Track 3-momentum at the vertex [GeV]
120 edm4hep::Vector3f& getMomentum();
121
122 /// Set the Covariance matrix in basis [x,y,z,px,py,pz]
123 void setPositionMomentumCovariance(const edm4eic::Cov6f& positionMomentumCovariance);
124 /// Get mutable reference to Covariance matrix in basis [x,y,z,px,py,pz]
126
127 /// Set the Track time at the vertex [ns]
128 void setTime(const float time);
129 /// Get mutable reference to Track time at the vertex [ns]
130 float& getTime();
131
132 /// Set the Error on the track vertex time
133 void setTimeError(const float timeError);
134 /// Get mutable reference to Error on the track vertex time
135 float& getTimeError();
136
137 /// Set the Particle charge
138 void setCharge(const float charge);
139 /// Get mutable reference to Particle charge
140 float& getCharge();
141
142 /// Set the Total chi2
143 void setChi2(const float chi2);
144 /// Get mutable reference to Total chi2
145 float& getChi2();
146
147 /// Set the Number of degrees of freedom
148 void setNdf(const std::uint32_t ndf);
149 /// Get mutable reference to Number of degrees of freedom
150 std::uint32_t& getNdf();
151
152 /// Set the PDG particle ID hypothesis
153 void setPdg(const std::int32_t pdg);
154 /// Get mutable reference to PDG particle ID hypothesis
155 std::int32_t& getPdg();
156
157
158 /// Set the Trajectory of this track
159 void setTrajectory(const edm4eic::Trajectory& value);
160
162 std::size_t measurements_size() const;
163 edm4eic::Measurement2D getMeasurements(std::size_t) const;
164 std::vector<edm4eic::Measurement2D>::const_iterator measurements_begin() const;
165 std::vector<edm4eic::Measurement2D>::const_iterator measurements_end() const;
166 podio::RelationRange<edm4eic::Measurement2D> getMeasurements() const;
167 void addToTracks(const edm4eic::Track&);
168 std::size_t tracks_size() const;
169 edm4eic::Track getTracks(std::size_t) const;
170 std::vector<edm4eic::Track>::const_iterator tracks_begin() const;
171 std::vector<edm4eic::Track>::const_iterator tracks_end() const;
172 podio::RelationRange<edm4eic::Track> getTracks() const;
173
174
175
176 /// check whether the object is actually available
177 bool isAvailable() const;
178 /// disconnect from TrackObj instance
179 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackObj>{nullptr}; }
180
181 constexpr bool operator==(const MutableTrack& other) const { return m_obj == other.m_obj; }
182 bool operator==(const Track& other) const;
183
184 constexpr bool operator!=(const MutableTrack& other) const { return !(*this == other); }
185 bool operator!=(const Track& other) const { return !(*this == other); }
186
187 // less comparison operator, so that objects can be e.g. stored in sets.
188 bool operator<(const MutableTrack& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
189
190 podio::ObjectID id() const { return getObjectID(); }
191
192 const podio::ObjectID getObjectID() const;
193
194 friend std::hash<MutableTrack>;
195
196 friend void swap(MutableTrack& a, MutableTrack& b) {
197 using std::swap;
198 swap(a.m_obj, b.m_obj); // swap out the internal pointers
199 }
200
201private:
202 /// constructor from existing TrackObj
203 explicit MutableTrack(podio::utils::MaybeSharedPtr<TrackObj> obj);
204
205 podio::utils::MaybeSharedPtr<TrackObj> m_obj{new TrackObj{}, podio::utils::MarkOwned};
206};
207
208#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
209void to_json(nlohmann::json& j, const MutableTrack& value);
210#endif
211
212
213} // namespace edm4eic
214
215
216
217template<>
218struct std::hash<edm4eic::MutableTrack> {
219 std::size_t operator()(const edm4eic::MutableTrack& obj) const {
220 return std::hash<edm4eic::TrackObj*>{}(obj.m_obj.get());
221 }
222};
223
224
225#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:190
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:196
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:188
bool operator!=(const Track &other) const
Definition MutableTrack.h:185
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
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
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:179
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
MutableTrack(const MutableTrack &other)=default
copy constructor
constexpr bool operator!=(const MutableTrack &other) const
Definition MutableTrack.h:184
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:181
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:61
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::MutableTrack &obj) const
Definition MutableTrack.h:219