Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-20 10:16:15

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_Vertex_H
0004 #define EDM4EIC_Vertex_H
0005 
0006 #include "edm4eic/VertexObj.h"
0007 
0008 #include "edm4eic/Cov4f.h"
0009 #include "edm4eic/ReconstructedParticle.h"
0010 #include "edm4hep/Vector4f.h"
0011 #include "podio/RelationRange.h"
0012 #include <cstdint>
0013 #include <vector>
0014 
0015 #include "podio/utilities/MaybeSharedPtr.h"
0016 #include "podio/detail/OrderKey.h"
0017 
0018 #include <ostream>
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 podio::detail {
0032 // Internal function used in less comparison operators of the datatypes and interface types
0033 OrderKey getOrderKey(const edm4eic::Vertex& obj);
0034 };
0035 
0036 namespace edm4eic {
0037 
0038 class MutableVertex;
0039 class VertexCollection;
0040 class VertexCollectionData;
0041 
0042 /** @class Vertex
0043  *  EIC vertex
0044  *  @author: J. Osborn
0045  */
0046 class Vertex {
0047 
0048   friend class MutableVertex;
0049   friend class VertexCollection;
0050   friend class edm4eic::VertexCollectionData;
0051   friend class VertexCollectionIterator;
0052   friend podio::detail::OrderKey podio::detail::getOrderKey(const Vertex & obj);
0053 
0054 public:
0055   using mutable_type = MutableVertex;
0056   using collection_type = VertexCollection;
0057 
0058   /// default constructor
0059   Vertex() = default;
0060 
0061   /// Constructor initializing all members
0062   Vertex(const std::int32_t type, const float chi2, const float ndf, const edm4hep::Vector4f& position, const edm4eic::Cov4f& positionError);
0063 
0064   /// copy constructor
0065   Vertex(const Vertex& other) noexcept = default;
0066 
0067   /// move constructor
0068   Vertex(Vertex&& other) noexcept = default;
0069 
0070   /// copy-assignment operator
0071   Vertex& operator=(Vertex other) &; // Rebind this to other's internal object
0072   Vertex& operator=(Vertex other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0073 
0074   /// create a mutable deep-copy of the object with identical relations
0075   /// if cloneRelations=false, the relations are not cloned and will be empty
0076   MutableVertex clone(bool cloneRelations=true) const;
0077 
0078   /// destructor
0079   ~Vertex() = default;
0080 
0081   /// converting constructor from mutable object
0082   Vertex(const MutableVertex& other);
0083 
0084   static Vertex makeEmpty();
0085 
0086 public:
0087 
0088   static constexpr std::string_view typeName = "edm4eic::Vertex";
0089 
0090   /// Access the Type flag, to identify what type of vertex it is (e.g. primary, secondary, generated, etc.)
0091   std::int32_t getType() const;
0092 
0093   /// Access the Chi-squared of the vertex fit
0094   float getChi2() const;
0095 
0096   /// Access the Ndf of the vertex fit, float allows for fractional numbers seen from AMVF - consistent with Acts EDM
0097   float getNdf() const;
0098 
0099   /// Access the position [mm] + time t0 [ns] of the vertex. Time is 4th component in vector
0100   const edm4hep::Vector4f& getPosition() const;
0101 
0102   /// Access the Covariance matrix of the position+time. Time is 4th component, similarly to 4vector
0103   const edm4eic::Cov4f& getPositionError() const;
0104 
0105 
0106 
0107   std::size_t associatedParticles_size() const;
0108   edm4eic::ReconstructedParticle getAssociatedParticles(std::size_t) const;
0109   std::vector<edm4eic::ReconstructedParticle>::const_iterator associatedParticles_begin() const;
0110   std::vector<edm4eic::ReconstructedParticle>::const_iterator associatedParticles_end() const;
0111   podio::RelationRange<edm4eic::ReconstructedParticle> getAssociatedParticles() const;
0112 
0113 
0114   /// check whether the object is actually available
0115   bool isAvailable() const;
0116   /// disconnect from VertexObj instance
0117   void unlink() { m_obj = podio::utils::MaybeSharedPtr<VertexObj>{nullptr}; }
0118 
0119   constexpr bool operator==(const Vertex& other) const { return m_obj == other.m_obj; }
0120   bool operator==(const MutableVertex& other) const;
0121 
0122   constexpr bool operator!=(const Vertex& other) const { return !(*this == other); }
0123   bool operator!=(const MutableVertex& other) const { return !(*this == other); }
0124 
0125   // less comparison operator, so that objects can be e.g. stored in sets.
0126   bool operator<(const Vertex& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0127 
0128   podio::ObjectID id() const { return getObjectID(); }
0129 
0130   const podio::ObjectID getObjectID() const;
0131 
0132   friend std::hash<Vertex>;
0133 
0134   friend void swap(Vertex& a, Vertex& b) {
0135     using std::swap;
0136     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0137   }
0138 
0139 private:
0140   /// constructor from existing VertexObj
0141   explicit Vertex(podio::utils::MaybeSharedPtr<VertexObj> obj);
0142   Vertex(VertexObj* obj);
0143 
0144   podio::utils::MaybeSharedPtr<VertexObj> m_obj{new VertexObj{}, podio::utils::MarkOwned};
0145 };
0146 
0147 std::ostream& operator<<(std::ostream& o, const Vertex& value);
0148 
0149 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0150 void to_json(nlohmann::json& j, const Vertex& value);
0151 #endif
0152 
0153 
0154 } // namespace edm4eic
0155 
0156 
0157 
0158 template<>
0159 struct std::hash<edm4eic::Vertex> {
0160   std::size_t operator()(const edm4eic::Vertex& obj) const {
0161     return std::hash<edm4eic::VertexObj*>{}(obj.m_obj.get());
0162   }
0163 };
0164 
0165 
0166 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0167 // until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
0168 // and https://github.com/AIDASoft/podio/issues/770
0169 #if defined(__clang__)
0170   #pragma clang diagnostic push
0171   #pragma clang diagnostic ignored "-Wunknown-warning-option"
0172   #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0173   #pragma clang diagnostic ignored "-Wdeprecated"
0174 constexpr std::string_view edm4eic::Vertex::typeName;
0175   #pragma clang diagnostic pop
0176 #elif defined(__GNUC__)
0177   #pragma GCC diagnostic push
0178   #pragma GCC diagnostic ignored "-Wdeprecated"
0179 constexpr std::string_view edm4eic::Vertex::typeName;
0180   #pragma GCC diagnostic pop
0181 #endif
0182 
0183 
0184 #endif