Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:55:01

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_MutableMeasurement2D_H
0004 #define EDM4EIC_MutableMeasurement2D_H
0005 
0006 #include "edm4eic/Measurement2DObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4eic/Measurement2D.h"
0009 
0010 #include "edm4eic/Cov3f.h"
0011 #include "edm4eic/TrackerHit.h"
0012 #include "edm4hep/Vector2f.h"
0013 #include "podio/RelationRange.h"
0014 #include <cstdint>
0015 #include <vector>
0016 
0017 #include "podio/utilities/MaybeSharedPtr.h"
0018 
0019 #include <cstdint>
0020 
0021 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0022 #include "nlohmann/json_fwd.hpp"
0023 #endif
0024 
0025 // forward declarations
0026 namespace edm4eic {
0027 class Measurement2DCollection;
0028 }
0029 
0030 
0031 namespace edm4eic {
0032 
0033 
0034 /** @class MutableMeasurement2D
0035  *  2D measurement (on an arbitrary surface)
0036  *  @author: W. Deconinck
0037  */
0038 class MutableMeasurement2D {
0039 
0040   friend class Measurement2DCollection;
0041   friend class Measurement2DMutableCollectionIterator;
0042   friend class Measurement2D;
0043 
0044 public:
0045   using object_type = Measurement2D;
0046   using collection_type = Measurement2DCollection;
0047 
0048   /// default constructor
0049   MutableMeasurement2D();
0050 
0051   /// Constructor initializing all members
0052   MutableMeasurement2D(const std::uint64_t surface, const edm4hep::Vector2f& loc, const float time, const edm4eic::Cov3f& covariance);
0053 
0054   /// copy constructor
0055   MutableMeasurement2D(const MutableMeasurement2D& other) = default;
0056 
0057   /// copy-assignment operator
0058   MutableMeasurement2D& operator=(MutableMeasurement2D other) &; // Rebind this to other's internal object
0059   MutableMeasurement2D& operator=(MutableMeasurement2D other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
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   MutableMeasurement2D clone(bool cloneRelations=true) const;
0064 
0065   /// destructor
0066   ~MutableMeasurement2D() = default;
0067 
0068 
0069 public:
0070 
0071   /// Access the Surface for bound coordinates (geometryID)
0072   std::uint64_t getSurface() const;
0073 
0074   /// Access the 2D location on surface
0075   const edm4hep::Vector2f& getLoc() const;
0076 
0077   /// Access the Measurement time
0078   float getTime() const;
0079 
0080   /// Access the Covariance on location and time
0081   const edm4eic::Cov3f& getCovariance() const;
0082 
0083 
0084 
0085   /// Set the Surface for bound coordinates (geometryID)
0086   void setSurface(const std::uint64_t surface);
0087   /// Get mutable reference to Surface for bound coordinates (geometryID)
0088   std::uint64_t& getSurface();
0089   /// Get reference to Surface for bound coordinates (geometryID)
0090   [[deprecated("use getSurface instead")]]
0091   std::uint64_t& surface();
0092 
0093   /// Set the 2D location on surface
0094   void setLoc(const edm4hep::Vector2f& loc);
0095   /// Get mutable reference to 2D location on surface
0096   edm4hep::Vector2f& getLoc();
0097   /// Get reference to 2D location on surface
0098   [[deprecated("use getLoc instead")]]
0099   edm4hep::Vector2f& loc();
0100 
0101   /// Set the Measurement time
0102   void setTime(const float time);
0103   /// Get mutable reference to Measurement time
0104   float& getTime();
0105   /// Get reference to Measurement time
0106   [[deprecated("use getTime instead")]]
0107   float& time();
0108 
0109   /// Set the Covariance on location and time
0110   void setCovariance(const edm4eic::Cov3f& covariance);
0111   /// Get mutable reference to Covariance on location and time
0112   edm4eic::Cov3f& getCovariance();
0113   /// Get reference to Covariance on location and time
0114   [[deprecated("use getCovariance instead")]]
0115   edm4eic::Cov3f& covariance();
0116 
0117 
0118 
0119   void addToHits(const edm4eic::TrackerHit&);
0120   std::size_t hits_size() const;
0121   edm4eic::TrackerHit getHits(std::size_t) const;
0122   std::vector<edm4eic::TrackerHit>::const_iterator hits_begin() const;
0123   std::vector<edm4eic::TrackerHit>::const_iterator hits_end() const;
0124   podio::RelationRange<edm4eic::TrackerHit> getHits() const;
0125   void addToWeights(const float&);
0126   std::size_t weights_size() const;
0127   float getWeights(std::size_t) const;
0128   std::vector<float>::const_iterator weights_begin() const;
0129   std::vector<float>::const_iterator weights_end() const;
0130   podio::RelationRange<float> getWeights() const;
0131 
0132 
0133 
0134   /// check whether the object is actually available
0135   bool isAvailable() const;
0136   /// disconnect from Measurement2DObj instance
0137   void unlink() { m_obj = podio::utils::MaybeSharedPtr<Measurement2DObj>{nullptr}; }
0138 
0139   bool operator==(const MutableMeasurement2D& other) const { return m_obj == other.m_obj; }
0140   bool operator==(const Measurement2D& other) const;
0141 
0142   bool operator!=(const MutableMeasurement2D& other) const { return !(*this == other); }
0143   bool operator!=(const Measurement2D& other) const { return !(*this == other); }
0144 
0145   // less comparison operator, so that objects can be e.g. stored in sets.
0146   bool operator<(const MutableMeasurement2D& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0147 
0148   podio::ObjectID id() const { return getObjectID(); }
0149 
0150   const podio::ObjectID getObjectID() const;
0151 
0152   friend std::hash<MutableMeasurement2D>;
0153 
0154   friend void swap(MutableMeasurement2D& a, MutableMeasurement2D& b) {
0155     using std::swap;
0156     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0157   }
0158 
0159 private:
0160   /// constructor from existing Measurement2DObj
0161   explicit MutableMeasurement2D(podio::utils::MaybeSharedPtr<Measurement2DObj> obj);
0162 
0163   podio::utils::MaybeSharedPtr<Measurement2DObj> m_obj{nullptr};
0164 };
0165 
0166 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0167 void to_json(nlohmann::json& j, const MutableMeasurement2D& value);
0168 #endif
0169 
0170 
0171 } // namespace edm4eic
0172 
0173 
0174 
0175 template<>
0176 struct std::hash<edm4eic::MutableMeasurement2D> {
0177   std::size_t operator()(const edm4eic::MutableMeasurement2D& obj) const {
0178     return std::hash<edm4eic::Measurement2DObj*>{}(obj.m_obj.get());
0179   }
0180 };
0181 
0182 
0183 #endif