Back to home page

EIC code displayed by LXR

 
 

    


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

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