EDM4eic
EIC data model
Loading...
Searching...
No Matches
MutableMCRecoClusterParticleAssociation.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_MutableMCRecoClusterParticleAssociation_H
4#define EDM4EIC_MutableMCRecoClusterParticleAssociation_H
5
7// Make the immutable class available from its mutable version but not vice versa
9
10#include <edm4eic/Cluster.h>
11#include <edm4hep/MCParticle.h>
12
13#include "podio/utilities/MaybeSharedPtr.h"
14
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 {
24class Cluster;
25class MutableCluster;
26}
27namespace edm4hep {
28class MCParticle;
29class MutableMCParticle;
30}
31
32
33namespace edm4eic {
34
35
36/** @class MutableMCRecoClusterParticleAssociation
37 * Association between a Cluster and a MCParticle
38 * @author: S. Joosten
39 */
41
45
46public:
49
50 /// default constructor
52
53 /// Constructor initializing all members
55
56 /// copy constructor
58
59 /// copy-assignment operator
60 MutableMCRecoClusterParticleAssociation& operator=(MutableMCRecoClusterParticleAssociation other) &; // Rebind this to other's internal object
61 MutableMCRecoClusterParticleAssociation& operator=(MutableMCRecoClusterParticleAssociation other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
62
63 /// create a mutable deep-copy of the object with identical relations
64 /// if cloneRelations=false, the relations are not cloned and will be empty
65 MutableMCRecoClusterParticleAssociation clone(bool cloneRelations=true) const;
66
67 /// destructor
69
70
71public:
72
73 /// Access the weight of this association
74 float getWeight() const;
75
76
77 /// Access the reference to the cluster
78 const edm4eic::Cluster getRec() const;
79 /// Access the reference to the Monte-Carlo particle
80 const edm4hep::MCParticle getSim() const;
81
82 /// Set the weight of this association
83 void setWeight(const float weight);
84 /// Get mutable reference to weight of this association
85 float& getWeight();
86 /// Get reference to weight of this association
87 [[deprecated("use getWeight instead")]]
88 float& weight();
89
90
91 /// Set the reference to the cluster
92 void setRec(const edm4eic::Cluster& value);
93 /// Set the reference to the Monte-Carlo particle
94 void setSim(const edm4hep::MCParticle& value);
95
96
97 [[deprecated("use getSim().getObjectID().index instead")]] int getSimID() const { return getSim().getObjectID().index; }
98 [[deprecated("use getRec().getObjectID().index instead")]] int getRecID() const { return getRec().getObjectID().index; }
99
100
101 [[deprecated("use setSim() instead; this function does nothing")]] void setSimID(int) { }
102 [[deprecated("use setRec() instead; this function does nothing")]] void setRecID(int) { }
103
104
105 /// check whether the object is actually available
106 bool isAvailable() const;
107 /// disconnect from MCRecoClusterParticleAssociationObj instance
108 void unlink() { m_obj = podio::utils::MaybeSharedPtr<MCRecoClusterParticleAssociationObj>{nullptr}; }
109
110 bool operator==(const MutableMCRecoClusterParticleAssociation& other) const { return m_obj == other.m_obj; }
111 bool operator==(const MCRecoClusterParticleAssociation& other) const;
112
113 bool operator!=(const MutableMCRecoClusterParticleAssociation& other) const { return !(*this == other); }
114 bool operator!=(const MCRecoClusterParticleAssociation& 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<MutableMCRecoClusterParticleAssociation>;
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 MCRecoClusterParticleAssociationObj
132 explicit MutableMCRecoClusterParticleAssociation(podio::utils::MaybeSharedPtr<MCRecoClusterParticleAssociationObj> obj);
133
134 podio::utils::MaybeSharedPtr<MCRecoClusterParticleAssociationObj> m_obj{new MCRecoClusterParticleAssociationObj{}, podio::utils::MarkOwned};
135};
136
137#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
138void to_json(nlohmann::json& j, const MutableMCRecoClusterParticleAssociation& value);
139#endif
140
141
142} // namespace edm4eic
143
144
145
146template<>
147struct std::hash<edm4eic::MutableMCRecoClusterParticleAssociation> {
149 return std::hash<edm4eic::MCRecoClusterParticleAssociationObj*>{}(obj.m_obj.get());
150 }
151};
152
153
154#endif
Definition Cluster.h:48
const podio::ObjectID getObjectID() const
Definition Cluster.cc:337
Definition MCRecoClusterParticleAssociationCollection.h:138
Definition MCRecoClusterParticleAssociation.h:48
Definition MCRecoClusterParticleAssociationObj.h:24
Definition MutableCluster.h:40
Definition MutableMCRecoClusterParticleAssociation.h:40
bool operator==(const MutableMCRecoClusterParticleAssociation &other) const
Definition MutableMCRecoClusterParticleAssociation.h:110
const podio::ObjectID getObjectID() const
Definition MutableMCRecoClusterParticleAssociation.cc:78
const edm4hep::MCParticle getSim() const
Access the reference to the Monte-Carlo particle.
Definition MutableMCRecoClusterParticleAssociation.cc:48
int getRecID() const
Definition MutableMCRecoClusterParticleAssociation.h:98
friend class MCRecoClusterParticleAssociation
Definition MutableMCRecoClusterParticleAssociation.h:44
void setRecID(int)
Definition MutableMCRecoClusterParticleAssociation.h:102
bool operator<(const MutableMCRecoClusterParticleAssociation &other) const
Definition MutableMCRecoClusterParticleAssociation.h:117
bool operator!=(const MCRecoClusterParticleAssociation &other) const
Definition MutableMCRecoClusterParticleAssociation.h:114
MCRecoClusterParticleAssociation object_type
Definition MutableMCRecoClusterParticleAssociation.h:47
MutableMCRecoClusterParticleAssociation & operator=(MutableMCRecoClusterParticleAssociation other) &
copy-assignment operator
Definition MutableMCRecoClusterParticleAssociation.cc:24
void setWeight(const float weight)
Set the weight of this association.
Definition MutableMCRecoClusterParticleAssociation.cc:56
void setRec(const edm4eic::Cluster &value)
Set the reference to the cluster.
Definition MutableMCRecoClusterParticleAssociation.cc:60
bool operator!=(const MutableMCRecoClusterParticleAssociation &other) const
Definition MutableMCRecoClusterParticleAssociation.h:113
MCRecoClusterParticleAssociationCollection collection_type
Definition MutableMCRecoClusterParticleAssociation.h:48
~MutableMCRecoClusterParticleAssociation()=default
destructor
void unlink()
disconnect from MCRecoClusterParticleAssociationObj instance
Definition MutableMCRecoClusterParticleAssociation.h:108
float getWeight() const
Access the weight of this association.
Definition MutableMCRecoClusterParticleAssociation.cc:39
MutableMCRecoClusterParticleAssociation clone(bool cloneRelations=true) const
Definition MutableMCRecoClusterParticleAssociation.cc:29
float & weight()
Get reference to weight of this association.
Definition MutableMCRecoClusterParticleAssociation.cc:58
bool isAvailable() const
check whether the object is actually available
Definition MutableMCRecoClusterParticleAssociation.cc:74
MutableMCRecoClusterParticleAssociation(const MutableMCRecoClusterParticleAssociation &other)=default
copy constructor
friend class MCRecoClusterParticleAssociationCollection
Definition MutableMCRecoClusterParticleAssociation.h:42
friend class MCRecoClusterParticleAssociationMutableCollectionIterator
Definition MutableMCRecoClusterParticleAssociation.h:43
MutableMCRecoClusterParticleAssociation & operator=(MutableMCRecoClusterParticleAssociation other) &&=delete
int getSimID() const
Definition MutableMCRecoClusterParticleAssociation.h:97
friend void swap(MutableMCRecoClusterParticleAssociation &a, MutableMCRecoClusterParticleAssociation &b)
Definition MutableMCRecoClusterParticleAssociation.h:125
void setSimID(int)
Definition MutableMCRecoClusterParticleAssociation.h:101
void setSim(const edm4hep::MCParticle &value)
Set the reference to the Monte-Carlo particle.
Definition MutableMCRecoClusterParticleAssociation.cc:64
MutableMCRecoClusterParticleAssociation()=default
default constructor
podio::ObjectID id() const
Definition MutableMCRecoClusterParticleAssociation.h:119
const edm4eic::Cluster getRec() const
Access the reference to the cluster.
Definition MutableMCRecoClusterParticleAssociation.cc:41
Definition CalorimeterHit.cc:17
Definition CalorimeterHit.h:25
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::MutableMCRecoClusterParticleAssociation &obj) const
Definition MutableMCRecoClusterParticleAssociation.h:148