Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-03-30 07:57:06

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef ACTSPODIOEDM_MutableMeasurement_H
0004 #define ACTSPODIOEDM_MutableMeasurement_H
0005 
0006 #include "ActsPodioEdm/MeasurementObj.h"
0007 // Make the immutable class available from its mutable version but not vice
0008 // versa
0009 #include "ActsPodioEdm/Measurement.h"
0010 
0011 #include <cstdint>
0012 #include <vector>
0013 
0014 #include "podio/RelationRange.h"
0015 #include "podio/utilities/MaybeSharedPtr.h"
0016 
0017 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0018 #include "nlohmann/json_fwd.hpp"
0019 #endif
0020 
0021 // forward declarations
0022 namespace ActsPodioEdm {
0023 class MeasurementCollection;
0024 }
0025 namespace edm4hep {
0026 class SimTrackerHit;
0027 class MutableSimTrackerHit;
0028 }  // namespace edm4hep
0029 
0030 namespace ActsPodioEdm {
0031 
0032 /** @class MutableMeasurement
0033  *  Local representation of a measurement
0034  *  @author: Paul Gessinger, CERN
0035  */
0036 class MutableMeasurement {
0037   friend class MeasurementCollection;
0038   friend class MeasurementMutableCollectionIterator;
0039   friend class Measurement;
0040 
0041  public:
0042   using object_type = Measurement;
0043   using collection_type = MeasurementCollection;
0044 
0045   /// default constructor
0046   MutableMeasurement() = default;
0047 
0048   /// Constructor initializing all members
0049   MutableMeasurement(const std::uint64_t geometryId);
0050 
0051   /// copy constructor
0052   MutableMeasurement(const MutableMeasurement& other) = default;
0053 
0054   /// copy-assignment operator
0055   MutableMeasurement& operator=(
0056       MutableMeasurement other) &;  // Rebind this to other's internal object
0057   MutableMeasurement& operator=(MutableMeasurement other) && =
0058       delete;  // Prevent rebinding temporary as the changes wouldn't persist
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   MutableMeasurement clone(bool cloneRelations = true) const;
0063 
0064   /// destructor
0065   ~MutableMeasurement() = default;
0066 
0067  public:
0068   /// Access the the associated surface identifier
0069   std::uint64_t getGeometryId() const;
0070 
0071   /// Access the the associated simulated hit
0072   const edm4hep::SimTrackerHit getSimHit() const;
0073 
0074   /// Set the the associated surface identifier
0075   void setGeometryId(const std::uint64_t geometryId);
0076   /// Get mutable reference to the associated surface identifier
0077   std::uint64_t& getGeometryId();
0078   /// Get reference to the associated surface identifier
0079   [[deprecated("use getGeometryId instead")]]
0080   std::uint64_t& geometryId();
0081 
0082   /// Set the the associated simulated hit
0083   void setSimHit(const edm4hep::SimTrackerHit& value);
0084 
0085   void addToIndices(const std::uint16_t&);
0086   std::size_t indices_size() const;
0087   std::uint16_t getIndices(std::size_t) const;
0088   std::vector<std::uint16_t>::const_iterator indices_begin() const;
0089   std::vector<std::uint16_t>::const_iterator indices_end() const;
0090   podio::RelationRange<std::uint16_t> getIndices() const;
0091   void addToParameterValues(const double&);
0092   std::size_t parameterValues_size() const;
0093   double getParameterValues(std::size_t) const;
0094   std::vector<double>::const_iterator parameterValues_begin() const;
0095   std::vector<double>::const_iterator parameterValues_end() const;
0096   podio::RelationRange<double> getParameterValues() const;
0097   void addToCovarianceValues(const double&);
0098   std::size_t covarianceValues_size() const;
0099   double getCovarianceValues(std::size_t) const;
0100   std::vector<double>::const_iterator covarianceValues_begin() const;
0101   std::vector<double>::const_iterator covarianceValues_end() const;
0102   podio::RelationRange<double> getCovarianceValues() const;
0103 
0104   std::size_t size() const { return indices_size(); }
0105 
0106   /// check whether the object is actually available
0107   bool isAvailable() const;
0108   /// disconnect from MeasurementObj instance
0109   void unlink() {
0110     m_obj = podio::utils::MaybeSharedPtr<MeasurementObj>{nullptr};
0111   }
0112 
0113   bool operator==(const MutableMeasurement& other) const {
0114     return m_obj == other.m_obj;
0115   }
0116   bool operator==(const Measurement& other) const;
0117 
0118   bool operator!=(const MutableMeasurement& other) const {
0119     return !(*this == other);
0120   }
0121   bool operator!=(const Measurement& other) const { return !(*this == other); }
0122 
0123   // less comparison operator, so that objects can be e.g. stored in sets.
0124   bool operator<(const MutableMeasurement& other) const {
0125     return podio::detail::getOrderKey(*this) <
0126            podio::detail::getOrderKey(other);
0127   }
0128 
0129   podio::ObjectID id() const { return getObjectID(); }
0130 
0131   const podio::ObjectID getObjectID() const;
0132 
0133   friend std::hash<MutableMeasurement>;
0134 
0135   friend void swap(MutableMeasurement& a, MutableMeasurement& b) {
0136     using std::swap;
0137     swap(a.m_obj, b.m_obj);  // swap out the internal pointers
0138   }
0139 
0140  private:
0141   /// constructor from existing MeasurementObj
0142   explicit MutableMeasurement(podio::utils::MaybeSharedPtr<MeasurementObj> obj);
0143 
0144   podio::utils::MaybeSharedPtr<MeasurementObj> m_obj{new MeasurementObj{},
0145                                                      podio::utils::MarkOwned};
0146 };
0147 
0148 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0149 void to_json(nlohmann::json& j, const MutableMeasurement& value);
0150 #endif
0151 
0152 }  // namespace ActsPodioEdm
0153 
0154 template <>
0155 struct std::hash<ActsPodioEdm::MutableMeasurement> {
0156   std::size_t operator()(const ActsPodioEdm::MutableMeasurement& obj) const {
0157     return std::hash<ActsPodioEdm::MeasurementObj*>{}(obj.m_obj.get());
0158   }
0159 };
0160 
0161 #endif