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 <edm4eic/Vertex.h>
11#include <edm4hep/MCParticle.h>
12
13#include "podio/utilities/MaybeSharedPtr.h"
14
15#include <cstdint>
16
17#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
18#include "nlohmann/json_fwd.hpp"
19#endif
20
21// forward declarations
22namespace edm4eic {
24class Vertex;
25class MutableVertex;
26}
27namespace edm4hep {
28class MCParticle;
29class MutableMCParticle;
30}
31
32
33namespace edm4eic {
34
35
36/** @class MutableMCRecoVertexParticleAssociation
37 * Association between a Vertex and a MCParticle
38 * @author: S. Joosten
39 */
41
45
46public:
49
50 /// default constructor
52
53 /// Constructor initializing all members
55
56 /// copy constructor
58
59 /// copy-assignment operator
60 MutableMCRecoVertexParticleAssociation& operator=(MutableMCRecoVertexParticleAssociation other) &; // Rebind this to other's internal object
61 MutableMCRecoVertexParticleAssociation& operator=(MutableMCRecoVertexParticleAssociation other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
62
63 /// create a mutable deep-copy of the object with identical relations
64 /// if cloneRelations=false, the relations are not cloned and will be empty
65 MutableMCRecoVertexParticleAssociation clone(bool cloneRelations=true) const;
66
67 /// destructor
69
70
71public:
72
73 /// Access the weight of this association
74 float getWeight() const;
75
76
77 /// Access the reference to the vertex
78 const edm4eic::Vertex getRec() const;
79 /// Access the reference to the Monte-Carlo particle
80 const edm4hep::MCParticle getSim() const;
81
82 /// Set the weight of this association
83 void setWeight(const float weight);
84 /// Get mutable reference to weight of this association
85 float& getWeight();
86
87
88 /// Set the reference to the vertex
89 void setRec(const edm4eic::Vertex& value);
90 /// Set the reference to the Monte-Carlo particle
91 void setSim(const edm4hep::MCParticle& value);
92
93
94 [[deprecated("use getSim().getObjectID().index instead")]] int getSimID() const { return getSim().getObjectID().index; }
95 [[deprecated("use getRec().getObjectID().index instead")]] int getRecID() const { return getRec().getObjectID().index; }
96
97
98 [[deprecated("use setSim() instead; this function does nothing")]] void setSimID(int) { }
99 [[deprecated("use setRec() instead; this function does nothing")]] void setRecID(int) { }
100
101
102 /// check whether the object is actually available
103 bool isAvailable() const;
104 /// disconnect from MCRecoVertexParticleAssociationObj instance
105 void unlink() { m_obj = podio::utils::MaybeSharedPtr<MCRecoVertexParticleAssociationObj>{nullptr}; }
106
107 constexpr bool operator==(const MutableMCRecoVertexParticleAssociation& other) const { return m_obj == other.m_obj; }
108 bool operator==(const MCRecoVertexParticleAssociation& other) const;
109
110 constexpr bool operator!=(const MutableMCRecoVertexParticleAssociation& other) const { return !(*this == other); }
111 bool operator!=(const MCRecoVertexParticleAssociation& other) const { return !(*this == other); }
112
113 // less comparison operator, so that objects can be e.g. stored in sets.
115
116 podio::ObjectID id() const { return getObjectID(); }
117
118 const podio::ObjectID getObjectID() const;
119
120 friend std::hash<MutableMCRecoVertexParticleAssociation>;
121
123 using std::swap;
124 swap(a.m_obj, b.m_obj); // swap out the internal pointers
125 }
126
127private:
128 /// constructor from existing MCRecoVertexParticleAssociationObj
129 explicit MutableMCRecoVertexParticleAssociation(podio::utils::MaybeSharedPtr<MCRecoVertexParticleAssociationObj> obj);
130
131 podio::utils::MaybeSharedPtr<MCRecoVertexParticleAssociationObj> m_obj{new MCRecoVertexParticleAssociationObj{}, podio::utils::MarkOwned};
132};
133
134#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
135void to_json(nlohmann::json& j, const MutableMCRecoVertexParticleAssociation& value);
136#endif
137
138
139} // namespace edm4eic
140
141
142
143template<>
144struct std::hash<edm4eic::MutableMCRecoVertexParticleAssociation> {
146 return std::hash<edm4eic::MCRecoVertexParticleAssociationObj*>{}(obj.m_obj.get());
147 }
148};
149
150
151#endif
Definition MCRecoVertexParticleAssociationCollection.h:139
Definition MCRecoVertexParticleAssociation.h:48
Definition MCRecoVertexParticleAssociationObj.h:24
Definition MutableMCRecoVertexParticleAssociation.h:40
bool operator<(const MutableMCRecoVertexParticleAssociation &other) const
Definition MutableMCRecoVertexParticleAssociation.h:114
void setRecID(int)
Definition MutableMCRecoVertexParticleAssociation.h:99
podio::ObjectID id() const
Definition MutableMCRecoVertexParticleAssociation.h:116
MutableMCRecoVertexParticleAssociation(const MutableMCRecoVertexParticleAssociation &other)=default
copy constructor
void setWeight(const float weight)
Set the weight of this association.
Definition MutableMCRecoVertexParticleAssociation.cc:56
const edm4eic::Vertex getRec() const
Access the reference to the vertex.
Definition MutableMCRecoVertexParticleAssociation.cc:41
int getRecID() const
Definition MutableMCRecoVertexParticleAssociation.h:95
bool isAvailable() const
check whether the object is actually available
Definition MutableMCRecoVertexParticleAssociation.cc:73
friend class MCRecoVertexParticleAssociation
Definition MutableMCRecoVertexParticleAssociation.h:44
const podio::ObjectID getObjectID() const
Definition MutableMCRecoVertexParticleAssociation.cc:77
void setRec(const edm4eic::Vertex &value)
Set the reference to the vertex.
Definition MutableMCRecoVertexParticleAssociation.cc:59
friend void swap(MutableMCRecoVertexParticleAssociation &a, MutableMCRecoVertexParticleAssociation &b)
Definition MutableMCRecoVertexParticleAssociation.h:122
MutableMCRecoVertexParticleAssociation()=default
default constructor
void setSimID(int)
Definition MutableMCRecoVertexParticleAssociation.h:98
bool operator!=(const MCRecoVertexParticleAssociation &other) const
Definition MutableMCRecoVertexParticleAssociation.h:111
friend class MCRecoVertexParticleAssociationCollection
Definition MutableMCRecoVertexParticleAssociation.h:42
MCRecoVertexParticleAssociation object_type
Definition MutableMCRecoVertexParticleAssociation.h:47
MutableMCRecoVertexParticleAssociation clone(bool cloneRelations=true) const
Definition MutableMCRecoVertexParticleAssociation.cc:29
friend class MCRecoVertexParticleAssociationMutableCollectionIterator
Definition MutableMCRecoVertexParticleAssociation.h:43
MutableMCRecoVertexParticleAssociation & operator=(MutableMCRecoVertexParticleAssociation other) &
copy-assignment operator
Definition MutableMCRecoVertexParticleAssociation.cc:24
int getSimID() const
Definition MutableMCRecoVertexParticleAssociation.h:94
constexpr bool operator==(const MutableMCRecoVertexParticleAssociation &other) const
Definition MutableMCRecoVertexParticleAssociation.h:107
~MutableMCRecoVertexParticleAssociation()=default
destructor
void unlink()
disconnect from MCRecoVertexParticleAssociationObj instance
Definition MutableMCRecoVertexParticleAssociation.h:105
MCRecoVertexParticleAssociationCollection collection_type
Definition MutableMCRecoVertexParticleAssociation.h:48
void setSim(const edm4hep::MCParticle &value)
Set the reference to the Monte-Carlo particle.
Definition MutableMCRecoVertexParticleAssociation.cc:63
MutableMCRecoVertexParticleAssociation & operator=(MutableMCRecoVertexParticleAssociation other) &&=delete
constexpr bool operator!=(const MutableMCRecoVertexParticleAssociation &other) const
Definition MutableMCRecoVertexParticleAssociation.h:110
float getWeight() const
Access the weight of this association.
Definition MutableMCRecoVertexParticleAssociation.cc:39
const edm4hep::MCParticle getSim() const
Access the reference to the Monte-Carlo particle.
Definition MutableMCRecoVertexParticleAssociation.cc:48
Definition MutableVertex.h:38
Definition Vertex.h:46
const podio::ObjectID getObjectID() const
Definition Vertex.cc:110
Definition ArrowMapper.cc:61
Definition CalorimeterHit.h:25
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::MutableMCRecoVertexParticleAssociation &obj) const
Definition MutableMCRecoVertexParticleAssociation.h:145