File indexing completed on 2025-12-11 10:20:45
0001
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
0024 class CalorimeterClusterCollection;
0025
0026
0027 namespace podio::detail {
0028
0029 OrderKey getOrderKey(const ::CalorimeterCluster& obj);
0030 };
0031
0032
0033 class MutableCalorimeterCluster;
0034 class CalorimeterClusterCollection;
0035 class CalorimeterClusterCollectionData;
0036
0037
0038
0039
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
0054 CalorimeterCluster() = default;
0055
0056
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
0060 CalorimeterCluster(const CalorimeterCluster& other) = default;
0061
0062
0063 CalorimeterCluster& operator=(CalorimeterCluster other) &;
0064 CalorimeterCluster& operator=(CalorimeterCluster other) && = delete;
0065
0066
0067
0068 MutableCalorimeterCluster clone(bool cloneRelations=true) const;
0069
0070
0071 ~CalorimeterCluster() = default;
0072
0073
0074 CalorimeterCluster(const MutableCalorimeterCluster& other);
0075
0076 static CalorimeterCluster makeEmpty();
0077
0078 public:
0079
0080 static constexpr std::string_view typeName = "CalorimeterCluster";
0081
0082
0083 double getX_center() const;
0084
0085
0086 double getY_center() const;
0087
0088
0089 double getZ_center() const;
0090
0091
0092 double getEnergy() const;
0093
0094
0095 std::uint64_t getTime_begin() const;
0096
0097
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
0115 bool isAvailable() const;
0116
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
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);
0137 }
0138
0139 private:
0140
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
0166
0167
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