Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-17 08:20:52

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_MutableIrtParticle_H
0004 #define EDM4EIC_MutableIrtParticle_H
0005 
0006 #include "edm4eic/IrtParticleObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4eic/IrtParticle.h"
0009 
0010 #include "edm4eic/IrtRadiatorInfo.h"
0011 #include "podio/RelationRange.h"
0012 #include <cstdint>
0013 #include <vector>
0014 
0015 #include "podio/utilities/MaybeSharedPtr.h"
0016 
0017 #include <cstdint>
0018 
0019 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0020 #include "nlohmann/json_fwd.hpp"
0021 #endif
0022 
0023 // forward declarations
0024 namespace edm4eic {
0025 class IrtParticleCollection;
0026 class Track;
0027 class MutableTrack;
0028 }
0029 
0030 
0031 namespace edm4eic {
0032 
0033 
0034 /** @class MutableIrtParticle
0035  *  IRT 2.1 output (track level)
0036  *  @author: A. Kiselev
0037  */
0038 class MutableIrtParticle {
0039 
0040   friend class IrtParticleCollection;
0041   friend class IrtParticleMutableCollectionIterator;
0042   friend class IrtParticle;
0043 
0044 public:
0045   using object_type = IrtParticle;
0046   using collection_type = IrtParticleCollection;
0047 
0048   /// default constructor
0049   MutableIrtParticle() = default;
0050 
0051   /// Constructor initializing all members
0052   MutableIrtParticle(const std::int32_t PDG, const std::uint16_t npe, const std::uint16_t nhits);
0053 
0054   /// copy constructor
0055   MutableIrtParticle(const MutableIrtParticle& other) = default;
0056 
0057   /// copy-assignment operator
0058   MutableIrtParticle& operator=(MutableIrtParticle other) &; // Rebind this to other's internal object
0059   MutableIrtParticle& operator=(MutableIrtParticle other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
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   MutableIrtParticle clone(bool cloneRelations=true) const;
0064 
0065   /// destructor
0066   ~MutableIrtParticle() = default;
0067 
0068 
0069 public:
0070 
0071   /// Access the Reconstructed most probable PDG code
0072   std::int32_t getPDG() const;
0073 
0074   /// Access the Detected photoelectron count
0075   std::uint16_t getNpe() const;
0076 
0077   /// Access the Hit count associated with this particle by IRT engine
0078   std::uint16_t getNhits() const;
0079 
0080 
0081   /// Access the charged particle track
0082   const edm4eic::Track getTrack() const;
0083 
0084   /// Set the Reconstructed most probable PDG code
0085   void setPDG(const std::int32_t PDG);
0086   /// Get mutable reference to Reconstructed most probable PDG code
0087   std::int32_t& getPDG();
0088   /// Get reference to Reconstructed most probable PDG code
0089   [[deprecated("use getPDG instead")]]
0090   std::int32_t& PDG();
0091 
0092   /// Set the Detected photoelectron count
0093   void setNpe(const std::uint16_t npe);
0094   /// Get mutable reference to Detected photoelectron count
0095   std::uint16_t& getNpe();
0096   /// Get reference to Detected photoelectron count
0097   [[deprecated("use getNpe instead")]]
0098   std::uint16_t& npe();
0099 
0100   /// Set the Hit count associated with this particle by IRT engine
0101   void setNhits(const std::uint16_t nhits);
0102   /// Get mutable reference to Hit count associated with this particle by IRT engine
0103   std::uint16_t& getNhits();
0104   /// Get reference to Hit count associated with this particle by IRT engine
0105   [[deprecated("use getNhits instead")]]
0106   std::uint16_t& nhits();
0107 
0108 
0109   /// Set the charged particle track
0110   void setTrack(const edm4eic::Track& value);
0111 
0112   void addToRadiators(const edm4eic::IrtRadiatorInfo&);
0113   std::size_t radiators_size() const;
0114   edm4eic::IrtRadiatorInfo getRadiators(std::size_t) const;
0115   std::vector<edm4eic::IrtRadiatorInfo>::const_iterator radiators_begin() const;
0116   std::vector<edm4eic::IrtRadiatorInfo>::const_iterator radiators_end() const;
0117   podio::RelationRange<edm4eic::IrtRadiatorInfo> getRadiators() const;
0118 
0119 
0120 
0121   /// check whether the object is actually available
0122   bool isAvailable() const;
0123   /// disconnect from IrtParticleObj instance
0124   void unlink() { m_obj = podio::utils::MaybeSharedPtr<IrtParticleObj>{nullptr}; }
0125 
0126   bool operator==(const MutableIrtParticle& other) const { return m_obj == other.m_obj; }
0127   bool operator==(const IrtParticle& other) const;
0128 
0129   bool operator!=(const MutableIrtParticle& other) const { return !(*this == other); }
0130   bool operator!=(const IrtParticle& other) const { return !(*this == other); }
0131 
0132   // less comparison operator, so that objects can be e.g. stored in sets.
0133   bool operator<(const MutableIrtParticle& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0134 
0135   podio::ObjectID id() const { return getObjectID(); }
0136 
0137   const podio::ObjectID getObjectID() const;
0138 
0139   friend std::hash<MutableIrtParticle>;
0140 
0141   friend void swap(MutableIrtParticle& a, MutableIrtParticle& b) {
0142     using std::swap;
0143     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0144   }
0145 
0146 private:
0147   /// constructor from existing IrtParticleObj
0148   explicit MutableIrtParticle(podio::utils::MaybeSharedPtr<IrtParticleObj> obj);
0149 
0150   podio::utils::MaybeSharedPtr<IrtParticleObj> m_obj{new IrtParticleObj{}, podio::utils::MarkOwned};
0151 };
0152 
0153 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0154 void to_json(nlohmann::json& j, const MutableIrtParticle& value);
0155 #endif
0156 
0157 
0158 } // namespace edm4eic
0159 
0160 
0161 
0162 template<>
0163 struct std::hash<edm4eic::MutableIrtParticle> {
0164   std::size_t operator()(const edm4eic::MutableIrtParticle& obj) const {
0165     return std::hash<edm4eic::IrtParticleObj*>{}(obj.m_obj.get());
0166   }
0167 };
0168 
0169 
0170 #endif