EDM4eic
EIC data model
Loading...
Searching...
No Matches
Track.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_Track_H
4#define EDM4EIC_Track_H
5
6#include "edm4eic/TrackObj.h"
7
8#include "edm4eic/Cov6f.h"
10#include "edm4hep/Vector3f.h"
11#include "podio/RelationRange.h"
12#include <cstdint>
13#include <vector>
14
15#include "podio/utilities/MaybeSharedPtr.h"
16
17#include <ostream>
18#include <cstdint>
19
20#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
21#include "nlohmann/json_fwd.hpp"
22#endif
23
24// forward declarations
25namespace edm4eic {
26class Trajectory;
27class MutableTrajectory;
28}
29
30
31namespace edm4eic {
32
33class MutableTrack;
34class TrackCollection;
35class TrackCollectionData;
36
37/** @class Track
38 * Track information at the vertex
39 * @author: S. Joosten, J. Osborn
40 */
41class Track {
42
43 friend class MutableTrack;
44 friend class TrackCollection;
47
48public:
51
52 /// default constructor
53 Track();
54
55 /// Constructor initializing all members
56 Track(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);
57
58 /// copy constructor
59 Track(const Track& other) = default;
60
61 /// copy-assignment operator
62 Track& operator=(Track other);
63
64 /// create a mutable deep-copy of the object with identical relations
65 /// if cloneRelations=false, the relations are not cloned and will be empty
66 MutableTrack clone(bool cloneRelations=true) const;
67
68 /// destructor
69 ~Track() = default;
70
71 /// converting constructor from mutable object
72 Track(const MutableTrack& other);
73
74 static Track makeEmpty();
75
76public:
77
78 /// Access the Flag that defines the type of track
79 std::int32_t getType() const;
80
81 /// Access the Track 3-position at the vertex
82 const edm4hep::Vector3f& getPosition() const;
83
84 /// Access the Track 3-momentum at the vertex [GeV]
85 const edm4hep::Vector3f& getMomentum() const;
86
87 /// Access the Covariance matrix in basis [x,y,z,px,py,pz]
89
90 /// Access the Track time at the vertex [ns]
91 float getTime() const;
92
93 /// Access the Error on the track vertex time
94 float getTimeError() const;
95
96 /// Access the Particle charge
97 float getCharge() const;
98
99 /// Access the Total chi2
100 float getChi2() const;
101
102 /// Access the Number of degrees of freedom
103 std::uint32_t getNdf() const;
104
105 /// Access the PDG particle ID hypothesis
106 std::int32_t getPdg() const;
107
108
109 /// Access the Trajectory of this track
111
112 std::size_t measurements_size() const;
113 edm4eic::Measurement2D getMeasurements(std::size_t) const;
114 std::vector<edm4eic::Measurement2D>::const_iterator measurements_begin() const;
115 std::vector<edm4eic::Measurement2D>::const_iterator measurements_end() const;
116 podio::RelationRange<edm4eic::Measurement2D> getMeasurements() const;
117 std::size_t tracks_size() const;
118 edm4eic::Track getTracks(std::size_t) const;
119 std::vector<edm4eic::Track>::const_iterator tracks_begin() const;
120 std::vector<edm4eic::Track>::const_iterator tracks_end() const;
121 podio::RelationRange<edm4eic::Track> getTracks() const;
122
123
124 /// check whether the object is actually available
125 bool isAvailable() const;
126 /// disconnect from TrackObj instance
127 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackObj>{nullptr}; }
128
129 bool operator==(const Track& other) const { return m_obj == other.m_obj; }
130 bool operator==(const MutableTrack& other) const;
131
132 bool operator!=(const Track& other) const { return !(*this == other); }
133 bool operator!=(const MutableTrack& other) const { return !(*this == other); }
134
135 // less comparison operator, so that objects can be e.g. stored in sets.
136 bool operator<(const Track& other) const { return m_obj < other.m_obj; }
137
138 podio::ObjectID id() const { return getObjectID(); }
139
140 const podio::ObjectID getObjectID() const;
141
142 friend void swap(Track& a, Track& b) {
143 using std::swap;
144 swap(a.m_obj, b.m_obj); // swap out the internal pointers
145 }
146
147private:
148 /// constructor from existing TrackObj
149 explicit Track(podio::utils::MaybeSharedPtr<TrackObj> obj);
150 Track(TrackObj* obj);
151
152 podio::utils::MaybeSharedPtr<TrackObj> m_obj{nullptr};
153};
154
155std::ostream& operator<<(std::ostream& o, const Track& value);
156
157#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
158void to_json(nlohmann::json& j, const Track& value);
159#endif
160
161
162} // namespace edm4eic
163
164
165#endif
Definition Cov6f.h:19
Definition Measurement2D.h:36
Definition MutableTrack.h:39
Definition TrackCollectionData.h:32
Definition TrackCollection.h:92
Definition TrackCollection.h:37
Definition Track.h:41
bool operator==(const Track &other) const
Definition Track.h:129
friend class MutableTrack
Definition Track.h:43
const edm4hep::Vector3f & getPosition() const
Access the Track 3-position at the vertex.
Definition Track.cc:88
std::int32_t getType() const
Access the Flag that defines the type of track.
Definition Track.cc:87
void unlink()
disconnect from TrackObj instance
Definition Track.h:127
Track & operator=(Track other)
copy-assignment operator
Definition Track.cc:38
float getChi2() const
Access the Total chi2.
Definition Track.cc:94
const edm4hep::Vector3f & getMomentum() const
Access the Track 3-momentum at the vertex [GeV].
Definition Track.cc:89
podio::RelationRange< edm4eic::Track > getTracks() const
Definition Track.cc:162
bool operator!=(const Track &other) const
Definition Track.h:132
MutableTrack clone(bool cloneRelations=true) const
Definition Track.cc:43
std::vector< edm4eic::Measurement2D >::const_iterator measurements_end() const
Definition Track.cc:113
podio::ObjectID id() const
Definition Track.h:138
std::vector< edm4eic::Track >::const_iterator tracks_end() const
Definition Track.cc:145
~Track()=default
destructor
std::int32_t getPdg() const
Access the PDG particle ID hypothesis.
Definition Track.cc:96
friend void swap(Track &a, Track &b)
Definition Track.h:142
podio::RelationRange< edm4eic::Measurement2D > getMeasurements() const
Definition Track.cc:130
Track(const Track &other)=default
copy constructor
bool operator<(const Track &other) const
Definition Track.h:136
bool operator!=(const MutableTrack &other) const
Definition Track.h:133
float getTime() const
Access the Track time at the vertex [ns].
Definition Track.cc:91
std::vector< edm4eic::Track >::const_iterator tracks_begin() const
Definition Track.cc:139
std::size_t measurements_size() const
Definition Track.cc:119
const podio::ObjectID getObjectID() const
Definition Track.cc:178
std::uint32_t getNdf() const
Access the Number of degrees of freedom.
Definition Track.cc:95
std::size_t tracks_size() const
Definition Track.cc:151
const edm4eic::Cov6f & getPositionMomentumCovariance() const
Access the Covariance matrix in basis [x,y,z,px,py,pz].
Definition Track.cc:90
static Track makeEmpty()
Definition Track.cc:83
float getCharge() const
Access the Particle charge.
Definition Track.cc:93
const edm4eic::Trajectory getTrajectory() const
Access the Trajectory of this track.
Definition Track.cc:98
float getTimeError() const
Access the Error on the track vertex time.
Definition Track.cc:92
bool isAvailable() const
check whether the object is actually available
Definition Track.cc:174
Track()
default constructor
Definition Track.cc:21
std::vector< edm4eic::Measurement2D >::const_iterator measurements_begin() const
Definition Track.cc:107
friend class TrackCollection
Definition Track.h:44
Definition TrackObj.h:23
Definition Trajectory.h:40
Definition CalorimeterHit.cc:17
std::ostream & operator<<(std::ostream &o, const CalorimeterHit &value)
Definition CalorimeterHit.cc:103