EDM4eic
EIC data model
Loading...
Searching...
No Matches
MutableMCRecoClusterParticleAssociation.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_MutableMCRecoClusterParticleAssociation_H
4#define EDM4EIC_MutableMCRecoClusterParticleAssociation_H
5
7// Make the immutable class available from its mutable version but not vice versa
9
10#include <cstdint>
11
12#include "podio/utilities/MaybeSharedPtr.h"
13
14#include <cstdint>
15
16#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
17#include "nlohmann/json_fwd.hpp"
18#endif
19
20// forward declarations
21namespace edm4eic {
23class Cluster;
24class MutableCluster;
25}
26namespace edm4hep {
27class MCParticle;
28class MutableMCParticle;
29}
30
31
32namespace edm4eic {
33
34
35/** @class MutableMCRecoClusterParticleAssociation
36 * Association between a Cluster and a MCParticle
37 * @author: S. Joosten
38 */
40
44
45public:
48
49 /// default constructor
51
52 /// Constructor initializing all members
53 MutableMCRecoClusterParticleAssociation(const std::uint32_t simID, const std::uint32_t recID, const float weight);
54
55 /// copy constructor
57
58 /// copy-assignment operator
59 MutableMCRecoClusterParticleAssociation& operator=(MutableMCRecoClusterParticleAssociation other) &; // Rebind this to other's internal object
60 MutableMCRecoClusterParticleAssociation& operator=(MutableMCRecoClusterParticleAssociation other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
61
62 /// create a mutable deep-copy of the object with identical relations
63 /// if cloneRelations=false, the relations are not cloned and will be empty
64 MutableMCRecoClusterParticleAssociation clone(bool cloneRelations=true) const;
65
66 /// destructor
68
69
70public:
71
72 /// Access the Index of corresponding MCParticle (position in MCParticles array)
73 std::uint32_t getSimID() const;
74
75 /// Access the Index of corresponding Cluster (position in Clusters array)
76 std::uint32_t getRecID() const;
77
78 /// Access the weight of this association
79 float getWeight() const;
80
81
82 /// Access the reference to the cluster
83 const edm4eic::Cluster getRec() const;
84 /// Access the reference to the Monte-Carlo particle
85 const edm4hep::MCParticle getSim() const;
86
87 /// Set the Index of corresponding MCParticle (position in MCParticles array)
88 void setSimID(const std::uint32_t simID);
89 /// Get mutable reference to Index of corresponding MCParticle (position in MCParticles array)
90 std::uint32_t& getSimID();
91 /// Get reference to Index of corresponding MCParticle (position in MCParticles array)
92 [[deprecated("use getSimID instead")]]
93 std::uint32_t& simID();
94
95 /// Set the Index of corresponding Cluster (position in Clusters array)
96 void setRecID(const std::uint32_t recID);
97 /// Get mutable reference to Index of corresponding Cluster (position in Clusters array)
98 std::uint32_t& getRecID();
99 /// Get reference to Index of corresponding Cluster (position in Clusters array)
100 [[deprecated("use getRecID instead")]]
101 std::uint32_t& recID();
102
103 /// Set the weight of this association
104 void setWeight(const float weight);
105 /// Get mutable reference to weight of this association
106 float& getWeight();
107 /// Get reference to weight of this association
108 [[deprecated("use getWeight instead")]]
109 float& weight();
110
111
112 /// Set the reference to the cluster
113 void setRec(const edm4eic::Cluster& value);
114 /// Set the reference to the Monte-Carlo particle
115 void setSim(const edm4hep::MCParticle& value);
116
117
118
119
120 /// check whether the object is actually available
121 bool isAvailable() const;
122 /// disconnect from MCRecoClusterParticleAssociationObj instance
123 void unlink() { m_obj = podio::utils::MaybeSharedPtr<MCRecoClusterParticleAssociationObj>{nullptr}; }
124
125 bool operator==(const MutableMCRecoClusterParticleAssociation& other) const { return m_obj == other.m_obj; }
126 bool operator==(const MCRecoClusterParticleAssociation& other) const;
127
128 bool operator!=(const MutableMCRecoClusterParticleAssociation& other) const { return !(*this == other); }
129 bool operator!=(const MCRecoClusterParticleAssociation& other) const { return !(*this == other); }
130
131 // less comparison operator, so that objects can be e.g. stored in sets.
133
134 podio::ObjectID id() const { return getObjectID(); }
135
136 const podio::ObjectID getObjectID() const;
137
138 friend std::hash<MutableMCRecoClusterParticleAssociation>;
139
141 using std::swap;
142 swap(a.m_obj, b.m_obj); // swap out the internal pointers
143 }
144
145private:
146 /// constructor from existing MCRecoClusterParticleAssociationObj
147 explicit MutableMCRecoClusterParticleAssociation(podio::utils::MaybeSharedPtr<MCRecoClusterParticleAssociationObj> obj);
148
149 podio::utils::MaybeSharedPtr<MCRecoClusterParticleAssociationObj> m_obj{nullptr};
150};
151
152#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
153void to_json(nlohmann::json& j, const MutableMCRecoClusterParticleAssociation& value);
154#endif
155
156
157} // namespace edm4eic
158
159
160
161template<>
162struct std::hash<edm4eic::MutableMCRecoClusterParticleAssociation> {
164 return std::hash<edm4eic::MCRecoClusterParticleAssociationObj*>{}(obj.m_obj.get());
165 }
166};
167
168
169#endif
Definition Cluster.h:48
Definition MCRecoClusterParticleAssociationCollection.h:137
Definition MCRecoClusterParticleAssociation.h:47
Definition MutableCluster.h:40
Definition MutableMCRecoClusterParticleAssociation.h:39
bool operator==(const MutableMCRecoClusterParticleAssociation &other) const
Definition MutableMCRecoClusterParticleAssociation.h:125
const podio::ObjectID getObjectID() const
Definition MutableMCRecoClusterParticleAssociation.cc:92
MutableMCRecoClusterParticleAssociation()
default constructor
Definition MutableMCRecoClusterParticleAssociation.cc:20
const edm4hep::MCParticle getSim() const
Access the reference to the Monte-Carlo particle.
Definition MutableMCRecoClusterParticleAssociation.cc:56
friend class MCRecoClusterParticleAssociation
Definition MutableMCRecoClusterParticleAssociation.h:43
bool operator<(const MutableMCRecoClusterParticleAssociation &other) const
Definition MutableMCRecoClusterParticleAssociation.h:132
bool operator!=(const MCRecoClusterParticleAssociation &other) const
Definition MutableMCRecoClusterParticleAssociation.h:129
void setSimID(const std::uint32_t simID)
Set the Index of corresponding MCParticle (position in MCParticles array)
Definition MutableMCRecoClusterParticleAssociation.cc:64
std::uint32_t getSimID() const
Access the Index of corresponding MCParticle (position in MCParticles array)
Definition MutableMCRecoClusterParticleAssociation.cc:45
MCRecoClusterParticleAssociation object_type
Definition MutableMCRecoClusterParticleAssociation.h:46
MutableMCRecoClusterParticleAssociation & operator=(MutableMCRecoClusterParticleAssociation other) &
copy-assignment operator
Definition MutableMCRecoClusterParticleAssociation.cc:30
void setWeight(const float weight)
Set the weight of this association.
Definition MutableMCRecoClusterParticleAssociation.cc:70
void setRecID(const std::uint32_t recID)
Set the Index of corresponding Cluster (position in Clusters array)
Definition MutableMCRecoClusterParticleAssociation.cc:67
std::uint32_t getRecID() const
Access the Index of corresponding Cluster (position in Clusters array)
Definition MutableMCRecoClusterParticleAssociation.cc:46
void setRec(const edm4eic::Cluster &value)
Set the reference to the cluster.
Definition MutableMCRecoClusterParticleAssociation.cc:74
bool operator!=(const MutableMCRecoClusterParticleAssociation &other) const
Definition MutableMCRecoClusterParticleAssociation.h:128
MCRecoClusterParticleAssociationCollection collection_type
Definition MutableMCRecoClusterParticleAssociation.h:47
std::uint32_t & simID()
Get reference to Index of corresponding MCParticle (position in MCParticles array)
Definition MutableMCRecoClusterParticleAssociation.cc:66
~MutableMCRecoClusterParticleAssociation()=default
destructor
void unlink()
disconnect from MCRecoClusterParticleAssociationObj instance
Definition MutableMCRecoClusterParticleAssociation.h:123
float getWeight() const
Access the weight of this association.
Definition MutableMCRecoClusterParticleAssociation.cc:47
MutableMCRecoClusterParticleAssociation clone(bool cloneRelations=true) const
Definition MutableMCRecoClusterParticleAssociation.cc:35
float & weight()
Get reference to weight of this association.
Definition MutableMCRecoClusterParticleAssociation.cc:72
bool isAvailable() const
check whether the object is actually available
Definition MutableMCRecoClusterParticleAssociation.cc:88
MutableMCRecoClusterParticleAssociation(const MutableMCRecoClusterParticleAssociation &other)=default
copy constructor
friend class MCRecoClusterParticleAssociationCollection
Definition MutableMCRecoClusterParticleAssociation.h:41
std::uint32_t & recID()
Get reference to Index of corresponding Cluster (position in Clusters array)
Definition MutableMCRecoClusterParticleAssociation.cc:69
friend class MCRecoClusterParticleAssociationMutableCollectionIterator
Definition MutableMCRecoClusterParticleAssociation.h:42
MutableMCRecoClusterParticleAssociation & operator=(MutableMCRecoClusterParticleAssociation other) &&=delete
friend void swap(MutableMCRecoClusterParticleAssociation &a, MutableMCRecoClusterParticleAssociation &b)
Definition MutableMCRecoClusterParticleAssociation.h:140
void setSim(const edm4hep::MCParticle &value)
Set the reference to the Monte-Carlo particle.
Definition MutableMCRecoClusterParticleAssociation.cc:78
podio::ObjectID id() const
Definition MutableMCRecoClusterParticleAssociation.h:134
const edm4eic::Cluster getRec() const
Access the reference to the cluster.
Definition MutableMCRecoClusterParticleAssociation.cc:49
Definition CalorimeterHit.cc:17
Definition CalorimeterHit.h:25
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:150
std::size_t operator()(const edm4eic::MutableMCRecoClusterParticleAssociation &obj) const
Definition MutableMCRecoClusterParticleAssociation.h:163