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) noexcept = default;
66
67 /// move constructor
68 IrtParticle(IrtParticle&& other) noexcept = default;
69
70 /// copy-assignment operator
71 IrtParticle& operator=(IrtParticle other) &; // Rebind this to other's internal object
72 IrtParticle& operator=(IrtParticle other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
73
74 /// create a mutable deep-copy of the object with identical relations
75 /// if cloneRelations=false, the relations are not cloned and will be empty
76 MutableIrtParticle clone(bool cloneRelations=true) const;
77
78 /// destructor
79 ~IrtParticle() = default;
80
81 /// converting constructor from mutable object
82 IrtParticle(const MutableIrtParticle& other);
83
84 static IrtParticle makeEmpty();
85
86public:
87
88 static constexpr std::string_view typeName = "edm4eic::IrtParticle";
89
90 /// Access the Reconstructed most probable PDG code
91 std::int32_t getPDG() const;
92
93 /// Access the Detected photoelectron count
94 std::uint16_t getNpe() const;
95
96 /// Access the Hit count associated with this particle by IRT engine
97 std::uint16_t getNhits() const;
98
99
100 /// Access the charged particle track
101 const edm4eic::Track getTrack() const;
102
103 std::size_t radiators_size() const;
104 edm4eic::IrtRadiatorInfo getRadiators(std::size_t) const;
105 std::vector<edm4eic::IrtRadiatorInfo>::const_iterator radiators_begin() const;
106 std::vector<edm4eic::IrtRadiatorInfo>::const_iterator radiators_end() const;
107 podio::RelationRange<edm4eic::IrtRadiatorInfo> getRadiators() const;
108
109
110 /// check whether the object is actually available
111 bool isAvailable() const;
112 /// disconnect from IrtParticleObj instance
113 void unlink() { m_obj = podio::utils::MaybeSharedPtr<IrtParticleObj>{nullptr}; }
114
115 constexpr bool operator==(const IrtParticle& other) const { return m_obj == other.m_obj; }
116 bool operator==(const MutableIrtParticle& other) const;
117
118 constexpr bool operator!=(const IrtParticle& other) const { return !(*this == other); }
119 bool operator!=(const MutableIrtParticle& other) const { return !(*this == other); }
120
121 // less comparison operator, so that objects can be e.g. stored in sets.
122 bool operator<(const IrtParticle& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
123
124 podio::ObjectID id() const { return getObjectID(); }
125
126 const podio::ObjectID getObjectID() const;
127
128 friend std::hash<IrtParticle>;
129
130 friend void swap(IrtParticle& a, IrtParticle& b) {
131 using std::swap;
132 swap(a.m_obj, b.m_obj); // swap out the internal pointers
133 }
134
135private:
136 /// constructor from existing IrtParticleObj
137 explicit IrtParticle(podio::utils::MaybeSharedPtr<IrtParticleObj> obj);
139
140 podio::utils::MaybeSharedPtr<IrtParticleObj> m_obj{new IrtParticleObj{}, podio::utils::MarkOwned};
141};
142
143std::ostream& operator<<(std::ostream& o, const IrtParticle& value);
144
145#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
146void to_json(nlohmann::json& j, const IrtParticle& value);
147#endif
148
149
150} // namespace edm4eic
151
152
153
154template<>
155struct std::hash<edm4eic::IrtParticle> {
156 std::size_t operator()(const edm4eic::IrtParticle& obj) const {
157 return std::hash<edm4eic::IrtParticleObj*>{}(obj.m_obj.get());
158 }
159};
160
161
162// This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
163// until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
164// and https://github.com/AIDASoft/podio/issues/770
165#if defined(__clang__)
166 #pragma clang diagnostic push
167 #pragma clang diagnostic ignored "-Wunknown-warning-option"
168 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
169 #pragma clang diagnostic ignored "-Wdeprecated"
170constexpr std::string_view edm4eic::IrtParticle::typeName;
171 #pragma clang diagnostic pop
172#elif defined(__GNUC__)
173 #pragma GCC diagnostic push
174 #pragma GCC diagnostic ignored "-Wdeprecated"
175constexpr std::string_view edm4eic::IrtParticle::typeName;
176 #pragma GCC diagnostic pop
177#endif
178
179
180#endif
Definition IrtParticleCollectionData.h:33
Definition IrtParticleCollection.h:139
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:130
bool operator<(const IrtParticle &other) const
Definition IrtParticle.h:122
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:119
friend class MutableIrtParticle
Definition IrtParticle.h:48
IrtParticle(IrtParticle &&other) noexcept=default
move constructor
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
IrtParticle(const IrtParticle &other) noexcept=default
copy constructor
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:113
IrtParticle & operator=(IrtParticle other) &&=delete
constexpr bool operator==(const IrtParticle &other) const
Definition IrtParticle.h:115
MutableIrtParticle mutable_type
Definition IrtParticle.h:55
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:88
constexpr bool operator!=(const IrtParticle &other) const
Definition IrtParticle.h:118
std::vector< edm4eic::IrtRadiatorInfo >::const_iterator radiators_begin() const
Definition IrtParticle.cc:78
podio::ObjectID id() const
Definition IrtParticle.h:124
Definition IrtParticleObj.h:24
Definition IrtRadiatorInfo.h:41
Definition MutableIrtParticle.h:38
Definition MutableTrack.h:40
Definition Track.h:48
Definition ArrowMapper.cc:63
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:156