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
23
24namespace edm4eic {
25
26
27/** @class MutableProtoCluster
28 * Collection of hits identified by the clustering algorithm to belong together
29 * @author: S. Joosten
30 */
32
35 friend class ProtoCluster;
36
37public:
40
41 /// default constructor
43
44
45 /// copy constructor
47
48 /// copy-assignment operator
50
51 /// create a mutable deep-copy of the object with identical relations
52 /// if cloneRelations=false, the relations are not cloned and will be empty
53 MutableProtoCluster clone(bool cloneRelations=true) const;
54
55 /// destructor
57
58
59public:
60
61
62
63
64
66 std::size_t hits_size() const;
67 edm4eic::CalorimeterHit getHits(std::size_t) const;
68 std::vector<edm4eic::CalorimeterHit>::const_iterator hits_begin() const;
69 std::vector<edm4eic::CalorimeterHit>::const_iterator hits_end() const;
70 podio::RelationRange<edm4eic::CalorimeterHit> getHits() const;
71 void addToWeights(const float&);
72 std::size_t weights_size() const;
73 float getWeights(std::size_t) const;
74 std::vector<float>::const_iterator weights_begin() const;
75 std::vector<float>::const_iterator weights_end() const;
76 podio::RelationRange<float> getWeights() const;
77
78
79
80 /// check whether the object is actually available
81 bool isAvailable() const;
82 /// disconnect from ProtoClusterObj instance
83 void unlink() { m_obj = podio::utils::MaybeSharedPtr<ProtoClusterObj>{nullptr}; }
84
85 bool operator==(const MutableProtoCluster& other) const { return m_obj == other.m_obj; }
86 bool operator==(const ProtoCluster& other) const;
87
88 bool operator!=(const MutableProtoCluster& other) const { return !(*this == other); }
89 bool operator!=(const ProtoCluster& other) const { return !(*this == other); }
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:31
friend class ProtoClusterCollection
Definition MutableProtoCluster.h:33
MutableProtoCluster clone(bool cloneRelations=true) const
Definition MutableProtoCluster.cc:27
bool operator==(const MutableProtoCluster &other) const
Definition MutableProtoCluster.h:85
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:94
bool operator<(const MutableProtoCluster &other) const
Definition MutableProtoCluster.h:92
void addToHits(const edm4eic::CalorimeterHit &)
Definition MutableProtoCluster.cc:47
friend void swap(MutableProtoCluster &a, MutableProtoCluster &b)
Definition MutableProtoCluster.h:98
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:88
std::vector< float >::const_iterator weights_end() const
Definition MutableProtoCluster.cc:94
~MutableProtoCluster()=default
destructor
bool operator!=(const ProtoCluster &other) const
Definition MutableProtoCluster.h:89
friend class ProtoCluster
Definition MutableProtoCluster.h:35
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:83
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:92
Definition ProtoCluster.h:33
Definition ProtoClusterCollection.h:63
Definition CalorimeterHit.cc:17