EDM4eic
EIC data model
Loading...
Searching...
No Matches
MCRecoParticleAssociation.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_MCRecoParticleAssociation_H
4#define EDM4EIC_MCRecoParticleAssociation_H
5
7
8#include <cstdint>
9
10#include "podio/utilities/MaybeSharedPtr.h"
11#include "podio/detail/OrderKey.h"
12
13#include <ostream>
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 podio::detail {
33// Internal function used in less comparison operators of the datatypes and interface types
34OrderKey getOrderKey(const edm4eic::MCRecoParticleAssociation& obj);
35};
36
37namespace edm4eic {
38
42
43/** @class MCRecoParticleAssociation
44 * Used to keep track of the correspondence between MC and reconstructed particles
45 * @author: S. Joosten
46 */
48
53 friend podio::detail::OrderKey podio::detail::getOrderKey(const MCRecoParticleAssociation & obj);
54
55public:
58
59 /// default constructor
61
62 /// Constructor initializing all members
63 MCRecoParticleAssociation(const std::uint32_t simID, const std::uint32_t recID, const float weight);
64
65 /// copy constructor
67
68 /// copy-assignment operator
69 MCRecoParticleAssociation& operator=(MCRecoParticleAssociation other) &; // Rebind this to other's internal object
70 MCRecoParticleAssociation& operator=(MCRecoParticleAssociation other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
71
72 /// create a mutable deep-copy of the object with identical relations
73 /// if cloneRelations=false, the relations are not cloned and will be empty
74 MutableMCRecoParticleAssociation clone(bool cloneRelations=true) const;
75
76 /// destructor
78
79 /// converting constructor from mutable object
81
83
84public:
85
86 static constexpr std::string_view typeName = "edm4eic::MCRecoParticleAssociation";
87
88 /// Access the Index of corresponding MCParticle (position in MCParticles array)
89 std::uint32_t getSimID() const;
90
91 /// Access the Index of corresponding ReconstructedParticle (position in ReconstructedParticles array)
92 std::uint32_t getRecID() const;
93
94 /// Access the weight of this association
95 float getWeight() const;
96
97
98 /// Access the reference to the reconstructed particle
100 /// Access the reference to the Monte-Carlo particle
101 const edm4hep::MCParticle getSim() const;
102
103
104
105 /// check whether the object is actually available
106 bool isAvailable() const;
107 /// disconnect from MCRecoParticleAssociationObj instance
108 void unlink() { m_obj = podio::utils::MaybeSharedPtr<MCRecoParticleAssociationObj>{nullptr}; }
109
110 bool operator==(const MCRecoParticleAssociation& other) const { return m_obj == other.m_obj; }
111 bool operator==(const MutableMCRecoParticleAssociation& other) const;
112
113 bool operator!=(const MCRecoParticleAssociation& other) const { return !(*this == other); }
114 bool operator!=(const MutableMCRecoParticleAssociation& other) const { return !(*this == other); }
115
116 // less comparison operator, so that objects can be e.g. stored in sets.
118
119 podio::ObjectID id() const { return getObjectID(); }
120
121 const podio::ObjectID getObjectID() const;
122
123 friend std::hash<MCRecoParticleAssociation>;
124
126 using std::swap;
127 swap(a.m_obj, b.m_obj); // swap out the internal pointers
128 }
129
130private:
131 /// constructor from existing MCRecoParticleAssociationObj
132 explicit MCRecoParticleAssociation(podio::utils::MaybeSharedPtr<MCRecoParticleAssociationObj> obj);
134
135 podio::utils::MaybeSharedPtr<MCRecoParticleAssociationObj> m_obj{nullptr};
136};
137
138std::ostream& operator<<(std::ostream& o, const MCRecoParticleAssociation& value);
139
140#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
141void to_json(nlohmann::json& j, const MCRecoParticleAssociation& value);
142#endif
143
144
145} // namespace edm4eic
146
147
148
149template<>
150struct std::hash<edm4eic::MCRecoParticleAssociation> {
151 std::size_t operator()(const edm4eic::MCRecoParticleAssociation& obj) const {
152 return std::hash<edm4eic::MCRecoParticleAssociationObj*>{}(obj.m_obj.get());
153 }
154};
155
156
157// This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
158// until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
159// and https://github.com/AIDASoft/podio/issues/770
160#if defined(__clang__)
161#pragma clang diagnostic push
162#pragma clang diagnostic ignored "-Wunknown-warning-option"
163#pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
164#pragma clang diagnostic ignored "-Wdeprecated"
165constexpr std::string_view edm4eic::MCRecoParticleAssociation::typeName;
166#pragma clang diagnostic pop
167#elif defined(__GNUC__)
168#pragma GCC diagnostic push
169#pragma GCC diagnostic ignored "-Wdeprecated"
170constexpr std::string_view edm4eic::MCRecoParticleAssociation::typeName;
171#pragma GCC diagnostic pop
172#endif
173
174#endif
Definition MCRecoParticleAssociationCollectionData.h:32
Definition MCRecoParticleAssociationCollection.h:137
Definition MCRecoParticleAssociation.h:47
friend class MutableMCRecoParticleAssociation
Definition MCRecoParticleAssociation.h:49
friend void swap(MCRecoParticleAssociation &a, MCRecoParticleAssociation &b)
Definition MCRecoParticleAssociation.h:125
bool operator<(const MCRecoParticleAssociation &other) const
Definition MCRecoParticleAssociation.h:117
const podio::ObjectID getObjectID() const
Definition MCRecoParticleAssociation.cc:89
const edm4eic::ReconstructedParticle getRec() const
Access the reference to the reconstructed particle.
Definition MCRecoParticleAssociation.cc:66
bool operator!=(const MutableMCRecoParticleAssociation &other) const
Definition MCRecoParticleAssociation.h:114
const edm4hep::MCParticle getSim() const
Access the reference to the Monte-Carlo particle.
Definition MCRecoParticleAssociation.cc:73
MCRecoParticleAssociation & operator=(MCRecoParticleAssociation other) &&=delete
bool operator==(const MCRecoParticleAssociation &other) const
Definition MCRecoParticleAssociation.h:110
MCRecoParticleAssociation & operator=(MCRecoParticleAssociation other) &
copy-assignment operator
Definition MCRecoParticleAssociation.cc:32
MutableMCRecoParticleAssociation mutable_type
Definition MCRecoParticleAssociation.h:56
MutableMCRecoParticleAssociation clone(bool cloneRelations=true) const
Definition MCRecoParticleAssociation.cc:37
std::uint32_t getSimID() const
Access the Index of corresponding MCParticle (position in MCParticles array)
Definition MCRecoParticleAssociation.cc:62
void unlink()
disconnect from MCRecoParticleAssociationObj instance
Definition MCRecoParticleAssociation.h:108
~MCRecoParticleAssociation()=default
destructor
static constexpr std::string_view typeName
Definition MCRecoParticleAssociation.h:86
bool isAvailable() const
check whether the object is actually available
Definition MCRecoParticleAssociation.cc:85
MCRecoParticleAssociation(const MCRecoParticleAssociation &other)=default
copy constructor
float getWeight() const
Access the weight of this association.
Definition MCRecoParticleAssociation.cc:64
friend class MCRecoParticleAssociationCollectionIterator
Definition MCRecoParticleAssociation.h:52
std::uint32_t getRecID() const
Access the Index of corresponding ReconstructedParticle (position in ReconstructedParticles array)
Definition MCRecoParticleAssociation.cc:63
static MCRecoParticleAssociation makeEmpty()
Definition MCRecoParticleAssociation.cc:58
MCRecoParticleAssociationCollection collection_type
Definition MCRecoParticleAssociation.h:57
MCRecoParticleAssociation()
default constructor
Definition MCRecoParticleAssociation.cc:22
friend class MCRecoParticleAssociationCollection
Definition MCRecoParticleAssociation.h:50
bool operator!=(const MCRecoParticleAssociation &other) const
Definition MCRecoParticleAssociation.h:113
podio::ObjectID id() const
Definition MCRecoParticleAssociation.h:119
Definition MCRecoParticleAssociationObj.h:24
Definition MutableMCRecoParticleAssociation.h:39
Definition MutableReconstructedParticle.h:46
Definition ReconstructedParticle.h:54
Definition CalorimeterHit.cc:17
std::ostream & operator<<(std::ostream &o, const CalorimeterHit &value)
Definition CalorimeterHit.cc:103
Definition CalorimeterHit.h:25
Definition CalorimeterHit.h:31
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:150
std::size_t operator()(const edm4eic::MCRecoParticleAssociation &obj) const
Definition MCRecoParticleAssociation.h:151