EDM4eic
EIC data model
Loading...
Searching...
No Matches
MutableTruthiness.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_MutableTruthiness_H
4#define EDM4EIC_MutableTruthiness_H
5
7// Make the immutable class available from its mutable version but not vice versa
9
13#include "edm4hep/MCParticle.h"
14#include "podio/RelationRange.h"
15#include <vector>
16
17#include "podio/utilities/MaybeSharedPtr.h"
18
19#include <cstdint>
20
21#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
22#include "nlohmann/json_fwd.hpp"
23#endif
24
25// forward declarations
26namespace edm4eic {
28}
29
30
31namespace edm4eic {
32
33
34/** @class MutableTruthiness
35 * Positive-definite convex norm of how confidently wrong the reconstruction is, with non-negative contributions from various aspects of the reconstruction, where a zero value indicates a perfect reconstruction.
36 * @author: W. Deconinck, S. Colbert
37 */
39
42 friend class Truthiness;
43
44public:
47
48 /// default constructor
50
51 /// Constructor initializing all members
53
54 /// copy constructor
55 MutableTruthiness(const MutableTruthiness& other) = default;
56
57 /// copy-assignment operator
58 MutableTruthiness& operator=(MutableTruthiness other) &; // Rebind this to other's internal object
59 MutableTruthiness& operator=(MutableTruthiness other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
60
61 /// create a mutable deep-copy of the object with identical relations
62 /// if cloneRelations=false, the relations are not cloned and will be empty
63 MutableTruthiness clone(bool cloneRelations=true) const;
64
65 /// destructor
66 ~MutableTruthiness() = default;
67
68
69public:
70
71 /// Access the Overall truthiness of the entire event
72 float getTruthiness() const;
73
74 /// Access the Contribution from all associated particles
76
77 /// Access the Contribution from unassociated MC particles
79
80 /// Access the Contribution from unassociated reconstructed particles
82
83
84
85 /// Set the Overall truthiness of the entire event
86 void setTruthiness(const float truthiness);
87 /// Get mutable reference to Overall truthiness of the entire event
88 float& getTruthiness();
89 /// Get reference to Overall truthiness of the entire event
90 [[deprecated("use getTruthiness instead")]]
91 float& truthiness();
92
93 /// Set the Contribution from all associated particles
95 /// Get mutable reference to Contribution from all associated particles
97 /// Get reference to Contribution from all associated particles
98 [[deprecated("use getAssociationContribution instead")]]
100
101 /// Set the Contribution from unassociated MC particles
103 /// Get mutable reference to Contribution from unassociated MC particles
105 /// Get reference to Contribution from unassociated MC particles
106 [[deprecated("use getUnassociatedMCParticlesContribution instead")]]
108
109 /// Set the Contribution from unassociated reconstructed particles
111 /// Get mutable reference to Contribution from unassociated reconstructed particles
113 /// Get reference to Contribution from unassociated reconstructed particles
114 [[deprecated("use getUnassociatedRecoParticlesContribution instead")]]
116
117
118
120 std::size_t associations_size() const;
122 std::vector<edm4eic::MCRecoParticleAssociation>::const_iterator associations_begin() const;
123 std::vector<edm4eic::MCRecoParticleAssociation>::const_iterator associations_end() const;
124 podio::RelationRange<edm4eic::MCRecoParticleAssociation> getAssociations() const;
125 void addToUnassociatedMCParticles(const edm4hep::MCParticle&);
126 std::size_t unassociatedMCParticles_size() const;
127 edm4hep::MCParticle getUnassociatedMCParticles(std::size_t) const;
128 std::vector<edm4hep::MCParticle>::const_iterator unassociatedMCParticles_begin() const;
129 std::vector<edm4hep::MCParticle>::const_iterator unassociatedMCParticles_end() const;
130 podio::RelationRange<edm4hep::MCParticle> getUnassociatedMCParticles() const;
132 std::size_t unassociatedRecoParticles_size() const;
134 std::vector<edm4eic::ReconstructedParticle>::const_iterator unassociatedRecoParticles_begin() const;
135 std::vector<edm4eic::ReconstructedParticle>::const_iterator unassociatedRecoParticles_end() const;
136 podio::RelationRange<edm4eic::ReconstructedParticle> getUnassociatedRecoParticles() const;
138 std::size_t associationContributions_size() const;
140 std::vector<edm4eic::TruthinessContribution>::const_iterator associationContributions_begin() const;
141 std::vector<edm4eic::TruthinessContribution>::const_iterator associationContributions_end() const;
142 podio::RelationRange<edm4eic::TruthinessContribution> getAssociationContributions() const;
143
144
145
146 /// check whether the object is actually available
147 bool isAvailable() const;
148 /// disconnect from TruthinessObj instance
149 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TruthinessObj>{nullptr}; }
150
151 bool operator==(const MutableTruthiness& other) const { return m_obj == other.m_obj; }
152 bool operator==(const Truthiness& other) const;
153
154 bool operator!=(const MutableTruthiness& other) const { return !(*this == other); }
155 bool operator!=(const Truthiness& other) const { return !(*this == other); }
156
157 // less comparison operator, so that objects can be e.g. stored in sets.
158 bool operator<(const MutableTruthiness& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
159
160 podio::ObjectID id() const { return getObjectID(); }
161
162 const podio::ObjectID getObjectID() const;
163
164 friend std::hash<MutableTruthiness>;
165
167 using std::swap;
168 swap(a.m_obj, b.m_obj); // swap out the internal pointers
169 }
170
171private:
172 /// constructor from existing TruthinessObj
173 explicit MutableTruthiness(podio::utils::MaybeSharedPtr<TruthinessObj> obj);
174
175 podio::utils::MaybeSharedPtr<TruthinessObj> m_obj{nullptr};
176};
177
178#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
179void to_json(nlohmann::json& j, const MutableTruthiness& value);
180#endif
181
182
183} // namespace edm4eic
184
185
186
187template<>
188struct std::hash<edm4eic::MutableTruthiness> {
189 std::size_t operator()(const edm4eic::MutableTruthiness& obj) const {
190 return std::hash<edm4eic::TruthinessObj*>{}(obj.m_obj.get());
191 }
192};
193
194
195#endif
Definition MCRecoParticleAssociation.h:47
Definition MutableTruthiness.h:38
std::vector< edm4eic::ReconstructedParticle >::const_iterator unassociatedRecoParticles_end() const
Definition MutableTruthiness.cc:159
friend class Truthiness
Definition MutableTruthiness.h:42
std::vector< edm4eic::TruthinessContribution >::const_iterator associationContributions_end() const
Definition MutableTruthiness.cc:195
const edm4eic::TruthinessContribution & getAssociationContribution() const
Access the Contribution from all associated particles.
Definition MutableTruthiness.cc:57
std::vector< edm4eic::TruthinessContribution >::const_iterator associationContributions_begin() const
Definition MutableTruthiness.cc:189
float getTruthiness() const
Access the Overall truthiness of the entire event.
Definition MutableTruthiness.cc:56
MutableTruthiness & operator=(MutableTruthiness other) &&=delete
podio::RelationRange< edm4eic::TruthinessContribution > getAssociationContributions() const
Definition MutableTruthiness.cc:212
void unlink()
disconnect from TruthinessObj instance
Definition MutableTruthiness.h:149
podio::RelationRange< edm4eic::MCRecoParticleAssociation > getAssociations() const
Definition MutableTruthiness.cc:104
std::vector< edm4hep::MCParticle >::const_iterator unassociatedMCParticles_begin() const
Definition MutableTruthiness.cc:117
float & unassociatedMCParticlesContribution()
Get reference to Contribution from unassociated MC particles.
Definition MutableTruthiness.cc:70
MutableTruthiness & operator=(MutableTruthiness other) &
copy-assignment operator
Definition MutableTruthiness.cc:29
std::vector< edm4eic::ReconstructedParticle >::const_iterator unassociatedRecoParticles_begin() const
Definition MutableTruthiness.cc:153
void setUnassociatedRecoParticlesContribution(const float unassociatedRecoParticlesContribution)
Set the Contribution from unassociated reconstructed particles.
Definition MutableTruthiness.cc:71
std::size_t associationContributions_size() const
Definition MutableTruthiness.cc:201
void setUnassociatedMCParticlesContribution(const float unassociatedMCParticlesContribution)
Set the Contribution from unassociated MC particles.
Definition MutableTruthiness.cc:68
std::size_t unassociatedMCParticles_size() const
Definition MutableTruthiness.cc:129
std::vector< edm4eic::MCRecoParticleAssociation >::const_iterator associations_end() const
Definition MutableTruthiness.cc:87
bool operator==(const MutableTruthiness &other) const
Definition MutableTruthiness.h:151
bool operator<(const MutableTruthiness &other) const
Definition MutableTruthiness.h:158
std::vector< edm4hep::MCParticle >::const_iterator unassociatedMCParticles_end() const
Definition MutableTruthiness.cc:123
std::vector< edm4eic::MCRecoParticleAssociation >::const_iterator associations_begin() const
Definition MutableTruthiness.cc:81
friend class TruthinessCollection
Definition MutableTruthiness.h:40
MutableTruthiness(const MutableTruthiness &other)=default
copy constructor
float & unassociatedRecoParticlesContribution()
Get reference to Contribution from unassociated reconstructed particles.
Definition MutableTruthiness.cc:73
MutableTruthiness()
default constructor
Definition MutableTruthiness.cc:18
void setTruthiness(const float truthiness)
Set the Overall truthiness of the entire event.
Definition MutableTruthiness.cc:62
const podio::ObjectID getObjectID() const
Definition MutableTruthiness.cc:229
edm4eic::TruthinessContribution & associationContribution()
Get reference to Contribution from all associated particles.
Definition MutableTruthiness.cc:67
bool isAvailable() const
check whether the object is actually available
Definition MutableTruthiness.cc:225
std::size_t associations_size() const
Definition MutableTruthiness.cc:93
friend void swap(MutableTruthiness &a, MutableTruthiness &b)
Definition MutableTruthiness.h:166
float getUnassociatedRecoParticlesContribution() const
Access the Contribution from unassociated reconstructed particles.
Definition MutableTruthiness.cc:59
std::size_t unassociatedRecoParticles_size() const
Definition MutableTruthiness.cc:165
void addToAssociationContributions(const edm4eic::TruthinessContribution &)
Definition MutableTruthiness.cc:184
podio::ObjectID id() const
Definition MutableTruthiness.h:160
MutableTruthiness clone(bool cloneRelations=true) const
Definition MutableTruthiness.cc:34
float getUnassociatedMCParticlesContribution() const
Access the Contribution from unassociated MC particles.
Definition MutableTruthiness.cc:58
~MutableTruthiness()=default
destructor
float & truthiness()
Get reference to Overall truthiness of the entire event.
Definition MutableTruthiness.cc:64
bool operator!=(const Truthiness &other) const
Definition MutableTruthiness.h:155
TruthinessCollection collection_type
Definition MutableTruthiness.h:46
void addToUnassociatedRecoParticles(const edm4eic::ReconstructedParticle &)
Definition MutableTruthiness.cc:148
bool operator!=(const MutableTruthiness &other) const
Definition MutableTruthiness.h:154
friend class TruthinessMutableCollectionIterator
Definition MutableTruthiness.h:41
podio::RelationRange< edm4eic::ReconstructedParticle > getUnassociatedRecoParticles() const
Definition MutableTruthiness.cc:176
void setAssociationContribution(const edm4eic::TruthinessContribution &associationContribution)
Set the Contribution from all associated particles.
Definition MutableTruthiness.cc:65
Truthiness object_type
Definition MutableTruthiness.h:45
void addToUnassociatedMCParticles(const edm4hep::MCParticle &)
Definition MutableTruthiness.cc:112
podio::RelationRange< edm4hep::MCParticle > getUnassociatedMCParticles() const
Definition MutableTruthiness.cc:140
void addToAssociations(const edm4eic::MCRecoParticleAssociation &)
Definition MutableTruthiness.cc:76
Definition ReconstructedParticle.h:54
Definition TruthinessCollection.h:137
Definition TruthinessContribution.h:18
Definition Truthiness.h:46
Definition CalorimeterHit.cc:17
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:150
std::size_t operator()(const edm4eic::MutableTruthiness &obj) const
Definition MutableTruthiness.h:189