Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_MutableReconstructedParticle_H
0004 #define EDM4HEP_MutableReconstructedParticle_H
0005 
0006 #include "edm4hep/ReconstructedParticleObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4hep/ReconstructedParticle.h"
0009 
0010 #include "edm4hep/Cluster.h"
0011 #include "edm4hep/ParticleID.h"
0012 #include "edm4hep/Track.h"
0013 #include "edm4hep/Vector3f.h"
0014 #include "podio/RelationRange.h"
0015 #include <array>
0016 #include <cstdint>
0017 #include <vector>
0018 
0019 #include "podio/utilities/MaybeSharedPtr.h"
0020 
0021 #include <cstdint>
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 Vertex;
0030 class MutableVertex;
0031 class ParticleID;
0032 class MutableParticleID;
0033 } // namespace edm4hep
0034 
0035 namespace edm4hep {
0036 
0037 /** @class MutableReconstructedParticle
0038  *  Reconstructed Particle
0039  *  @author: F.Gaede, DESY
0040  */
0041 class MutableReconstructedParticle {
0042 
0043   friend class ReconstructedParticleCollection;
0044   friend class ReconstructedParticleMutableCollectionIterator;
0045   friend class ReconstructedParticle;
0046 
0047 public:
0048   using object_type = ReconstructedParticle;
0049   using collection_type = ReconstructedParticleCollection;
0050 
0051   /// default constructor
0052   MutableReconstructedParticle();
0053 
0054   /// Constructor initializing all members
0055   MutableReconstructedParticle(std::int32_t type, float energy, edm4hep::Vector3f momentum,
0056                                edm4hep::Vector3f referencePoint, float charge, float mass, float goodnessOfPID,
0057                                std::array<float, 10> covMatrix);
0058 
0059   /// copy constructor
0060   MutableReconstructedParticle(const MutableReconstructedParticle& other) = default;
0061 
0062   /// copy-assignment operator
0063   MutableReconstructedParticle& operator=(MutableReconstructedParticle other);
0064 
0065   /// create a mutable deep-copy of the object with identical relations
0066   /// if cloneRelations=false, the relations are not cloned and will be empty
0067   MutableReconstructedParticle clone(bool cloneRelations = true) const;
0068 
0069   /// destructor
0070   ~MutableReconstructedParticle() = default;
0071 
0072 public:
0073   /// Access the type of reconstructed particle. Check/set collection parameters ReconstructedParticleTypeNames and
0074   /// ReconstructedParticleTypeValues.
0075   std::int32_t getType() const;
0076 
0077   /// Access the [GeV] energy of the reconstructed particle. Four momentum state is not kept consistent internally.
0078   float getEnergy() const;
0079 
0080   /// Access the [GeV] particle momentum. Four momentum state is not kept consistent internally.
0081   const edm4hep::Vector3f& getMomentum() const;
0082 
0083   /// Access the [mm] reference, i.e. where the particle has been measured
0084   const edm4hep::Vector3f& getReferencePoint() const;
0085 
0086   /// Access the charge of the reconstructed particle.
0087   float getCharge() const;
0088 
0089   /// Access the [GeV] mass of the reconstructed particle, set independently from four vector. Four momentum state is
0090   /// not kept consistent internally.
0091   float getMass() const;
0092 
0093   /// Access the overall goodness of the PID on a scale of [0;1]
0094   float getGoodnessOfPID() const;
0095 
0096   /// Access the cvariance matrix of the reconstructed particle 4vector (10 parameters). Stored as lower triangle matrix
0097   /// of the four momentum (px,py,pz,E), i.e. cov(px,px), cov(py,##
0098   const std::array<float, 10>& getCovMatrix() const;
0099   /// Access item i of the cvariance matrix of the reconstructed particle 4vector (10 parameters). Stored as lower
0100   /// triangle matrix of the four momentum (px,py,pz,E), i.e. cov(px,px), cov(py,##
0101   float getCovMatrix(size_t i) const;
0102 
0103   /// Access the start vertex associated to this particle
0104   const edm4hep::Vertex getStartVertex() const;
0105   /// Access the particle Id used for the kinematics of this particle
0106   const edm4hep::ParticleID getParticleIDUsed() const;
0107 
0108   /// Set the type of reconstructed particle. Check/set collection parameters ReconstructedParticleTypeNames and
0109   /// ReconstructedParticleTypeValues.
0110   void setType(std::int32_t value);
0111   /// Get mutable reference to type of reconstructed particle. Check/set collection parameters
0112   /// ReconstructedParticleTypeNames and ReconstructedParticleTypeValues.
0113   std::int32_t& getType();
0114   /// Get reference to type of reconstructed particle. Check/set collection parameters ReconstructedParticleTypeNames
0115   /// and ReconstructedParticleTypeValues.
0116   [[deprecated("use getType instead")]] std::int32_t& type();
0117 
0118   /// Set the [GeV] energy of the reconstructed particle. Four momentum state is not kept consistent internally.
0119   void setEnergy(float value);
0120   /// Get mutable reference to [GeV] energy of the reconstructed particle. Four momentum state is not kept consistent
0121   /// internally.
0122   float& getEnergy();
0123   /// Get reference to [GeV] energy of the reconstructed particle. Four momentum state is not kept consistent
0124   /// internally.
0125   [[deprecated("use getEnergy instead")]] float& energy();
0126 
0127   /// Set the [GeV] particle momentum. Four momentum state is not kept consistent internally.
0128   void setMomentum(edm4hep::Vector3f value);
0129   /// Get mutable reference to [GeV] particle momentum. Four momentum state is not kept consistent internally.
0130   edm4hep::Vector3f& getMomentum();
0131   /// Get reference to [GeV] particle momentum. Four momentum state is not kept consistent internally.
0132   [[deprecated("use getMomentum instead")]] edm4hep::Vector3f& momentum();
0133 
0134   /// Set the [mm] reference, i.e. where the particle has been measured
0135   void setReferencePoint(edm4hep::Vector3f value);
0136   /// Get mutable reference to [mm] reference, i.e. where the particle has been measured
0137   edm4hep::Vector3f& getReferencePoint();
0138   /// Get reference to [mm] reference, i.e. where the particle has been measured
0139   [[deprecated("use getReferencePoint instead")]] edm4hep::Vector3f& referencePoint();
0140 
0141   /// Set the charge of the reconstructed particle.
0142   void setCharge(float value);
0143   /// Get mutable reference to charge of the reconstructed particle.
0144   float& getCharge();
0145   /// Get reference to charge of the reconstructed particle.
0146   [[deprecated("use getCharge instead")]] float& charge();
0147 
0148   /// Set the [GeV] mass of the reconstructed particle, set independently from four vector. Four momentum state is not
0149   /// kept consistent internally.
0150   void setMass(float value);
0151   /// Get mutable reference to [GeV] mass of the reconstructed particle, set independently from four vector. Four
0152   /// momentum state is not kept consistent internally.
0153   float& getMass();
0154   /// Get reference to [GeV] mass of the reconstructed particle, set independently from four vector. Four momentum state
0155   /// is not kept consistent internally.
0156   [[deprecated("use getMass instead")]] float& mass();
0157 
0158   /// Set the overall goodness of the PID on a scale of [0;1]
0159   void setGoodnessOfPID(float value);
0160   /// Get mutable reference to overall goodness of the PID on a scale of [0;1]
0161   float& getGoodnessOfPID();
0162   /// Get reference to overall goodness of the PID on a scale of [0;1]
0163   [[deprecated("use getGoodnessOfPID instead")]] float& goodnessOfPID();
0164 
0165   /// Set the cvariance matrix of the reconstructed particle 4vector (10 parameters). Stored as lower triangle matrix of
0166   /// the four momentum (px,py,pz,E), i.e. cov(px,px), cov(py,##
0167   void setCovMatrix(std::array<float, 10> value);
0168   void setCovMatrix(size_t i, float value);
0169   /// Get mutable reference to cvariance matrix of the reconstructed particle 4vector (10 parameters). Stored as lower
0170   /// triangle matrix of the four momentum (px,py,pz,E), i.e. cov(px,px), cov(py,##
0171   std::array<float, 10>& getCovMatrix();
0172   /// Get reference to cvariance matrix of the reconstructed particle 4vector (10 parameters). Stored as lower triangle
0173   /// matrix of the four momentum (px,py,pz,E), i.e. cov(px,px), cov(py,##
0174   [[deprecated("use getCovMatrix instead")]] std::array<float, 10>& covMatrix();
0175 
0176   /// Set the start vertex associated to this particle
0177   void setStartVertex(const edm4hep::Vertex& value);
0178   /// Set the particle Id used for the kinematics of this particle
0179   void setParticleIDUsed(const edm4hep::ParticleID& value);
0180 
0181   void addToClusters(const edm4hep::Cluster&);
0182   std::size_t clusters_size() const;
0183   edm4hep::Cluster getClusters(std::size_t) const;
0184   std::vector<edm4hep::Cluster>::const_iterator clusters_begin() const;
0185   std::vector<edm4hep::Cluster>::const_iterator clusters_end() const;
0186   podio::RelationRange<edm4hep::Cluster> getClusters() const;
0187   void addToTracks(const edm4hep::Track&);
0188   std::size_t tracks_size() const;
0189   edm4hep::Track getTracks(std::size_t) const;
0190   std::vector<edm4hep::Track>::const_iterator tracks_begin() const;
0191   std::vector<edm4hep::Track>::const_iterator tracks_end() const;
0192   podio::RelationRange<edm4hep::Track> getTracks() const;
0193   void addToParticles(const edm4hep::ReconstructedParticle&);
0194   std::size_t particles_size() const;
0195   edm4hep::ReconstructedParticle getParticles(std::size_t) const;
0196   std::vector<edm4hep::ReconstructedParticle>::const_iterator particles_begin() const;
0197   std::vector<edm4hep::ReconstructedParticle>::const_iterator particles_end() const;
0198   podio::RelationRange<edm4hep::ReconstructedParticle> getParticles() const;
0199   void addToParticleIDs(const edm4hep::ParticleID&);
0200   std::size_t particleIDs_size() const;
0201   edm4hep::ParticleID getParticleIDs(std::size_t) const;
0202   std::vector<edm4hep::ParticleID>::const_iterator particleIDs_begin() const;
0203   std::vector<edm4hep::ParticleID>::const_iterator particleIDs_end() const;
0204   podio::RelationRange<edm4hep::ParticleID> getParticleIDs() const;
0205 
0206   bool isCompound() const {
0207     return particles_size() > 0;
0208   }
0209 
0210   // vertex where the particle decays This method actually returns the start vertex from the first daughter particle
0211   // found.
0212   // TODO: edm4hep::Vertex  getEndVertex() { return  edm4hep::Vertex(  (getParticles(0).isAvailable() ?
0213   // getParticles(0).getStartVertex() :  edm4hep::Vertex(0,0) ) ) ; }
0214 
0215   /// check whether the object is actually available
0216   bool isAvailable() const;
0217   /// disconnect from ReconstructedParticleObj instance
0218   void unlink() {
0219     m_obj = podio::utils::MaybeSharedPtr<ReconstructedParticleObj>{nullptr};
0220   }
0221 
0222   bool operator==(const MutableReconstructedParticle& other) const {
0223     return m_obj == other.m_obj;
0224   }
0225   bool operator==(const ReconstructedParticle& other) const;
0226 
0227   bool operator!=(const MutableReconstructedParticle& other) const {
0228     return !(*this == other);
0229   }
0230   bool operator!=(const ReconstructedParticle& other) const {
0231     return !(*this == other);
0232   }
0233 
0234   // less comparison operator, so that objects can be e.g. stored in sets.
0235   bool operator<(const MutableReconstructedParticle& other) const {
0236     return m_obj < other.m_obj;
0237   }
0238 
0239   podio::ObjectID id() const {
0240     return getObjectID();
0241   }
0242 
0243   const podio::ObjectID getObjectID() const;
0244 
0245   friend void swap(MutableReconstructedParticle& a, MutableReconstructedParticle& b) {
0246     using std::swap;
0247     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0248   }
0249 
0250 private:
0251   /// constructor from existing ReconstructedParticleObj
0252   explicit MutableReconstructedParticle(podio::utils::MaybeSharedPtr<ReconstructedParticleObj> obj);
0253 
0254   podio::utils::MaybeSharedPtr<ReconstructedParticleObj> m_obj{nullptr};
0255 };
0256 
0257 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0258 void to_json(nlohmann::json& j, const MutableReconstructedParticle& value);
0259 #endif
0260 
0261 } // namespace edm4hep
0262 
0263 #endif