Back to home page

EIC code displayed by LXR

 
 

    


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

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(std::int32_t type, float chi2, int ndf, edm4hep::Vector4f position, edm4eic::Cov4f positionError);
0063 
0064   /// copy constructor
0065   Vertex(const Vertex& other) = default;
0066 
0067   /// copy-assignment operator
0068   Vertex& operator=(Vertex other);
0069 
0070   /// create a mutable deep-copy of the object with identical relations
0071   /// if cloneRelations=false, the relations are not cloned and will be empty
0072   MutableVertex clone(bool cloneRelations=true) const;
0073 
0074   /// destructor
0075   ~Vertex() = default;
0076 
0077   /// converting constructor from mutable object
0078   Vertex(const MutableVertex& other);
0079 
0080   static Vertex makeEmpty();
0081 
0082 public:
0083 
0084   static constexpr auto typeName = "edm4eic::Vertex";
0085 
0086   /// Access the Type flag, to identify what type of vertex it is (e.g. primary, secondary, generated, etc.)
0087   std::int32_t getType() const;
0088 
0089   /// Access the Chi-squared of the vertex fit
0090   float getChi2() const;
0091 
0092   /// Access the NDF of the vertex fit
0093   int getNdf() const;
0094 
0095   /// Access the position [mm] + time t0 [ns] of the vertex. Time is 4th component in vector
0096   const edm4hep::Vector4f& getPosition() const;
0097 
0098   /// Access the Covariance matrix of the position+time. Time is 4th component, similarly to 4vector
0099   const edm4eic::Cov4f& getPositionError() const;
0100 
0101 
0102 
0103   std::size_t associatedParticles_size() const;
0104   edm4eic::ReconstructedParticle getAssociatedParticles(std::size_t) const;
0105   std::vector<edm4eic::ReconstructedParticle>::const_iterator associatedParticles_begin() const;
0106   std::vector<edm4eic::ReconstructedParticle>::const_iterator associatedParticles_end() const;
0107   podio::RelationRange<edm4eic::ReconstructedParticle> getAssociatedParticles() const;
0108 
0109 
0110   /// check whether the object is actually available
0111   bool isAvailable() const;
0112   /// disconnect from VertexObj instance
0113   void unlink() { m_obj = podio::utils::MaybeSharedPtr<VertexObj>{nullptr}; }
0114 
0115   bool operator==(const Vertex& other) const { return m_obj == other.m_obj; }
0116   bool operator==(const MutableVertex& other) const;
0117 
0118   bool operator!=(const Vertex& other) const { return !(*this == other); }
0119   bool operator!=(const MutableVertex& other) const { return !(*this == other); }
0120 
0121   // less comparison operator, so that objects can be e.g. stored in sets.
0122   bool operator<(const Vertex& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0123 
0124   podio::ObjectID id() const { return getObjectID(); }
0125 
0126   const podio::ObjectID getObjectID() const;
0127 
0128   friend void swap(Vertex& a, Vertex& b) {
0129     using std::swap;
0130     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0131   }
0132 
0133 private:
0134   /// constructor from existing VertexObj
0135   explicit Vertex(podio::utils::MaybeSharedPtr<VertexObj> obj);
0136   Vertex(VertexObj* obj);
0137 
0138   podio::utils::MaybeSharedPtr<VertexObj> m_obj{nullptr};
0139 };
0140 
0141 std::ostream& operator<<(std::ostream& o, const Vertex& value);
0142 
0143 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0144 void to_json(nlohmann::json& j, const Vertex& value);
0145 #endif
0146 
0147 
0148 } // namespace edm4eic
0149 
0150 
0151 #endif