File indexing completed on 2024-11-15 09:35:34
0001
0002
0003 #ifndef EDM4EIC_ProtoCluster_H
0004 #define EDM4EIC_ProtoCluster_H
0005
0006 #include "edm4eic/ProtoClusterObj.h"
0007
0008 #include "edm4eic/CalorimeterHit.h"
0009 #include "podio/RelationRange.h"
0010 #include <vector>
0011
0012 #include "podio/utilities/MaybeSharedPtr.h"
0013
0014 #include <ostream>
0015 #include <cstddef>
0016
0017 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0018 #include "nlohmann/json_fwd.hpp"
0019 #endif
0020
0021
0022
0023 namespace edm4eic {
0024
0025 class MutableProtoCluster;
0026 class ProtoClusterCollection;
0027 class ProtoClusterCollectionData;
0028
0029
0030
0031
0032
0033 class ProtoCluster {
0034
0035 friend class MutableProtoCluster;
0036 friend class ProtoClusterCollection;
0037 friend class edm4eic::ProtoClusterCollectionData;
0038 friend class ProtoClusterCollectionIterator;
0039
0040 public:
0041 using mutable_type = MutableProtoCluster;
0042 using collection_type = ProtoClusterCollection;
0043
0044
0045 ProtoCluster();
0046
0047
0048
0049 ProtoCluster(const ProtoCluster& other) = default;
0050
0051
0052 ProtoCluster& operator=(ProtoCluster other);
0053
0054
0055 MutableProtoCluster clone() const;
0056
0057
0058 ~ProtoCluster() = default;
0059
0060
0061 static ProtoCluster makeEmpty();
0062
0063 public:
0064
0065
0066
0067 std::size_t hits_size() const;
0068 edm4eic::CalorimeterHit getHits(std::size_t) const;
0069 std::vector<edm4eic::CalorimeterHit>::const_iterator hits_begin() const;
0070 std::vector<edm4eic::CalorimeterHit>::const_iterator hits_end() const;
0071 podio::RelationRange<edm4eic::CalorimeterHit> getHits() const;
0072 std::size_t weights_size() const;
0073 float getWeights(std::size_t) const;
0074 std::vector<float>::const_iterator weights_begin() const;
0075 std::vector<float>::const_iterator weights_end() const;
0076 podio::RelationRange<float> getWeights() const;
0077
0078
0079
0080 bool isAvailable() const;
0081
0082 void unlink() { m_obj = podio::utils::MaybeSharedPtr<ProtoClusterObj>{nullptr}; }
0083
0084 bool operator==(const ProtoCluster& other) const { return m_obj == other.m_obj; }
0085 bool operator==(const MutableProtoCluster& other) const;
0086
0087
0088 bool operator<(const ProtoCluster& other) const { return m_obj < other.m_obj; }
0089
0090 podio::ObjectID id() const { return getObjectID(); }
0091
0092 const podio::ObjectID getObjectID() const;
0093
0094 friend void swap(ProtoCluster& a, ProtoCluster& b) {
0095 using std::swap;
0096 swap(a.m_obj, b.m_obj);
0097 }
0098
0099 private:
0100
0101 explicit ProtoCluster(podio::utils::MaybeSharedPtr<ProtoClusterObj> obj);
0102 ProtoCluster(ProtoClusterObj* obj);
0103
0104 podio::utils::MaybeSharedPtr<ProtoClusterObj> m_obj{nullptr};
0105 };
0106
0107 std::ostream& operator<<(std::ostream& o, const ProtoCluster& value);
0108
0109 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0110 void to_json(nlohmann::json& j, const ProtoCluster& value);
0111 #endif
0112
0113
0114 }
0115
0116
0117 #endif