Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:31

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 Track;
0025 class MutableTrack;
0026 }
0027 
0028 
0029 namespace edm4eic {
0030 
0031 
0032 /** @class MutableTrackSegment
0033  *  A track segment defined by one or more points along a track.
0034  *  @author: S. Joosten
0035  */
0036 class MutableTrackSegment {
0037 
0038   friend class TrackSegmentCollection;
0039   friend class TrackSegmentMutableCollectionIterator;
0040   friend class TrackSegment;
0041 
0042 public:
0043   using object_type = TrackSegment;
0044   using collection_type = TrackSegmentCollection;
0045 
0046   /// default constructor
0047   MutableTrackSegment();
0048 
0049   /// Constructor initializing all members
0050   MutableTrackSegment(float length, float lengthError);
0051 
0052   /// copy constructor
0053   MutableTrackSegment(const MutableTrackSegment& other) = default;
0054 
0055   /// copy-assignment operator
0056   MutableTrackSegment& operator=(MutableTrackSegment other);
0057 
0058   /// create a mutable deep-copy of the object with identical relations
0059   /// if cloneRelations=false, the relations are not cloned and will be empty
0060   MutableTrackSegment clone(bool cloneRelations=true) const;
0061 
0062   /// destructor
0063   ~MutableTrackSegment() = default;
0064 
0065 
0066 public:
0067 
0068   /// Access the Pathlength from the first to the last point
0069   float getLength() const;
0070 
0071   /// Access the Error on the segment length
0072   float getLengthError() const;
0073 
0074 
0075   /// Access the Track used for this projection
0076   const edm4eic::Track getTrack() const;
0077 
0078   /// Set the Pathlength from the first to the last point
0079   void setLength(float value);
0080   /// Get mutable reference to Pathlength from the first to the last point
0081   float& getLength();
0082   /// Get reference to Pathlength from the first to the last point
0083   [[deprecated("use getLength instead")]]
0084   float& length();
0085 
0086   /// Set the Error on the segment length
0087   void setLengthError(float value);
0088   /// Get mutable reference to Error on the segment length
0089   float& getLengthError();
0090   /// Get reference to Error on the segment length
0091   [[deprecated("use getLengthError instead")]]
0092   float& lengthError();
0093 
0094 
0095   /// Set the Track used for this projection
0096   void setTrack(const edm4eic::Track& value);
0097 
0098   void addToPoints(const edm4eic::TrackPoint&);
0099   std::size_t points_size() const;
0100   edm4eic::TrackPoint getPoints(std::size_t) const;
0101   std::vector<edm4eic::TrackPoint>::const_iterator points_begin() const;
0102   std::vector<edm4eic::TrackPoint>::const_iterator points_end() const;
0103   podio::RelationRange<edm4eic::TrackPoint> getPoints() const;
0104 
0105 
0106 
0107   /// check whether the object is actually available
0108   bool isAvailable() const;
0109   /// disconnect from TrackSegmentObj instance
0110   void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackSegmentObj>{nullptr}; }
0111 
0112   bool operator==(const MutableTrackSegment& other) const { return m_obj == other.m_obj; }
0113   bool operator==(const TrackSegment& other) const;
0114 
0115   bool operator!=(const MutableTrackSegment& other) const { return !(*this == other); }
0116   bool operator!=(const TrackSegment& other) const { return !(*this == other); }
0117 
0118   // less comparison operator, so that objects can be e.g. stored in sets.
0119   bool operator<(const MutableTrackSegment& other) const { return m_obj < other.m_obj; }
0120 
0121   podio::ObjectID id() const { return getObjectID(); }
0122 
0123   const podio::ObjectID getObjectID() const;
0124 
0125   friend void swap(MutableTrackSegment& a, MutableTrackSegment& b) {
0126     using std::swap;
0127     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0128   }
0129 
0130 private:
0131   /// constructor from existing TrackSegmentObj
0132   explicit MutableTrackSegment(podio::utils::MaybeSharedPtr<TrackSegmentObj> obj);
0133 
0134   podio::utils::MaybeSharedPtr<TrackSegmentObj> m_obj{nullptr};
0135 };
0136 
0137 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0138 void to_json(nlohmann::json& j, const MutableTrackSegment& value);
0139 #endif
0140 
0141 
0142 } // namespace edm4eic
0143 
0144 
0145 #endif