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