Back to home page

EIC code displayed by LXR

 
 

    


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

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