EDM4eic
EIC data model
Loading...
Searching...
No Matches
MutableIrtParticle.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_MutableIrtParticle_H
4#define EDM4EIC_MutableIrtParticle_H
5
7// Make the immutable class available from its mutable version but not vice versa
9
11#include "podio/RelationRange.h"
12#include <cstdint>
13#include <vector>
14
15#include "podio/utilities/MaybeSharedPtr.h"
16
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 edm4eic {
32
33
34/** @class MutableIrtParticle
35 * IRT 2.1 output (track level)
36 * @author: A. Kiselev
37 */
39
42 friend class IrtParticle;
43
44public:
47
48 /// default constructor
49 MutableIrtParticle() = default;
50
51 /// Constructor initializing all members
52 MutableIrtParticle(const std::int32_t PDG, const std::uint16_t npe, const std::uint16_t nhits);
53
54 /// copy constructor
55 MutableIrtParticle(const MutableIrtParticle& other) = default;
56
57 /// copy-assignment operator
58 MutableIrtParticle& operator=(MutableIrtParticle other) &; // Rebind this to other's internal object
59 MutableIrtParticle& operator=(MutableIrtParticle other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
60
61 /// create a mutable deep-copy of the object with identical relations
62 /// if cloneRelations=false, the relations are not cloned and will be empty
63 MutableIrtParticle clone(bool cloneRelations=true) const;
64
65 /// destructor
67
68
69public:
70
71 /// Access the Reconstructed most probable PDG code
72 std::int32_t getPDG() const;
73
74 /// Access the Detected photoelectron count
75 std::uint16_t getNpe() const;
76
77 /// Access the Hit count associated with this particle by IRT engine
78 std::uint16_t getNhits() const;
79
80
81 /// Access the charged particle track
82 const edm4eic::Track getTrack() const;
83
84 /// Set the Reconstructed most probable PDG code
85 void setPDG(const std::int32_t PDG);
86 /// Get mutable reference to Reconstructed most probable PDG code
87 std::int32_t& getPDG();
88 /// Get reference to Reconstructed most probable PDG code
89 [[deprecated("use getPDG instead")]]
90 std::int32_t& PDG();
91
92 /// Set the Detected photoelectron count
93 void setNpe(const std::uint16_t npe);
94 /// Get mutable reference to Detected photoelectron count
95 std::uint16_t& getNpe();
96 /// Get reference to Detected photoelectron count
97 [[deprecated("use getNpe instead")]]
98 std::uint16_t& npe();
99
100 /// Set the Hit count associated with this particle by IRT engine
101 void setNhits(const std::uint16_t nhits);
102 /// Get mutable reference to Hit count associated with this particle by IRT engine
103 std::uint16_t& getNhits();
104 /// Get reference to Hit count associated with this particle by IRT engine
105 [[deprecated("use getNhits instead")]]
106 std::uint16_t& nhits();
107
108
109 /// Set the charged particle track
110 void setTrack(const edm4eic::Track& value);
111
113 std::size_t radiators_size() const;
114 edm4eic::IrtRadiatorInfo getRadiators(std::size_t) const;
115 std::vector<edm4eic::IrtRadiatorInfo>::const_iterator radiators_begin() const;
116 std::vector<edm4eic::IrtRadiatorInfo>::const_iterator radiators_end() const;
117 podio::RelationRange<edm4eic::IrtRadiatorInfo> getRadiators() const;
118
119
120
121 /// check whether the object is actually available
122 bool isAvailable() const;
123 /// disconnect from IrtParticleObj instance
124 void unlink() { m_obj = podio::utils::MaybeSharedPtr<IrtParticleObj>{nullptr}; }
125
126 bool operator==(const MutableIrtParticle& other) const { return m_obj == other.m_obj; }
127 bool operator==(const IrtParticle& other) const;
128
129 bool operator!=(const MutableIrtParticle& other) const { return !(*this == other); }
130 bool operator!=(const IrtParticle& other) const { return !(*this == other); }
131
132 // less comparison operator, so that objects can be e.g. stored in sets.
133 bool operator<(const MutableIrtParticle& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
134
135 podio::ObjectID id() const { return getObjectID(); }
136
137 const podio::ObjectID getObjectID() const;
138
139 friend std::hash<MutableIrtParticle>;
140
142 using std::swap;
143 swap(a.m_obj, b.m_obj); // swap out the internal pointers
144 }
145
146private:
147 /// constructor from existing IrtParticleObj
148 explicit MutableIrtParticle(podio::utils::MaybeSharedPtr<IrtParticleObj> obj);
149
150 podio::utils::MaybeSharedPtr<IrtParticleObj> m_obj{new IrtParticleObj{}, podio::utils::MarkOwned};
151};
152
153#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
154void to_json(nlohmann::json& j, const MutableIrtParticle& value);
155#endif
156
157
158} // namespace edm4eic
159
160
161
162template<>
163struct std::hash<edm4eic::MutableIrtParticle> {
164 std::size_t operator()(const edm4eic::MutableIrtParticle& obj) const {
165 return std::hash<edm4eic::IrtParticleObj*>{}(obj.m_obj.get());
166 }
167};
168
169
170#endif
Definition IrtParticleCollection.h:138
Definition IrtParticle.h:46
Definition IrtParticleObj.h:24
Definition IrtRadiatorInfo.h:41
Definition MutableIrtParticle.h:38
const podio::ObjectID getObjectID() const
Definition MutableIrtParticle.cc:115
void addToRadiators(const edm4eic::IrtRadiatorInfo &)
Definition MutableIrtParticle.cc:70
~MutableIrtParticle()=default
destructor
void setNhits(const std::uint16_t nhits)
Set the Hit count associated with this particle by IRT engine.
Definition MutableIrtParticle.cc:61
std::int32_t getPDG() const
Access the Reconstructed most probable PDG code.
Definition MutableIrtParticle.cc:43
std::vector< edm4eic::IrtRadiatorInfo >::const_iterator radiators_begin() const
Definition MutableIrtParticle.cc:75
std::size_t radiators_size() const
Definition MutableIrtParticle.cc:87
std::vector< edm4eic::IrtRadiatorInfo >::const_iterator radiators_end() const
Definition MutableIrtParticle.cc:81
bool isAvailable() const
check whether the object is actually available
Definition MutableIrtParticle.cc:111
MutableIrtParticle & operator=(MutableIrtParticle other) &
copy-assignment operator
Definition MutableIrtParticle.cc:25
std::uint16_t & nhits()
Get reference to Hit count associated with this particle by IRT engine.
Definition MutableIrtParticle.cc:63
void setNpe(const std::uint16_t npe)
Set the Detected photoelectron count.
Definition MutableIrtParticle.cc:58
void unlink()
disconnect from IrtParticleObj instance
Definition MutableIrtParticle.h:124
MutableIrtParticle & operator=(MutableIrtParticle other) &&=delete
IrtParticleCollection collection_type
Definition MutableIrtParticle.h:46
friend class IrtParticleMutableCollectionIterator
Definition MutableIrtParticle.h:41
friend class IrtParticle
Definition MutableIrtParticle.h:42
bool operator!=(const IrtParticle &other) const
Definition MutableIrtParticle.h:130
friend void swap(MutableIrtParticle &a, MutableIrtParticle &b)
Definition MutableIrtParticle.h:141
void setTrack(const edm4eic::Track &value)
Set the charged particle track.
Definition MutableIrtParticle.cc:65
friend class IrtParticleCollection
Definition MutableIrtParticle.h:40
const edm4eic::Track getTrack() const
Access the charged particle track.
Definition MutableIrtParticle.cc:47
IrtParticle object_type
Definition MutableIrtParticle.h:45
std::uint16_t getNpe() const
Access the Detected photoelectron count.
Definition MutableIrtParticle.cc:44
podio::RelationRange< edm4eic::IrtRadiatorInfo > getRadiators() const
Definition MutableIrtParticle.cc:98
std::uint16_t getNhits() const
Access the Hit count associated with this particle by IRT engine.
Definition MutableIrtParticle.cc:45
bool operator==(const MutableIrtParticle &other) const
Definition MutableIrtParticle.h:126
void setPDG(const std::int32_t PDG)
Set the Reconstructed most probable PDG code.
Definition MutableIrtParticle.cc:55
bool operator!=(const MutableIrtParticle &other) const
Definition MutableIrtParticle.h:129
MutableIrtParticle(const MutableIrtParticle &other)=default
copy constructor
MutableIrtParticle()=default
default constructor
std::int32_t & PDG()
Get reference to Reconstructed most probable PDG code.
Definition MutableIrtParticle.cc:57
bool operator<(const MutableIrtParticle &other) const
Definition MutableIrtParticle.h:133
MutableIrtParticle clone(bool cloneRelations=true) const
Definition MutableIrtParticle.cc:30
std::uint16_t & npe()
Get reference to Detected photoelectron count.
Definition MutableIrtParticle.cc:60
podio::ObjectID id() const
Definition MutableIrtParticle.h:135
Definition MutableTrack.h:40
Definition Track.h:48
Definition CalorimeterHit.cc:17
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::MutableIrtParticle &obj) const
Definition MutableIrtParticle.h:164