EDM4eic
EIC data model
Loading...
Searching...
No Matches
Truthiness.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_Truthiness_H
4#define EDM4EIC_Truthiness_H
5
7
11#include "edm4hep/MCParticle.h"
12#include "podio/RelationRange.h"
13#include <vector>
14
15#include "podio/utilities/MaybeSharedPtr.h"
16#include "podio/detail/OrderKey.h"
17
18#include <ostream>
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 podio::detail {
32// Internal function used in less comparison operators of the datatypes and interface types
33OrderKey getOrderKey(const edm4eic::Truthiness& obj);
34};
35
36namespace edm4eic {
37
41
42/** @class Truthiness
43 * 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.
44 * @author: W. Deconinck, S. Colbert
45 */
47
48 friend class MutableTruthiness;
52 friend podio::detail::OrderKey podio::detail::getOrderKey(const Truthiness & obj);
53
54public:
57
58 /// default constructor
59 Truthiness();
60
61 /// Constructor initializing all members
62 Truthiness(const float truthiness, const edm4eic::TruthinessContribution& associationContribution, const float unassociatedMCParticlesContribution, const float unassociatedRecoParticlesContribution);
63
64 /// copy constructor
65 Truthiness(const Truthiness& other) = default;
66
67 /// copy-assignment operator
68 Truthiness& operator=(Truthiness other) &; // Rebind this to other's internal object
69 Truthiness& operator=(Truthiness other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
70
71 /// create a mutable deep-copy of the object with identical relations
72 /// if cloneRelations=false, the relations are not cloned and will be empty
73 MutableTruthiness clone(bool cloneRelations=true) const;
74
75 /// destructor
76 ~Truthiness() = default;
77
78 /// converting constructor from mutable object
79 Truthiness(const MutableTruthiness& other);
80
81 static Truthiness makeEmpty();
82
83public:
84
85 static constexpr std::string_view typeName = "edm4eic::Truthiness";
86
87 /// Access the Overall truthiness of the entire event
88 float getTruthiness() const;
89
90 /// Access the Contribution from all associated particles
92
93 /// Access the Contribution from unassociated MC particles
95
96 /// Access the Contribution from unassociated reconstructed particles
98
99
100
101 std::size_t associations_size() const;
103 std::vector<edm4eic::MCRecoParticleAssociation>::const_iterator associations_begin() const;
104 std::vector<edm4eic::MCRecoParticleAssociation>::const_iterator associations_end() const;
105 podio::RelationRange<edm4eic::MCRecoParticleAssociation> getAssociations() const;
106 std::size_t unassociatedMCParticles_size() const;
107 edm4hep::MCParticle getUnassociatedMCParticles(std::size_t) const;
108 std::vector<edm4hep::MCParticle>::const_iterator unassociatedMCParticles_begin() const;
109 std::vector<edm4hep::MCParticle>::const_iterator unassociatedMCParticles_end() const;
110 podio::RelationRange<edm4hep::MCParticle> getUnassociatedMCParticles() const;
111 std::size_t unassociatedRecoParticles_size() const;
113 std::vector<edm4eic::ReconstructedParticle>::const_iterator unassociatedRecoParticles_begin() const;
114 std::vector<edm4eic::ReconstructedParticle>::const_iterator unassociatedRecoParticles_end() const;
115 podio::RelationRange<edm4eic::ReconstructedParticle> getUnassociatedRecoParticles() const;
116 std::size_t associationContributions_size() const;
118 std::vector<edm4eic::TruthinessContribution>::const_iterator associationContributions_begin() const;
119 std::vector<edm4eic::TruthinessContribution>::const_iterator associationContributions_end() const;
120 podio::RelationRange<edm4eic::TruthinessContribution> getAssociationContributions() const;
121
122
123 /// check whether the object is actually available
124 bool isAvailable() const;
125 /// disconnect from TruthinessObj instance
126 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TruthinessObj>{nullptr}; }
127
128 bool operator==(const Truthiness& other) const { return m_obj == other.m_obj; }
129 bool operator==(const MutableTruthiness& other) const;
130
131 bool operator!=(const Truthiness& other) const { return !(*this == other); }
132 bool operator!=(const MutableTruthiness& other) const { return !(*this == other); }
133
134 // less comparison operator, so that objects can be e.g. stored in sets.
135 bool operator<(const Truthiness& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
136
137 podio::ObjectID id() const { return getObjectID(); }
138
139 const podio::ObjectID getObjectID() const;
140
141 friend std::hash<Truthiness>;
142
143 friend void swap(Truthiness& a, Truthiness& b) {
144 using std::swap;
145 swap(a.m_obj, b.m_obj); // swap out the internal pointers
146 }
147
148private:
149 /// constructor from existing TruthinessObj
150 explicit Truthiness(podio::utils::MaybeSharedPtr<TruthinessObj> obj);
152
153 podio::utils::MaybeSharedPtr<TruthinessObj> m_obj{nullptr};
154};
155
156std::ostream& operator<<(std::ostream& o, const Truthiness& value);
157
158#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
159void to_json(nlohmann::json& j, const Truthiness& value);
160#endif
161
162
163} // namespace edm4eic
164
165
166
167template<>
168struct std::hash<edm4eic::Truthiness> {
169 std::size_t operator()(const edm4eic::Truthiness& obj) const {
170 return std::hash<edm4eic::TruthinessObj*>{}(obj.m_obj.get());
171 }
172};
173
174
175// This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
176// until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
177// and https://github.com/AIDASoft/podio/issues/770
178#if defined(__clang__)
179#pragma clang diagnostic push
180#pragma clang diagnostic ignored "-Wunknown-warning-option"
181#pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
182#pragma clang diagnostic ignored "-Wdeprecated"
183constexpr std::string_view edm4eic::Truthiness::typeName;
184#pragma clang diagnostic pop
185#elif defined(__GNUC__)
186#pragma GCC diagnostic push
187#pragma GCC diagnostic ignored "-Wdeprecated"
188constexpr std::string_view edm4eic::Truthiness::typeName;
189#pragma GCC diagnostic pop
190#endif
191
192#endif
Definition MCRecoParticleAssociation.h:47
Definition MutableTruthiness.h:38
Definition ReconstructedParticle.h:54
Definition TruthinessCollectionData.h:33
Definition TruthinessCollection.h:137
Definition TruthinessContribution.h:18
Definition Truthiness.h:46
bool operator==(const Truthiness &other) const
Definition Truthiness.h:128
std::vector< edm4hep::MCParticle >::const_iterator unassociatedMCParticles_end() const
Definition Truthiness.cc:144
podio::RelationRange< edm4hep::MCParticle > getUnassociatedMCParticles() const
Definition Truthiness.cc:161
std::vector< edm4eic::MCRecoParticleAssociation >::const_iterator associations_begin() const
Definition Truthiness.cc:106
bool operator!=(const MutableTruthiness &other) const
Definition Truthiness.h:132
podio::ObjectID id() const
Definition Truthiness.h:137
bool isAvailable() const
check whether the object is actually available
Definition Truthiness.cc:237
float getUnassociatedMCParticlesContribution() const
Access the Contribution from unassociated MC particles.
Definition Truthiness.cc:101
const edm4eic::TruthinessContribution & getAssociationContribution() const
Access the Contribution from all associated particles.
Definition Truthiness.cc:100
podio::RelationRange< edm4eic::TruthinessContribution > getAssociationContributions() const
Definition Truthiness.cc:225
static constexpr std::string_view typeName
Definition Truthiness.h:85
bool operator<(const Truthiness &other) const
Definition Truthiness.h:135
podio::RelationRange< edm4eic::ReconstructedParticle > getUnassociatedRecoParticles() const
Definition Truthiness.cc:193
std::size_t unassociatedRecoParticles_size() const
Definition Truthiness.cc:182
std::vector< edm4eic::TruthinessContribution >::const_iterator associationContributions_end() const
Definition Truthiness.cc:208
friend void swap(Truthiness &a, Truthiness &b)
Definition Truthiness.h:143
std::size_t associationContributions_size() const
Definition Truthiness.cc:214
podio::RelationRange< edm4eic::MCRecoParticleAssociation > getAssociations() const
Definition Truthiness.cc:129
static Truthiness makeEmpty()
Definition Truthiness.cc:95
std::vector< edm4eic::MCRecoParticleAssociation >::const_iterator associations_end() const
Definition Truthiness.cc:112
friend class TruthinessCollection
Definition Truthiness.h:49
std::vector< edm4eic::ReconstructedParticle >::const_iterator unassociatedRecoParticles_end() const
Definition Truthiness.cc:176
friend class TruthinessCollectionIterator
Definition Truthiness.h:51
void unlink()
disconnect from TruthinessObj instance
Definition Truthiness.h:126
std::vector< edm4hep::MCParticle >::const_iterator unassociatedMCParticles_begin() const
Definition Truthiness.cc:138
Truthiness(const Truthiness &other)=default
copy constructor
MutableTruthiness mutable_type
Definition Truthiness.h:55
float getTruthiness() const
Access the Overall truthiness of the entire event.
Definition Truthiness.cc:99
float getUnassociatedRecoParticlesContribution() const
Access the Contribution from unassociated reconstructed particles.
Definition Truthiness.cc:102
std::size_t associations_size() const
Definition Truthiness.cc:118
std::size_t unassociatedMCParticles_size() const
Definition Truthiness.cc:150
friend class MutableTruthiness
Definition Truthiness.h:48
Truthiness & operator=(Truthiness other) &
copy-assignment operator
Definition Truthiness.cc:31
const podio::ObjectID getObjectID() const
Definition Truthiness.cc:241
TruthinessCollection collection_type
Definition Truthiness.h:56
~Truthiness()=default
destructor
std::vector< edm4eic::ReconstructedParticle >::const_iterator unassociatedRecoParticles_begin() const
Definition Truthiness.cc:170
Truthiness()
default constructor
Definition Truthiness.cc:20
MutableTruthiness clone(bool cloneRelations=true) const
Definition Truthiness.cc:36
Truthiness & operator=(Truthiness other) &&=delete
std::vector< edm4eic::TruthinessContribution >::const_iterator associationContributions_begin() const
Definition Truthiness.cc:202
bool operator!=(const Truthiness &other) const
Definition Truthiness.h:131
Definition TruthinessObj.h:23
Definition CalorimeterHit.cc:17
std::ostream & operator<<(std::ostream &o, const CalorimeterHit &value)
Definition CalorimeterHit.cc:103
Definition CalorimeterHit.h:31
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:150
std::size_t operator()(const edm4eic::Truthiness &obj) const
Definition Truthiness.h:169