EICd
EIC data model
MutableProtoCluster.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EICD_MutableProtoCluster_H
4#define EICD_MutableProtoCluster_H
5
7// Make the immutable class available from its mutable version but not vice versa
8#include "eicd/ProtoCluster.h"
9
10#include "eicd/CalorimeterHit.h"
11#include "podio/RelationRange.h"
12#include <vector>
13#include "podio/ObjectID.h"
14#include <ostream>
15
16#ifdef PODIO_JSON_OUTPUT
17#include "nlohmann/json.hpp"
18#endif
19
20
21
22namespace eicd {
23
24
25/** @class MutableProtoCluster
26 * Collection of hits identified by the clustering algorithm to belong together
27 * @author: S. Joosten
28 */
30
33 friend class ProtoCluster;
34
35public:
36
37 /// default constructor
39
40 /// constructor from existing ProtoClusterObj
42
43 /// copy constructor
45
46 /// copy-assignment operator
48
49 /// create a mutable deep-copy of the object with identical relations
51
52 /// destructor
54
55 /// conversion to const object
56 operator ProtoCluster() const;
57
58public:
59
60
61
62
63
65 unsigned int hits_size() const;
66 eicd::CalorimeterHit getHits(unsigned int) const;
67 std::vector<eicd::CalorimeterHit>::const_iterator hits_begin() const;
68 std::vector<eicd::CalorimeterHit>::const_iterator hits_end() const;
69 podio::RelationRange<eicd::CalorimeterHit> getHits() const;
70 void addToWeights(float);
71 unsigned int weights_size() const;
72 float getWeights(unsigned int) const;
73 std::vector<float>::const_iterator weights_begin() const;
74 std::vector<float>::const_iterator weights_end() const;
75 podio::RelationRange<float> getWeights() const;
76
77
78
79 /// check whether the object is actually available
80 bool isAvailable() const;
81 /// disconnect from ProtoClusterObj instance
82 void unlink() { m_obj = nullptr; }
83
84 bool operator==(const MutableProtoCluster& other) const { return m_obj == other.m_obj; }
85 bool operator==(const ProtoCluster& other) const;
86
87 // less comparison operator, so that objects can be e.g. stored in sets.
88 bool operator<(const MutableProtoCluster& other) const { return m_obj < other.m_obj; }
89
90 unsigned int id() const { return getObjectID().collectionID * 10000000 + getObjectID().index; }
91
92 const podio::ObjectID getObjectID() const;
93
95 using std::swap;
96 swap(a.m_obj, b.m_obj); // swap out the internal pointers
97 }
98
99private:
100 ProtoClusterObj* m_obj;
101};
102
103#ifdef PODIO_JSON_OUTPUT
104void to_json(nlohmann::json& j, const MutableProtoCluster& value);
105#endif
106
107
108} // namespace eicd
109
110
111#endif
Definition: CalorimeterHit.h:27
Definition: MutableProtoCluster.h:29
unsigned int hits_size() const
Definition: MutableProtoCluster.cc:68
MutableProtoCluster & operator=(MutableProtoCluster other)
copy-assignment operator
Definition: MutableProtoCluster.cc:25
void addToWeights(float)
Definition: MutableProtoCluster.cc:87
std::vector< eicd::CalorimeterHit >::const_iterator hits_end() const
Definition: MutableProtoCluster.cc:62
friend void swap(MutableProtoCluster &a, MutableProtoCluster &b)
Definition: MutableProtoCluster.h:94
MutableProtoCluster()
default constructor
Definition: MutableProtoCluster.cc:16
unsigned int id() const
Definition: MutableProtoCluster.h:90
podio::RelationRange< float > getWeights() const
Definition: MutableProtoCluster.cc:115
bool isAvailable() const
check whether the object is actually available
Definition: MutableProtoCluster.cc:128
MutableProtoCluster clone() const
create a mutable deep-copy of the object with identical relations
Definition: MutableProtoCluster.cc:36
bool operator==(const MutableProtoCluster &other) const
Definition: MutableProtoCluster.h:84
void unlink()
disconnect from ProtoClusterObj instance
Definition: MutableProtoCluster.h:82
std::vector< float >::const_iterator weights_end() const
Definition: MutableProtoCluster.cc:98
std::vector< float >::const_iterator weights_begin() const
Definition: MutableProtoCluster.cc:92
const podio::ObjectID getObjectID() const
Definition: MutableProtoCluster.cc:135
friend class ProtoCluster
Definition: MutableProtoCluster.h:33
std::vector< eicd::CalorimeterHit >::const_iterator hits_begin() const
Definition: MutableProtoCluster.cc:56
void addToHits(eicd::CalorimeterHit)
Definition: MutableProtoCluster.cc:51
bool operator<(const MutableProtoCluster &other) const
Definition: MutableProtoCluster.h:88
unsigned int weights_size() const
Definition: MutableProtoCluster.cc:104
~MutableProtoCluster()
destructor
Definition: MutableProtoCluster.cc:40
podio::RelationRange< eicd::CalorimeterHit > getHits() const
Definition: MutableProtoCluster.cc:79
Definition: ProtoClusterCollection.h:82
Definition: ProtoCluster.h:28
Definition: ProtoClusterCollection.h:57
Definition: ProtoClusterObj.h:19
Definition: CalorimeterHit.cc:13