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() = default;
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) noexcept = default;
66
67 /// move constructor
68 Truthiness(Truthiness&& other) noexcept = default;
69
70 /// copy-assignment operator
71 Truthiness& operator=(Truthiness other) &; // Rebind this to other's internal object
72 Truthiness& operator=(Truthiness other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
73
74 /// create a mutable deep-copy of the object with identical relations
75 /// if cloneRelations=false, the relations are not cloned and will be empty
76 MutableTruthiness clone(bool cloneRelations=true) const;
77
78 /// destructor
79 ~Truthiness() = default;
80
81 /// converting constructor from mutable object
82 Truthiness(const MutableTruthiness& other);
83
84 static Truthiness makeEmpty();
85
86public:
87
88 static constexpr std::string_view typeName = "edm4eic::Truthiness";
89
90 /// Access the Overall truthiness of the entire event
91 float getTruthiness() const;
92
93 /// Access the Contribution from all associated particles
95
96 /// Access the Contribution from unassociated MC particles
98
99 /// Access the Contribution from unassociated reconstructed particles
101
102
103
104 std::size_t associations_size() const;
106 std::vector<edm4eic::MCRecoParticleAssociation>::const_iterator associations_begin() const;
107 std::vector<edm4eic::MCRecoParticleAssociation>::const_iterator associations_end() const;
108 podio::RelationRange<edm4eic::MCRecoParticleAssociation> getAssociations() const;
109 std::size_t unassociatedMCParticles_size() const;
110 edm4hep::MCParticle getUnassociatedMCParticles(std::size_t) const;
111 std::vector<edm4hep::MCParticle>::const_iterator unassociatedMCParticles_begin() const;
112 std::vector<edm4hep::MCParticle>::const_iterator unassociatedMCParticles_end() const;
113 podio::RelationRange<edm4hep::MCParticle> getUnassociatedMCParticles() const;
114 std::size_t unassociatedRecoParticles_size() const;
116 std::vector<edm4eic::ReconstructedParticle>::const_iterator unassociatedRecoParticles_begin() const;
117 std::vector<edm4eic::ReconstructedParticle>::const_iterator unassociatedRecoParticles_end() const;
118 podio::RelationRange<edm4eic::ReconstructedParticle> getUnassociatedRecoParticles() const;
119 std::size_t associationContributions_size() const;
121 std::vector<edm4eic::TruthinessContribution>::const_iterator associationContributions_begin() const;
122 std::vector<edm4eic::TruthinessContribution>::const_iterator associationContributions_end() const;
123 podio::RelationRange<edm4eic::TruthinessContribution> getAssociationContributions() const;
124
125
126 /// check whether the object is actually available
127 bool isAvailable() const;
128 /// disconnect from TruthinessObj instance
129 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TruthinessObj>{nullptr}; }
130
131 constexpr bool operator==(const Truthiness& other) const { return m_obj == other.m_obj; }
132 bool operator==(const MutableTruthiness& other) const;
133
134 constexpr bool operator!=(const Truthiness& other) const { return !(*this == other); }
135 bool operator!=(const MutableTruthiness& other) const { return !(*this == other); }
136
137 // less comparison operator, so that objects can be e.g. stored in sets.
138 bool operator<(const Truthiness& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
139
140 podio::ObjectID id() const { return getObjectID(); }
141
142 const podio::ObjectID getObjectID() const;
143
144 friend std::hash<Truthiness>;
145
146 friend void swap(Truthiness& a, Truthiness& b) {
147 using std::swap;
148 swap(a.m_obj, b.m_obj); // swap out the internal pointers
149 }
150
151private:
152 /// constructor from existing TruthinessObj
153 explicit Truthiness(podio::utils::MaybeSharedPtr<TruthinessObj> obj);
155
156 podio::utils::MaybeSharedPtr<TruthinessObj> m_obj{new TruthinessObj{}, podio::utils::MarkOwned};
157};
158
159std::ostream& operator<<(std::ostream& o, const Truthiness& value);
160
161#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
162void to_json(nlohmann::json& j, const Truthiness& value);
163#endif
164
165
166} // namespace edm4eic
167
168
169
170template<>
171struct std::hash<edm4eic::Truthiness> {
172 std::size_t operator()(const edm4eic::Truthiness& obj) const {
173 return std::hash<edm4eic::TruthinessObj*>{}(obj.m_obj.get());
174 }
175};
176
177
178// This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
179// until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
180// and https://github.com/AIDASoft/podio/issues/770
181#if defined(__clang__)
182 #pragma clang diagnostic push
183 #pragma clang diagnostic ignored "-Wunknown-warning-option"
184 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
185 #pragma clang diagnostic ignored "-Wdeprecated"
186constexpr std::string_view edm4eic::Truthiness::typeName;
187 #pragma clang diagnostic pop
188#elif defined(__GNUC__)
189 #pragma GCC diagnostic push
190 #pragma GCC diagnostic ignored "-Wdeprecated"
191constexpr std::string_view edm4eic::Truthiness::typeName;
192 #pragma GCC diagnostic pop
193#endif
194
195
196#endif
Definition MCRecoParticleAssociation.h:48
Definition MutableTruthiness.h:38
Definition ReconstructedParticle.h:54
Definition TruthinessCollectionData.h:34
Definition TruthinessCollection.h:139
Definition TruthinessContribution.h:19
Definition Truthiness.h:46
std::vector< edm4hep::MCParticle >::const_iterator unassociatedMCParticles_end() const
Definition Truthiness.cc:140
podio::RelationRange< edm4hep::MCParticle > getUnassociatedMCParticles() const
Definition Truthiness.cc:157
std::vector< edm4eic::MCRecoParticleAssociation >::const_iterator associations_begin() const
Definition Truthiness.cc:102
bool operator!=(const MutableTruthiness &other) const
Definition Truthiness.h:135
podio::ObjectID id() const
Definition Truthiness.h:140
bool isAvailable() const
check whether the object is actually available
Definition Truthiness.cc:233
float getUnassociatedMCParticlesContribution() const
Access the Contribution from unassociated MC particles.
Definition Truthiness.cc:97
const edm4eic::TruthinessContribution & getAssociationContribution() const
Access the Contribution from all associated particles.
Definition Truthiness.cc:96
podio::RelationRange< edm4eic::TruthinessContribution > getAssociationContributions() const
Definition Truthiness.cc:221
static constexpr std::string_view typeName
Definition Truthiness.h:88
bool operator<(const Truthiness &other) const
Definition Truthiness.h:138
Truthiness(Truthiness &&other) noexcept=default
move constructor
podio::RelationRange< edm4eic::ReconstructedParticle > getUnassociatedRecoParticles() const
Definition Truthiness.cc:189
std::size_t unassociatedRecoParticles_size() const
Definition Truthiness.cc:178
std::vector< edm4eic::TruthinessContribution >::const_iterator associationContributions_end() const
Definition Truthiness.cc:204
friend void swap(Truthiness &a, Truthiness &b)
Definition Truthiness.h:146
std::size_t associationContributions_size() const
Definition Truthiness.cc:210
podio::RelationRange< edm4eic::MCRecoParticleAssociation > getAssociations() const
Definition Truthiness.cc:125
static Truthiness makeEmpty()
Definition Truthiness.cc:91
std::vector< edm4eic::MCRecoParticleAssociation >::const_iterator associations_end() const
Definition Truthiness.cc:108
friend class TruthinessCollection
Definition Truthiness.h:49
std::vector< edm4eic::ReconstructedParticle >::const_iterator unassociatedRecoParticles_end() const
Definition Truthiness.cc:172
friend class TruthinessCollectionIterator
Definition Truthiness.h:51
void unlink()
disconnect from TruthinessObj instance
Definition Truthiness.h:129
std::vector< edm4hep::MCParticle >::const_iterator unassociatedMCParticles_begin() const
Definition Truthiness.cc:134
MutableTruthiness mutable_type
Definition Truthiness.h:55
float getTruthiness() const
Access the Overall truthiness of the entire event.
Definition Truthiness.cc:95
Truthiness(const Truthiness &other) noexcept=default
copy constructor
float getUnassociatedRecoParticlesContribution() const
Access the Contribution from unassociated reconstructed particles.
Definition Truthiness.cc:98
std::size_t associations_size() const
Definition Truthiness.cc:114
std::size_t unassociatedMCParticles_size() const
Definition Truthiness.cc:146
friend class MutableTruthiness
Definition Truthiness.h:48
Truthiness & operator=(Truthiness other) &
copy-assignment operator
Definition Truthiness.cc:27
const podio::ObjectID getObjectID() const
Definition Truthiness.cc:237
constexpr bool operator!=(const Truthiness &other) const
Definition Truthiness.h:134
TruthinessCollection collection_type
Definition Truthiness.h:56
~Truthiness()=default
destructor
std::vector< edm4eic::ReconstructedParticle >::const_iterator unassociatedRecoParticles_begin() const
Definition Truthiness.cc:166
MutableTruthiness clone(bool cloneRelations=true) const
Definition Truthiness.cc:32
Truthiness & operator=(Truthiness other) &&=delete
std::vector< edm4eic::TruthinessContribution >::const_iterator associationContributions_begin() const
Definition Truthiness.cc:198
constexpr bool operator==(const Truthiness &other) const
Definition Truthiness.h:131
Truthiness()=default
default constructor
Definition TruthinessObj.h:23
Definition ArrowMapper.cc:63
std::ostream & operator<<(std::ostream &o, const CalorimeterHit &value)
Definition CalorimeterHit.cc:99
Definition CalorimeterHit.h:31
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::Truthiness &obj) const
Definition Truthiness.h:172