Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-03 08:34:33

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