Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:55:07

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();
0060 
0061   /// Constructor initializing all members
0062   Vertex(const std::int32_t type, const float chi2, const int ndf, const edm4hep::Vector4f& position, const edm4eic::Cov4f& positionError);
0063 
0064   /// copy constructor
0065   Vertex(const Vertex& other) = default;
0066 
0067   /// copy-assignment operator
0068   Vertex& operator=(Vertex other) &; // Rebind this to other's internal object
0069   Vertex& operator=(Vertex other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0070 
0071   /// create a mutable deep-copy of the object with identical relations
0072   /// if cloneRelations=false, the relations are not cloned and will be empty
0073   MutableVertex clone(bool cloneRelations=true) const;
0074 
0075   /// destructor
0076   ~Vertex() = default;
0077 
0078   /// converting constructor from mutable object
0079   Vertex(const MutableVertex& other);
0080 
0081   static Vertex makeEmpty();
0082 
0083 public:
0084 
0085   static constexpr std::string_view typeName = "edm4eic::Vertex";
0086 
0087   /// Access the Type flag, to identify what type of vertex it is (e.g. primary, secondary, generated, etc.)
0088   std::int32_t getType() const;
0089 
0090   /// Access the Chi-squared of the vertex fit
0091   float getChi2() const;
0092 
0093   /// Access the NDF of the vertex fit
0094   int getNdf() const;
0095 
0096   /// Access the position [mm] + time t0 [ns] of the vertex. Time is 4th component in vector
0097   const edm4hep::Vector4f& getPosition() const;
0098 
0099   /// Access the Covariance matrix of the position+time. Time is 4th component, similarly to 4vector
0100   const edm4eic::Cov4f& getPositionError() const;
0101 
0102 
0103 
0104   std::size_t associatedParticles_size() const;
0105   edm4eic::ReconstructedParticle getAssociatedParticles(std::size_t) const;
0106   std::vector<edm4eic::ReconstructedParticle>::const_iterator associatedParticles_begin() const;
0107   std::vector<edm4eic::ReconstructedParticle>::const_iterator associatedParticles_end() const;
0108   podio::RelationRange<edm4eic::ReconstructedParticle> getAssociatedParticles() const;
0109 
0110 
0111   /// check whether the object is actually available
0112   bool isAvailable() const;
0113   /// disconnect from VertexObj instance
0114   void unlink() { m_obj = podio::utils::MaybeSharedPtr<VertexObj>{nullptr}; }
0115 
0116   bool operator==(const Vertex& other) const { return m_obj == other.m_obj; }
0117   bool operator==(const MutableVertex& other) const;
0118 
0119   bool operator!=(const Vertex& other) const { return !(*this == other); }
0120   bool operator!=(const MutableVertex& other) const { return !(*this == other); }
0121 
0122   // less comparison operator, so that objects can be e.g. stored in sets.
0123   bool operator<(const Vertex& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0124 
0125   podio::ObjectID id() const { return getObjectID(); }
0126 
0127   const podio::ObjectID getObjectID() const;
0128 
0129   friend std::hash<Vertex>;
0130 
0131   friend void swap(Vertex& a, Vertex& b) {
0132     using std::swap;
0133     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0134   }
0135 
0136 private:
0137   /// constructor from existing VertexObj
0138   explicit Vertex(podio::utils::MaybeSharedPtr<VertexObj> obj);
0139   Vertex(VertexObj* obj);
0140 
0141   podio::utils::MaybeSharedPtr<VertexObj> m_obj{nullptr};
0142 };
0143 
0144 std::ostream& operator<<(std::ostream& o, const Vertex& value);
0145 
0146 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0147 void to_json(nlohmann::json& j, const Vertex& value);
0148 #endif
0149 
0150 
0151 } // namespace edm4eic
0152 
0153 
0154 
0155 template<>
0156 struct std::hash<edm4eic::Vertex> {
0157   std::size_t operator()(const edm4eic::Vertex& obj) const {
0158     return std::hash<edm4eic::VertexObj*>{}(obj.m_obj.get());
0159   }
0160 };
0161 
0162 
0163 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0164 // until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
0165 // and https://github.com/AIDASoft/podio/issues/770
0166 #if defined(__clang__)
0167 #pragma clang diagnostic push
0168 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0169 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0170 #pragma clang diagnostic ignored "-Wdeprecated"
0171 constexpr std::string_view edm4eic::Vertex::typeName;
0172 #pragma clang diagnostic pop
0173 #elif defined(__GNUC__)
0174 #pragma GCC diagnostic push
0175 #pragma GCC diagnostic ignored "-Wdeprecated"
0176 constexpr std::string_view edm4eic::Vertex::typeName;
0177 #pragma GCC diagnostic pop
0178 #endif
0179 
0180 #endif