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 <ostream>
17#include <cstddef>
18
19#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
20#include "nlohmann/json_fwd.hpp"
21#endif
22
23
24
25namespace edm4eic {
26
27
28/** @class MutableProtoCluster
29 * Collection of hits identified by the clustering algorithm to belong together
30 * @author: S. Joosten
31 */
33
36 friend class ProtoCluster;
37
38public:
41
42 /// default constructor
44
45
46 /// copy constructor
48
49 /// copy-assignment operator
51
52 /// create a mutable deep-copy of the object with identical relations
54
55 /// destructor
57
58
59 /// conversion to const object
60 operator ProtoCluster() const;
61
62public:
63
64
65
66
67
69 std::size_t hits_size() const;
70 edm4eic::CalorimeterHit getHits(std::size_t) const;
71 std::vector<edm4eic::CalorimeterHit>::const_iterator hits_begin() const;
72 std::vector<edm4eic::CalorimeterHit>::const_iterator hits_end() const;
73 podio::RelationRange<edm4eic::CalorimeterHit> getHits() const;
74 void addToWeights(float);
75 std::size_t weights_size() const;
76 float getWeights(std::size_t) const;
77 std::vector<float>::const_iterator weights_begin() const;
78 std::vector<float>::const_iterator weights_end() const;
79 podio::RelationRange<float> getWeights() const;
80
81
82
83 /// check whether the object is actually available
84 bool isAvailable() const;
85 /// disconnect from ProtoClusterObj instance
86 void unlink() { m_obj = podio::utils::MaybeSharedPtr<ProtoClusterObj>{nullptr}; }
87
88 bool operator==(const MutableProtoCluster& other) const { return m_obj == other.m_obj; }
89 bool operator==(const ProtoCluster& other) const;
90
91 // less comparison operator, so that objects can be e.g. stored in sets.
92 bool operator<(const MutableProtoCluster& other) const { return m_obj < other.m_obj; }
93
94 podio::ObjectID id() const { return getObjectID(); }
95
96 const podio::ObjectID getObjectID() const;
97
99 using std::swap;
100 swap(a.m_obj, b.m_obj); // swap out the internal pointers
101 }
102
103private:
104 /// constructor from existing ProtoClusterObj
105 explicit MutableProtoCluster(podio::utils::MaybeSharedPtr<ProtoClusterObj> obj);
106
107 podio::utils::MaybeSharedPtr<ProtoClusterObj> m_obj{nullptr};
108};
109
110#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
111void to_json(nlohmann::json& j, const MutableProtoCluster& value);
112#endif
113
114
115} // namespace edm4eic
116
117
118#endif
Definition CalorimeterHit.h:37
Definition MutableProtoCluster.h:32
friend class ProtoClusterCollection
Definition MutableProtoCluster.h:34
bool operator==(const MutableProtoCluster &other) const
Definition MutableProtoCluster.h:88
void addToWeights(float)
Definition MutableProtoCluster.cc:77
MutableProtoCluster clone() const
create a mutable deep-copy of the object with identical relations
Definition MutableProtoCluster.cc:30
MutableProtoCluster & operator=(MutableProtoCluster other)
copy-assignment operator
Definition MutableProtoCluster.cc:25
std::size_t weights_size() const
Definition MutableProtoCluster.cc:94
podio::ObjectID id() const
Definition MutableProtoCluster.h:94
bool operator<(const MutableProtoCluster &other) const
Definition MutableProtoCluster.h:92
friend void swap(MutableProtoCluster &a, MutableProtoCluster &b)
Definition MutableProtoCluster.h:98
std::vector< edm4eic::CalorimeterHit >::const_iterator hits_end() const
Definition MutableProtoCluster.cc:52
bool isAvailable() const
check whether the object is actually available
Definition MutableProtoCluster.cc:118
const podio::ObjectID getObjectID() const
Definition MutableProtoCluster.cc:125
std::vector< float >::const_iterator weights_end() const
Definition MutableProtoCluster.cc:88
~MutableProtoCluster()=default
destructor
friend class ProtoCluster
Definition MutableProtoCluster.h:36
podio::RelationRange< float > getWeights() const
Definition MutableProtoCluster.cc:105
std::vector< float >::const_iterator weights_begin() const
Definition MutableProtoCluster.cc:82
podio::RelationRange< edm4eic::CalorimeterHit > getHits() const
Definition MutableProtoCluster.cc:69
void unlink()
disconnect from ProtoClusterObj instance
Definition MutableProtoCluster.h:86
MutableProtoCluster()
default constructor
Definition MutableProtoCluster.cc:21
std::vector< edm4eic::CalorimeterHit >::const_iterator hits_begin() const
Definition MutableProtoCluster.cc:46
void addToHits(edm4eic::CalorimeterHit)
Definition MutableProtoCluster.cc:41
MutableProtoCluster(const MutableProtoCluster &other)=default
copy constructor
std::size_t hits_size() const
Definition MutableProtoCluster.cc:58
Definition ProtoClusterCollection.h:95
Definition ProtoCluster.h:33
Definition ProtoClusterCollection.h:66
Definition CalorimeterHit.cc:18