Back to home page

EIC code displayed by LXR

 
 

    


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

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 
0017 #include <ostream>
0018 #include <cstdint>
0019 
0020 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0021 #include "nlohmann/json_fwd.hpp"
0022 #endif
0023 
0024 
0025 
0026 namespace edm4eic {
0027 
0028 class MutableVertex;
0029 class VertexCollection;
0030 class VertexCollectionData;
0031 
0032 /** @class Vertex
0033  *  EIC vertex
0034  *  @author: J. Osborn
0035  */
0036 class Vertex {
0037 
0038   friend class MutableVertex;
0039   friend class VertexCollection;
0040   friend class edm4eic::VertexCollectionData;
0041   friend class VertexCollectionIterator;
0042 
0043 public:
0044   using mutable_type = MutableVertex;
0045   using collection_type = VertexCollection;
0046 
0047   /// default constructor
0048   Vertex();
0049 
0050   /// Constructor initializing all members
0051   Vertex(std::int32_t type, float chi2, int ndf, edm4hep::Vector4f position, edm4eic::Cov4f positionError);
0052 
0053   /// copy constructor
0054   Vertex(const Vertex& other) = default;
0055 
0056   /// copy-assignment operator
0057   Vertex& operator=(Vertex other);
0058 
0059   /// create a mutable deep-copy of the object with identical relations
0060   /// if cloneRelations=false, the relations are not cloned and will be empty
0061   MutableVertex clone(bool cloneRelations=true) const;
0062 
0063   /// destructor
0064   ~Vertex() = default;
0065 
0066   /// converting constructor from mutable object
0067   Vertex(const MutableVertex& other);
0068 
0069   static Vertex makeEmpty();
0070 
0071 public:
0072 
0073   /// Access the Type flag, to identify what type of vertex it is (e.g. primary, secondary, generated, etc.)
0074   std::int32_t getType() const;
0075 
0076   /// Access the Chi-squared of the vertex fit
0077   float getChi2() const;
0078 
0079   /// Access the NDF of the vertex fit
0080   int getNdf() const;
0081 
0082   /// Access the position [mm] + time t0 [ns] of the vertex. Time is 4th component in vector
0083   const edm4hep::Vector4f& getPosition() const;
0084 
0085   /// Access the Covariance matrix of the position+time. Time is 4th component, similarly to 4vector
0086   const edm4eic::Cov4f& getPositionError() const;
0087 
0088 
0089 
0090   std::size_t associatedParticles_size() const;
0091   edm4eic::ReconstructedParticle getAssociatedParticles(std::size_t) const;
0092   std::vector<edm4eic::ReconstructedParticle>::const_iterator associatedParticles_begin() const;
0093   std::vector<edm4eic::ReconstructedParticle>::const_iterator associatedParticles_end() const;
0094   podio::RelationRange<edm4eic::ReconstructedParticle> getAssociatedParticles() const;
0095 
0096 
0097   /// check whether the object is actually available
0098   bool isAvailable() const;
0099   /// disconnect from VertexObj instance
0100   void unlink() { m_obj = podio::utils::MaybeSharedPtr<VertexObj>{nullptr}; }
0101 
0102   bool operator==(const Vertex& other) const { return m_obj == other.m_obj; }
0103   bool operator==(const MutableVertex& other) const;
0104 
0105   bool operator!=(const Vertex& other) const { return !(*this == other); }
0106   bool operator!=(const MutableVertex& other) const { return !(*this == other); }
0107 
0108   // less comparison operator, so that objects can be e.g. stored in sets.
0109   bool operator<(const Vertex& other) const { return m_obj < other.m_obj; }
0110 
0111   podio::ObjectID id() const { return getObjectID(); }
0112 
0113   const podio::ObjectID getObjectID() const;
0114 
0115   friend void swap(Vertex& a, Vertex& b) {
0116     using std::swap;
0117     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0118   }
0119 
0120 private:
0121   /// constructor from existing VertexObj
0122   explicit Vertex(podio::utils::MaybeSharedPtr<VertexObj> obj);
0123   Vertex(VertexObj* obj);
0124 
0125   podio::utils::MaybeSharedPtr<VertexObj> m_obj{nullptr};
0126 };
0127 
0128 std::ostream& operator<<(std::ostream& o, const Vertex& value);
0129 
0130 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0131 void to_json(nlohmann::json& j, const Vertex& value);
0132 #endif
0133 
0134 
0135 } // namespace edm4eic
0136 
0137 
0138 #endif