Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-11 08:30:16

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_ReconstructedParticle_H
0004 #define EDM4HEP_ReconstructedParticle_H
0005 
0006 #include "edm4hep/ReconstructedParticleObj.h"
0007 
0008 #include "edm4hep/Cluster.h"
0009 #include "edm4hep/CovMatrix4f.h"
0010 #include "edm4hep/Track.h"
0011 #include "edm4hep/Vector3f.h"
0012 #include "podio/RelationRange.h"
0013 #include <cstdint>
0014 #include <edm4hep/Constants.h>
0015 #include <vector>
0016 
0017 #include "podio/detail/OrderKey.h"
0018 #include "podio/utilities/MaybeSharedPtr.h"
0019 
0020 #include <cstdint>
0021 #include <ostream>
0022 
0023 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0024 #include "nlohmann/json_fwd.hpp"
0025 #endif
0026 
0027 // forward declarations
0028 namespace edm4hep {
0029 class ReconstructedParticleCollection;
0030 class Vertex;
0031 class MutableVertex;
0032 } // namespace edm4hep
0033 
0034 namespace podio::detail {
0035 // Internal function used in less comparison operators of the datatypes and interface types
0036 OrderKey getOrderKey(const edm4hep::ReconstructedParticle& obj);
0037 }; // namespace podio::detail
0038 
0039 namespace edm4hep {
0040 
0041 class MutableReconstructedParticle;
0042 class ReconstructedParticleCollection;
0043 class ReconstructedParticleCollectionData;
0044 
0045 /** @class ReconstructedParticle
0046  *  Reconstructed Particle
0047  *  @author: EDM4hep authors
0048  */
0049 class ReconstructedParticle {
0050 
0051   friend class MutableReconstructedParticle;
0052   friend class ReconstructedParticleCollection;
0053   friend class edm4hep::ReconstructedParticleCollectionData;
0054   friend class ReconstructedParticleCollectionIterator;
0055   friend podio::detail::OrderKey podio::detail::getOrderKey(const ReconstructedParticle& obj);
0056 
0057 public:
0058   using mutable_type = MutableReconstructedParticle;
0059   using collection_type = ReconstructedParticleCollection;
0060 
0061   /// default constructor
0062   ReconstructedParticle();
0063 
0064   /// Constructor initializing all members
0065   ReconstructedParticle(std::int32_t PDG, float energy, edm4hep::Vector3f momentum, edm4hep::Vector3f referencePoint,
0066                         float charge, float mass, float goodnessOfPID, edm4hep::CovMatrix4f covMatrix);
0067 
0068   /// copy constructor
0069   ReconstructedParticle(const ReconstructedParticle& other) = default;
0070 
0071   /// copy-assignment operator
0072   ReconstructedParticle& operator=(ReconstructedParticle other);
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   MutableReconstructedParticle clone(bool cloneRelations = true) const;
0077 
0078   /// destructor
0079   ~ReconstructedParticle() = default;
0080 
0081   /// converting constructor from mutable object
0082   ReconstructedParticle(const MutableReconstructedParticle& other);
0083 
0084   static ReconstructedParticle makeEmpty();
0085 
0086 public:
0087   static constexpr auto typeName = "edm4hep::ReconstructedParticle";
0088 
0089   /// Access the PDG of the reconstructed particle.
0090   std::int32_t getPDG() const;
0091 
0092   /// Access the energy of the reconstructed particle. Four momentum state is not kept consistent internally [GeV]
0093   float getEnergy() const;
0094 
0095   /// Access the particle momentum. Four momentum state is not kept consistent internally [GeV]
0096   const edm4hep::Vector3f& getMomentum() const;
0097 
0098   /// Access the reference, i.e. where the particle has been measured [mm]
0099   const edm4hep::Vector3f& getReferencePoint() const;
0100 
0101   /// Access the charge of the reconstructed particle
0102   float getCharge() const;
0103 
0104   /// Access the mass of the reconstructed particle, set independently from four vector. Four momentum state is not kept
0105   /// consistent internally [GeV]
0106   float getMass() const;
0107 
0108   /// Access the overall goodness of the PID on a scale of [0;1]
0109   float getGoodnessOfPID() const;
0110 
0111   /// Access the covariance matrix of the reconstructed particle 4vector
0112   const edm4hep::CovMatrix4f& getCovMatrix() const;
0113 
0114   /// Access the decay vertex for the particle (if it is a composite particle)
0115   const edm4hep::Vertex getDecayVertex() const;
0116 
0117   std::size_t clusters_size() const;
0118   edm4hep::Cluster getClusters(std::size_t) const;
0119   std::vector<edm4hep::Cluster>::const_iterator clusters_begin() const;
0120   std::vector<edm4hep::Cluster>::const_iterator clusters_end() const;
0121   podio::RelationRange<edm4hep::Cluster> getClusters() const;
0122   std::size_t tracks_size() const;
0123   edm4hep::Track getTracks(std::size_t) const;
0124   std::vector<edm4hep::Track>::const_iterator tracks_begin() const;
0125   std::vector<edm4hep::Track>::const_iterator tracks_end() const;
0126   podio::RelationRange<edm4hep::Track> getTracks() const;
0127   std::size_t particles_size() const;
0128   edm4hep::ReconstructedParticle getParticles(std::size_t) const;
0129   std::vector<edm4hep::ReconstructedParticle>::const_iterator particles_begin() const;
0130   std::vector<edm4hep::ReconstructedParticle>::const_iterator particles_end() const;
0131   podio::RelationRange<edm4hep::ReconstructedParticle> getParticles() const;
0132 
0133   bool isCompound() const {
0134     return particles_size() > 0;
0135   }
0136   [[deprecated("use setPDG instead")]] int32_t getType() const {
0137     return getPDG();
0138   }
0139   /// Get the four momentum covariance matrix value for the two passed dimensions
0140   float getCovMatrix(edm4hep::FourMomCoords dimI, edm4hep::FourMomCoords dimJ) const {
0141     return getCovMatrix().getValue(dimI, dimJ);
0142   }
0143 
0144   /// check whether the object is actually available
0145   bool isAvailable() const;
0146   /// disconnect from ReconstructedParticleObj instance
0147   void unlink() {
0148     m_obj = podio::utils::MaybeSharedPtr<ReconstructedParticleObj>{nullptr};
0149   }
0150 
0151   bool operator==(const ReconstructedParticle& other) const {
0152     return m_obj == other.m_obj;
0153   }
0154   bool operator==(const MutableReconstructedParticle& other) const;
0155 
0156   bool operator!=(const ReconstructedParticle& other) const {
0157     return !(*this == other);
0158   }
0159   bool operator!=(const MutableReconstructedParticle& other) const {
0160     return !(*this == other);
0161   }
0162 
0163   // less comparison operator, so that objects can be e.g. stored in sets.
0164   bool operator<(const ReconstructedParticle& other) const {
0165     return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0166   }
0167 
0168   podio::ObjectID id() const {
0169     return getObjectID();
0170   }
0171 
0172   const podio::ObjectID getObjectID() const;
0173 
0174   friend void swap(ReconstructedParticle& a, ReconstructedParticle& b) {
0175     using std::swap;
0176     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0177   }
0178 
0179 private:
0180   /// constructor from existing ReconstructedParticleObj
0181   explicit ReconstructedParticle(podio::utils::MaybeSharedPtr<ReconstructedParticleObj> obj);
0182   ReconstructedParticle(ReconstructedParticleObj* obj);
0183 
0184   podio::utils::MaybeSharedPtr<ReconstructedParticleObj> m_obj{nullptr};
0185 };
0186 
0187 std::ostream& operator<<(std::ostream& o, const ReconstructedParticle& value);
0188 
0189 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0190 void to_json(nlohmann::json& j, const ReconstructedParticle& value);
0191 #endif
0192 
0193 } // namespace edm4hep
0194 
0195 #endif