EDM4eic
EIC data model
Loading...
Searching...
No Matches
MutableMCRecoVertexParticleAssociation.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_MutableMCRecoVertexParticleAssociation_H
4#define EDM4EIC_MutableMCRecoVertexParticleAssociation_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 Vertex;
24class MutableVertex;
25}
26namespace edm4hep {
27class MCParticle;
28class MutableMCParticle;
29}
30
31
32namespace edm4eic {
33
34
35/** @class MutableMCRecoVertexParticleAssociation
36 * Association between a Vertex and a MCParticle
37 * @author: S. Joosten
38 */
40
44
45public:
48
49 /// default constructor
51
52 /// Constructor initializing all members
53 MutableMCRecoVertexParticleAssociation(const std::uint32_t simID, const std::uint32_t recID, const float weight);
54
55 /// copy constructor
57
58 /// copy-assignment operator
59 MutableMCRecoVertexParticleAssociation& operator=(MutableMCRecoVertexParticleAssociation other) &; // Rebind this to other's internal object
60 MutableMCRecoVertexParticleAssociation& operator=(MutableMCRecoVertexParticleAssociation 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 MutableMCRecoVertexParticleAssociation 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 Vertex (position in Vertices 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 vertex
83 const edm4eic::Vertex 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 Vertex (position in Vertices array)
96 void setRecID(const std::uint32_t recID);
97 /// Get mutable reference to Index of corresponding Vertex (position in Vertices array)
98 std::uint32_t& getRecID();
99 /// Get reference to Index of corresponding Vertex (position in Vertices 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 vertex
113 void setRec(const edm4eic::Vertex& 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 MCRecoVertexParticleAssociationObj instance
123 void unlink() { m_obj = podio::utils::MaybeSharedPtr<MCRecoVertexParticleAssociationObj>{nullptr}; }
124
125 bool operator==(const MutableMCRecoVertexParticleAssociation& other) const { return m_obj == other.m_obj; }
126 bool operator==(const MCRecoVertexParticleAssociation& other) const;
127
128 bool operator!=(const MutableMCRecoVertexParticleAssociation& other) const { return !(*this == other); }
129 bool operator!=(const MCRecoVertexParticleAssociation& 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<MutableMCRecoVertexParticleAssociation>;
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 MCRecoVertexParticleAssociationObj
147 explicit MutableMCRecoVertexParticleAssociation(podio::utils::MaybeSharedPtr<MCRecoVertexParticleAssociationObj> obj);
148
149 podio::utils::MaybeSharedPtr<MCRecoVertexParticleAssociationObj> m_obj{nullptr};
150};
151
152#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
153void to_json(nlohmann::json& j, const MutableMCRecoVertexParticleAssociation& value);
154#endif
155
156
157} // namespace edm4eic
158
159
160
161template<>
162struct std::hash<edm4eic::MutableMCRecoVertexParticleAssociation> {
164 return std::hash<edm4eic::MCRecoVertexParticleAssociationObj*>{}(obj.m_obj.get());
165 }
166};
167
168
169#endif
Definition MCRecoVertexParticleAssociationCollection.h:137
Definition MCRecoVertexParticleAssociation.h:47
Definition MutableMCRecoVertexParticleAssociation.h:39
bool operator<(const MutableMCRecoVertexParticleAssociation &other) const
Definition MutableMCRecoVertexParticleAssociation.h:132
podio::ObjectID id() const
Definition MutableMCRecoVertexParticleAssociation.h:134
MutableMCRecoVertexParticleAssociation(const MutableMCRecoVertexParticleAssociation &other)=default
copy constructor
void setWeight(const float weight)
Set the weight of this association.
Definition MutableMCRecoVertexParticleAssociation.cc:70
const edm4eic::Vertex getRec() const
Access the reference to the vertex.
Definition MutableMCRecoVertexParticleAssociation.cc:49
void setRecID(const std::uint32_t recID)
Set the Index of corresponding Vertex (position in Vertices array)
Definition MutableMCRecoVertexParticleAssociation.cc:67
bool isAvailable() const
check whether the object is actually available
Definition MutableMCRecoVertexParticleAssociation.cc:88
void setSimID(const std::uint32_t simID)
Set the Index of corresponding MCParticle (position in MCParticles array)
Definition MutableMCRecoVertexParticleAssociation.cc:64
friend class MCRecoVertexParticleAssociation
Definition MutableMCRecoVertexParticleAssociation.h:43
const podio::ObjectID getObjectID() const
Definition MutableMCRecoVertexParticleAssociation.cc:92
std::uint32_t & simID()
Get reference to Index of corresponding MCParticle (position in MCParticles array)
Definition MutableMCRecoVertexParticleAssociation.cc:66
bool operator==(const MutableMCRecoVertexParticleAssociation &other) const
Definition MutableMCRecoVertexParticleAssociation.h:125
void setRec(const edm4eic::Vertex &value)
Set the reference to the vertex.
Definition MutableMCRecoVertexParticleAssociation.cc:74
friend void swap(MutableMCRecoVertexParticleAssociation &a, MutableMCRecoVertexParticleAssociation &b)
Definition MutableMCRecoVertexParticleAssociation.h:140
std::uint32_t getRecID() const
Access the Index of corresponding Vertex (position in Vertices array)
Definition MutableMCRecoVertexParticleAssociation.cc:46
bool operator!=(const MCRecoVertexParticleAssociation &other) const
Definition MutableMCRecoVertexParticleAssociation.h:129
friend class MCRecoVertexParticleAssociationCollection
Definition MutableMCRecoVertexParticleAssociation.h:41
MCRecoVertexParticleAssociation object_type
Definition MutableMCRecoVertexParticleAssociation.h:46
MutableMCRecoVertexParticleAssociation clone(bool cloneRelations=true) const
Definition MutableMCRecoVertexParticleAssociation.cc:35
friend class MCRecoVertexParticleAssociationMutableCollectionIterator
Definition MutableMCRecoVertexParticleAssociation.h:42
MutableMCRecoVertexParticleAssociation & operator=(MutableMCRecoVertexParticleAssociation other) &
copy-assignment operator
Definition MutableMCRecoVertexParticleAssociation.cc:30
bool operator!=(const MutableMCRecoVertexParticleAssociation &other) const
Definition MutableMCRecoVertexParticleAssociation.h:128
~MutableMCRecoVertexParticleAssociation()=default
destructor
void unlink()
disconnect from MCRecoVertexParticleAssociationObj instance
Definition MutableMCRecoVertexParticleAssociation.h:123
std::uint32_t getSimID() const
Access the Index of corresponding MCParticle (position in MCParticles array)
Definition MutableMCRecoVertexParticleAssociation.cc:45
MCRecoVertexParticleAssociationCollection collection_type
Definition MutableMCRecoVertexParticleAssociation.h:47
MutableMCRecoVertexParticleAssociation()
default constructor
Definition MutableMCRecoVertexParticleAssociation.cc:20
void setSim(const edm4hep::MCParticle &value)
Set the reference to the Monte-Carlo particle.
Definition MutableMCRecoVertexParticleAssociation.cc:78
float & weight()
Get reference to weight of this association.
Definition MutableMCRecoVertexParticleAssociation.cc:72
MutableMCRecoVertexParticleAssociation & operator=(MutableMCRecoVertexParticleAssociation other) &&=delete
float getWeight() const
Access the weight of this association.
Definition MutableMCRecoVertexParticleAssociation.cc:47
std::uint32_t & recID()
Get reference to Index of corresponding Vertex (position in Vertices array)
Definition MutableMCRecoVertexParticleAssociation.cc:69
const edm4hep::MCParticle getSim() const
Access the reference to the Monte-Carlo particle.
Definition MutableMCRecoVertexParticleAssociation.cc:56
Definition MutableVertex.h:38
Definition Vertex.h:46
Definition CalorimeterHit.cc:17
Definition CalorimeterHit.h:25
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:150
std::size_t operator()(const edm4eic::MutableMCRecoVertexParticleAssociation &obj) const
Definition MutableMCRecoVertexParticleAssociation.h:163