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
89 /// Set the Detected photoelectron count
90 void setNpe(const std::uint16_t npe);
91 /// Get mutable reference to Detected photoelectron count
92 std::uint16_t& getNpe();
93
94 /// Set the Hit count associated with this particle by IRT engine
95 void setNhits(const std::uint16_t nhits);
96 /// Get mutable reference to Hit count associated with this particle by IRT engine
97 std::uint16_t& getNhits();
98
99
100 /// Set the charged particle track
101 void setTrack(const edm4eic::Track& value);
102
104 std::size_t radiators_size() const;
105 edm4eic::IrtRadiatorInfo getRadiators(std::size_t) const;
106 std::vector<edm4eic::IrtRadiatorInfo>::const_iterator radiators_begin() const;
107 std::vector<edm4eic::IrtRadiatorInfo>::const_iterator radiators_end() const;
108 podio::RelationRange<edm4eic::IrtRadiatorInfo> getRadiators() const;
109
110
111
112 /// check whether the object is actually available
113 bool isAvailable() const;
114 /// disconnect from IrtParticleObj instance
115 void unlink() { m_obj = podio::utils::MaybeSharedPtr<IrtParticleObj>{nullptr}; }
116
117 constexpr bool operator==(const MutableIrtParticle& other) const { return m_obj == other.m_obj; }
118 bool operator==(const IrtParticle& other) const;
119
120 constexpr bool operator!=(const MutableIrtParticle& other) const { return !(*this == other); }
121 bool operator!=(const IrtParticle& other) const { return !(*this == other); }
122
123 // less comparison operator, so that objects can be e.g. stored in sets.
124 bool operator<(const MutableIrtParticle& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
125
126 podio::ObjectID id() const { return getObjectID(); }
127
128 const podio::ObjectID getObjectID() const;
129
130 friend std::hash<MutableIrtParticle>;
131
133 using std::swap;
134 swap(a.m_obj, b.m_obj); // swap out the internal pointers
135 }
136
137private:
138 /// constructor from existing IrtParticleObj
139 explicit MutableIrtParticle(podio::utils::MaybeSharedPtr<IrtParticleObj> obj);
140
141 podio::utils::MaybeSharedPtr<IrtParticleObj> m_obj{new IrtParticleObj{}, podio::utils::MarkOwned};
142};
143
144#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
145void to_json(nlohmann::json& j, const MutableIrtParticle& value);
146#endif
147
148
149} // namespace edm4eic
150
151
152
153template<>
154struct std::hash<edm4eic::MutableIrtParticle> {
155 std::size_t operator()(const edm4eic::MutableIrtParticle& obj) const {
156 return std::hash<edm4eic::IrtParticleObj*>{}(obj.m_obj.get());
157 }
158};
159
160
161#endif
Definition IrtParticleCollection.h:139
Definition IrtParticle.h:46
Definition IrtParticleObj.h:24
Definition IrtRadiatorInfo.h:41
Definition MutableIrtParticle.h:38
const podio::ObjectID getObjectID() const
Definition MutableIrtParticle.cc:112
void addToRadiators(const edm4eic::IrtRadiatorInfo &)
Definition MutableIrtParticle.cc:67
~MutableIrtParticle()=default
destructor
void setNhits(const std::uint16_t nhits)
Set the Hit count associated with this particle by IRT engine.
Definition MutableIrtParticle.cc:59
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:72
std::size_t radiators_size() const
Definition MutableIrtParticle.cc:84
std::vector< edm4eic::IrtRadiatorInfo >::const_iterator radiators_end() const
Definition MutableIrtParticle.cc:78
bool isAvailable() const
check whether the object is actually available
Definition MutableIrtParticle.cc:108
MutableIrtParticle & operator=(MutableIrtParticle other) &
copy-assignment operator
Definition MutableIrtParticle.cc:25
void setNpe(const std::uint16_t npe)
Set the Detected photoelectron count.
Definition MutableIrtParticle.cc:57
void unlink()
disconnect from IrtParticleObj instance
Definition MutableIrtParticle.h:115
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:121
friend void swap(MutableIrtParticle &a, MutableIrtParticle &b)
Definition MutableIrtParticle.h:132
void setTrack(const edm4eic::Track &value)
Set the charged particle track.
Definition MutableIrtParticle.cc:62
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:95
std::uint16_t getNhits() const
Access the Hit count associated with this particle by IRT engine.
Definition MutableIrtParticle.cc:45
void setPDG(const std::int32_t PDG)
Set the Reconstructed most probable PDG code.
Definition MutableIrtParticle.cc:55
MutableIrtParticle(const MutableIrtParticle &other)=default
copy constructor
constexpr bool operator==(const MutableIrtParticle &other) const
Definition MutableIrtParticle.h:117
MutableIrtParticle()=default
default constructor
bool operator<(const MutableIrtParticle &other) const
Definition MutableIrtParticle.h:124
MutableIrtParticle clone(bool cloneRelations=true) const
Definition MutableIrtParticle.cc:30
podio::ObjectID id() const
Definition MutableIrtParticle.h:126
constexpr bool operator!=(const MutableIrtParticle &other) const
Definition MutableIrtParticle.h:120
Definition MutableTrack.h:40
Definition Track.h:48
Definition ArrowMapper.cc:61
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::MutableIrtParticle &obj) const
Definition MutableIrtParticle.h:155