Back to home page

EIC code displayed by LXR

 
 

    


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

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