EDM4eic
EIC data model
Loading...
Searching...
No Matches
MutableMCRecoParticleAssociation.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_MutableMCRecoParticleAssociation_H
4#define EDM4EIC_MutableMCRecoParticleAssociation_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 {
22class ReconstructedParticle;
23class MutableReconstructedParticle;
24}
25namespace edm4hep {
26class MCParticle;
27class MutableMCParticle;
28}
29
30
31namespace edm4eic {
32
33
34/** @class MutableMCRecoParticleAssociation
35 * Used to keep track of the correspondence between MC and reconstructed particles
36 * @author: S. Joosten
37 */
39
43
44public:
47
48 /// default constructor
50
51 /// Constructor initializing all members
52 MutableMCRecoParticleAssociation(std::uint32_t simID, std::uint32_t recID, float weight);
53
54 /// copy constructor
56
57 /// copy-assignment operator
59
60 /// create a mutable deep-copy of the object with identical relations
61 /// if cloneRelations=false, the relations are not cloned and will be empty
62 MutableMCRecoParticleAssociation clone(bool cloneRelations=true) const;
63
64 /// destructor
66
67
68public:
69
70 /// Access the Index of corresponding MCParticle (position in MCParticles array)
71 std::uint32_t getSimID() const;
72
73 /// Access the Index of corresponding ReconstructedParticle (position in ReconstructedParticles array)
74 std::uint32_t getRecID() const;
75
76 /// Access the weight of this association
77 float getWeight() const;
78
79
80 /// Access the reference to the reconstructed particle
82 /// Access the reference to the Monte-Carlo particle
83 const edm4hep::MCParticle getSim() const;
84
85 /// Set the Index of corresponding MCParticle (position in MCParticles array)
86 void setSimID(std::uint32_t value);
87 /// Get mutable reference to Index of corresponding MCParticle (position in MCParticles array)
88 std::uint32_t& getSimID();
89 /// Get reference to Index of corresponding MCParticle (position in MCParticles array)
90 [[deprecated("use getSimID instead")]]
91 std::uint32_t& simID();
92
93 /// Set the Index of corresponding ReconstructedParticle (position in ReconstructedParticles array)
94 void setRecID(std::uint32_t value);
95 /// Get mutable reference to Index of corresponding ReconstructedParticle (position in ReconstructedParticles array)
96 std::uint32_t& getRecID();
97 /// Get reference to Index of corresponding ReconstructedParticle (position in ReconstructedParticles array)
98 [[deprecated("use getRecID instead")]]
99 std::uint32_t& recID();
100
101 /// Set the weight of this association
102 void setWeight(float value);
103 /// Get mutable reference to weight of this association
104 float& getWeight();
105 /// Get reference to weight of this association
106 [[deprecated("use getWeight instead")]]
107 float& weight();
108
109
110 /// Set the reference to the reconstructed particle
111 void setRec(const edm4eic::ReconstructedParticle& value);
112 /// Set the reference to the Monte-Carlo particle
113 void setSim(const edm4hep::MCParticle& value);
114
115
116
117
118 /// check whether the object is actually available
119 bool isAvailable() const;
120 /// disconnect from MCRecoParticleAssociationObj instance
121 void unlink() { m_obj = podio::utils::MaybeSharedPtr<MCRecoParticleAssociationObj>{nullptr}; }
122
123 bool operator==(const MutableMCRecoParticleAssociation& other) const { return m_obj == other.m_obj; }
124 bool operator==(const MCRecoParticleAssociation& other) const;
125
126 bool operator!=(const MutableMCRecoParticleAssociation& other) const { return !(*this == other); }
127 bool operator!=(const MCRecoParticleAssociation& other) const { return !(*this == other); }
128
129 // less comparison operator, so that objects can be e.g. stored in sets.
130 bool operator<(const MutableMCRecoParticleAssociation& other) const { return m_obj < other.m_obj; }
131
132 podio::ObjectID id() const { return getObjectID(); }
133
134 const podio::ObjectID getObjectID() const;
135
137 using std::swap;
138 swap(a.m_obj, b.m_obj); // swap out the internal pointers
139 }
140
141private:
142 /// constructor from existing MCRecoParticleAssociationObj
143 explicit MutableMCRecoParticleAssociation(podio::utils::MaybeSharedPtr<MCRecoParticleAssociationObj> obj);
144
145 podio::utils::MaybeSharedPtr<MCRecoParticleAssociationObj> m_obj{nullptr};
146};
147
148#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
149void to_json(nlohmann::json& j, const MutableMCRecoParticleAssociation& value);
150#endif
151
152
153} // namespace edm4eic
154
155
156#endif
Definition MCRecoParticleAssociationCollection.h:92
Definition MCRecoParticleAssociation.h:40
Definition MCRecoParticleAssociationCollection.h:63
Definition MutableMCRecoParticleAssociation.h:38
std::uint32_t getSimID() const
Access the Index of corresponding MCParticle (position in MCParticles array)
Definition MutableMCRecoParticleAssociation.cc:45
const edm4hep::MCParticle getSim() const
Access the reference to the Monte-Carlo particle.
Definition MutableMCRecoParticleAssociation.cc:56
bool operator!=(const MutableMCRecoParticleAssociation &other) const
Definition MutableMCRecoParticleAssociation.h:126
MutableMCRecoParticleAssociation(const MutableMCRecoParticleAssociation &other)=default
copy constructor
const podio::ObjectID getObjectID() const
Definition MutableMCRecoParticleAssociation.cc:94
void setRec(const edm4eic::ReconstructedParticle &value)
Set the reference to the reconstructed particle.
Definition MutableMCRecoParticleAssociation.cc:74
float & weight()
Get reference to weight of this association.
Definition MutableMCRecoParticleAssociation.cc:72
void setWeight(float value)
Set the weight of this association.
Definition MutableMCRecoParticleAssociation.cc:70
void setRecID(std::uint32_t value)
Set the Index of corresponding ReconstructedParticle (position in ReconstructedParticles array)
Definition MutableMCRecoParticleAssociation.cc:67
podio::ObjectID id() const
Definition MutableMCRecoParticleAssociation.h:132
void unlink()
disconnect from MCRecoParticleAssociationObj instance
Definition MutableMCRecoParticleAssociation.h:121
MutableMCRecoParticleAssociation()
default constructor
Definition MutableMCRecoParticleAssociation.cc:20
void setSimID(std::uint32_t value)
Set the Index of corresponding MCParticle (position in MCParticles array)
Definition MutableMCRecoParticleAssociation.cc:64
std::uint32_t & simID()
Get reference to Index of corresponding MCParticle (position in MCParticles array)
Definition MutableMCRecoParticleAssociation.cc:66
bool operator<(const MutableMCRecoParticleAssociation &other) const
Definition MutableMCRecoParticleAssociation.h:130
void setSim(const edm4hep::MCParticle &value)
Set the reference to the Monte-Carlo particle.
Definition MutableMCRecoParticleAssociation.cc:79
std::uint32_t & recID()
Get reference to Index of corresponding ReconstructedParticle (position in ReconstructedParticles arr...
Definition MutableMCRecoParticleAssociation.cc:69
MutableMCRecoParticleAssociation clone(bool cloneRelations=true) const
Definition MutableMCRecoParticleAssociation.cc:35
friend void swap(MutableMCRecoParticleAssociation &a, MutableMCRecoParticleAssociation &b)
Definition MutableMCRecoParticleAssociation.h:136
const edm4eic::ReconstructedParticle getRec() const
Access the reference to the reconstructed particle.
Definition MutableMCRecoParticleAssociation.cc:49
friend class MCRecoParticleAssociation
Definition MutableMCRecoParticleAssociation.h:42
bool operator!=(const MCRecoParticleAssociation &other) const
Definition MutableMCRecoParticleAssociation.h:127
bool operator==(const MutableMCRecoParticleAssociation &other) const
Definition MutableMCRecoParticleAssociation.h:123
std::uint32_t getRecID() const
Access the Index of corresponding ReconstructedParticle (position in ReconstructedParticles array)
Definition MutableMCRecoParticleAssociation.cc:46
float getWeight() const
Access the weight of this association.
Definition MutableMCRecoParticleAssociation.cc:47
~MutableMCRecoParticleAssociation()=default
destructor
MutableMCRecoParticleAssociation & operator=(MutableMCRecoParticleAssociation other)
copy-assignment operator
Definition MutableMCRecoParticleAssociation.cc:30
bool isAvailable() const
check whether the object is actually available
Definition MutableMCRecoParticleAssociation.cc:90
friend class MCRecoParticleAssociationCollection
Definition MutableMCRecoParticleAssociation.h:40
Definition ReconstructedParticle.h:47
Definition CalorimeterHit.cc:17
Definition CalorimeterHit.h:21