EDM4eic
EIC data model
Loading...
Searching...
No Matches
Jet.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_Jet_H
4#define EDM4EIC_Jet_H
5
6#include "edm4eic/JetObj.h"
7
9#include "edm4hep/Vector3f.h"
10#include "podio/RelationRange.h"
11#include <cstdint>
12#include <vector>
13
14#include "podio/utilities/MaybeSharedPtr.h"
15#include "podio/detail/OrderKey.h"
16
17#include <ostream>
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 podio::detail {
31// Internal function used in less comparison operators of the datatypes and interface types
32OrderKey getOrderKey(const edm4eic::Jet& obj);
33};
34
35namespace edm4eic {
36
37class MutableJet;
38class JetCollection;
40
41/** @class Jet
42 * A reconstructed jet, inspired by the FastJet PseudoJet
43 * @author: D. Anderson
44 */
45class Jet {
46
47 friend class MutableJet;
48 friend class JetCollection;
51 friend podio::detail::OrderKey podio::detail::getOrderKey(const Jet & obj);
52
53public:
56
57 /// default constructor
58 Jet() = default;
59
60 /// Constructor initializing all members
61 Jet(const std::uint32_t type, const float area, const float energy, const float backgroundEnergyDensity, const edm4hep::Vector3f& momentum);
62
63 /// copy constructor
64 Jet(const Jet& other) = default;
65
66 /// copy-assignment operator
67 Jet& operator=(Jet other) &; // Rebind this to other's internal object
68 Jet& operator=(Jet other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
69
70 /// create a mutable deep-copy of the object with identical relations
71 /// if cloneRelations=false, the relations are not cloned and will be empty
72 MutableJet clone(bool cloneRelations=true) const;
73
74 /// destructor
75 ~Jet() = default;
76
77 /// converting constructor from mutable object
78 Jet(const MutableJet& other);
79
80 static Jet makeEmpty();
81
82public:
83
84 static constexpr std::string_view typeName = "edm4eic::Jet";
85
86 /// Access the Jet type as enumerated in fastjet::JetAlgorithm
87 std::uint32_t getType() const;
88
89 /// Access the Jet area
90 float getArea() const;
91
92 /// Access the Jet energy [GeV]
93 float getEnergy() const;
94
95 /// Access the Background energy density [GeV/area]
96 float getBackgroundEnergyDensity() const;
97
98 /// Access the Jet 3-momentum [GeV]
99 const edm4hep::Vector3f& getMomentum() const;
100
101
102
103 std::size_t constituents_size() const;
105 std::vector<edm4eic::ReconstructedParticle>::const_iterator constituents_begin() const;
106 std::vector<edm4eic::ReconstructedParticle>::const_iterator constituents_end() const;
107 podio::RelationRange<edm4eic::ReconstructedParticle> getConstituents() const;
108
109 /// Compute the background energy in [GeV]
111
112
113 /// check whether the object is actually available
114 bool isAvailable() const;
115 /// disconnect from JetObj instance
116 void unlink() { m_obj = podio::utils::MaybeSharedPtr<JetObj>{nullptr}; }
117
118 bool operator==(const Jet& other) const { return m_obj == other.m_obj; }
119 bool operator==(const MutableJet& other) const;
120
121 bool operator!=(const Jet& other) const { return !(*this == other); }
122 bool operator!=(const MutableJet& other) const { return !(*this == other); }
123
124 // less comparison operator, so that objects can be e.g. stored in sets.
125 bool operator<(const Jet& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
126
127 podio::ObjectID id() const { return getObjectID(); }
128
129 const podio::ObjectID getObjectID() const;
130
131 friend std::hash<Jet>;
132
133 friend void swap(Jet& a, Jet& b) {
134 using std::swap;
135 swap(a.m_obj, b.m_obj); // swap out the internal pointers
136 }
137
138private:
139 /// constructor from existing JetObj
140 explicit Jet(podio::utils::MaybeSharedPtr<JetObj> obj);
141 Jet(JetObj* obj);
142
143 podio::utils::MaybeSharedPtr<JetObj> m_obj{new JetObj{}, podio::utils::MarkOwned};
144};
145
146std::ostream& operator<<(std::ostream& o, const Jet& value);
147
148#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
149void to_json(nlohmann::json& j, const Jet& value);
150#endif
151
152
153} // namespace edm4eic
154
155
156
157template<>
158struct std::hash<edm4eic::Jet> {
159 std::size_t operator()(const edm4eic::Jet& obj) const {
160 return std::hash<edm4eic::JetObj*>{}(obj.m_obj.get());
161 }
162};
163
164
165// This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
166// until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
167// and https://github.com/AIDASoft/podio/issues/770
168#if defined(__clang__)
169 #pragma clang diagnostic push
170 #pragma clang diagnostic ignored "-Wunknown-warning-option"
171 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
172 #pragma clang diagnostic ignored "-Wdeprecated"
173constexpr std::string_view edm4eic::Jet::typeName;
174 #pragma clang diagnostic pop
175#elif defined(__GNUC__)
176 #pragma GCC diagnostic push
177 #pragma GCC diagnostic ignored "-Wdeprecated"
178constexpr std::string_view edm4eic::Jet::typeName;
179 #pragma GCC diagnostic pop
180#endif
181
182
183#endif
Definition JetCollectionData.h:32
Definition JetCollection.h:138
Definition Jet.h:45
bool operator!=(const MutableJet &other) const
Definition Jet.h:122
static Jet makeEmpty()
Definition Jet.cc:59
const podio::ObjectID getObjectID() const
Definition Jet.cc:110
JetCollection collection_type
Definition Jet.h:55
~Jet()=default
destructor
podio::ObjectID id() const
Definition Jet.h:127
std::vector< edm4eic::ReconstructedParticle >::const_iterator constituents_end() const
Definition Jet.cc:77
std::size_t constituents_size() const
Definition Jet.cc:83
Jet(const Jet &other)=default
copy constructor
MutableJet clone(bool cloneRelations=true) const
Definition Jet.cc:33
std::vector< edm4eic::ReconstructedParticle >::const_iterator constituents_begin() const
Definition Jet.cc:71
friend class JetCollectionIterator
Definition Jet.h:50
friend class MutableJet
Definition Jet.h:47
static constexpr std::string_view typeName
Definition Jet.h:84
Jet & operator=(Jet other) &&=delete
float getBackgroundEnergy() const
Compute the background energy in [GeV].
Definition Jet.h:110
void unlink()
disconnect from JetObj instance
Definition Jet.h:116
float getBackgroundEnergyDensity() const
Access the Background energy density [GeV/area].
Definition Jet.cc:66
friend class JetCollection
Definition Jet.h:48
float getEnergy() const
Access the Jet energy [GeV].
Definition Jet.cc:65
std::uint32_t getType() const
Access the Jet type as enumerated in fastjet::JetAlgorithm.
Definition Jet.cc:63
float getArea() const
Access the Jet area.
Definition Jet.cc:64
podio::RelationRange< edm4eic::ReconstructedParticle > getConstituents() const
Definition Jet.cc:94
MutableJet mutable_type
Definition Jet.h:54
Jet & operator=(Jet other) &
copy-assignment operator
Definition Jet.cc:28
friend void swap(Jet &a, Jet &b)
Definition Jet.h:133
bool operator!=(const Jet &other) const
Definition Jet.h:121
bool operator<(const Jet &other) const
Definition Jet.h:125
bool isAvailable() const
check whether the object is actually available
Definition Jet.cc:106
const edm4hep::Vector3f & getMomentum() const
Access the Jet 3-momentum [GeV].
Definition Jet.cc:67
bool operator==(const Jet &other) const
Definition Jet.h:118
Jet()=default
default constructor
Definition JetObj.h:20
Definition MutableJet.h:37
Definition ReconstructedParticle.h:54
Definition CalorimeterHit.cc:17
std::ostream & operator<<(std::ostream &o, const CalorimeterHit &value)
Definition CalorimeterHit.cc:99
Definition CalorimeterHit.h:31
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::Jet &obj) const
Definition Jet.h:159