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_MutableParticleID_H
0004 #define EDM4HEP_MutableParticleID_H
0005 
0006 #include "edm4hep/ParticleIDObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4hep/ParticleID.h"
0009 
0010 #include "podio/RelationRange.h"
0011 #include <cstdint>
0012 #include <vector>
0013 
0014 #include "podio/utilities/MaybeSharedPtr.h"
0015 
0016 #include <cstdint>
0017 
0018 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0019 #include "nlohmann/json_fwd.hpp"
0020 #endif
0021 
0022 namespace edm4hep {
0023 
0024 /** @class MutableParticleID
0025  *  ParticleID
0026  *  @author: F.Gaede, DESY
0027  */
0028 class MutableParticleID {
0029 
0030   friend class ParticleIDCollection;
0031   friend class ParticleIDMutableCollectionIterator;
0032   friend class ParticleID;
0033 
0034 public:
0035   using object_type = ParticleID;
0036   using collection_type = ParticleIDCollection;
0037 
0038   /// default constructor
0039   MutableParticleID();
0040 
0041   /// Constructor initializing all members
0042   MutableParticleID(std::int32_t type, std::int32_t PDG, std::int32_t algorithmType, float likelihood);
0043 
0044   /// copy constructor
0045   MutableParticleID(const MutableParticleID& other) = default;
0046 
0047   /// copy-assignment operator
0048   MutableParticleID& operator=(MutableParticleID other);
0049 
0050   /// create a mutable deep-copy of the object with identical relations
0051   /// if cloneRelations=false, the relations are not cloned and will be empty
0052   MutableParticleID clone(bool cloneRelations = true) const;
0053 
0054   /// destructor
0055   ~MutableParticleID() = default;
0056 
0057 public:
0058   /// Access the userdefined type
0059   std::int32_t getType() const;
0060 
0061   /// Access the PDG code of this id - ( 999999 ) if unknown.
0062   std::int32_t getPDG() const;
0063 
0064   /// Access the type of the algorithm/module that created this hypothesis
0065   std::int32_t getAlgorithmType() const;
0066 
0067   /// Access the likelihood of this hypothesis - in a user defined normalization.
0068   float getLikelihood() const;
0069 
0070   /// Set the userdefined type
0071   void setType(std::int32_t value);
0072   /// Get mutable reference to userdefined type
0073   std::int32_t& getType();
0074   /// Get reference to userdefined type
0075   [[deprecated("use getType instead")]] std::int32_t& type();
0076 
0077   /// Set the PDG code of this id - ( 999999 ) if unknown.
0078   void setPDG(std::int32_t value);
0079   /// Get mutable reference to PDG code of this id - ( 999999 ) if unknown.
0080   std::int32_t& getPDG();
0081   /// Get reference to PDG code of this id - ( 999999 ) if unknown.
0082   [[deprecated("use getPDG instead")]] std::int32_t& PDG();
0083 
0084   /// Set the type of the algorithm/module that created this hypothesis
0085   void setAlgorithmType(std::int32_t value);
0086   /// Get mutable reference to type of the algorithm/module that created this hypothesis
0087   std::int32_t& getAlgorithmType();
0088   /// Get reference to type of the algorithm/module that created this hypothesis
0089   [[deprecated("use getAlgorithmType instead")]] std::int32_t& algorithmType();
0090 
0091   /// Set the likelihood of this hypothesis - in a user defined normalization.
0092   void setLikelihood(float value);
0093   /// Get mutable reference to likelihood of this hypothesis - in a user defined normalization.
0094   float& getLikelihood();
0095   /// Get reference to likelihood of this hypothesis - in a user defined normalization.
0096   [[deprecated("use getLikelihood instead")]] float& likelihood();
0097 
0098   void addToParameters(const float&);
0099   std::size_t parameters_size() const;
0100   float getParameters(std::size_t) const;
0101   std::vector<float>::const_iterator parameters_begin() const;
0102   std::vector<float>::const_iterator parameters_end() const;
0103   podio::RelationRange<float> getParameters() const;
0104 
0105   /// check whether the object is actually available
0106   bool isAvailable() const;
0107   /// disconnect from ParticleIDObj instance
0108   void unlink() {
0109     m_obj = podio::utils::MaybeSharedPtr<ParticleIDObj>{nullptr};
0110   }
0111 
0112   bool operator==(const MutableParticleID& other) const {
0113     return m_obj == other.m_obj;
0114   }
0115   bool operator==(const ParticleID& other) const;
0116 
0117   bool operator!=(const MutableParticleID& other) const {
0118     return !(*this == other);
0119   }
0120   bool operator!=(const ParticleID& other) const {
0121     return !(*this == other);
0122   }
0123 
0124   // less comparison operator, so that objects can be e.g. stored in sets.
0125   bool operator<(const MutableParticleID& other) const {
0126     return m_obj < other.m_obj;
0127   }
0128 
0129   podio::ObjectID id() const {
0130     return getObjectID();
0131   }
0132 
0133   const podio::ObjectID getObjectID() const;
0134 
0135   friend void swap(MutableParticleID& a, MutableParticleID& b) {
0136     using std::swap;
0137     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0138   }
0139 
0140 private:
0141   /// constructor from existing ParticleIDObj
0142   explicit MutableParticleID(podio::utils::MaybeSharedPtr<ParticleIDObj> obj);
0143 
0144   podio::utils::MaybeSharedPtr<ParticleIDObj> m_obj{nullptr};
0145 };
0146 
0147 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0148 void to_json(nlohmann::json& j, const MutableParticleID& value);
0149 #endif
0150 
0151 } // namespace edm4hep
0152 
0153 #endif