Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-09 08:30:09

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(std::uint64_t surface, edm4hep::Vector2f loc, float time, edm4eic::Cov3f covariance);
0053 
0054   /// copy constructor
0055   MutableMeasurement2D(const MutableMeasurement2D& other) = default;
0056 
0057   /// copy-assignment operator
0058   MutableMeasurement2D& operator=(MutableMeasurement2D other);
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   MutableMeasurement2D clone(bool cloneRelations=true) const;
0063 
0064   /// destructor
0065   ~MutableMeasurement2D() = default;
0066 
0067 
0068 public:
0069 
0070   /// Access the Surface for bound coordinates (geometryID)
0071   std::uint64_t getSurface() const;
0072 
0073   /// Access the 2D location on surface
0074   const edm4hep::Vector2f& getLoc() const;
0075 
0076   /// Access the Measurement time
0077   float getTime() const;
0078 
0079   /// Access the Covariance on location and time
0080   const edm4eic::Cov3f& getCovariance() const;
0081 
0082 
0083 
0084   /// Set the Surface for bound coordinates (geometryID)
0085   void setSurface(std::uint64_t value);
0086   /// Get mutable reference to Surface for bound coordinates (geometryID)
0087   std::uint64_t& getSurface();
0088   /// Get reference to Surface for bound coordinates (geometryID)
0089   [[deprecated("use getSurface instead")]]
0090   std::uint64_t& surface();
0091 
0092   /// Set the 2D location on surface
0093   void setLoc(edm4hep::Vector2f value);
0094   /// Get mutable reference to 2D location on surface
0095   edm4hep::Vector2f& getLoc();
0096   /// Get reference to 2D location on surface
0097   [[deprecated("use getLoc instead")]]
0098   edm4hep::Vector2f& loc();
0099 
0100   /// Set the Measurement time
0101   void setTime(float value);
0102   /// Get mutable reference to Measurement time
0103   float& getTime();
0104   /// Get reference to Measurement time
0105   [[deprecated("use getTime instead")]]
0106   float& time();
0107 
0108   /// Set the Covariance on location and time
0109   void setCovariance(edm4eic::Cov3f value);
0110   /// Get mutable reference to Covariance on location and time
0111   edm4eic::Cov3f& getCovariance();
0112   /// Get reference to Covariance on location and time
0113   [[deprecated("use getCovariance instead")]]
0114   edm4eic::Cov3f& covariance();
0115 
0116 
0117 
0118   void addToHits(const edm4eic::TrackerHit&);
0119   std::size_t hits_size() const;
0120   edm4eic::TrackerHit getHits(std::size_t) const;
0121   std::vector<edm4eic::TrackerHit>::const_iterator hits_begin() const;
0122   std::vector<edm4eic::TrackerHit>::const_iterator hits_end() const;
0123   podio::RelationRange<edm4eic::TrackerHit> getHits() const;
0124   void addToWeights(const float&);
0125   std::size_t weights_size() const;
0126   float getWeights(std::size_t) const;
0127   std::vector<float>::const_iterator weights_begin() const;
0128   std::vector<float>::const_iterator weights_end() const;
0129   podio::RelationRange<float> getWeights() const;
0130 
0131 
0132 
0133   /// check whether the object is actually available
0134   bool isAvailable() const;
0135   /// disconnect from Measurement2DObj instance
0136   void unlink() { m_obj = podio::utils::MaybeSharedPtr<Measurement2DObj>{nullptr}; }
0137 
0138   bool operator==(const MutableMeasurement2D& other) const { return m_obj == other.m_obj; }
0139   bool operator==(const Measurement2D& other) const;
0140 
0141   bool operator!=(const MutableMeasurement2D& other) const { return !(*this == other); }
0142   bool operator!=(const Measurement2D& other) const { return !(*this == other); }
0143 
0144   // less comparison operator, so that objects can be e.g. stored in sets.
0145   bool operator<(const MutableMeasurement2D& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0146 
0147   podio::ObjectID id() const { return getObjectID(); }
0148 
0149   const podio::ObjectID getObjectID() const;
0150 
0151   friend void swap(MutableMeasurement2D& a, MutableMeasurement2D& b) {
0152     using std::swap;
0153     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0154   }
0155 
0156 private:
0157   /// constructor from existing Measurement2DObj
0158   explicit MutableMeasurement2D(podio::utils::MaybeSharedPtr<Measurement2DObj> obj);
0159 
0160   podio::utils::MaybeSharedPtr<Measurement2DObj> m_obj{nullptr};
0161 };
0162 
0163 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0164 void to_json(nlohmann::json& j, const MutableMeasurement2D& value);
0165 #endif
0166 
0167 
0168 } // namespace edm4eic
0169 
0170 
0171 #endif