EDM4eic
EIC data model
Loading...
Searching...
No Matches
MutableProtoCluster.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_MutableProtoCluster_H
4#define EDM4EIC_MutableProtoCluster_H
5
7// Make the immutable class available from its mutable version but not vice versa
9
11#include "podio/RelationRange.h"
12#include <vector>
13
14#include "podio/utilities/MaybeSharedPtr.h"
15
16#include <cstdint>
17
18#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
19#include "nlohmann/json_fwd.hpp"
20#endif
21
22// forward declarations
23namespace edm4eic {
24class ProtoClusterCollection;
25}
26
27
28namespace edm4eic {
29
30
31/** @class MutableProtoCluster
32 * Collection of hits identified by the clustering algorithm to belong together
33 * @author: S. Joosten
34 */
36
39 friend class ProtoCluster;
40
41public:
44
45 /// default constructor
47
48
49 /// copy constructor
51
52 /// copy-assignment operator
54
55 /// create a mutable deep-copy of the object with identical relations
56 /// if cloneRelations=false, the relations are not cloned and will be empty
57 MutableProtoCluster clone(bool cloneRelations=true) const;
58
59 /// destructor
61
62
63public:
64
65
66
67
68
70 std::size_t hits_size() const;
71 edm4eic::CalorimeterHit getHits(std::size_t) const;
72 std::vector<edm4eic::CalorimeterHit>::const_iterator hits_begin() const;
73 std::vector<edm4eic::CalorimeterHit>::const_iterator hits_end() const;
74 podio::RelationRange<edm4eic::CalorimeterHit> getHits() const;
75 void addToWeights(const float&);
76 std::size_t weights_size() const;
77 float getWeights(std::size_t) const;
78 std::vector<float>::const_iterator weights_begin() const;
79 std::vector<float>::const_iterator weights_end() const;
80 podio::RelationRange<float> getWeights() const;
81
82
83
84 /// check whether the object is actually available
85 bool isAvailable() const;
86 /// disconnect from ProtoClusterObj instance
87 void unlink() { m_obj = podio::utils::MaybeSharedPtr<ProtoClusterObj>{nullptr}; }
88
89 bool operator==(const MutableProtoCluster& other) const { return m_obj == other.m_obj; }
90 bool operator==(const ProtoCluster& other) const;
91
92 bool operator!=(const MutableProtoCluster& other) const { return !(*this == other); }
93 bool operator!=(const ProtoCluster& other) const { return !(*this == other); }
94
95 // less comparison operator, so that objects can be e.g. stored in sets.
96 bool operator<(const MutableProtoCluster& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
97
98 podio::ObjectID id() const { return getObjectID(); }
99
100 const podio::ObjectID getObjectID() const;
101
103 using std::swap;
104 swap(a.m_obj, b.m_obj); // swap out the internal pointers
105 }
106
107private:
108 /// constructor from existing ProtoClusterObj
109 explicit MutableProtoCluster(podio::utils::MaybeSharedPtr<ProtoClusterObj> obj);
110
111 podio::utils::MaybeSharedPtr<ProtoClusterObj> m_obj{nullptr};
112};
113
114#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
115void to_json(nlohmann::json& j, const MutableProtoCluster& value);
116#endif
117
118
119} // namespace edm4eic
120
121
122#endif
Definition CalorimeterHit.h:46
Definition MutableProtoCluster.h:35
friend class ProtoClusterCollection
Definition MutableProtoCluster.h:37
MutableProtoCluster clone(bool cloneRelations=true) const
Definition MutableProtoCluster.cc:27
bool operator==(const MutableProtoCluster &other) const
Definition MutableProtoCluster.h:89
MutableProtoCluster & operator=(MutableProtoCluster other)
copy-assignment operator
Definition MutableProtoCluster.cc:22
std::size_t weights_size() const
Definition MutableProtoCluster.cc:100
podio::ObjectID id() const
Definition MutableProtoCluster.h:98
bool operator<(const MutableProtoCluster &other) const
Definition MutableProtoCluster.h:96
void addToHits(const edm4eic::CalorimeterHit &)
Definition MutableProtoCluster.cc:47
friend void swap(MutableProtoCluster &a, MutableProtoCluster &b)
Definition MutableProtoCluster.h:102
std::vector< edm4eic::CalorimeterHit >::const_iterator hits_end() const
Definition MutableProtoCluster.cc:58
bool isAvailable() const
check whether the object is actually available
Definition MutableProtoCluster.cc:124
void addToWeights(const float &)
Definition MutableProtoCluster.cc:83
const podio::ObjectID getObjectID() const
Definition MutableProtoCluster.cc:128
bool operator!=(const MutableProtoCluster &other) const
Definition MutableProtoCluster.h:92
std::vector< float >::const_iterator weights_end() const
Definition MutableProtoCluster.cc:94
~MutableProtoCluster()=default
destructor
bool operator!=(const ProtoCluster &other) const
Definition MutableProtoCluster.h:93
friend class ProtoCluster
Definition MutableProtoCluster.h:39
podio::RelationRange< float > getWeights() const
Definition MutableProtoCluster.cc:111
std::vector< float >::const_iterator weights_begin() const
Definition MutableProtoCluster.cc:88
podio::RelationRange< edm4eic::CalorimeterHit > getHits() const
Definition MutableProtoCluster.cc:75
void unlink()
disconnect from ProtoClusterObj instance
Definition MutableProtoCluster.h:87
MutableProtoCluster()
default constructor
Definition MutableProtoCluster.cc:18
std::vector< edm4eic::CalorimeterHit >::const_iterator hits_begin() const
Definition MutableProtoCluster.cc:52
MutableProtoCluster(const MutableProtoCluster &other)=default
copy constructor
std::size_t hits_size() const
Definition MutableProtoCluster.cc:64
Definition ProtoClusterCollection.h:91
Definition ProtoCluster.h:43
Definition ProtoClusterCollection.h:62
Definition CalorimeterHit.cc:17
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:150