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_MutableRecDqdx_H
0004 #define EDM4HEP_MutableRecDqdx_H
0005 
0006 #include "edm4hep/RecDqdxObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4hep/RecDqdx.h"
0009 
0010 #include "edm4hep/HitLevelData.h"
0011 #include "edm4hep/Hypothesis.h"
0012 #include "edm4hep/Quantity.h"
0013 #include "podio/RelationRange.h"
0014 #include <array>
0015 #include <cstdint>
0016 #include <vector>
0017 
0018 #include "podio/utilities/MaybeSharedPtr.h"
0019 
0020 #include <cstdint>
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 Track;
0029 class MutableTrack;
0030 } // namespace edm4hep
0031 
0032 namespace edm4hep {
0033 
0034 /** @class MutableRecDqdx
0035  *  dN/dx or dE/dx info of Track.
0036  *  @author: Wenxing Fang, IHEP
0037  */
0038 class MutableRecDqdx {
0039 
0040   friend class RecDqdxCollection;
0041   friend class RecDqdxMutableCollectionIterator;
0042   friend class RecDqdx;
0043 
0044 public:
0045   using object_type = RecDqdx;
0046   using collection_type = RecDqdxCollection;
0047 
0048   /// default constructor
0049   MutableRecDqdx();
0050 
0051   /// Constructor initializing all members
0052   MutableRecDqdx(edm4hep::Quantity dQdx, std::int16_t particleType, std::int16_t type,
0053                  std::array<edm4hep::Hypothesis, 5> hypotheses);
0054 
0055   /// copy constructor
0056   MutableRecDqdx(const MutableRecDqdx& other) = default;
0057 
0058   /// copy-assignment operator
0059   MutableRecDqdx& operator=(MutableRecDqdx other);
0060 
0061   /// create a mutable deep-copy of the object with identical relations
0062   /// if cloneRelations=false, the relations are not cloned and will be empty
0063   MutableRecDqdx clone(bool cloneRelations = true) const;
0064 
0065   /// destructor
0066   ~MutableRecDqdx() = default;
0067 
0068 public:
0069   /// Access the the reconstructed dEdx or dNdx and its error
0070   const edm4hep::Quantity& getDQdx() const;
0071 
0072   /// Access the particle type, e(0),mu(1),pi(2),K(3),p(4).
0073   std::int16_t getParticleType() const;
0074 
0075   /// Access the type.
0076   std::int16_t getType() const;
0077 
0078   /// Access the 5 particle hypothesis
0079   const std::array<edm4hep::Hypothesis, 5>& getHypotheses() const;
0080   /// Access item i of the 5 particle hypothesis
0081   const edm4hep::Hypothesis& getHypotheses(size_t i) const;
0082 
0083   /// Access the the corresponding track.
0084   const edm4hep::Track getTrack() const;
0085 
0086   /// Set the the reconstructed dEdx or dNdx and its error
0087   void setDQdx(edm4hep::Quantity value);
0088   /// Get mutable reference to the reconstructed dEdx or dNdx and its error
0089   edm4hep::Quantity& getDQdx();
0090   /// Get reference to the reconstructed dEdx or dNdx and its error
0091   [[deprecated("use getDQdx instead")]] edm4hep::Quantity& dQdx();
0092 
0093   /// Set the particle type, e(0),mu(1),pi(2),K(3),p(4).
0094   void setParticleType(std::int16_t value);
0095   /// Get mutable reference to particle type, e(0),mu(1),pi(2),K(3),p(4).
0096   std::int16_t& getParticleType();
0097   /// Get reference to particle type, e(0),mu(1),pi(2),K(3),p(4).
0098   [[deprecated("use getParticleType instead")]] std::int16_t& particleType();
0099 
0100   /// Set the type.
0101   void setType(std::int16_t value);
0102   /// Get mutable reference to type.
0103   std::int16_t& getType();
0104   /// Get reference to type.
0105   [[deprecated("use getType instead")]] std::int16_t& type();
0106 
0107   /// Set the 5 particle hypothesis
0108   void setHypotheses(std::array<edm4hep::Hypothesis, 5> value);
0109   void setHypotheses(size_t i, edm4hep::Hypothesis value);
0110   /// Get mutable reference to 5 particle hypothesis
0111   std::array<edm4hep::Hypothesis, 5>& getHypotheses();
0112   /// Get reference to 5 particle hypothesis
0113   [[deprecated("use getHypotheses instead")]] std::array<edm4hep::Hypothesis, 5>& hypotheses();
0114 
0115   /// Set the the corresponding track.
0116   void setTrack(const edm4hep::Track& value);
0117 
0118   void addToHitData(const edm4hep::HitLevelData&);
0119   std::size_t hitData_size() const;
0120   edm4hep::HitLevelData getHitData(std::size_t) const;
0121   std::vector<edm4hep::HitLevelData>::const_iterator hitData_begin() const;
0122   std::vector<edm4hep::HitLevelData>::const_iterator hitData_end() const;
0123   podio::RelationRange<edm4hep::HitLevelData> getHitData() const;
0124 
0125   /// check whether the object is actually available
0126   bool isAvailable() const;
0127   /// disconnect from RecDqdxObj instance
0128   void unlink() {
0129     m_obj = podio::utils::MaybeSharedPtr<RecDqdxObj>{nullptr};
0130   }
0131 
0132   bool operator==(const MutableRecDqdx& other) const {
0133     return m_obj == other.m_obj;
0134   }
0135   bool operator==(const RecDqdx& other) const;
0136 
0137   bool operator!=(const MutableRecDqdx& other) const {
0138     return !(*this == other);
0139   }
0140   bool operator!=(const RecDqdx& other) const {
0141     return !(*this == other);
0142   }
0143 
0144   // less comparison operator, so that objects can be e.g. stored in sets.
0145   bool operator<(const MutableRecDqdx& other) const {
0146     return m_obj < other.m_obj;
0147   }
0148 
0149   podio::ObjectID id() const {
0150     return getObjectID();
0151   }
0152 
0153   const podio::ObjectID getObjectID() const;
0154 
0155   friend void swap(MutableRecDqdx& a, MutableRecDqdx& b) {
0156     using std::swap;
0157     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0158   }
0159 
0160 private:
0161   /// constructor from existing RecDqdxObj
0162   explicit MutableRecDqdx(podio::utils::MaybeSharedPtr<RecDqdxObj> obj);
0163 
0164   podio::utils::MaybeSharedPtr<RecDqdxObj> m_obj{nullptr};
0165 };
0166 
0167 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0168 void to_json(nlohmann::json& j, const MutableRecDqdx& value);
0169 #endif
0170 
0171 } // namespace edm4hep
0172 
0173 #endif