EDM4eic
EIC data model
Loading...
Searching...
No Matches
MutableJet.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_MutableJet_H
4#define EDM4EIC_MutableJet_H
5
6#include "edm4eic/JetObj.h"
7// Make the immutable class available from its mutable version but not vice versa
8#include "edm4eic/Jet.h"
9
11#include "edm4hep/Vector3f.h"
12#include "podio/RelationRange.h"
13#include <cstdint>
14#include <vector>
15
16#include "podio/utilities/MaybeSharedPtr.h"
17
18#include <cstdint>
19
20#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
21#include "nlohmann/json_fwd.hpp"
22#endif
23
24// forward declarations
25namespace edm4eic {
26class JetCollection;
27}
28
29
30namespace edm4eic {
31
32
33/** @class MutableJet
34 * A reconstructed jet, inspired by the FastJet PseudoJet
35 * @author: D. Anderson
36 */
38
39 friend class JetCollection;
41 friend class Jet;
42
43public:
46
47 /// default constructor
48 MutableJet() = default;
49
50 /// Constructor initializing all members
51 MutableJet(const std::uint32_t type, const float area, const float energy, const float backgroundEnergyDensity, const edm4hep::Vector3f& momentum);
52
53 /// copy constructor
54 MutableJet(const MutableJet& other) = default;
55
56 /// copy-assignment operator
57 MutableJet& operator=(MutableJet other) &; // Rebind this to other's internal object
58 MutableJet& operator=(MutableJet other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
59
60 /// create a mutable deep-copy of the object with identical relations
61 /// if cloneRelations=false, the relations are not cloned and will be empty
62 MutableJet clone(bool cloneRelations=true) const;
63
64 /// destructor
65 ~MutableJet() = default;
66
67
68public:
69
70 /// Access the Jet type as enumerated in fastjet::JetAlgorithm
71 std::uint32_t getType() const;
72
73 /// Access the Jet area
74 float getArea() const;
75
76 /// Access the Jet energy [GeV]
77 float getEnergy() const;
78
79 /// Access the Background energy density [GeV/area]
80 float getBackgroundEnergyDensity() const;
81
82 /// Access the Jet 3-momentum [GeV]
83 const edm4hep::Vector3f& getMomentum() const;
84
85
86
87 /// Set the Jet type as enumerated in fastjet::JetAlgorithm
88 void setType(const std::uint32_t type);
89 /// Get mutable reference to Jet type as enumerated in fastjet::JetAlgorithm
90 std::uint32_t& getType();
91 /// Get reference to Jet type as enumerated in fastjet::JetAlgorithm
92 [[deprecated("use getType instead")]]
93 std::uint32_t& type();
94
95 /// Set the Jet area
96 void setArea(const float area);
97 /// Get mutable reference to Jet area
98 float& getArea();
99 /// Get reference to Jet area
100 [[deprecated("use getArea instead")]]
101 float& area();
102
103 /// Set the Jet energy [GeV]
104 void setEnergy(const float energy);
105 /// Get mutable reference to Jet energy [GeV]
106 float& getEnergy();
107 /// Get reference to Jet energy [GeV]
108 [[deprecated("use getEnergy instead")]]
109 float& energy();
110
111 /// Set the Background energy density [GeV/area]
113 /// Get mutable reference to Background energy density [GeV/area]
115 /// Get reference to Background energy density [GeV/area]
116 [[deprecated("use getBackgroundEnergyDensity instead")]]
118
119 /// Set the Jet 3-momentum [GeV]
120 void setMomentum(const edm4hep::Vector3f& momentum);
121 /// Get mutable reference to Jet 3-momentum [GeV]
122 edm4hep::Vector3f& getMomentum();
123 /// Get reference to Jet 3-momentum [GeV]
124 [[deprecated("use getMomentum instead")]]
125 edm4hep::Vector3f& momentum();
126
127
128
130 std::size_t constituents_size() const;
132 std::vector<edm4eic::ReconstructedParticle>::const_iterator constituents_begin() const;
133 std::vector<edm4eic::ReconstructedParticle>::const_iterator constituents_end() const;
134 podio::RelationRange<edm4eic::ReconstructedParticle> getConstituents() const;
135
136 /// Compute the background energy in [GeV]
138
139
140
141 /// check whether the object is actually available
142 bool isAvailable() const;
143 /// disconnect from JetObj instance
144 void unlink() { m_obj = podio::utils::MaybeSharedPtr<JetObj>{nullptr}; }
145
146 bool operator==(const MutableJet& other) const { return m_obj == other.m_obj; }
147 bool operator==(const Jet& other) const;
148
149 bool operator!=(const MutableJet& other) const { return !(*this == other); }
150 bool operator!=(const Jet& other) const { return !(*this == other); }
151
152 // less comparison operator, so that objects can be e.g. stored in sets.
153 bool operator<(const MutableJet& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
154
155 podio::ObjectID id() const { return getObjectID(); }
156
157 const podio::ObjectID getObjectID() const;
158
159 friend std::hash<MutableJet>;
160
161 friend void swap(MutableJet& a, MutableJet& b) {
162 using std::swap;
163 swap(a.m_obj, b.m_obj); // swap out the internal pointers
164 }
165
166private:
167 /// constructor from existing JetObj
168 explicit MutableJet(podio::utils::MaybeSharedPtr<JetObj> obj);
169
170 podio::utils::MaybeSharedPtr<JetObj> m_obj{new JetObj{}, podio::utils::MarkOwned};
171};
172
173#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
174void to_json(nlohmann::json& j, const MutableJet& value);
175#endif
176
177
178} // namespace edm4eic
179
180
181
182template<>
183struct std::hash<edm4eic::MutableJet> {
184 std::size_t operator()(const edm4eic::MutableJet& obj) const {
185 return std::hash<edm4eic::JetObj*>{}(obj.m_obj.get());
186 }
187};
188
189
190#endif
Definition JetCollection.h:138
Definition Jet.h:45
Definition JetObj.h:20
Definition MutableJet.h:37
void setArea(const float area)
Set the Jet area.
Definition MutableJet.cc:54
podio::RelationRange< edm4eic::ReconstructedParticle > getConstituents() const
Definition MutableJet.cc:96
~MutableJet()=default
destructor
float & energy()
Get reference to Jet energy [GeV].
Definition MutableJet.cc:59
std::uint32_t getType() const
Access the Jet type as enumerated in fastjet::JetAlgorithm.
Definition MutableJet.cc:44
edm4hep::Vector3f & momentum()
Get reference to Jet 3-momentum [GeV].
Definition MutableJet.cc:65
bool operator!=(const MutableJet &other) const
Definition MutableJet.h:149
bool operator<(const MutableJet &other) const
Definition MutableJet.h:153
const edm4hep::Vector3f & getMomentum() const
Access the Jet 3-momentum [GeV].
Definition MutableJet.cc:48
MutableJet()=default
default constructor
float getBackgroundEnergy() const
Compute the background energy in [GeV].
Definition MutableJet.h:137
bool operator!=(const Jet &other) const
Definition MutableJet.h:150
void setBackgroundEnergyDensity(const float backgroundEnergyDensity)
Set the Background energy density [GeV/area].
Definition MutableJet.cc:60
std::size_t constituents_size() const
Definition MutableJet.cc:85
MutableJet clone(bool cloneRelations=true) const
Definition MutableJet.cc:31
std::uint32_t & type()
Get reference to Jet type as enumerated in fastjet::JetAlgorithm.
Definition MutableJet.cc:53
MutableJet & operator=(MutableJet other) &&=delete
podio::ObjectID id() const
Definition MutableJet.h:155
JetCollection collection_type
Definition MutableJet.h:45
float & backgroundEnergyDensity()
Get reference to Background energy density [GeV/area].
Definition MutableJet.cc:62
std::vector< edm4eic::ReconstructedParticle >::const_iterator constituents_end() const
Definition MutableJet.cc:79
void setEnergy(const float energy)
Set the Jet energy [GeV].
Definition MutableJet.cc:57
friend class JetCollection
Definition MutableJet.h:39
float getEnergy() const
Access the Jet energy [GeV].
Definition MutableJet.cc:46
void setType(const std::uint32_t type)
Set the Jet type as enumerated in fastjet::JetAlgorithm.
Definition MutableJet.cc:51
float & area()
Get reference to Jet area.
Definition MutableJet.cc:56
Jet object_type
Definition MutableJet.h:44
MutableJet(const MutableJet &other)=default
copy constructor
MutableJet & operator=(MutableJet other) &
copy-assignment operator
Definition MutableJet.cc:26
bool operator==(const MutableJet &other) const
Definition MutableJet.h:146
void addToConstituents(const edm4eic::ReconstructedParticle &)
Definition MutableJet.cc:68
friend class JetMutableCollectionIterator
Definition MutableJet.h:40
friend class Jet
Definition MutableJet.h:41
const podio::ObjectID getObjectID() const
Definition MutableJet.cc:113
void unlink()
disconnect from JetObj instance
Definition MutableJet.h:144
std::vector< edm4eic::ReconstructedParticle >::const_iterator constituents_begin() const
Definition MutableJet.cc:73
float getBackgroundEnergyDensity() const
Access the Background energy density [GeV/area].
Definition MutableJet.cc:47
void setMomentum(const edm4hep::Vector3f &momentum)
Set the Jet 3-momentum [GeV].
Definition MutableJet.cc:63
float getArea() const
Access the Jet area.
Definition MutableJet.cc:45
bool isAvailable() const
check whether the object is actually available
Definition MutableJet.cc:109
friend void swap(MutableJet &a, MutableJet &b)
Definition MutableJet.h:161
Definition ReconstructedParticle.h:54
Definition CalorimeterHit.cc:17
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::MutableJet &obj) const
Definition MutableJet.h:184