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_MutableCalorimeterCluster_H
0004 #define JANA2_TUTORIAL_PODIO_DATAMODEL_MutableCalorimeterCluster_H
0005 
0006 #include "jana2_tutorial_podio_datamodel/CalorimeterClusterObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "jana2_tutorial_podio_datamodel/CalorimeterCluster.h"
0009 
0010 #include "jana2_tutorial_podio_datamodel/CalorimeterHit.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 class CalorimeterClusterCollection;
0025 
0026 
0027 
0028 
0029 /** @class MutableCalorimeterCluster
0030  *  A simple calorimeter cluster
0031  *  @author: N. Brei
0032  */
0033 class MutableCalorimeterCluster {
0034 
0035   friend class CalorimeterClusterCollection;
0036   friend class CalorimeterClusterMutableCollectionIterator;
0037   friend class CalorimeterCluster;
0038 
0039 public:
0040   using object_type = CalorimeterCluster;
0041   using collection_type = CalorimeterClusterCollection;
0042 
0043   /// default constructor
0044   MutableCalorimeterCluster() = default;
0045 
0046   /// Constructor initializing all members
0047   MutableCalorimeterCluster(const double x_center, const double y_center, const double z_center, const double energy, const std::uint64_t time_begin, const std::uint64_t time_end);
0048 
0049   /// copy constructor
0050   MutableCalorimeterCluster(const MutableCalorimeterCluster& other) = default;
0051 
0052   /// copy-assignment operator
0053   MutableCalorimeterCluster& operator=(MutableCalorimeterCluster other) &; // Rebind this to other's internal object
0054   MutableCalorimeterCluster& operator=(MutableCalorimeterCluster other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0055 
0056   /// create a mutable deep-copy of the object with identical relations
0057   /// if cloneRelations=false, the relations are not cloned and will be empty
0058   MutableCalorimeterCluster clone(bool cloneRelations=true) const;
0059 
0060   /// destructor
0061   ~MutableCalorimeterCluster() = default;
0062 
0063 
0064 public:
0065 
0066   /// Access the x location of cluster center [cm]
0067   double getX_center() const;
0068 
0069   /// Access the y location of cluster center [cm]
0070   double getY_center() const;
0071 
0072   /// Access the z location of cluster center [cm]
0073   double getZ_center() const;
0074 
0075   /// Access the Total energy deposited [GeV]
0076   double getEnergy() const;
0077 
0078   /// Access the Timestamp of earliest hit [ns]
0079   std::uint64_t getTime_begin() const;
0080 
0081   /// Access the Timestamp of latest hit [ns]
0082   std::uint64_t getTime_end() const;
0083 
0084 
0085 
0086   /// Set the x location of cluster center [cm]
0087   void setX_center(const double x_center);
0088   /// Get mutable reference to x location of cluster center [cm]
0089   double& getX_center();
0090   /// Get reference to x location of cluster center [cm]
0091   [[deprecated("use getX_center instead")]]
0092   double& x_center();
0093 
0094   /// Set the y location of cluster center [cm]
0095   void setY_center(const double y_center);
0096   /// Get mutable reference to y location of cluster center [cm]
0097   double& getY_center();
0098   /// Get reference to y location of cluster center [cm]
0099   [[deprecated("use getY_center instead")]]
0100   double& y_center();
0101 
0102   /// Set the z location of cluster center [cm]
0103   void setZ_center(const double z_center);
0104   /// Get mutable reference to z location of cluster center [cm]
0105   double& getZ_center();
0106   /// Get reference to z location of cluster center [cm]
0107   [[deprecated("use getZ_center instead")]]
0108   double& z_center();
0109 
0110   /// Set the Total energy deposited [GeV]
0111   void setEnergy(const double energy);
0112   /// Get mutable reference to Total energy deposited [GeV]
0113   double& getEnergy();
0114   /// Get reference to Total energy deposited [GeV]
0115   [[deprecated("use getEnergy instead")]]
0116   double& energy();
0117 
0118   /// Set the Timestamp of earliest hit [ns]
0119   void setTime_begin(const std::uint64_t time_begin);
0120   /// Get mutable reference to Timestamp of earliest hit [ns]
0121   std::uint64_t& getTime_begin();
0122   /// Get reference to Timestamp of earliest hit [ns]
0123   [[deprecated("use getTime_begin instead")]]
0124   std::uint64_t& time_begin();
0125 
0126   /// Set the Timestamp of latest hit [ns]
0127   void setTime_end(const std::uint64_t time_end);
0128   /// Get mutable reference to Timestamp of latest hit [ns]
0129   std::uint64_t& getTime_end();
0130   /// Get reference to Timestamp of latest hit [ns]
0131   [[deprecated("use getTime_end instead")]]
0132   std::uint64_t& time_end();
0133 
0134 
0135 
0136   void addToHits(const CalorimeterHit&);
0137   std::size_t hits_size() const;
0138   CalorimeterHit getHits(std::size_t) const;
0139   std::vector<CalorimeterHit>::const_iterator hits_begin() const;
0140   std::vector<CalorimeterHit>::const_iterator hits_end() const;
0141   podio::RelationRange<CalorimeterHit> getHits() const;
0142   void addToClusters(const CalorimeterCluster&);
0143   std::size_t clusters_size() const;
0144   CalorimeterCluster getClusters(std::size_t) const;
0145   std::vector<CalorimeterCluster>::const_iterator clusters_begin() const;
0146   std::vector<CalorimeterCluster>::const_iterator clusters_end() const;
0147   podio::RelationRange<CalorimeterCluster> getClusters() const;
0148 
0149 
0150 
0151   /// check whether the object is actually available
0152   bool isAvailable() const;
0153   /// disconnect from CalorimeterClusterObj instance
0154   void unlink() { m_obj = podio::utils::MaybeSharedPtr<CalorimeterClusterObj>{nullptr}; }
0155 
0156   bool operator==(const MutableCalorimeterCluster& other) const { return m_obj == other.m_obj; }
0157   bool operator==(const CalorimeterCluster& other) const;
0158 
0159   bool operator!=(const MutableCalorimeterCluster& other) const { return !(*this == other); }
0160   bool operator!=(const CalorimeterCluster& other) const { return !(*this == other); }
0161 
0162   // less comparison operator, so that objects can be e.g. stored in sets.
0163   bool operator<(const MutableCalorimeterCluster& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0164 
0165   podio::ObjectID id() const { return getObjectID(); }
0166 
0167   const podio::ObjectID getObjectID() const;
0168 
0169   friend std::hash<MutableCalorimeterCluster>;
0170 
0171   friend void swap(MutableCalorimeterCluster& a, MutableCalorimeterCluster& b) {
0172     using std::swap;
0173     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0174   }
0175 
0176 private:
0177   /// constructor from existing CalorimeterClusterObj
0178   explicit MutableCalorimeterCluster(podio::utils::MaybeSharedPtr<CalorimeterClusterObj> obj);
0179 
0180   podio::utils::MaybeSharedPtr<CalorimeterClusterObj> m_obj{new CalorimeterClusterObj{}, podio::utils::MarkOwned};
0181 };
0182 
0183 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0184 void to_json(nlohmann::json& j, const MutableCalorimeterCluster& value);
0185 #endif
0186 
0187 
0188 
0189 
0190 
0191 template<>
0192 struct std::hash<MutableCalorimeterCluster> {
0193   std::size_t operator()(const MutableCalorimeterCluster& obj) const {
0194     return std::hash<CalorimeterClusterObj*>{}(obj.m_obj.get());
0195   }
0196 };
0197 
0198 
0199 #endif