EICd
EIC data model
MutableTrackSegment.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EICD_MutableTrackSegment_H
4#define EICD_MutableTrackSegment_H
5
7// Make the immutable class available from its mutable version but not vice versa
8#include "eicd/TrackSegment.h"
9
10#include "eicd/TrackPoint.h"
11#include "podio/RelationRange.h"
12#include <vector>
13#include "podio/ObjectID.h"
14#include <ostream>
15
16#ifdef PODIO_JSON_OUTPUT
17#include "nlohmann/json.hpp"
18#endif
19
20// forward declarations
21namespace eicd {
22class Track;
23class MutableTrack;
24}
25
26
27namespace eicd {
28
29
30/** @class MutableTrackSegment
31 * A track segment defined by one or more points along a track.
32 * @author: S. Joosten
33 */
35
38 friend class TrackSegment;
39
40public:
41
42 /// default constructor
44 MutableTrackSegment(float length, float lengthError);
45
46 /// constructor from existing TrackSegmentObj
48
49 /// copy constructor
51
52 /// copy-assignment operator
54
55 /// create a mutable deep-copy of the object with identical relations
57
58 /// destructor
60
61 /// conversion to const object
62 operator TrackSegment() const;
63
64public:
65
66 /// Access the Pathlength from the first to the last point
67 const float& getLength() const;
68
69 /// Access the Error on the segment length
70 const float& getLengthError() const;
71
72
73 /// Access the Track used for this projection
74 const eicd::Track getTrack() const;
75
76 /// Set the Pathlength from the first to the last point
77 void setLength(float value);
78
79 /// Set the Error on the segment length
80 void setLengthError(float value);
81
82
83 /// Set the Track used for this projection
84 void setTrack(eicd::Track value);
85
87 unsigned int points_size() const;
88 eicd::TrackPoint getPoints(unsigned int) const;
89 std::vector<eicd::TrackPoint>::const_iterator points_begin() const;
90 std::vector<eicd::TrackPoint>::const_iterator points_end() const;
91 podio::RelationRange<eicd::TrackPoint> getPoints() const;
92
93
94
95 /// check whether the object is actually available
96 bool isAvailable() const;
97 /// disconnect from TrackSegmentObj instance
98 void unlink() { m_obj = nullptr; }
99
100 bool operator==(const MutableTrackSegment& other) const { return m_obj == other.m_obj; }
101 bool operator==(const TrackSegment& other) const;
102
103 // less comparison operator, so that objects can be e.g. stored in sets.
104 bool operator<(const MutableTrackSegment& other) const { return m_obj < other.m_obj; }
105
106 unsigned int id() const { return getObjectID().collectionID * 10000000 + getObjectID().index; }
107
108 const podio::ObjectID getObjectID() const;
109
111 using std::swap;
112 swap(a.m_obj, b.m_obj); // swap out the internal pointers
113 }
114
115private:
116 TrackSegmentObj* m_obj;
117};
118
119#ifdef PODIO_JSON_OUTPUT
120void to_json(nlohmann::json& j, const MutableTrackSegment& value);
121#endif
122
123
124} // namespace eicd
125
126
127#endif
Definition: MutableTrackSegment.h:34
const float & getLength() const
Access the Pathlength from the first to the last point.
Definition: MutableTrackSegment.cc:53
~MutableTrackSegment()
destructor
Definition: MutableTrackSegment.cc:46
const float & getLengthError() const
Access the Error on the segment length.
Definition: MutableTrackSegment.cc:54
std::vector< eicd::TrackPoint >::const_iterator points_begin() const
Definition: MutableTrackSegment.cc:80
const podio::ObjectID getObjectID() const
Definition: MutableTrackSegment.cc:123
MutableTrackSegment()
default constructor
Definition: MutableTrackSegment.cc:17
const eicd::Track getTrack() const
Access the Track used for this projection.
Definition: MutableTrackSegment.cc:56
bool isAvailable() const
check whether the object is actually available
Definition: MutableTrackSegment.cc:116
unsigned int points_size() const
Definition: MutableTrackSegment.cc:92
friend class TrackSegment
Definition: MutableTrackSegment.h:38
friend void swap(MutableTrackSegment &a, MutableTrackSegment &b)
Definition: MutableTrackSegment.h:110
void setLength(float value)
Set the Pathlength from the first to the last point.
Definition: MutableTrackSegment.cc:64
unsigned int id() const
Definition: MutableTrackSegment.h:106
void setTrack(eicd::Track value)
Set the Track used for this projection.
Definition: MutableTrackSegment.cc:67
MutableTrackSegment clone() const
create a mutable deep-copy of the object with identical relations
Definition: MutableTrackSegment.cc:42
void unlink()
disconnect from TrackSegmentObj instance
Definition: MutableTrackSegment.h:98
void addToPoints(eicd::TrackPoint)
Definition: MutableTrackSegment.cc:75
bool operator<(const MutableTrackSegment &other) const
Definition: MutableTrackSegment.h:104
std::vector< eicd::TrackPoint >::const_iterator points_end() const
Definition: MutableTrackSegment.cc:86
MutableTrackSegment & operator=(MutableTrackSegment other)
copy-assignment operator
Definition: MutableTrackSegment.cc:31
bool operator==(const MutableTrackSegment &other) const
Definition: MutableTrackSegment.h:100
podio::RelationRange< eicd::TrackPoint > getPoints() const
Definition: MutableTrackSegment.cc:103
void setLengthError(float value)
Set the Error on the segment length.
Definition: MutableTrackSegment.cc:65
Definition: Track.h:32
Definition: TrackPoint.h:18
Definition: TrackSegmentCollection.h:82
Definition: TrackSegment.h:33
Definition: TrackSegmentCollection.h:57
Definition: TrackSegmentObj.h:23
Definition: CalorimeterHit.cc:13