Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_MutableVertex_H
0004 #define EDM4HEP_MutableVertex_H
0005 
0006 #include "edm4hep/VertexObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4hep/Vertex.h"
0009 
0010 #include "edm4hep/Vector3f.h"
0011 #include "podio/RelationRange.h"
0012 #include <array>
0013 #include <cstdint>
0014 #include <vector>
0015 
0016 #include "podio/utilities/MaybeSharedPtr.h"
0017 
0018 #include <cstdint>
0019 
0020 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0021 #include "nlohmann/json_fwd.hpp"
0022 #endif
0023 
0024 // forward declarations
0025 namespace edm4hep {
0026 class ReconstructedParticle;
0027 class MutableReconstructedParticle;
0028 } // namespace edm4hep
0029 
0030 namespace edm4hep {
0031 
0032 /** @class MutableVertex
0033  *  Vertex
0034  *  @author: F.Gaede, DESY
0035  */
0036 class MutableVertex {
0037 
0038   friend class VertexCollection;
0039   friend class VertexMutableCollectionIterator;
0040   friend class Vertex;
0041 
0042 public:
0043   using object_type = Vertex;
0044   using collection_type = VertexCollection;
0045 
0046   /// default constructor
0047   MutableVertex();
0048 
0049   /// Constructor initializing all members
0050   MutableVertex(std::int32_t primary, float chi2, float probability, edm4hep::Vector3f position,
0051                 std::array<float, 6> covMatrix, std::int32_t algorithmType);
0052 
0053   /// copy constructor
0054   MutableVertex(const MutableVertex& other) = default;
0055 
0056   /// copy-assignment operator
0057   MutableVertex& operator=(MutableVertex other);
0058 
0059   /// create a mutable deep-copy of the object with identical relations
0060   /// if cloneRelations=false, the relations are not cloned and will be empty
0061   MutableVertex clone(bool cloneRelations = true) const;
0062 
0063   /// destructor
0064   ~MutableVertex() = default;
0065 
0066 public:
0067   /// Access the boolean flag, if vertex is the primary vertex of the event
0068   std::int32_t getPrimary() const;
0069 
0070   /// Access the chi-squared of the vertex fit
0071   float getChi2() const;
0072 
0073   /// Access the probability of the vertex fit
0074   float getProbability() const;
0075 
0076   /// Access the [mm] position of the vertex.
0077   const edm4hep::Vector3f& getPosition() const;
0078 
0079   /// Access the covariance matrix of the position (stored as lower triangle matrix, i.e.
0080   /// cov(xx),cov(y,x),cov(z,x),cov(y,y),... )
0081   const std::array<float, 6>& getCovMatrix() const;
0082   /// Access item i of the covariance matrix of the position (stored as lower triangle matrix, i.e.
0083   /// cov(xx),cov(y,x),cov(z,x),cov(y,y),... )
0084   float getCovMatrix(size_t i) const;
0085   /// Access the type code for the algorithm that has been used to create the vertex - check/set the collection
0086   /// parameters AlgorithmName and AlgorithmType.
0087   std::int32_t getAlgorithmType() const;
0088 
0089   /// Access the reconstructed particle associated to this vertex.
0090   const edm4hep::ReconstructedParticle getAssociatedParticle() const;
0091 
0092   /// Set the boolean flag, if vertex is the primary vertex of the event
0093   void setPrimary(std::int32_t value);
0094   /// Get mutable reference to boolean flag, if vertex is the primary vertex of the event
0095   std::int32_t& getPrimary();
0096   /// Get reference to boolean flag, if vertex is the primary vertex of the event
0097   [[deprecated("use getPrimary instead")]] std::int32_t& primary();
0098 
0099   /// Set the chi-squared of the vertex fit
0100   void setChi2(float value);
0101   /// Get mutable reference to chi-squared of the vertex fit
0102   float& getChi2();
0103   /// Get reference to chi-squared of the vertex fit
0104   [[deprecated("use getChi2 instead")]] float& chi2();
0105 
0106   /// Set the probability of the vertex fit
0107   void setProbability(float value);
0108   /// Get mutable reference to probability of the vertex fit
0109   float& getProbability();
0110   /// Get reference to probability of the vertex fit
0111   [[deprecated("use getProbability instead")]] float& probability();
0112 
0113   /// Set the [mm] position of the vertex.
0114   void setPosition(edm4hep::Vector3f value);
0115   /// Get mutable reference to [mm] position of the vertex.
0116   edm4hep::Vector3f& getPosition();
0117   /// Get reference to [mm] position of the vertex.
0118   [[deprecated("use getPosition instead")]] edm4hep::Vector3f& position();
0119 
0120   /// Set the covariance matrix of the position (stored as lower triangle matrix, i.e.
0121   /// cov(xx),cov(y,x),cov(z,x),cov(y,y),... )
0122   void setCovMatrix(std::array<float, 6> value);
0123   void setCovMatrix(size_t i, float value);
0124   /// Get mutable reference to covariance matrix of the position (stored as lower triangle matrix, i.e.
0125   /// cov(xx),cov(y,x),cov(z,x),cov(y,y),... )
0126   std::array<float, 6>& getCovMatrix();
0127   /// Get reference to covariance matrix of the position (stored as lower triangle matrix, i.e.
0128   /// cov(xx),cov(y,x),cov(z,x),cov(y,y),... )
0129   [[deprecated("use getCovMatrix instead")]] std::array<float, 6>& covMatrix();
0130 
0131   /// Set the type code for the algorithm that has been used to create the vertex - check/set the collection parameters
0132   /// AlgorithmName and AlgorithmType.
0133   void setAlgorithmType(std::int32_t value);
0134   /// Get mutable reference to type code for the algorithm that has been used to create the vertex - check/set the
0135   /// collection parameters AlgorithmName and AlgorithmType.
0136   std::int32_t& getAlgorithmType();
0137   /// Get reference to type code for the algorithm that has been used to create the vertex - check/set the collection
0138   /// parameters AlgorithmName and AlgorithmType.
0139   [[deprecated("use getAlgorithmType instead")]] std::int32_t& algorithmType();
0140 
0141   /// Set the reconstructed particle associated to this vertex.
0142   void setAssociatedParticle(const edm4hep::ReconstructedParticle& value);
0143 
0144   void addToParameters(const float&);
0145   std::size_t parameters_size() const;
0146   float getParameters(std::size_t) const;
0147   std::vector<float>::const_iterator parameters_begin() const;
0148   std::vector<float>::const_iterator parameters_end() const;
0149   podio::RelationRange<float> getParameters() const;
0150 
0151   /// check whether the object is actually available
0152   bool isAvailable() const;
0153   /// disconnect from VertexObj instance
0154   void unlink() {
0155     m_obj = podio::utils::MaybeSharedPtr<VertexObj>{nullptr};
0156   }
0157 
0158   bool operator==(const MutableVertex& other) const {
0159     return m_obj == other.m_obj;
0160   }
0161   bool operator==(const Vertex& other) const;
0162 
0163   bool operator!=(const MutableVertex& other) const {
0164     return !(*this == other);
0165   }
0166   bool operator!=(const Vertex& other) const {
0167     return !(*this == other);
0168   }
0169 
0170   // less comparison operator, so that objects can be e.g. stored in sets.
0171   bool operator<(const MutableVertex& other) const {
0172     return m_obj < other.m_obj;
0173   }
0174 
0175   podio::ObjectID id() const {
0176     return getObjectID();
0177   }
0178 
0179   const podio::ObjectID getObjectID() const;
0180 
0181   friend void swap(MutableVertex& a, MutableVertex& b) {
0182     using std::swap;
0183     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0184   }
0185 
0186 private:
0187   /// constructor from existing VertexObj
0188   explicit MutableVertex(podio::utils::MaybeSharedPtr<VertexObj> obj);
0189 
0190   podio::utils::MaybeSharedPtr<VertexObj> m_obj{nullptr};
0191 };
0192 
0193 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0194 void to_json(nlohmann::json& j, const MutableVertex& value);
0195 #endif
0196 
0197 } // namespace edm4hep
0198 
0199 #endif