Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-14 08:51:40

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();
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   /// Get reference to Pathlength from the first to the last point
0085   [[deprecated("use getLength instead")]]
0086   float& length();
0087 
0088   /// Set the Error on the segment length
0089   void setLengthError(const float lengthError);
0090   /// Get mutable reference to Error on the segment length
0091   float& getLengthError();
0092   /// Get reference to Error on the segment length
0093   [[deprecated("use getLengthError instead")]]
0094   float& lengthError();
0095 
0096 
0097   /// Set the Track used for this projection
0098   void setTrack(const edm4eic::Track& value);
0099 
0100   void addToPoints(const edm4eic::TrackPoint&);
0101   std::size_t points_size() const;
0102   edm4eic::TrackPoint getPoints(std::size_t) const;
0103   std::vector<edm4eic::TrackPoint>::const_iterator points_begin() const;
0104   std::vector<edm4eic::TrackPoint>::const_iterator points_end() const;
0105   podio::RelationRange<edm4eic::TrackPoint> getPoints() const;
0106 
0107 
0108 
0109   /// check whether the object is actually available
0110   bool isAvailable() const;
0111   /// disconnect from TrackSegmentObj instance
0112   void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackSegmentObj>{nullptr}; }
0113 
0114   bool operator==(const MutableTrackSegment& other) const { return m_obj == other.m_obj; }
0115   bool operator==(const TrackSegment& other) const;
0116 
0117   bool operator!=(const MutableTrackSegment& other) const { return !(*this == other); }
0118   bool operator!=(const TrackSegment& other) const { return !(*this == other); }
0119 
0120   // less comparison operator, so that objects can be e.g. stored in sets.
0121   bool operator<(const MutableTrackSegment& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0122 
0123   podio::ObjectID id() const { return getObjectID(); }
0124 
0125   const podio::ObjectID getObjectID() const;
0126 
0127   friend std::hash<MutableTrackSegment>;
0128 
0129   friend void swap(MutableTrackSegment& a, MutableTrackSegment& b) {
0130     using std::swap;
0131     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0132   }
0133 
0134 private:
0135   /// constructor from existing TrackSegmentObj
0136   explicit MutableTrackSegment(podio::utils::MaybeSharedPtr<TrackSegmentObj> obj);
0137 
0138   podio::utils::MaybeSharedPtr<TrackSegmentObj> m_obj{nullptr};
0139 };
0140 
0141 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0142 void to_json(nlohmann::json& j, const MutableTrackSegment& value);
0143 #endif
0144 
0145 
0146 } // namespace edm4eic
0147 
0148 
0149 
0150 template<>
0151 struct std::hash<edm4eic::MutableTrackSegment> {
0152   std::size_t operator()(const edm4eic::MutableTrackSegment& obj) const {
0153     return std::hash<edm4eic::TrackSegmentObj*>{}(obj.m_obj.get());
0154   }
0155 };
0156 
0157 
0158 #endif