Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef JANA2_TUTORIAL_PODIO_DATAMODEL_CalorimeterCluster_H
0004 #define JANA2_TUTORIAL_PODIO_DATAMODEL_CalorimeterCluster_H
0005 
0006 #include "jana2_tutorial_podio_datamodel/CalorimeterClusterObj.h"
0007 
0008 #include "jana2_tutorial_podio_datamodel/CalorimeterHit.h"
0009 #include "podio/RelationRange.h"
0010 #include <cstdint>
0011 #include <vector>
0012 
0013 #include "podio/utilities/MaybeSharedPtr.h"
0014 #include "podio/detail/OrderKey.h"
0015 
0016 #include <ostream>
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 namespace podio::detail {
0028 // Internal function used in less comparison operators of the datatypes and interface types
0029 OrderKey getOrderKey(const ::CalorimeterCluster& obj);
0030 };
0031 
0032 
0033 class MutableCalorimeterCluster;
0034 class CalorimeterClusterCollection;
0035 class CalorimeterClusterCollectionData;
0036 
0037 /** @class CalorimeterCluster
0038  *  A simple calorimeter cluster
0039  *  @author: N. Brei
0040  */
0041 class CalorimeterCluster {
0042 
0043   friend class MutableCalorimeterCluster;
0044   friend class CalorimeterClusterCollection;
0045   friend class CalorimeterClusterCollectionData;
0046   friend class CalorimeterClusterCollectionIterator;
0047   friend podio::detail::OrderKey podio::detail::getOrderKey(const CalorimeterCluster & obj);
0048 
0049 public:
0050   using mutable_type = MutableCalorimeterCluster;
0051   using collection_type = CalorimeterClusterCollection;
0052 
0053   /// default constructor
0054   CalorimeterCluster() = default;
0055 
0056   /// Constructor initializing all members
0057   CalorimeterCluster(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);
0058 
0059   /// copy constructor
0060   CalorimeterCluster(const CalorimeterCluster& other) = default;
0061 
0062   /// copy-assignment operator
0063   CalorimeterCluster& operator=(CalorimeterCluster other) &; // Rebind this to other's internal object
0064   CalorimeterCluster& operator=(CalorimeterCluster other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0065 
0066   /// create a mutable deep-copy of the object with identical relations
0067   /// if cloneRelations=false, the relations are not cloned and will be empty
0068   MutableCalorimeterCluster clone(bool cloneRelations=true) const;
0069 
0070   /// destructor
0071   ~CalorimeterCluster() = default;
0072 
0073   /// converting constructor from mutable object
0074   CalorimeterCluster(const MutableCalorimeterCluster& other);
0075 
0076   static CalorimeterCluster makeEmpty();
0077 
0078 public:
0079 
0080   static constexpr std::string_view typeName = "CalorimeterCluster";
0081 
0082   /// Access the x location of cluster center [cm]
0083   double getX_center() const;
0084 
0085   /// Access the y location of cluster center [cm]
0086   double getY_center() const;
0087 
0088   /// Access the z location of cluster center [cm]
0089   double getZ_center() const;
0090 
0091   /// Access the Total energy deposited [GeV]
0092   double getEnergy() const;
0093 
0094   /// Access the Timestamp of earliest hit [ns]
0095   std::uint64_t getTime_begin() const;
0096 
0097   /// Access the Timestamp of latest hit [ns]
0098   std::uint64_t getTime_end() const;
0099 
0100 
0101 
0102   std::size_t hits_size() const;
0103   CalorimeterHit getHits(std::size_t) const;
0104   std::vector<CalorimeterHit>::const_iterator hits_begin() const;
0105   std::vector<CalorimeterHit>::const_iterator hits_end() const;
0106   podio::RelationRange<CalorimeterHit> getHits() const;
0107   std::size_t clusters_size() const;
0108   CalorimeterCluster getClusters(std::size_t) const;
0109   std::vector<CalorimeterCluster>::const_iterator clusters_begin() const;
0110   std::vector<CalorimeterCluster>::const_iterator clusters_end() const;
0111   podio::RelationRange<CalorimeterCluster> getClusters() const;
0112 
0113 
0114   /// check whether the object is actually available
0115   bool isAvailable() const;
0116   /// disconnect from CalorimeterClusterObj instance
0117   void unlink() { m_obj = podio::utils::MaybeSharedPtr<CalorimeterClusterObj>{nullptr}; }
0118 
0119   bool operator==(const CalorimeterCluster& other) const { return m_obj == other.m_obj; }
0120   bool operator==(const MutableCalorimeterCluster& other) const;
0121 
0122   bool operator!=(const CalorimeterCluster& other) const { return !(*this == other); }
0123   bool operator!=(const MutableCalorimeterCluster& other) const { return !(*this == other); }
0124 
0125   // less comparison operator, so that objects can be e.g. stored in sets.
0126   bool operator<(const CalorimeterCluster& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0127 
0128   podio::ObjectID id() const { return getObjectID(); }
0129 
0130   const podio::ObjectID getObjectID() const;
0131 
0132   friend std::hash<CalorimeterCluster>;
0133 
0134   friend void swap(CalorimeterCluster& a, CalorimeterCluster& b) {
0135     using std::swap;
0136     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0137   }
0138 
0139 private:
0140   /// constructor from existing CalorimeterClusterObj
0141   explicit CalorimeterCluster(podio::utils::MaybeSharedPtr<CalorimeterClusterObj> obj);
0142   CalorimeterCluster(CalorimeterClusterObj* obj);
0143 
0144   podio::utils::MaybeSharedPtr<CalorimeterClusterObj> m_obj{new CalorimeterClusterObj{}, podio::utils::MarkOwned};
0145 };
0146 
0147 std::ostream& operator<<(std::ostream& o, const CalorimeterCluster& value);
0148 
0149 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0150 void to_json(nlohmann::json& j, const CalorimeterCluster& value);
0151 #endif
0152 
0153 
0154 
0155 
0156 
0157 template<>
0158 struct std::hash<CalorimeterCluster> {
0159   std::size_t operator()(const CalorimeterCluster& obj) const {
0160     return std::hash<CalorimeterClusterObj*>{}(obj.m_obj.get());
0161   }
0162 };
0163 
0164 
0165 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0166 // until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
0167 // and https://github.com/AIDASoft/podio/issues/770
0168 #if defined(__clang__)
0169   #pragma clang diagnostic push
0170   #pragma clang diagnostic ignored "-Wunknown-warning-option"
0171   #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0172   #pragma clang diagnostic ignored "-Wdeprecated"
0173 constexpr std::string_view CalorimeterCluster::typeName;
0174   #pragma clang diagnostic pop
0175 #elif defined(__GNUC__)
0176   #pragma GCC diagnostic push
0177   #pragma GCC diagnostic ignored "-Wdeprecated"
0178 constexpr std::string_view CalorimeterCluster::typeName;
0179   #pragma GCC diagnostic pop
0180 #endif
0181 
0182 
0183 #endif