Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-30 08:34:16

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_MutableVertex_H
0004 #define EDM4EIC_MutableVertex_H
0005 
0006 #include "edm4eic/VertexObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4eic/Vertex.h"
0009 
0010 #include "edm4eic/Cov4f.h"
0011 #include "edm4eic/ReconstructedParticle.h"
0012 #include "edm4hep/Vector4f.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 VertexCollection;
0028 }
0029 
0030 
0031 namespace edm4eic {
0032 
0033 
0034 /** @class MutableVertex
0035  *  EIC vertex
0036  *  @author: J. Osborn
0037  */
0038 class MutableVertex {
0039 
0040   friend class VertexCollection;
0041   friend class VertexMutableCollectionIterator;
0042   friend class Vertex;
0043 
0044 public:
0045   using object_type = Vertex;
0046   using collection_type = VertexCollection;
0047 
0048   /// default constructor
0049   MutableVertex();
0050 
0051   /// Constructor initializing all members
0052   MutableVertex(std::int32_t type, float chi2, int ndf, edm4hep::Vector4f position, edm4eic::Cov4f positionError);
0053 
0054   /// copy constructor
0055   MutableVertex(const MutableVertex& other) = default;
0056 
0057   /// copy-assignment operator
0058   MutableVertex& operator=(MutableVertex 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   MutableVertex clone(bool cloneRelations=true) const;
0063 
0064   /// destructor
0065   ~MutableVertex() = default;
0066 
0067 
0068 public:
0069 
0070   /// Access the Type flag, to identify what type of vertex it is (e.g. primary, secondary, generated, etc.)
0071   std::int32_t getType() const;
0072 
0073   /// Access the Chi-squared of the vertex fit
0074   float getChi2() const;
0075 
0076   /// Access the NDF of the vertex fit
0077   int getNdf() const;
0078 
0079   /// Access the position [mm] + time t0 [ns] of the vertex. Time is 4th component in vector
0080   const edm4hep::Vector4f& getPosition() const;
0081 
0082   /// Access the Covariance matrix of the position+time. Time is 4th component, similarly to 4vector
0083   const edm4eic::Cov4f& getPositionError() const;
0084 
0085 
0086 
0087   /// Set the Type flag, to identify what type of vertex it is (e.g. primary, secondary, generated, etc.)
0088   void setType(std::int32_t value);
0089   /// Get mutable reference to Type flag, to identify what type of vertex it is (e.g. primary, secondary, generated, etc.)
0090   std::int32_t& getType();
0091   /// Get reference to Type flag, to identify what type of vertex it is (e.g. primary, secondary, generated, etc.)
0092   [[deprecated("use getType instead")]]
0093   std::int32_t& type();
0094 
0095   /// Set the Chi-squared of the vertex fit
0096   void setChi2(float value);
0097   /// Get mutable reference to Chi-squared of the vertex fit
0098   float& getChi2();
0099   /// Get reference to Chi-squared of the vertex fit
0100   [[deprecated("use getChi2 instead")]]
0101   float& chi2();
0102 
0103   /// Set the NDF of the vertex fit
0104   void setNdf(int value);
0105   /// Get mutable reference to NDF of the vertex fit
0106   int& getNdf();
0107   /// Get reference to NDF of the vertex fit
0108   [[deprecated("use getNdf instead")]]
0109   int& ndf();
0110 
0111   /// Set the position [mm] + time t0 [ns] of the vertex. Time is 4th component in vector
0112   void setPosition(edm4hep::Vector4f value);
0113   /// Get mutable reference to position [mm] + time t0 [ns] of the vertex. Time is 4th component in vector
0114   edm4hep::Vector4f& getPosition();
0115   /// Get reference to position [mm] + time t0 [ns] of the vertex. Time is 4th component in vector
0116   [[deprecated("use getPosition instead")]]
0117   edm4hep::Vector4f& position();
0118 
0119   /// Set the Covariance matrix of the position+time. Time is 4th component, similarly to 4vector
0120   void setPositionError(edm4eic::Cov4f value);
0121   /// Get mutable reference to Covariance matrix of the position+time. Time is 4th component, similarly to 4vector
0122   edm4eic::Cov4f& getPositionError();
0123   /// Get reference to Covariance matrix of the position+time. Time is 4th component, similarly to 4vector
0124   [[deprecated("use getPositionError instead")]]
0125   edm4eic::Cov4f& positionError();
0126 
0127 
0128 
0129   void addToAssociatedParticles(const edm4eic::ReconstructedParticle&);
0130   std::size_t associatedParticles_size() const;
0131   edm4eic::ReconstructedParticle getAssociatedParticles(std::size_t) const;
0132   std::vector<edm4eic::ReconstructedParticle>::const_iterator associatedParticles_begin() const;
0133   std::vector<edm4eic::ReconstructedParticle>::const_iterator associatedParticles_end() const;
0134   podio::RelationRange<edm4eic::ReconstructedParticle> getAssociatedParticles() const;
0135 
0136 
0137 
0138   /// check whether the object is actually available
0139   bool isAvailable() const;
0140   /// disconnect from VertexObj instance
0141   void unlink() { m_obj = podio::utils::MaybeSharedPtr<VertexObj>{nullptr}; }
0142 
0143   bool operator==(const MutableVertex& other) const { return m_obj == other.m_obj; }
0144   bool operator==(const Vertex& other) const;
0145 
0146   bool operator!=(const MutableVertex& other) const { return !(*this == other); }
0147   bool operator!=(const Vertex& other) const { return !(*this == other); }
0148 
0149   // less comparison operator, so that objects can be e.g. stored in sets.
0150   bool operator<(const MutableVertex& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0151 
0152   podio::ObjectID id() const { return getObjectID(); }
0153 
0154   const podio::ObjectID getObjectID() const;
0155 
0156   friend void swap(MutableVertex& a, MutableVertex& b) {
0157     using std::swap;
0158     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0159   }
0160 
0161 private:
0162   /// constructor from existing VertexObj
0163   explicit MutableVertex(podio::utils::MaybeSharedPtr<VertexObj> obj);
0164 
0165   podio::utils::MaybeSharedPtr<VertexObj> m_obj{nullptr};
0166 };
0167 
0168 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0169 void to_json(nlohmann::json& j, const MutableVertex& value);
0170 #endif
0171 
0172 
0173 } // namespace edm4eic
0174 
0175 
0176 #endif