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) noexcept = default;
55
56 /// move constructor
57 MutableJet(MutableJet&& other) noexcept = default;
58
59 /// copy-assignment operator
60 MutableJet& operator=(MutableJet other) &; // Rebind this to other's internal object
61 MutableJet& operator=(MutableJet 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 MutableJet clone(bool cloneRelations=true) const;
66
67 /// destructor
68 ~MutableJet() = default;
69
70
71public:
72
73 /// Access the Jet type as enumerated in fastjet::JetAlgorithm
74 std::uint32_t getType() const;
75
76 /// Access the Jet area
77 float getArea() const;
78
79 /// Access the Jet energy [GeV]
80 float getEnergy() const;
81
82 /// Access the Background energy density [GeV/area]
83 float getBackgroundEnergyDensity() const;
84
85 /// Access the Jet 3-momentum [GeV]
86 const edm4hep::Vector3f& getMomentum() const;
87
88
89
90 /// Set the Jet type as enumerated in fastjet::JetAlgorithm
91 void setType(const std::uint32_t type);
92 /// Get mutable reference to Jet type as enumerated in fastjet::JetAlgorithm
93 std::uint32_t& getType();
94
95 /// Set the Jet area
96 void setArea(const float area);
97 /// Get mutable reference to Jet area
98 float& getArea();
99
100 /// Set the Jet energy [GeV]
101 void setEnergy(const float energy);
102 /// Get mutable reference to Jet energy [GeV]
103 float& getEnergy();
104
105 /// Set the Background energy density [GeV/area]
106 void setBackgroundEnergyDensity(const float backgroundEnergyDensity);
107 /// Get mutable reference to Background energy density [GeV/area]
109
110 /// Set the Jet 3-momentum [GeV]
111 void setMomentum(const edm4hep::Vector3f& momentum);
112 /// Get mutable reference to Jet 3-momentum [GeV]
113 edm4hep::Vector3f& getMomentum();
114
115
116
118 std::size_t constituents_size() const;
120 std::vector<edm4eic::ReconstructedParticle>::const_iterator constituents_begin() const;
121 std::vector<edm4eic::ReconstructedParticle>::const_iterator constituents_end() const;
122 podio::RelationRange<edm4eic::ReconstructedParticle> getConstituents() const;
123
124 /// Compute the background energy in [GeV]
126
127
128
129 /// check whether the object is actually available
130 bool isAvailable() const;
131 /// disconnect from JetObj instance
132 void unlink() { m_obj = podio::utils::MaybeSharedPtr<JetObj>{nullptr}; }
133
134 constexpr bool operator==(const MutableJet& other) const { return m_obj == other.m_obj; }
135 bool operator==(const Jet& other) const;
136
137 constexpr bool operator!=(const MutableJet& other) const { return !(*this == other); }
138 bool operator!=(const Jet& other) const { return !(*this == other); }
139
140 // less comparison operator, so that objects can be e.g. stored in sets.
141 bool operator<(const MutableJet& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
142
143 podio::ObjectID id() const { return getObjectID(); }
144
145 const podio::ObjectID getObjectID() const;
146
147 friend std::hash<MutableJet>;
148
149 friend void swap(MutableJet& a, MutableJet& b) {
150 using std::swap;
151 swap(a.m_obj, b.m_obj); // swap out the internal pointers
152 }
153
154private:
155 /// constructor from existing JetObj
156 explicit MutableJet(podio::utils::MaybeSharedPtr<JetObj> obj);
157
158 podio::utils::MaybeSharedPtr<JetObj> m_obj{new JetObj{}, podio::utils::MarkOwned};
159};
160
161#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
162void to_json(nlohmann::json& j, const MutableJet& value);
163#endif
164
165
166} // namespace edm4eic
167
168
169
170template<>
171struct std::hash<edm4eic::MutableJet> {
172 std::size_t operator()(const edm4eic::MutableJet& obj) const {
173 return std::hash<edm4eic::JetObj*>{}(obj.m_obj.get());
174 }
175};
176
177
178#endif
Definition JetCollection.h:139
Definition Jet.h:45
Definition JetObj.h:20
Definition MutableJet.h:37
void setArea(const float area)
Set the Jet area.
Definition MutableJet.cc:53
podio::RelationRange< edm4eic::ReconstructedParticle > getConstituents() const
Definition MutableJet.cc:91
constexpr bool operator!=(const MutableJet &other) const
Definition MutableJet.h:137
~MutableJet()=default
destructor
std::uint32_t getType() const
Access the Jet type as enumerated in fastjet::JetAlgorithm.
Definition MutableJet.cc:44
bool operator<(const MutableJet &other) const
Definition MutableJet.h:141
const edm4hep::Vector3f & getMomentum() const
Access the Jet 3-momentum [GeV].
Definition MutableJet.cc:48
MutableJet()=default
default constructor
constexpr bool operator==(const MutableJet &other) const
Definition MutableJet.h:134
float getBackgroundEnergy() const
Compute the background energy in [GeV].
Definition MutableJet.h:125
bool operator!=(const Jet &other) const
Definition MutableJet.h:138
void setBackgroundEnergyDensity(const float backgroundEnergyDensity)
Set the Background energy density [GeV/area].
Definition MutableJet.cc:57
std::size_t constituents_size() const
Definition MutableJet.cc:80
MutableJet clone(bool cloneRelations=true) const
Definition MutableJet.cc:31
MutableJet & operator=(MutableJet other) &&=delete
podio::ObjectID id() const
Definition MutableJet.h:143
JetCollection collection_type
Definition MutableJet.h:45
std::vector< edm4eic::ReconstructedParticle >::const_iterator constituents_end() const
Definition MutableJet.cc:74
void setEnergy(const float energy)
Set the Jet energy [GeV].
Definition MutableJet.cc:55
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
Jet object_type
Definition MutableJet.h:44
MutableJet & operator=(MutableJet other) &
copy-assignment operator
Definition MutableJet.cc:26
void addToConstituents(const edm4eic::ReconstructedParticle &)
Definition MutableJet.cc:63
friend class JetMutableCollectionIterator
Definition MutableJet.h:40
friend class Jet
Definition MutableJet.h:41
const podio::ObjectID getObjectID() const
Definition MutableJet.cc:108
void unlink()
disconnect from JetObj instance
Definition MutableJet.h:132
std::vector< edm4eic::ReconstructedParticle >::const_iterator constituents_begin() const
Definition MutableJet.cc:68
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:59
MutableJet(MutableJet &&other) noexcept=default
move constructor
float getArea() const
Access the Jet area.
Definition MutableJet.cc:45
bool isAvailable() const
check whether the object is actually available
Definition MutableJet.cc:104
MutableJet(const MutableJet &other) noexcept=default
copy constructor
friend void swap(MutableJet &a, MutableJet &b)
Definition MutableJet.h:149
Definition ReconstructedParticle.h:54
Definition ArrowMapper.cc:63
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::MutableJet &obj) const
Definition MutableJet.h:172