Warning, file /include/edm4eic/MutableProtoCluster.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003 #ifndef EDM4EIC_MutableProtoCluster_H
0004 #define EDM4EIC_MutableProtoCluster_H
0005
0006 #include "edm4eic/ProtoClusterObj.h"
0007
0008 #include "edm4eic/ProtoCluster.h"
0009
0010 #include "edm4eic/CalorimeterHit.h"
0011 #include "podio/RelationRange.h"
0012 #include <vector>
0013
0014 #include "podio/utilities/MaybeSharedPtr.h"
0015
0016 #include <cstdint>
0017
0018 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0019 #include "nlohmann/json_fwd.hpp"
0020 #endif
0021
0022
0023 namespace edm4eic {
0024 class ProtoClusterCollection;
0025 }
0026
0027
0028 namespace edm4eic {
0029
0030
0031
0032
0033
0034
0035 class MutableProtoCluster {
0036
0037 friend class ProtoClusterCollection;
0038 friend class ProtoClusterMutableCollectionIterator;
0039 friend class ProtoCluster;
0040
0041 public:
0042 using object_type = ProtoCluster;
0043 using collection_type = ProtoClusterCollection;
0044
0045
0046 MutableProtoCluster() = default;
0047
0048
0049
0050 MutableProtoCluster(const MutableProtoCluster& other) = default;
0051
0052
0053 MutableProtoCluster& operator=(MutableProtoCluster other) &;
0054 MutableProtoCluster& operator=(MutableProtoCluster other) && = delete;
0055
0056
0057
0058 MutableProtoCluster clone(bool cloneRelations=true) const;
0059
0060
0061 ~MutableProtoCluster() = default;
0062
0063
0064 public:
0065
0066
0067
0068
0069
0070 void addToHits(const edm4eic::CalorimeterHit&);
0071 std::size_t hits_size() const;
0072 edm4eic::CalorimeterHit getHits(std::size_t) const;
0073 std::vector<edm4eic::CalorimeterHit>::const_iterator hits_begin() const;
0074 std::vector<edm4eic::CalorimeterHit>::const_iterator hits_end() const;
0075 podio::RelationRange<edm4eic::CalorimeterHit> getHits() const;
0076 void addToWeights(const float&);
0077 std::size_t weights_size() const;
0078 float getWeights(std::size_t) const;
0079 std::vector<float>::const_iterator weights_begin() const;
0080 std::vector<float>::const_iterator weights_end() const;
0081 podio::RelationRange<float> getWeights() const;
0082
0083
0084
0085
0086 bool isAvailable() const;
0087
0088 void unlink() { m_obj = podio::utils::MaybeSharedPtr<ProtoClusterObj>{nullptr}; }
0089
0090 bool operator==(const MutableProtoCluster& other) const { return m_obj == other.m_obj; }
0091 bool operator==(const ProtoCluster& other) const;
0092
0093 bool operator!=(const MutableProtoCluster& other) const { return !(*this == other); }
0094 bool operator!=(const ProtoCluster& other) const { return !(*this == other); }
0095
0096
0097 bool operator<(const MutableProtoCluster& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0098
0099 podio::ObjectID id() const { return getObjectID(); }
0100
0101 const podio::ObjectID getObjectID() const;
0102
0103 friend std::hash<MutableProtoCluster>;
0104
0105 friend void swap(MutableProtoCluster& a, MutableProtoCluster& b) {
0106 using std::swap;
0107 swap(a.m_obj, b.m_obj);
0108 }
0109
0110 private:
0111
0112 explicit MutableProtoCluster(podio::utils::MaybeSharedPtr<ProtoClusterObj> obj);
0113
0114 podio::utils::MaybeSharedPtr<ProtoClusterObj> m_obj{new ProtoClusterObj{}, podio::utils::MarkOwned};
0115 };
0116
0117 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0118 void to_json(nlohmann::json& j, const MutableProtoCluster& value);
0119 #endif
0120
0121
0122 }
0123
0124
0125
0126 template<>
0127 struct std::hash<edm4eic::MutableProtoCluster> {
0128 std::size_t operator()(const edm4eic::MutableProtoCluster& obj) const {
0129 return std::hash<edm4eic::ProtoClusterObj*>{}(obj.m_obj.get());
0130 }
0131 };
0132
0133
0134 #endif