File indexing completed on 2025-01-18 10:01:27
0001
0002
0003 #ifndef PODIODATAMODEL_ExampleHit_H
0004 #define PODIODATAMODEL_ExampleHit_H
0005
0006 #include "PodioDatamodel/ExampleHitObj.h"
0007
0008 #include <cstdint>
0009
0010 #include "podio/utilities/MaybeSharedPtr.h"
0011
0012 #include <ostream>
0013 #include <cstdint>
0014
0015 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0016 #include "nlohmann/json_fwd.hpp"
0017 #endif
0018
0019
0020
0021
0022 class MutableExampleHit;
0023 class ExampleHitCollection;
0024 class ExampleHitCollectionData;
0025
0026
0027
0028
0029
0030 class ExampleHit {
0031
0032 friend class MutableExampleHit;
0033 friend class ExampleHitCollection;
0034 friend class ExampleHitCollectionData;
0035 friend class ExampleHitCollectionIterator;
0036
0037 public:
0038 using mutable_type = MutableExampleHit;
0039 using collection_type = ExampleHitCollection;
0040
0041
0042 ExampleHit();
0043
0044
0045 ExampleHit(std::uint64_t cellID, double x, double y, double z, double energy, std::uint64_t time);
0046
0047
0048 ExampleHit(const ExampleHit& other) = default;
0049
0050
0051 ExampleHit& operator=(ExampleHit other);
0052
0053
0054
0055 MutableExampleHit clone(bool cloneRelations=true) const;
0056
0057
0058 ~ExampleHit() = default;
0059
0060
0061 ExampleHit(const MutableExampleHit& other);
0062
0063 static ExampleHit makeEmpty();
0064
0065 public:
0066
0067
0068 std::uint64_t cellID() const;
0069
0070
0071 double x() const;
0072
0073
0074 double y() const;
0075
0076
0077 double z() const;
0078
0079
0080 double energy() const;
0081
0082
0083 std::uint64_t time() const;
0084
0085
0086
0087
0088
0089
0090 bool isAvailable() const;
0091
0092 void unlink() { m_obj = podio::utils::MaybeSharedPtr<ExampleHitObj>{nullptr}; }
0093
0094 bool operator==(const ExampleHit& other) const { return m_obj == other.m_obj; }
0095 bool operator==(const MutableExampleHit& other) const;
0096
0097 bool operator!=(const ExampleHit& other) const { return !(*this == other); }
0098 bool operator!=(const MutableExampleHit& other) const { return !(*this == other); }
0099
0100
0101 bool operator<(const ExampleHit& other) const { return m_obj < other.m_obj; }
0102
0103 podio::ObjectID id() const { return getObjectID(); }
0104
0105 const podio::ObjectID getObjectID() const;
0106
0107 friend void swap(ExampleHit& a, ExampleHit& b) {
0108 using std::swap;
0109 swap(a.m_obj, b.m_obj);
0110 }
0111
0112 private:
0113
0114 explicit ExampleHit(podio::utils::MaybeSharedPtr<ExampleHitObj> obj);
0115 ExampleHit(ExampleHitObj* obj);
0116
0117 podio::utils::MaybeSharedPtr<ExampleHitObj> m_obj{nullptr};
0118 };
0119
0120 std::ostream& operator<<(std::ostream& o, const ExampleHit& value);
0121
0122 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0123 void to_json(nlohmann::json& j, const ExampleHit& value);
0124 #endif
0125
0126
0127
0128
0129 #endif