Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-03 09:14:06

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_MutableTrackSegment_H
0004 #define EDM4EIC_MutableTrackSegment_H
0005 
0006 #include "edm4eic/TrackSegmentObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4eic/TrackSegment.h"
0009 
0010 #include "edm4eic/TrackPoint.h"
0011 #include "podio/RelationRange.h"
0012 #include <vector>
0013 
0014 #include "podio/utilities/MaybeSharedPtr.h"
0015 
0016 #include <cstdint>
0017 
0018 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0019 #include "nlohmann/json_fwd.hpp"
0020 #endif
0021 
0022 // forward declarations
0023 namespace edm4eic {
0024 class TrackSegmentCollection;
0025 class Track;
0026 class MutableTrack;
0027 }
0028 
0029 
0030 namespace edm4eic {
0031 
0032 
0033 /** @class MutableTrackSegment
0034  *  A track segment defined by one or more points along a track.
0035  *  @author: S. Joosten
0036  */
0037 class MutableTrackSegment {
0038 
0039   friend class TrackSegmentCollection;
0040   friend class TrackSegmentMutableCollectionIterator;
0041   friend class TrackSegment;
0042 
0043 public:
0044   using object_type = TrackSegment;
0045   using collection_type = TrackSegmentCollection;
0046 
0047   /// default constructor
0048   MutableTrackSegment() = default;
0049 
0050   /// Constructor initializing all members
0051   MutableTrackSegment(const float length, const float lengthError);
0052 
0053   /// copy constructor
0054   MutableTrackSegment(const MutableTrackSegment& other) = default;
0055 
0056   /// copy-assignment operator
0057   MutableTrackSegment& operator=(MutableTrackSegment other) &; // Rebind this to other's internal object
0058   MutableTrackSegment& operator=(MutableTrackSegment other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0059 
0060   /// create a mutable deep-copy of the object with identical relations
0061   /// if cloneRelations=false, the relations are not cloned and will be empty
0062   MutableTrackSegment clone(bool cloneRelations=true) const;
0063 
0064   /// destructor
0065   ~MutableTrackSegment() = default;
0066 
0067 
0068 public:
0069 
0070   /// Access the Pathlength from the first to the last point
0071   float getLength() const;
0072 
0073   /// Access the Error on the segment length
0074   float getLengthError() const;
0075 
0076 
0077   /// Access the Track used for this projection
0078   const edm4eic::Track getTrack() const;
0079 
0080   /// Set the Pathlength from the first to the last point
0081   void setLength(const float length);
0082   /// Get mutable reference to Pathlength from the first to the last point
0083   float& getLength();
0084 
0085   /// Set the Error on the segment length
0086   void setLengthError(const float lengthError);
0087   /// Get mutable reference to Error on the segment length
0088   float& getLengthError();
0089 
0090 
0091   /// Set the Track used for this projection
0092   void setTrack(const edm4eic::Track& value);
0093 
0094   void addToPoints(const edm4eic::TrackPoint&);
0095   std::size_t points_size() const;
0096   edm4eic::TrackPoint getPoints(std::size_t) const;
0097   std::vector<edm4eic::TrackPoint>::const_iterator points_begin() const;
0098   std::vector<edm4eic::TrackPoint>::const_iterator points_end() const;
0099   podio::RelationRange<edm4eic::TrackPoint> getPoints() const;
0100 
0101 
0102 
0103   /// check whether the object is actually available
0104   bool isAvailable() const;
0105   /// disconnect from TrackSegmentObj instance
0106   void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackSegmentObj>{nullptr}; }
0107 
0108   constexpr bool operator==(const MutableTrackSegment& other) const { return m_obj == other.m_obj; }
0109   bool operator==(const TrackSegment& other) const;
0110 
0111   constexpr bool operator!=(const MutableTrackSegment& other) const { return !(*this == other); }
0112   bool operator!=(const TrackSegment& other) const { return !(*this == other); }
0113 
0114   // less comparison operator, so that objects can be e.g. stored in sets.
0115   bool operator<(const MutableTrackSegment& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0116 
0117   podio::ObjectID id() const { return getObjectID(); }
0118 
0119   const podio::ObjectID getObjectID() const;
0120 
0121   friend std::hash<MutableTrackSegment>;
0122 
0123   friend void swap(MutableTrackSegment& a, MutableTrackSegment& b) {
0124     using std::swap;
0125     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0126   }
0127 
0128 private:
0129   /// constructor from existing TrackSegmentObj
0130   explicit MutableTrackSegment(podio::utils::MaybeSharedPtr<TrackSegmentObj> obj);
0131 
0132   podio::utils::MaybeSharedPtr<TrackSegmentObj> m_obj{new TrackSegmentObj{}, podio::utils::MarkOwned};
0133 };
0134 
0135 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0136 void to_json(nlohmann::json& j, const MutableTrackSegment& value);
0137 #endif
0138 
0139 
0140 } // namespace edm4eic
0141 
0142 
0143 
0144 template<>
0145 struct std::hash<edm4eic::MutableTrackSegment> {
0146   std::size_t operator()(const edm4eic::MutableTrackSegment& obj) const {
0147     return std::hash<edm4eic::TrackSegmentObj*>{}(obj.m_obj.get());
0148   }
0149 };
0150 
0151 
0152 #endif