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