File indexing completed on 2025-12-11 10:20:45
0001
0002
0003 #ifndef JANA2_TUTORIAL_PODIO_DATAMODEL_ADCHit_H
0004 #define JANA2_TUTORIAL_PODIO_DATAMODEL_ADCHit_H
0005
0006 #include "jana2_tutorial_podio_datamodel/ADCHitObj.h"
0007
0008 #include <cstdint>
0009
0010 #include "podio/utilities/MaybeSharedPtr.h"
0011 #include "podio/detail/OrderKey.h"
0012
0013 #include <ostream>
0014 #include <cstdint>
0015
0016 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0017 #include "nlohmann/json_fwd.hpp"
0018 #endif
0019
0020
0021 class ADCHitCollection;
0022
0023
0024 namespace podio::detail {
0025
0026 OrderKey getOrderKey(const ::ADCHit& obj);
0027 };
0028
0029
0030 class MutableADCHit;
0031 class ADCHitCollection;
0032 class ADCHitCollectionData;
0033
0034
0035
0036
0037
0038 class ADCHit {
0039
0040 friend class MutableADCHit;
0041 friend class ADCHitCollection;
0042 friend class ADCHitCollectionData;
0043 friend class ADCHitCollectionIterator;
0044 friend podio::detail::OrderKey podio::detail::getOrderKey(const ADCHit & obj);
0045
0046 public:
0047 using mutable_type = MutableADCHit;
0048 using collection_type = ADCHitCollection;
0049
0050
0051 ADCHit() = default;
0052
0053
0054 ADCHit(const std::uint32_t crate, const std::uint32_t slot, const std::uint32_t channel, const std::uint32_t energy, const std::uint32_t timestamp);
0055
0056
0057 ADCHit(const ADCHit& other) = default;
0058
0059
0060 ADCHit& operator=(ADCHit other) &;
0061 ADCHit& operator=(ADCHit other) && = delete;
0062
0063
0064
0065 MutableADCHit clone(bool cloneRelations=true) const;
0066
0067
0068 ~ADCHit() = default;
0069
0070
0071 ADCHit(const MutableADCHit& other);
0072
0073 static ADCHit makeEmpty();
0074
0075 public:
0076
0077 static constexpr std::string_view typeName = "ADCHit";
0078
0079
0080 std::uint32_t getCrate() const;
0081
0082
0083 std::uint32_t getSlot() const;
0084
0085
0086 std::uint32_t getChannel() const;
0087
0088
0089 std::uint32_t getEnergy() const;
0090
0091
0092 std::uint32_t getTimestamp() const;
0093
0094
0095
0096
0097
0098
0099 bool isAvailable() const;
0100
0101 void unlink() { m_obj = podio::utils::MaybeSharedPtr<ADCHitObj>{nullptr}; }
0102
0103 bool operator==(const ADCHit& other) const { return m_obj == other.m_obj; }
0104 bool operator==(const MutableADCHit& other) const;
0105
0106 bool operator!=(const ADCHit& other) const { return !(*this == other); }
0107 bool operator!=(const MutableADCHit& other) const { return !(*this == other); }
0108
0109
0110 bool operator<(const ADCHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0111
0112 podio::ObjectID id() const { return getObjectID(); }
0113
0114 const podio::ObjectID getObjectID() const;
0115
0116 friend std::hash<ADCHit>;
0117
0118 friend void swap(ADCHit& a, ADCHit& b) {
0119 using std::swap;
0120 swap(a.m_obj, b.m_obj);
0121 }
0122
0123 private:
0124
0125 explicit ADCHit(podio::utils::MaybeSharedPtr<ADCHitObj> obj);
0126 ADCHit(ADCHitObj* obj);
0127
0128 podio::utils::MaybeSharedPtr<ADCHitObj> m_obj{new ADCHitObj{}, podio::utils::MarkOwned};
0129 };
0130
0131 std::ostream& operator<<(std::ostream& o, const ADCHit& value);
0132
0133 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0134 void to_json(nlohmann::json& j, const ADCHit& value);
0135 #endif
0136
0137
0138
0139
0140
0141 template<>
0142 struct std::hash<ADCHit> {
0143 std::size_t operator()(const ADCHit& obj) const {
0144 return std::hash<ADCHitObj*>{}(obj.m_obj.get());
0145 }
0146 };
0147
0148
0149
0150
0151
0152 #if defined(__clang__)
0153 #pragma clang diagnostic push
0154 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0155 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0156 #pragma clang diagnostic ignored "-Wdeprecated"
0157 constexpr std::string_view ADCHit::typeName;
0158 #pragma clang diagnostic pop
0159 #elif defined(__GNUC__)
0160 #pragma GCC diagnostic push
0161 #pragma GCC diagnostic ignored "-Wdeprecated"
0162 constexpr std::string_view ADCHit::typeName;
0163 #pragma GCC diagnostic pop
0164 #endif
0165
0166
0167 #endif