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
92 /// Set the Jet area
93 void setArea(const float area);
94 /// Get mutable reference to Jet area
95 float& getArea();
96
97 /// Set the Jet energy [GeV]
98 void setEnergy(const float energy);
99 /// Get mutable reference to Jet energy [GeV]
100 float& getEnergy();
101
102 /// Set the Background energy density [GeV/area]
103 void setBackgroundEnergyDensity(const float backgroundEnergyDensity);
104 /// Get mutable reference to Background energy density [GeV/area]
106
107 /// Set the Jet 3-momentum [GeV]
108 void setMomentum(const edm4hep::Vector3f& momentum);
109 /// Get mutable reference to Jet 3-momentum [GeV]
110 edm4hep::Vector3f& getMomentum();
111
112
113
115 std::size_t constituents_size() const;
117 std::vector<edm4eic::ReconstructedParticle>::const_iterator constituents_begin() const;
118 std::vector<edm4eic::ReconstructedParticle>::const_iterator constituents_end() const;
119 podio::RelationRange<edm4eic::ReconstructedParticle> getConstituents() const;
120
121 /// Compute the background energy in [GeV]
123
124
125
126 /// check whether the object is actually available
127 bool isAvailable() const;
128 /// disconnect from JetObj instance
129 void unlink() { m_obj = podio::utils::MaybeSharedPtr<JetObj>{nullptr}; }
130
131 constexpr bool operator==(const MutableJet& other) const { return m_obj == other.m_obj; }
132 bool operator==(const Jet& other) const;
133
134 constexpr bool operator!=(const MutableJet& other) const { return !(*this == other); }
135 bool operator!=(const Jet& other) const { return !(*this == other); }
136
137 // less comparison operator, so that objects can be e.g. stored in sets.
138 bool operator<(const MutableJet& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
139
140 podio::ObjectID id() const { return getObjectID(); }
141
142 const podio::ObjectID getObjectID() const;
143
144 friend std::hash<MutableJet>;
145
146 friend void swap(MutableJet& a, MutableJet& b) {
147 using std::swap;
148 swap(a.m_obj, b.m_obj); // swap out the internal pointers
149 }
150
151private:
152 /// constructor from existing JetObj
153 explicit MutableJet(podio::utils::MaybeSharedPtr<JetObj> obj);
154
155 podio::utils::MaybeSharedPtr<JetObj> m_obj{new JetObj{}, podio::utils::MarkOwned};
156};
157
158#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
159void to_json(nlohmann::json& j, const MutableJet& value);
160#endif
161
162
163} // namespace edm4eic
164
165
166
167template<>
168struct std::hash<edm4eic::MutableJet> {
169 std::size_t operator()(const edm4eic::MutableJet& obj) const {
170 return std::hash<edm4eic::JetObj*>{}(obj.m_obj.get());
171 }
172};
173
174
175#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:134
~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:138
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:131
float getBackgroundEnergy() const
Compute the background energy in [GeV].
Definition MutableJet.h:122
bool operator!=(const Jet &other) const
Definition MutableJet.h:135
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:140
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(const MutableJet &other)=default
copy constructor
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:129
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
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
friend void swap(MutableJet &a, MutableJet &b)
Definition MutableJet.h:146
Definition ReconstructedParticle.h:54
Definition ArrowMapper.cc:61
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::MutableJet &obj) const
Definition MutableJet.h:169