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 {
25}
26namespace edm4hep {
27class MCParticle;
28class MutableMCParticle;
29}
30
31
32namespace edm4eic {
33
34
35/** @class MutableMCRecoParticleAssociation
36 * Used to keep track of the correspondence between MC and reconstructed particles
37 * @author: S. Joosten
38 */
40
44
45public:
48
49 /// default constructor
51
52 /// Constructor initializing all members
53 MutableMCRecoParticleAssociation(const std::uint32_t simID, const std::uint32_t recID, const float weight);
54
55 /// copy constructor
57
58 /// copy-assignment operator
59 MutableMCRecoParticleAssociation& operator=(MutableMCRecoParticleAssociation other) &; // Rebind this to other's internal object
60 MutableMCRecoParticleAssociation& operator=(MutableMCRecoParticleAssociation 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 MutableMCRecoParticleAssociation 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 ReconstructedParticle (position in ReconstructedParticles 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 reconstructed particle
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 ReconstructedParticle (position in ReconstructedParticles array)
96 void setRecID(const std::uint32_t recID);
97 /// Get mutable reference to Index of corresponding ReconstructedParticle (position in ReconstructedParticles array)
98 std::uint32_t& getRecID();
99 /// Get reference to Index of corresponding ReconstructedParticle (position in ReconstructedParticles 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 reconstructed particle
113 void setRec(const edm4eic::ReconstructedParticle& 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 MCRecoParticleAssociationObj instance
123 void unlink() { m_obj = podio::utils::MaybeSharedPtr<MCRecoParticleAssociationObj>{nullptr}; }
124
125 bool operator==(const MutableMCRecoParticleAssociation& other) const { return m_obj == other.m_obj; }
126 bool operator==(const MCRecoParticleAssociation& other) const;
127
128 bool operator!=(const MutableMCRecoParticleAssociation& other) const { return !(*this == other); }
129 bool operator!=(const MCRecoParticleAssociation& 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<MutableMCRecoParticleAssociation>;
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 MCRecoParticleAssociationObj
147 explicit MutableMCRecoParticleAssociation(podio::utils::MaybeSharedPtr<MCRecoParticleAssociationObj> obj);
148
149 podio::utils::MaybeSharedPtr<MCRecoParticleAssociationObj> m_obj{nullptr};
150};
151
152#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
153void to_json(nlohmann::json& j, const MutableMCRecoParticleAssociation& value);
154#endif
155
156
157} // namespace edm4eic
158
159
160
161template<>
162struct std::hash<edm4eic::MutableMCRecoParticleAssociation> {
164 return std::hash<edm4eic::MCRecoParticleAssociationObj*>{}(obj.m_obj.get());
165 }
166};
167
168
169#endif
Definition MCRecoParticleAssociationCollection.h:137
Definition MCRecoParticleAssociation.h:47
Definition MutableMCRecoParticleAssociation.h:39
void setRecID(const std::uint32_t recID)
Set the Index of corresponding ReconstructedParticle (position in ReconstructedParticles array)
Definition MutableMCRecoParticleAssociation.cc:67
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:128
MutableMCRecoParticleAssociation(const MutableMCRecoParticleAssociation &other)=default
copy constructor
MutableMCRecoParticleAssociation & operator=(MutableMCRecoParticleAssociation other) &&=delete
const podio::ObjectID getObjectID() const
Definition MutableMCRecoParticleAssociation.cc:92
void setRec(const edm4eic::ReconstructedParticle &value)
Set the reference to the reconstructed particle.
Definition MutableMCRecoParticleAssociation.cc:74
MCRecoParticleAssociationCollection collection_type
Definition MutableMCRecoParticleAssociation.h:47
float & weight()
Get reference to weight of this association.
Definition MutableMCRecoParticleAssociation.cc:72
podio::ObjectID id() const
Definition MutableMCRecoParticleAssociation.h:134
MCRecoParticleAssociation object_type
Definition MutableMCRecoParticleAssociation.h:46
void setSimID(const std::uint32_t simID)
Set the Index of corresponding MCParticle (position in MCParticles array)
Definition MutableMCRecoParticleAssociation.cc:64
void unlink()
disconnect from MCRecoParticleAssociationObj instance
Definition MutableMCRecoParticleAssociation.h:123
MutableMCRecoParticleAssociation()
default constructor
Definition MutableMCRecoParticleAssociation.cc:20
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:132
void setSim(const edm4hep::MCParticle &value)
Set the reference to the Monte-Carlo particle.
Definition MutableMCRecoParticleAssociation.cc:78
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:140
void setWeight(const float weight)
Set the weight of this association.
Definition MutableMCRecoParticleAssociation.cc:70
const edm4eic::ReconstructedParticle getRec() const
Access the reference to the reconstructed particle.
Definition MutableMCRecoParticleAssociation.cc:49
friend class MCRecoParticleAssociation
Definition MutableMCRecoParticleAssociation.h:43
bool operator!=(const MCRecoParticleAssociation &other) const
Definition MutableMCRecoParticleAssociation.h:129
MutableMCRecoParticleAssociation & operator=(MutableMCRecoParticleAssociation other) &
copy-assignment operator
Definition MutableMCRecoParticleAssociation.cc:30
bool operator==(const MutableMCRecoParticleAssociation &other) const
Definition MutableMCRecoParticleAssociation.h:125
std::uint32_t getRecID() const
Access the Index of corresponding ReconstructedParticle (position in ReconstructedParticles array)
Definition MutableMCRecoParticleAssociation.cc:46
friend class MCRecoParticleAssociationMutableCollectionIterator
Definition MutableMCRecoParticleAssociation.h:42
float getWeight() const
Access the weight of this association.
Definition MutableMCRecoParticleAssociation.cc:47
~MutableMCRecoParticleAssociation()=default
destructor
bool isAvailable() const
check whether the object is actually available
Definition MutableMCRecoParticleAssociation.cc:88
friend class MCRecoParticleAssociationCollection
Definition MutableMCRecoParticleAssociation.h:41
Definition MutableReconstructedParticle.h:46
Definition ReconstructedParticle.h:54
Definition CalorimeterHit.cc:17
Definition CalorimeterHit.h:25
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:150
std::size_t operator()(const edm4eic::MutableMCRecoParticleAssociation &obj) const
Definition MutableMCRecoParticleAssociation.h:163