Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/edm4eic/TrackSegment.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 #include "podio/detail/OrderKey.h"
0014 
0015 #include <ostream>
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 podio::detail {
0031 // Internal function used in less comparison operators of the datatypes and interface types
0032 OrderKey getOrderKey(const edm4eic::TrackSegment& obj);
0033 };
0034 
0035 namespace edm4eic {
0036 
0037 class MutableTrackSegment;
0038 class TrackSegmentCollection;
0039 class TrackSegmentCollectionData;
0040 
0041 /** @class TrackSegment
0042  *  A track segment defined by one or more points along a track.
0043  *  @author: S. Joosten
0044  */
0045 class TrackSegment {
0046 
0047   friend class MutableTrackSegment;
0048   friend class TrackSegmentCollection;
0049   friend class edm4eic::TrackSegmentCollectionData;
0050   friend class TrackSegmentCollectionIterator;
0051   friend podio::detail::OrderKey podio::detail::getOrderKey(const TrackSegment & obj);
0052 
0053 public:
0054   using mutable_type = MutableTrackSegment;
0055   using collection_type = TrackSegmentCollection;
0056 
0057   /// default constructor
0058   TrackSegment();
0059 
0060   /// Constructor initializing all members
0061   TrackSegment(const float length, const float lengthError);
0062 
0063   /// copy constructor
0064   TrackSegment(const TrackSegment& other) = default;
0065 
0066   /// copy-assignment operator
0067   TrackSegment& operator=(TrackSegment other) &; // Rebind this to other's internal object
0068   TrackSegment& operator=(TrackSegment other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0069 
0070   /// create a mutable deep-copy of the object with identical relations
0071   /// if cloneRelations=false, the relations are not cloned and will be empty
0072   MutableTrackSegment clone(bool cloneRelations=true) const;
0073 
0074   /// destructor
0075   ~TrackSegment() = default;
0076 
0077   /// converting constructor from mutable object
0078   TrackSegment(const MutableTrackSegment& other);
0079 
0080   static TrackSegment makeEmpty();
0081 
0082 public:
0083 
0084   static constexpr std::string_view typeName = "edm4eic::TrackSegment";
0085 
0086   /// Access the Pathlength from the first to the last point
0087   float getLength() const;
0088 
0089   /// Access the Error on the segment length
0090   float getLengthError() const;
0091 
0092 
0093   /// Access the Track used for this projection
0094   const edm4eic::Track getTrack() const;
0095 
0096   std::size_t points_size() const;
0097   edm4eic::TrackPoint getPoints(std::size_t) const;
0098   std::vector<edm4eic::TrackPoint>::const_iterator points_begin() const;
0099   std::vector<edm4eic::TrackPoint>::const_iterator points_end() const;
0100   podio::RelationRange<edm4eic::TrackPoint> getPoints() const;
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   bool operator==(const TrackSegment& other) const { return m_obj == other.m_obj; }
0109   bool operator==(const MutableTrackSegment& other) const;
0110 
0111   bool operator!=(const TrackSegment& other) const { return !(*this == other); }
0112   bool operator!=(const MutableTrackSegment& other) const { return !(*this == other); }
0113 
0114   // less comparison operator, so that objects can be e.g. stored in sets.
0115   bool operator<(const TrackSegment& 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<TrackSegment>;
0122 
0123   friend void swap(TrackSegment& a, TrackSegment& 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 TrackSegment(podio::utils::MaybeSharedPtr<TrackSegmentObj> obj);
0131   TrackSegment(TrackSegmentObj* obj);
0132 
0133   podio::utils::MaybeSharedPtr<TrackSegmentObj> m_obj{nullptr};
0134 };
0135 
0136 std::ostream& operator<<(std::ostream& o, const TrackSegment& value);
0137 
0138 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0139 void to_json(nlohmann::json& j, const TrackSegment& value);
0140 #endif
0141 
0142 
0143 } // namespace edm4eic
0144 
0145 
0146 
0147 template<>
0148 struct std::hash<edm4eic::TrackSegment> {
0149   std::size_t operator()(const edm4eic::TrackSegment& obj) const {
0150     return std::hash<edm4eic::TrackSegmentObj*>{}(obj.m_obj.get());
0151   }
0152 };
0153 
0154 
0155 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0156 // until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
0157 // and https://github.com/AIDASoft/podio/issues/770
0158 #if defined(__clang__)
0159 #pragma clang diagnostic push
0160 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0161 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0162 #pragma clang diagnostic ignored "-Wdeprecated"
0163 constexpr std::string_view edm4eic::TrackSegment::typeName;
0164 #pragma clang diagnostic pop
0165 #elif defined(__GNUC__)
0166 #pragma GCC diagnostic push
0167 #pragma GCC diagnostic ignored "-Wdeprecated"
0168 constexpr std::string_view edm4eic::TrackSegment::typeName;
0169 #pragma GCC diagnostic pop
0170 #endif
0171 
0172 #endif