EICd
EIC data model
MutableTrack.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EICD_MutableTrack_H
4#define EICD_MutableTrack_H
5
6#include "eicd/TrackObj.h"
7// Make the immutable class available from its mutable version but not vice versa
8#include "eicd/Track.h"
9
10#include "eicd/Cov3f.h"
12#include "eicd/TrackerHit.h"
13#include "edm4hep/Vector3f.h"
14#include "podio/RelationRange.h"
15#include <cstdint>
16#include <vector>
17#include "podio/ObjectID.h"
18#include <ostream>
19
20#ifdef PODIO_JSON_OUTPUT
21#include "nlohmann/json.hpp"
22#endif
23
24
25
26namespace eicd {
27
28
29/** @class MutableTrack
30 * Track information at the vertex
31 * @author: S. Joosten
32 */
34
35 friend class TrackCollection;
37 friend class Track;
38
39public:
40
41 /// default constructor
43 MutableTrack(std::int32_t type, float chi2, std::int32_t ndf, edm4hep::Vector3f momentum, eicd::Cov3f momentumError, float time, float timeError, float charge);
44
45 /// constructor from existing TrackObj
47
48 /// copy constructor
49 MutableTrack(const MutableTrack& other);
50
51 /// copy-assignment operator
53
54 /// create a mutable deep-copy of the object with identical relations
55 MutableTrack clone() const;
56
57 /// destructor
59
60 /// conversion to const object
61 operator Track() const;
62
63public:
64
65 /// Access the Flag that defines the type of track
66 const std::int32_t& getType() const;
67
68 /// Access the Total chi2 (sum) of the track fit
69 const float& getChi2() const;
70
71 /// Access the Numbers of degrees of freedom of the track fit
72 const std::int32_t& getNdf() const;
73
74 /// Access the Track 3-momentum at the vertex [GeV]
75 const edm4hep::Vector3f& getMomentum() const;
76
77 /// Access the Covariance matrix on the momentum
78 const eicd::Cov3f& getMomentumError() const;
79
80 /// Access the Track time at the vertex [ns]
81 const float& getTime() const;
82
83 /// Access the Error on the track vertex time
84 const float& getTimeError() const;
85
86 /// Access the Particle charge
87 const float& getCharge() const;
88
89
90
91 /// Set the Flag that defines the type of track
92 void setType(std::int32_t value);
93
94 /// Set the Total chi2 (sum) of the track fit
95 void setChi2(float value);
96
97 /// Set the Numbers of degrees of freedom of the track fit
98 void setNdf(std::int32_t value);
99
100 /// Set the Track 3-momentum at the vertex [GeV]
101 void setMomentum(edm4hep::Vector3f value);
102 /// Get reference to Track 3-momentum at the vertex [GeV]
103 edm4hep::Vector3f& momentum();
104
105 /// Set the Covariance matrix on the momentum
106 void setMomentumError(eicd::Cov3f value);
107 /// Get reference to Covariance matrix on the momentum
109
110 /// Set the Track time at the vertex [ns]
111 void setTime(float value);
112
113 /// Set the Error on the track vertex time
114 void setTimeError(float value);
115
116 /// Set the Particle charge
117 void setCharge(float value);
118
119
120
122 unsigned int parameters_size() const;
123 eicd::TrackParameters getParameters(unsigned int) const;
124 std::vector<eicd::TrackParameters>::const_iterator parameters_begin() const;
125 std::vector<eicd::TrackParameters>::const_iterator parameters_end() const;
126 podio::RelationRange<eicd::TrackParameters> getParameters() const;
128 unsigned int trackerHits_size() const;
129 eicd::TrackerHit getTrackerHits(unsigned int) const;
130 std::vector<eicd::TrackerHit>::const_iterator trackerHits_begin() const;
131 std::vector<eicd::TrackerHit>::const_iterator trackerHits_end() const;
132 podio::RelationRange<eicd::TrackerHit> getTrackerHits() const;
134 unsigned int tracks_size() const;
135 eicd::Track getTracks(unsigned int) const;
136 std::vector<eicd::Track>::const_iterator tracks_begin() const;
137 std::vector<eicd::Track>::const_iterator tracks_end() const;
138 podio::RelationRange<eicd::Track> getTracks() const;
139
140
141
142 /// check whether the object is actually available
143 bool isAvailable() const;
144 /// disconnect from TrackObj instance
145 void unlink() { m_obj = nullptr; }
146
147 bool operator==(const MutableTrack& other) const { return m_obj == other.m_obj; }
148 bool operator==(const Track& other) const;
149
150 // less comparison operator, so that objects can be e.g. stored in sets.
151 bool operator<(const MutableTrack& other) const { return m_obj < other.m_obj; }
152
153 unsigned int id() const { return getObjectID().collectionID * 10000000 + getObjectID().index; }
154
155 const podio::ObjectID getObjectID() const;
156
157 friend void swap(MutableTrack& a, MutableTrack& b) {
158 using std::swap;
159 swap(a.m_obj, b.m_obj); // swap out the internal pointers
160 }
161
162private:
163 TrackObj* m_obj;
164};
165
166#ifdef PODIO_JSON_OUTPUT
167void to_json(nlohmann::json& j, const MutableTrack& value);
168#endif
169
170
171} // namespace eicd
172
173
174#endif
Definition: Cov3f.h:15
Definition: MutableTrack.h:33
MutableTrack clone() const
create a mutable deep-copy of the object with identical relations
Definition: MutableTrack.cc:47
bool operator==(const MutableTrack &other) const
Definition: MutableTrack.h:147
void setNdf(std::int32_t value)
Set the Numbers of degrees of freedom of the track fit.
Definition: MutableTrack.cc:70
edm4hep::Vector3f & momentum()
Get reference to Track 3-momentum at the vertex [GeV].
Definition: MutableTrack.cc:72
void setTime(float value)
Set the Track time at the vertex [ns].
Definition: MutableTrack.cc:75
std::vector< eicd::TrackParameters >::const_iterator parameters_end() const
Definition: MutableTrack.cc:91
podio::RelationRange< eicd::Track > getTracks() const
Definition: MutableTrack.cc:180
podio::RelationRange< eicd::TrackerHit > getTrackerHits() const
Definition: MutableTrack.cc:144
~MutableTrack()
destructor
Definition: MutableTrack.cc:51
friend void swap(MutableTrack &a, MutableTrack &b)
Definition: MutableTrack.h:157
bool operator<(const MutableTrack &other) const
Definition: MutableTrack.h:151
const std::int32_t & getType() const
Access the Flag that defines the type of track.
Definition: MutableTrack.cc:58
MutableTrack & operator=(MutableTrack other)
copy-assignment operator
Definition: MutableTrack.cc:36
void addToTracks(eicd::Track)
Definition: MutableTrack.cc:152
const podio::ObjectID getObjectID() const
Definition: MutableTrack.cc:200
std::vector< eicd::TrackerHit >::const_iterator trackerHits_begin() const
Definition: MutableTrack.cc:121
std::vector< eicd::Track >::const_iterator tracks_end() const
Definition: MutableTrack.cc:163
void addToTrackerHits(eicd::TrackerHit)
Definition: MutableTrack.cc:116
const std::int32_t & getNdf() const
Access the Numbers of degrees of freedom of the track fit.
Definition: MutableTrack.cc:60
unsigned int trackerHits_size() const
Definition: MutableTrack.cc:133
bool isAvailable() const
check whether the object is actually available
Definition: MutableTrack.cc:193
const float & getChi2() const
Access the Total chi2 (sum) of the track fit.
Definition: MutableTrack.cc:59
MutableTrack()
default constructor
Definition: MutableTrack.cc:16
const edm4hep::Vector3f & getMomentum() const
Access the Track 3-momentum at the vertex [GeV].
Definition: MutableTrack.cc:61
std::vector< eicd::TrackerHit >::const_iterator trackerHits_end() const
Definition: MutableTrack.cc:127
std::vector< eicd::Track >::const_iterator tracks_begin() const
Definition: MutableTrack.cc:157
std::vector< eicd::TrackParameters >::const_iterator parameters_begin() const
Definition: MutableTrack.cc:85
void setType(std::int32_t value)
Set the Flag that defines the type of track.
Definition: MutableTrack.cc:68
void setChi2(float value)
Set the Total chi2 (sum) of the track fit.
Definition: MutableTrack.cc:69
const float & getTime() const
Access the Track time at the vertex [ns].
Definition: MutableTrack.cc:63
const eicd::Cov3f & getMomentumError() const
Access the Covariance matrix on the momentum.
Definition: MutableTrack.cc:62
const float & getCharge() const
Access the Particle charge.
Definition: MutableTrack.cc:65
void setMomentum(edm4hep::Vector3f value)
Set the Track 3-momentum at the vertex [GeV].
Definition: MutableTrack.cc:71
eicd::Cov3f & momentumError()
Get reference to Covariance matrix on the momentum.
Definition: MutableTrack.cc:74
friend class Track
Definition: MutableTrack.h:37
const float & getTimeError() const
Access the Error on the track vertex time.
Definition: MutableTrack.cc:64
void setMomentumError(eicd::Cov3f value)
Set the Covariance matrix on the momentum.
Definition: MutableTrack.cc:73
podio::RelationRange< eicd::TrackParameters > getParameters() const
Definition: MutableTrack.cc:108
void unlink()
disconnect from TrackObj instance
Definition: MutableTrack.h:145
unsigned int parameters_size() const
Definition: MutableTrack.cc:97
void setTimeError(float value)
Set the Error on the track vertex time.
Definition: MutableTrack.cc:76
unsigned int tracks_size() const
Definition: MutableTrack.cc:169
void addToParameters(eicd::TrackParameters)
Definition: MutableTrack.cc:80
void setCharge(float value)
Set the Particle charge.
Definition: MutableTrack.cc:77
unsigned int id() const
Definition: MutableTrack.h:153
Definition: TrackCollection.h:82
Definition: Track.h:32
Definition: TrackCollection.h:57
Definition: TrackObj.h:20
Definition: TrackParameters.h:34
Definition: TrackerHit.h:28
Definition: CalorimeterHit.cc:13