EDM4eic
EIC data model
Loading...
Searching...
No Matches
IrtParticle.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_IrtParticle_H
4#define EDM4EIC_IrtParticle_H
5
7
9#include "podio/RelationRange.h"
10#include <cstdint>
11#include <vector>
12
13#include "podio/utilities/MaybeSharedPtr.h"
14#include "podio/detail/OrderKey.h"
15
16#include <ostream>
17#include <cstdint>
18
19#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
20#include "nlohmann/json_fwd.hpp"
21#endif
22
23// forward declarations
24namespace edm4eic {
26class Track;
27class MutableTrack;
28}
29
30
31namespace podio::detail {
32// Internal function used in less comparison operators of the datatypes and interface types
33OrderKey getOrderKey(const edm4eic::IrtParticle& obj);
34};
35
36namespace edm4eic {
37
41
42/** @class IrtParticle
43 * IRT 2.1 output (track level)
44 * @author: A. Kiselev
45 */
47
48 friend class MutableIrtParticle;
52 friend podio::detail::OrderKey podio::detail::getOrderKey(const IrtParticle & obj);
53
54public:
57
58 /// default constructor
59 IrtParticle() = default;
60
61 /// Constructor initializing all members
62 IrtParticle(const std::int32_t PDG, const std::uint16_t npe, const std::uint16_t nhits);
63
64 /// copy constructor
65 IrtParticle(const IrtParticle& other) = default;
66
67 /// copy-assignment operator
68 IrtParticle& operator=(IrtParticle other) &; // Rebind this to other's internal object
69 IrtParticle& operator=(IrtParticle other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
70
71 /// create a mutable deep-copy of the object with identical relations
72 /// if cloneRelations=false, the relations are not cloned and will be empty
73 MutableIrtParticle clone(bool cloneRelations=true) const;
74
75 /// destructor
76 ~IrtParticle() = default;
77
78 /// converting constructor from mutable object
79 IrtParticle(const MutableIrtParticle& other);
80
81 static IrtParticle makeEmpty();
82
83public:
84
85 static constexpr std::string_view typeName = "edm4eic::IrtParticle";
86
87 /// Access the Reconstructed most probable PDG code
88 std::int32_t getPDG() const;
89
90 /// Access the Detected photoelectron count
91 std::uint16_t getNpe() const;
92
93 /// Access the Hit count associated with this particle by IRT engine
94 std::uint16_t getNhits() const;
95
96
97 /// Access the charged particle track
98 const edm4eic::Track getTrack() const;
99
100 std::size_t radiators_size() const;
101 edm4eic::IrtRadiatorInfo getRadiators(std::size_t) const;
102 std::vector<edm4eic::IrtRadiatorInfo>::const_iterator radiators_begin() const;
103 std::vector<edm4eic::IrtRadiatorInfo>::const_iterator radiators_end() const;
104 podio::RelationRange<edm4eic::IrtRadiatorInfo> getRadiators() const;
105
106
107 /// check whether the object is actually available
108 bool isAvailable() const;
109 /// disconnect from IrtParticleObj instance
110 void unlink() { m_obj = podio::utils::MaybeSharedPtr<IrtParticleObj>{nullptr}; }
111
112 bool operator==(const IrtParticle& other) const { return m_obj == other.m_obj; }
113 bool operator==(const MutableIrtParticle& other) const;
114
115 bool operator!=(const IrtParticle& other) const { return !(*this == other); }
116 bool operator!=(const MutableIrtParticle& other) const { return !(*this == other); }
117
118 // less comparison operator, so that objects can be e.g. stored in sets.
119 bool operator<(const IrtParticle& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
120
121 podio::ObjectID id() const { return getObjectID(); }
122
123 const podio::ObjectID getObjectID() const;
124
125 friend std::hash<IrtParticle>;
126
127 friend void swap(IrtParticle& a, IrtParticle& b) {
128 using std::swap;
129 swap(a.m_obj, b.m_obj); // swap out the internal pointers
130 }
131
132private:
133 /// constructor from existing IrtParticleObj
134 explicit IrtParticle(podio::utils::MaybeSharedPtr<IrtParticleObj> obj);
136
137 podio::utils::MaybeSharedPtr<IrtParticleObj> m_obj{new IrtParticleObj{}, podio::utils::MarkOwned};
138};
139
140std::ostream& operator<<(std::ostream& o, const IrtParticle& value);
141
142#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
143void to_json(nlohmann::json& j, const IrtParticle& value);
144#endif
145
146
147} // namespace edm4eic
148
149
150
151template<>
152struct std::hash<edm4eic::IrtParticle> {
153 std::size_t operator()(const edm4eic::IrtParticle& obj) const {
154 return std::hash<edm4eic::IrtParticleObj*>{}(obj.m_obj.get());
155 }
156};
157
158
159// This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
160// until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
161// and https://github.com/AIDASoft/podio/issues/770
162#if defined(__clang__)
163 #pragma clang diagnostic push
164 #pragma clang diagnostic ignored "-Wunknown-warning-option"
165 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
166 #pragma clang diagnostic ignored "-Wdeprecated"
167constexpr std::string_view edm4eic::IrtParticle::typeName;
168 #pragma clang diagnostic pop
169#elif defined(__GNUC__)
170 #pragma GCC diagnostic push
171 #pragma GCC diagnostic ignored "-Wdeprecated"
172constexpr std::string_view edm4eic::IrtParticle::typeName;
173 #pragma GCC diagnostic pop
174#endif
175
176
177#endif
Definition IrtParticleCollectionData.h:33
Definition IrtParticleCollection.h:138
Definition IrtParticle.h:46
MutableIrtParticle clone(bool cloneRelations=true) const
Definition IrtParticle.cc:32
const podio::ObjectID getObjectID() const
Definition IrtParticle.cc:117
friend void swap(IrtParticle &a, IrtParticle &b)
Definition IrtParticle.h:127
bool operator<(const IrtParticle &other) const
Definition IrtParticle.h:119
static IrtParticle makeEmpty()
Definition IrtParticle.cc:61
podio::RelationRange< edm4eic::IrtRadiatorInfo > getRadiators() const
Definition IrtParticle.cc:101
friend class IrtParticleCollectionIterator
Definition IrtParticle.h:51
bool operator!=(const MutableIrtParticle &other) const
Definition IrtParticle.h:116
friend class MutableIrtParticle
Definition IrtParticle.h:48
bool operator==(const IrtParticle &other) const
Definition IrtParticle.h:112
std::size_t radiators_size() const
Definition IrtParticle.cc:90
std::int32_t getPDG() const
Access the Reconstructed most probable PDG code.
Definition IrtParticle.cc:65
std::uint16_t getNhits() const
Access the Hit count associated with this particle by IRT engine.
Definition IrtParticle.cc:67
std::uint16_t getNpe() const
Access the Detected photoelectron count.
Definition IrtParticle.cc:66
bool isAvailable() const
check whether the object is actually available
Definition IrtParticle.cc:113
IrtParticle()=default
default constructor
IrtParticle & operator=(IrtParticle other) &
copy-assignment operator
Definition IrtParticle.cc:27
friend class IrtParticleCollection
Definition IrtParticle.h:49
const edm4eic::Track getTrack() const
Access the charged particle track.
Definition IrtParticle.cc:69
void unlink()
disconnect from IrtParticleObj instance
Definition IrtParticle.h:110
IrtParticle & operator=(IrtParticle other) &&=delete
IrtParticle(const IrtParticle &other)=default
copy constructor
MutableIrtParticle mutable_type
Definition IrtParticle.h:55
bool operator!=(const IrtParticle &other) const
Definition IrtParticle.h:115
IrtParticleCollection collection_type
Definition IrtParticle.h:56
std::vector< edm4eic::IrtRadiatorInfo >::const_iterator radiators_end() const
Definition IrtParticle.cc:84
~IrtParticle()=default
destructor
static constexpr std::string_view typeName
Definition IrtParticle.h:85
std::vector< edm4eic::IrtRadiatorInfo >::const_iterator radiators_begin() const
Definition IrtParticle.cc:78
podio::ObjectID id() const
Definition IrtParticle.h:121
Definition IrtParticleObj.h:24
Definition IrtRadiatorInfo.h:41
Definition MutableIrtParticle.h:38
Definition MutableTrack.h:40
Definition Track.h:48
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::IrtParticle &obj) const
Definition IrtParticle.h:153