Back to home page

EIC code displayed by LXR

 
 

    


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

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/ParticleID.h"
0010 #include "edm4hep/Track.h"
0011 #include "edm4hep/Vector3f.h"
0012 #include "podio/RelationRange.h"
0013 #include <array>
0014 #include <cstdint>
0015 #include <vector>
0016 
0017 #include "podio/utilities/MaybeSharedPtr.h"
0018 
0019 #include <cstdint>
0020 #include <ostream>
0021 
0022 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0023 #include "nlohmann/json_fwd.hpp"
0024 #endif
0025 
0026 // forward declarations
0027 namespace edm4hep {
0028 class Vertex;
0029 class MutableVertex;
0030 class ParticleID;
0031 class MutableParticleID;
0032 } // namespace edm4hep
0033 
0034 namespace edm4hep {
0035 
0036 class MutableReconstructedParticle;
0037 class ReconstructedParticleCollection;
0038 class ReconstructedParticleCollectionData;
0039 
0040 /** @class ReconstructedParticle
0041  *  Reconstructed Particle
0042  *  @author: F.Gaede, DESY
0043  */
0044 class ReconstructedParticle {
0045 
0046   friend class MutableReconstructedParticle;
0047   friend class ReconstructedParticleCollection;
0048   friend class edm4hep::ReconstructedParticleCollectionData;
0049   friend class ReconstructedParticleCollectionIterator;
0050 
0051 public:
0052   using mutable_type = MutableReconstructedParticle;
0053   using collection_type = ReconstructedParticleCollection;
0054 
0055   /// default constructor
0056   ReconstructedParticle();
0057 
0058   /// Constructor initializing all members
0059   ReconstructedParticle(std::int32_t type, float energy, edm4hep::Vector3f momentum, edm4hep::Vector3f referencePoint,
0060                         float charge, float mass, float goodnessOfPID, std::array<float, 10> covMatrix);
0061 
0062   /// copy constructor
0063   ReconstructedParticle(const ReconstructedParticle& other) = default;
0064 
0065   /// copy-assignment operator
0066   ReconstructedParticle& operator=(ReconstructedParticle other);
0067 
0068   /// create a mutable deep-copy of the object with identical relations
0069   /// if cloneRelations=false, the relations are not cloned and will be empty
0070   MutableReconstructedParticle clone(bool cloneRelations = true) const;
0071 
0072   /// destructor
0073   ~ReconstructedParticle() = default;
0074 
0075   /// converting constructor from mutable object
0076   ReconstructedParticle(const MutableReconstructedParticle& other);
0077 
0078   static ReconstructedParticle makeEmpty();
0079 
0080 public:
0081   /// Access the type of reconstructed particle. Check/set collection parameters ReconstructedParticleTypeNames and
0082   /// ReconstructedParticleTypeValues.
0083   std::int32_t getType() const;
0084 
0085   /// Access the [GeV] energy of the reconstructed particle. Four momentum state is not kept consistent internally.
0086   float getEnergy() const;
0087 
0088   /// Access the [GeV] particle momentum. Four momentum state is not kept consistent internally.
0089   const edm4hep::Vector3f& getMomentum() const;
0090 
0091   /// Access the [mm] reference, i.e. where the particle has been measured
0092   const edm4hep::Vector3f& getReferencePoint() const;
0093 
0094   /// Access the charge of the reconstructed particle.
0095   float getCharge() const;
0096 
0097   /// Access the [GeV] mass of the reconstructed particle, set independently from four vector. Four momentum state is
0098   /// not kept consistent internally.
0099   float getMass() const;
0100 
0101   /// Access the overall goodness of the PID on a scale of [0;1]
0102   float getGoodnessOfPID() const;
0103 
0104   /// Access the cvariance matrix of the reconstructed particle 4vector (10 parameters). Stored as lower triangle matrix
0105   /// of the four momentum (px,py,pz,E), i.e. cov(px,px), cov(py,##
0106   const std::array<float, 10>& getCovMatrix() const;
0107   /// Access item i of the cvariance matrix of the reconstructed particle 4vector (10 parameters). Stored as lower
0108   /// triangle matrix of the four momentum (px,py,pz,E), i.e. cov(px,px), cov(py,##
0109   float getCovMatrix(size_t i) const;
0110 
0111   /// Access the start vertex associated to this particle
0112   const edm4hep::Vertex getStartVertex() const;
0113   /// Access the particle Id used for the kinematics of this particle
0114   const edm4hep::ParticleID getParticleIDUsed() const;
0115 
0116   std::size_t clusters_size() const;
0117   edm4hep::Cluster getClusters(std::size_t) const;
0118   std::vector<edm4hep::Cluster>::const_iterator clusters_begin() const;
0119   std::vector<edm4hep::Cluster>::const_iterator clusters_end() const;
0120   podio::RelationRange<edm4hep::Cluster> getClusters() const;
0121   std::size_t tracks_size() const;
0122   edm4hep::Track getTracks(std::size_t) const;
0123   std::vector<edm4hep::Track>::const_iterator tracks_begin() const;
0124   std::vector<edm4hep::Track>::const_iterator tracks_end() const;
0125   podio::RelationRange<edm4hep::Track> getTracks() const;
0126   std::size_t particles_size() const;
0127   edm4hep::ReconstructedParticle getParticles(std::size_t) const;
0128   std::vector<edm4hep::ReconstructedParticle>::const_iterator particles_begin() const;
0129   std::vector<edm4hep::ReconstructedParticle>::const_iterator particles_end() const;
0130   podio::RelationRange<edm4hep::ReconstructedParticle> getParticles() const;
0131   std::size_t particleIDs_size() const;
0132   edm4hep::ParticleID getParticleIDs(std::size_t) const;
0133   std::vector<edm4hep::ParticleID>::const_iterator particleIDs_begin() const;
0134   std::vector<edm4hep::ParticleID>::const_iterator particleIDs_end() const;
0135   podio::RelationRange<edm4hep::ParticleID> getParticleIDs() const;
0136 
0137   bool isCompound() const {
0138     return particles_size() > 0;
0139   }
0140 
0141   /// check whether the object is actually available
0142   bool isAvailable() const;
0143   /// disconnect from ReconstructedParticleObj instance
0144   void unlink() {
0145     m_obj = podio::utils::MaybeSharedPtr<ReconstructedParticleObj>{nullptr};
0146   }
0147 
0148   bool operator==(const ReconstructedParticle& other) const {
0149     return m_obj == other.m_obj;
0150   }
0151   bool operator==(const MutableReconstructedParticle& other) const;
0152 
0153   bool operator!=(const ReconstructedParticle& other) const {
0154     return !(*this == other);
0155   }
0156   bool operator!=(const MutableReconstructedParticle& other) const {
0157     return !(*this == other);
0158   }
0159 
0160   // less comparison operator, so that objects can be e.g. stored in sets.
0161   bool operator<(const ReconstructedParticle& other) const {
0162     return m_obj < other.m_obj;
0163   }
0164 
0165   podio::ObjectID id() const {
0166     return getObjectID();
0167   }
0168 
0169   const podio::ObjectID getObjectID() const;
0170 
0171   friend void swap(ReconstructedParticle& a, ReconstructedParticle& b) {
0172     using std::swap;
0173     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0174   }
0175 
0176 private:
0177   /// constructor from existing ReconstructedParticleObj
0178   explicit ReconstructedParticle(podio::utils::MaybeSharedPtr<ReconstructedParticleObj> obj);
0179   ReconstructedParticle(ReconstructedParticleObj* obj);
0180 
0181   podio::utils::MaybeSharedPtr<ReconstructedParticleObj> m_obj{nullptr};
0182 };
0183 
0184 std::ostream& operator<<(std::ostream& o, const ReconstructedParticle& value);
0185 
0186 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0187 void to_json(nlohmann::json& j, const ReconstructedParticle& value);
0188 #endif
0189 
0190 } // namespace edm4hep
0191 
0192 #endif