Back to home page

EIC code displayed by LXR

 
 

    


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

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