EDM4eic
EIC data model
Loading...
Searching...
No Matches
TrackSegment.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_TrackSegment_H
4#define EDM4EIC_TrackSegment_H
5
7
9#include "podio/RelationRange.h"
10#include <vector>
11
12#include "podio/utilities/MaybeSharedPtr.h"
13#include "podio/detail/OrderKey.h"
14
15#include <ostream>
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 podio::detail {
31// Internal function used in less comparison operators of the datatypes and interface types
32OrderKey getOrderKey(const edm4eic::TrackSegment& obj);
33};
34
35namespace edm4eic {
36
40
41/** @class TrackSegment
42 * A track segment defined by one or more points along a track.
43 * @author: S. Joosten
44 */
46
47 friend class MutableTrackSegment;
51 friend podio::detail::OrderKey podio::detail::getOrderKey(const TrackSegment & obj);
52
53public:
56
57 /// default constructor
58 TrackSegment() = default;
59
60 /// Constructor initializing all members
61 TrackSegment(const float length, const float lengthError);
62
63 /// copy constructor
64 TrackSegment(const TrackSegment& other) noexcept = default;
65
66 /// move constructor
67 TrackSegment(TrackSegment&& other) noexcept = default;
68
69 /// copy-assignment operator
70 TrackSegment& operator=(TrackSegment other) &; // Rebind this to other's internal object
71 TrackSegment& operator=(TrackSegment other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
72
73 /// create a mutable deep-copy of the object with identical relations
74 /// if cloneRelations=false, the relations are not cloned and will be empty
75 MutableTrackSegment clone(bool cloneRelations=true) const;
76
77 /// destructor
78 ~TrackSegment() = default;
79
80 /// converting constructor from mutable object
82
83 static TrackSegment makeEmpty();
84
85public:
86
87 static constexpr std::string_view typeName = "edm4eic::TrackSegment";
88
89 /// Access the Pathlength from the first to the last point
90 float getLength() const;
91
92 /// Access the Error on the segment length
93 float getLengthError() const;
94
95
96 /// Access the Track used for this projection
97 const edm4eic::Track getTrack() const;
98
99 std::size_t points_size() const;
100 edm4eic::TrackPoint getPoints(std::size_t) const;
101 std::vector<edm4eic::TrackPoint>::const_iterator points_begin() const;
102 std::vector<edm4eic::TrackPoint>::const_iterator points_end() const;
103 podio::RelationRange<edm4eic::TrackPoint> getPoints() const;
104
105
106 /// check whether the object is actually available
107 bool isAvailable() const;
108 /// disconnect from TrackSegmentObj instance
109 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackSegmentObj>{nullptr}; }
110
111 constexpr bool operator==(const TrackSegment& other) const { return m_obj == other.m_obj; }
112 bool operator==(const MutableTrackSegment& other) const;
113
114 constexpr bool operator!=(const TrackSegment& other) const { return !(*this == other); }
115 bool operator!=(const MutableTrackSegment& other) const { return !(*this == other); }
116
117 // less comparison operator, so that objects can be e.g. stored in sets.
118 bool operator<(const TrackSegment& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
119
120 podio::ObjectID id() const { return getObjectID(); }
121
122 const podio::ObjectID getObjectID() const;
123
124 friend std::hash<TrackSegment>;
125
126 friend void swap(TrackSegment& a, TrackSegment& b) {
127 using std::swap;
128 swap(a.m_obj, b.m_obj); // swap out the internal pointers
129 }
130
131private:
132 /// constructor from existing TrackSegmentObj
133 explicit TrackSegment(podio::utils::MaybeSharedPtr<TrackSegmentObj> obj);
135
136 podio::utils::MaybeSharedPtr<TrackSegmentObj> m_obj{new TrackSegmentObj{}, podio::utils::MarkOwned};
137};
138
139std::ostream& operator<<(std::ostream& o, const TrackSegment& value);
140
141#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
142void to_json(nlohmann::json& j, const TrackSegment& value);
143#endif
144
145
146} // namespace edm4eic
147
148
149
150template<>
151struct std::hash<edm4eic::TrackSegment> {
152 std::size_t operator()(const edm4eic::TrackSegment& obj) const {
153 return std::hash<edm4eic::TrackSegmentObj*>{}(obj.m_obj.get());
154 }
155};
156
157
158// This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
159// until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
160// and https://github.com/AIDASoft/podio/issues/770
161#if defined(__clang__)
162 #pragma clang diagnostic push
163 #pragma clang diagnostic ignored "-Wunknown-warning-option"
164 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
165 #pragma clang diagnostic ignored "-Wdeprecated"
166constexpr std::string_view edm4eic::TrackSegment::typeName;
167 #pragma clang diagnostic pop
168#elif defined(__GNUC__)
169 #pragma GCC diagnostic push
170 #pragma GCC diagnostic ignored "-Wdeprecated"
171constexpr std::string_view edm4eic::TrackSegment::typeName;
172 #pragma GCC diagnostic pop
173#endif
174
175
176#endif
Definition MutableTrack.h:40
Definition MutableTrackSegment.h:37
Definition Track.h:48
Definition TrackPoint.h:23
Definition TrackSegmentCollectionData.h:32
Definition TrackSegmentCollection.h:139
Definition TrackSegment.h:45
friend class TrackSegmentCollection
Definition TrackSegment.h:48
float getLength() const
Access the Pathlength from the first to the last point.
Definition TrackSegment.cc:64
friend class MutableTrackSegment
Definition TrackSegment.h:47
std::size_t points_size() const
Definition TrackSegment.cc:88
const podio::ObjectID getObjectID() const
Definition TrackSegment.cc:115
TrackSegment(const TrackSegment &other) noexcept=default
copy constructor
MutableTrackSegment clone(bool cloneRelations=true) const
Definition TrackSegment.cc:31
void unlink()
disconnect from TrackSegmentObj instance
Definition TrackSegment.h:109
~TrackSegment()=default
destructor
std::vector< edm4eic::TrackPoint >::const_iterator points_begin() const
Definition TrackSegment.cc:76
std::vector< edm4eic::TrackPoint >::const_iterator points_end() const
Definition TrackSegment.cc:82
constexpr bool operator!=(const TrackSegment &other) const
Definition TrackSegment.h:114
bool isAvailable() const
check whether the object is actually available
Definition TrackSegment.cc:111
TrackSegment & operator=(TrackSegment other) &
copy-assignment operator
Definition TrackSegment.cc:26
podio::RelationRange< edm4eic::TrackPoint > getPoints() const
Definition TrackSegment.cc:99
TrackSegment & operator=(TrackSegment other) &&=delete
bool operator<(const TrackSegment &other) const
Definition TrackSegment.h:118
bool operator!=(const MutableTrackSegment &other) const
Definition TrackSegment.h:115
friend void swap(TrackSegment &a, TrackSegment &b)
Definition TrackSegment.h:126
friend class TrackSegmentCollectionIterator
Definition TrackSegment.h:50
constexpr bool operator==(const TrackSegment &other) const
Definition TrackSegment.h:111
const edm4eic::Track getTrack() const
Access the Track used for this projection.
Definition TrackSegment.cc:67
TrackSegmentCollection collection_type
Definition TrackSegment.h:55
podio::ObjectID id() const
Definition TrackSegment.h:120
static TrackSegment makeEmpty()
Definition TrackSegment.cc:60
MutableTrackSegment mutable_type
Definition TrackSegment.h:54
static constexpr std::string_view typeName
Definition TrackSegment.h:87
TrackSegment()=default
default constructor
TrackSegment(TrackSegment &&other) noexcept=default
move constructor
float getLengthError() const
Access the Error on the segment length.
Definition TrackSegment.cc:65
Definition TrackSegmentObj.h:24
Definition ArrowMapper.cc:63
std::ostream & operator<<(std::ostream &o, const CalorimeterHit &value)
Definition CalorimeterHit.cc:99
Definition CalorimeterHit.h:31
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::TrackSegment &obj) const
Definition TrackSegment.h:152