Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-11 10:20:46

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef JANA2_TUTORIAL_PODIO_DATAMODEL_MutableCalorimeterHit_H
0004 #define JANA2_TUTORIAL_PODIO_DATAMODEL_MutableCalorimeterHit_H
0005 
0006 #include "jana2_tutorial_podio_datamodel/CalorimeterHitObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "jana2_tutorial_podio_datamodel/CalorimeterHit.h"
0009 
0010 #include <cstdint>
0011 
0012 #include "podio/utilities/MaybeSharedPtr.h"
0013 
0014 #include <cstdint>
0015 
0016 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0017 #include "nlohmann/json_fwd.hpp"
0018 #endif
0019 
0020 // forward declarations
0021 class CalorimeterHitCollection;
0022 
0023 
0024 
0025 
0026 /** @class MutableCalorimeterHit
0027  *  A simple calorimeter hit
0028  *  @author: N. Brei
0029  */
0030 class MutableCalorimeterHit {
0031 
0032   friend class CalorimeterHitCollection;
0033   friend class CalorimeterHitMutableCollectionIterator;
0034   friend class CalorimeterHit;
0035 
0036 public:
0037   using object_type = CalorimeterHit;
0038   using collection_type = CalorimeterHitCollection;
0039 
0040   /// default constructor
0041   MutableCalorimeterHit() = default;
0042 
0043   /// Constructor initializing all members
0044   MutableCalorimeterHit(const std::uint64_t cell_id, const std::uint64_t row, const std::uint64_t col, const double x, const double y, const double z, const double energy, const std::uint64_t time);
0045 
0046   /// copy constructor
0047   MutableCalorimeterHit(const MutableCalorimeterHit& other) = default;
0048 
0049   /// copy-assignment operator
0050   MutableCalorimeterHit& operator=(MutableCalorimeterHit other) &; // Rebind this to other's internal object
0051   MutableCalorimeterHit& operator=(MutableCalorimeterHit other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0052 
0053   /// create a mutable deep-copy of the object with identical relations
0054   /// if cloneRelations=false, the relations are not cloned and will be empty
0055   MutableCalorimeterHit clone(bool cloneRelations=true) const;
0056 
0057   /// destructor
0058   ~MutableCalorimeterHit() = default;
0059 
0060 
0061 public:
0062 
0063   /// Access the Cell ID
0064   std::uint64_t getCell_id() const;
0065 
0066   /// Access the Cell row (zero-indexed)
0067   std::uint64_t getRow() const;
0068 
0069   /// Access the Cell column (zero-indexed)
0070   std::uint64_t getCol() const;
0071 
0072   /// Access the x coordinate of cell center [cm]
0073   double getX() const;
0074 
0075   /// Access the y coordinate of cell center [cm]
0076   double getY() const;
0077 
0078   /// Access the z coordinate of cell center [cm]
0079   double getZ() const;
0080 
0081   /// Access the Measured energy deposit [GeV]
0082   double getEnergy() const;
0083 
0084   /// Access the Time [ns]
0085   std::uint64_t getTime() const;
0086 
0087 
0088 
0089   /// Set the Cell ID
0090   void setCell_id(const std::uint64_t cell_id);
0091   /// Get mutable reference to Cell ID
0092   std::uint64_t& getCell_id();
0093   /// Get reference to Cell ID
0094   [[deprecated("use getCell_id instead")]]
0095   std::uint64_t& cell_id();
0096 
0097   /// Set the Cell row (zero-indexed)
0098   void setRow(const std::uint64_t row);
0099   /// Get mutable reference to Cell row (zero-indexed)
0100   std::uint64_t& getRow();
0101   /// Get reference to Cell row (zero-indexed)
0102   [[deprecated("use getRow instead")]]
0103   std::uint64_t& row();
0104 
0105   /// Set the Cell column (zero-indexed)
0106   void setCol(const std::uint64_t col);
0107   /// Get mutable reference to Cell column (zero-indexed)
0108   std::uint64_t& getCol();
0109   /// Get reference to Cell column (zero-indexed)
0110   [[deprecated("use getCol instead")]]
0111   std::uint64_t& col();
0112 
0113   /// Set the x coordinate of cell center [cm]
0114   void setX(const double x);
0115   /// Get mutable reference to x coordinate of cell center [cm]
0116   double& getX();
0117   /// Get reference to x coordinate of cell center [cm]
0118   [[deprecated("use getX instead")]]
0119   double& x();
0120 
0121   /// Set the y coordinate of cell center [cm]
0122   void setY(const double y);
0123   /// Get mutable reference to y coordinate of cell center [cm]
0124   double& getY();
0125   /// Get reference to y coordinate of cell center [cm]
0126   [[deprecated("use getY instead")]]
0127   double& y();
0128 
0129   /// Set the z coordinate of cell center [cm]
0130   void setZ(const double z);
0131   /// Get mutable reference to z coordinate of cell center [cm]
0132   double& getZ();
0133   /// Get reference to z coordinate of cell center [cm]
0134   [[deprecated("use getZ instead")]]
0135   double& z();
0136 
0137   /// Set the Measured energy deposit [GeV]
0138   void setEnergy(const double energy);
0139   /// Get mutable reference to Measured energy deposit [GeV]
0140   double& getEnergy();
0141   /// Get reference to Measured energy deposit [GeV]
0142   [[deprecated("use getEnergy instead")]]
0143   double& energy();
0144 
0145   /// Set the Time [ns]
0146   void setTime(const std::uint64_t time);
0147   /// Get mutable reference to Time [ns]
0148   std::uint64_t& getTime();
0149   /// Get reference to Time [ns]
0150   [[deprecated("use getTime instead")]]
0151   std::uint64_t& time();
0152 
0153 
0154 
0155 
0156 
0157 
0158   /// check whether the object is actually available
0159   bool isAvailable() const;
0160   /// disconnect from CalorimeterHitObj instance
0161   void unlink() { m_obj = podio::utils::MaybeSharedPtr<CalorimeterHitObj>{nullptr}; }
0162 
0163   bool operator==(const MutableCalorimeterHit& other) const { return m_obj == other.m_obj; }
0164   bool operator==(const CalorimeterHit& other) const;
0165 
0166   bool operator!=(const MutableCalorimeterHit& other) const { return !(*this == other); }
0167   bool operator!=(const CalorimeterHit& other) const { return !(*this == other); }
0168 
0169   // less comparison operator, so that objects can be e.g. stored in sets.
0170   bool operator<(const MutableCalorimeterHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0171 
0172   podio::ObjectID id() const { return getObjectID(); }
0173 
0174   const podio::ObjectID getObjectID() const;
0175 
0176   friend std::hash<MutableCalorimeterHit>;
0177 
0178   friend void swap(MutableCalorimeterHit& a, MutableCalorimeterHit& b) {
0179     using std::swap;
0180     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0181   }
0182 
0183 private:
0184   /// constructor from existing CalorimeterHitObj
0185   explicit MutableCalorimeterHit(podio::utils::MaybeSharedPtr<CalorimeterHitObj> obj);
0186 
0187   podio::utils::MaybeSharedPtr<CalorimeterHitObj> m_obj{new CalorimeterHitObj{}, podio::utils::MarkOwned};
0188 };
0189 
0190 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0191 void to_json(nlohmann::json& j, const MutableCalorimeterHit& value);
0192 #endif
0193 
0194 
0195 
0196 
0197 
0198 template<>
0199 struct std::hash<MutableCalorimeterHit> {
0200   std::size_t operator()(const MutableCalorimeterHit& obj) const {
0201     return std::hash<CalorimeterHitObj*>{}(obj.m_obj.get());
0202   }
0203 };
0204 
0205 
0206 #endif