EDM4eic
EIC data model
Loading...
Searching...
No Matches
MutableTrackSegment.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_MutableTrackSegment_H
4#define EDM4EIC_MutableTrackSegment_H
5
7// Make the immutable class available from its mutable version but not vice versa
9
10#include "edm4eic/TrackPoint.h"
11#include "podio/RelationRange.h"
12#include <vector>
13
14#include "podio/utilities/MaybeSharedPtr.h"
15
16#include <cstdint>
17
18#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
19#include "nlohmann/json_fwd.hpp"
20#endif
21
22// forward declarations
23namespace edm4eic {
25class Track;
26class MutableTrack;
27}
28
29
30namespace edm4eic {
31
32
33/** @class MutableTrackSegment
34 * A track segment defined by one or more points along a track.
35 * @author: S. Joosten
36 */
38
41 friend class TrackSegment;
42
43public:
46
47 /// default constructor
49
50 /// Constructor initializing all members
51 MutableTrackSegment(const float length, const float lengthError);
52
53 /// copy constructor
55
56 /// copy-assignment operator
57 MutableTrackSegment& operator=(MutableTrackSegment other) &; // Rebind this to other's internal object
58 MutableTrackSegment& operator=(MutableTrackSegment other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
59
60 /// create a mutable deep-copy of the object with identical relations
61 /// if cloneRelations=false, the relations are not cloned and will be empty
62 MutableTrackSegment clone(bool cloneRelations=true) const;
63
64 /// destructor
66
67
68public:
69
70 /// Access the Pathlength from the first to the last point
71 float getLength() const;
72
73 /// Access the Error on the segment length
74 float getLengthError() const;
75
76
77 /// Access the Track used for this projection
78 const edm4eic::Track getTrack() const;
79
80 /// Set the Pathlength from the first to the last point
81 void setLength(const float length);
82 /// Get mutable reference to Pathlength from the first to the last point
83 float& getLength();
84
85 /// Set the Error on the segment length
86 void setLengthError(const float lengthError);
87 /// Get mutable reference to Error on the segment length
88 float& getLengthError();
89
90
91 /// Set the Track used for this projection
92 void setTrack(const edm4eic::Track& value);
93
95 std::size_t points_size() const;
96 edm4eic::TrackPoint getPoints(std::size_t) const;
97 std::vector<edm4eic::TrackPoint>::const_iterator points_begin() const;
98 std::vector<edm4eic::TrackPoint>::const_iterator points_end() const;
99 podio::RelationRange<edm4eic::TrackPoint> getPoints() const;
100
101
102
103 /// check whether the object is actually available
104 bool isAvailable() const;
105 /// disconnect from TrackSegmentObj instance
106 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackSegmentObj>{nullptr}; }
107
108 constexpr bool operator==(const MutableTrackSegment& other) const { return m_obj == other.m_obj; }
109 bool operator==(const TrackSegment& other) const;
110
111 constexpr bool operator!=(const MutableTrackSegment& other) const { return !(*this == other); }
112 bool operator!=(const TrackSegment& other) const { return !(*this == other); }
113
114 // less comparison operator, so that objects can be e.g. stored in sets.
115 bool operator<(const MutableTrackSegment& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
116
117 podio::ObjectID id() const { return getObjectID(); }
118
119 const podio::ObjectID getObjectID() const;
120
121 friend std::hash<MutableTrackSegment>;
122
124 using std::swap;
125 swap(a.m_obj, b.m_obj); // swap out the internal pointers
126 }
127
128private:
129 /// constructor from existing TrackSegmentObj
130 explicit MutableTrackSegment(podio::utils::MaybeSharedPtr<TrackSegmentObj> obj);
131
132 podio::utils::MaybeSharedPtr<TrackSegmentObj> m_obj{new TrackSegmentObj{}, podio::utils::MarkOwned};
133};
134
135#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
136void to_json(nlohmann::json& j, const MutableTrackSegment& value);
137#endif
138
139
140} // namespace edm4eic
141
142
143
144template<>
145struct std::hash<edm4eic::MutableTrackSegment> {
146 std::size_t operator()(const edm4eic::MutableTrackSegment& obj) const {
147 return std::hash<edm4eic::TrackSegmentObj*>{}(obj.m_obj.get());
148 }
149};
150
151
152#endif
Definition MutableTrack.h:40
Definition MutableTrackSegment.h:37
friend class TrackSegmentCollection
Definition MutableTrackSegment.h:39
podio::RelationRange< edm4eic::TrackPoint > getPoints() const
Definition MutableTrackSegment.cc:91
MutableTrackSegment & operator=(MutableTrackSegment other) &&=delete
MutableTrackSegment clone(bool cloneRelations=true) const
Definition MutableTrackSegment.cc:29
std::vector< edm4eic::TrackPoint >::const_iterator points_begin() const
Definition MutableTrackSegment.cc:68
bool operator<(const MutableTrackSegment &other) const
Definition MutableTrackSegment.h:115
std::vector< edm4eic::TrackPoint >::const_iterator points_end() const
Definition MutableTrackSegment.cc:74
MutableTrackSegment & operator=(MutableTrackSegment other) &
copy-assignment operator
Definition MutableTrackSegment.cc:24
MutableTrackSegment()=default
default constructor
void setLength(const float length)
Set the Pathlength from the first to the last point.
Definition MutableTrackSegment.cc:53
bool isAvailable() const
check whether the object is actually available
Definition MutableTrackSegment.cc:104
MutableTrackSegment(const MutableTrackSegment &other)=default
copy constructor
friend class TrackSegment
Definition MutableTrackSegment.h:41
friend void swap(MutableTrackSegment &a, MutableTrackSegment &b)
Definition MutableTrackSegment.h:123
friend class TrackSegmentMutableCollectionIterator
Definition MutableTrackSegment.h:40
constexpr bool operator!=(const MutableTrackSegment &other) const
Definition MutableTrackSegment.h:111
bool operator!=(const TrackSegment &other) const
Definition MutableTrackSegment.h:112
~MutableTrackSegment()=default
destructor
void unlink()
disconnect from TrackSegmentObj instance
Definition MutableTrackSegment.h:106
void setLengthError(const float lengthError)
Set the Error on the segment length.
Definition MutableTrackSegment.cc:55
TrackSegmentCollection collection_type
Definition MutableTrackSegment.h:45
std::size_t points_size() const
Definition MutableTrackSegment.cc:80
const edm4eic::Track getTrack() const
Access the Track used for this projection.
Definition MutableTrackSegment.cc:45
TrackSegment object_type
Definition MutableTrackSegment.h:44
void setTrack(const edm4eic::Track &value)
Set the Track used for this projection.
Definition MutableTrackSegment.cc:58
const podio::ObjectID getObjectID() const
Definition MutableTrackSegment.cc:108
podio::ObjectID id() const
Definition MutableTrackSegment.h:117
float getLengthError() const
Access the Error on the segment length.
Definition MutableTrackSegment.cc:43
float getLength() const
Access the Pathlength from the first to the last point.
Definition MutableTrackSegment.cc:42
void addToPoints(const edm4eic::TrackPoint &)
Definition MutableTrackSegment.cc:63
constexpr bool operator==(const MutableTrackSegment &other) const
Definition MutableTrackSegment.h:108
Definition Track.h:48
Definition TrackPoint.h:23
Definition TrackSegmentCollection.h:139
Definition TrackSegment.h:45
Definition TrackSegmentObj.h:24
Definition ArrowMapper.cc:61
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::MutableTrackSegment &obj) const
Definition MutableTrackSegment.h:146