EDM4eic
EIC data model
Loading...
Searching...
No Matches
MutableSimPulse.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EDM4EIC_MutableSimPulse_H
4#define EDM4EIC_MutableSimPulse_H
5
7// Make the immutable class available from its mutable version but not vice versa
8#include "edm4eic/SimPulse.h"
9
10#include "edm4hep/MCParticle.h"
11#include "edm4hep/SimCalorimeterHit.h"
12#include "edm4hep/SimTrackerHit.h"
13#include "edm4hep/Vector3f.h"
14#include "podio/RelationRange.h"
15#include <cstdint>
16#include <vector>
17
18#include "podio/utilities/MaybeSharedPtr.h"
19
20#include <cstdint>
21
22#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
23#include "nlohmann/json_fwd.hpp"
24#endif
25
26// forward declarations
27namespace edm4eic {
29}
30
31
32namespace edm4eic {
33
34
35/** @class MutableSimPulse
36 * Simulated pulse prior to digitization.
37 * @author: D. Anderson, S. Gardner, S. Joosten., D. Kalinkin
38 */
40
41 friend class SimPulseCollection;
43 friend class SimPulse;
44
45public:
48
49 /// default constructor
50 MutableSimPulse() = default;
51
52 /// Constructor initializing all members
53 MutableSimPulse(const std::uint64_t cellID, const float integral, const edm4hep::Vector3f& position, const float time, const float interval);
54
55 /// copy constructor
56 MutableSimPulse(const MutableSimPulse& other) = default;
57
58 /// copy-assignment operator
59 MutableSimPulse& operator=(MutableSimPulse other) &; // Rebind this to other's internal object
60 MutableSimPulse& operator=(MutableSimPulse other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
61
62 /// create a mutable deep-copy of the object with identical relations
63 /// if cloneRelations=false, the relations are not cloned and will be empty
64 MutableSimPulse clone(bool cloneRelations=true) const;
65
66 /// destructor
67 ~MutableSimPulse() = default;
68
69
70public:
71
72 /// Access the ID of the readout cell for this pulse.
73 std::uint64_t getCellID() const;
74
75 /// Access the Total pulse integral in relevant units.
76 float getIntegral() const;
77
78 /// Access the Position the pulse is evaluated in world coordinates [mm].
79 const edm4hep::Vector3f& getPosition() const;
80
81 /// Access the Start time for the pulse in [ns].
82 float getTime() const;
83
84 /// Access the Time interval between amplitude values [ns].
85 float getInterval() const;
86
87
88
89 /// Set the ID of the readout cell for this pulse.
90 void setCellID(const std::uint64_t cellID);
91 /// Get mutable reference to ID of the readout cell for this pulse.
92 std::uint64_t& getCellID();
93
94 /// Set the Total pulse integral in relevant units.
95 void setIntegral(const float integral);
96 /// Get mutable reference to Total pulse integral in relevant units.
97 float& getIntegral();
98
99 /// Set the Position the pulse is evaluated in world coordinates [mm].
100 void setPosition(const edm4hep::Vector3f& position);
101 /// Get mutable reference to Position the pulse is evaluated in world coordinates [mm].
102 edm4hep::Vector3f& getPosition();
103
104 /// Set the Start time for the pulse in [ns].
105 void setTime(const float time);
106 /// Get mutable reference to Start time for the pulse in [ns].
107 float& getTime();
108
109 /// Set the Time interval between amplitude values [ns].
110 void setInterval(const float interval);
111 /// Get mutable reference to Time interval between amplitude values [ns].
112 float& getInterval();
113
114
115
116 void addToCalorimeterHits(const edm4hep::SimCalorimeterHit&);
117 std::size_t calorimeterHits_size() const;
118 edm4hep::SimCalorimeterHit getCalorimeterHits(std::size_t) const;
119 std::vector<edm4hep::SimCalorimeterHit>::const_iterator calorimeterHits_begin() const;
120 std::vector<edm4hep::SimCalorimeterHit>::const_iterator calorimeterHits_end() const;
121 podio::RelationRange<edm4hep::SimCalorimeterHit> getCalorimeterHits() const;
122 void addToTrackerHits(const edm4hep::SimTrackerHit&);
123 std::size_t trackerHits_size() const;
124 edm4hep::SimTrackerHit getTrackerHits(std::size_t) const;
125 std::vector<edm4hep::SimTrackerHit>::const_iterator trackerHits_begin() const;
126 std::vector<edm4hep::SimTrackerHit>::const_iterator trackerHits_end() const;
127 podio::RelationRange<edm4hep::SimTrackerHit> getTrackerHits() const;
128 void addToPulses(const edm4eic::SimPulse&);
129 std::size_t pulses_size() const;
130 edm4eic::SimPulse getPulses(std::size_t) const;
131 std::vector<edm4eic::SimPulse>::const_iterator pulses_begin() const;
132 std::vector<edm4eic::SimPulse>::const_iterator pulses_end() const;
133 podio::RelationRange<edm4eic::SimPulse> getPulses() const;
134 void addToParticles(const edm4hep::MCParticle&);
135 std::size_t particles_size() const;
136 edm4hep::MCParticle getParticles(std::size_t) const;
137 std::vector<edm4hep::MCParticle>::const_iterator particles_begin() const;
138 std::vector<edm4hep::MCParticle>::const_iterator particles_end() const;
139 podio::RelationRange<edm4hep::MCParticle> getParticles() const;
140 void addToAmplitude(const float&);
141 std::size_t amplitude_size() const;
142 float getAmplitude(std::size_t) const;
143 std::vector<float>::const_iterator amplitude_begin() const;
144 std::vector<float>::const_iterator amplitude_end() const;
145 podio::RelationRange<float> getAmplitude() const;
146
147
148
149 /// check whether the object is actually available
150 bool isAvailable() const;
151 /// disconnect from SimPulseObj instance
152 void unlink() { m_obj = podio::utils::MaybeSharedPtr<SimPulseObj>{nullptr}; }
153
154 constexpr bool operator==(const MutableSimPulse& other) const { return m_obj == other.m_obj; }
155 bool operator==(const SimPulse& other) const;
156
157 constexpr bool operator!=(const MutableSimPulse& other) const { return !(*this == other); }
158 bool operator!=(const SimPulse& other) const { return !(*this == other); }
159
160 // less comparison operator, so that objects can be e.g. stored in sets.
161 bool operator<(const MutableSimPulse& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
162
163 podio::ObjectID id() const { return getObjectID(); }
164
165 const podio::ObjectID getObjectID() const;
166
167 friend std::hash<MutableSimPulse>;
168
170 using std::swap;
171 swap(a.m_obj, b.m_obj); // swap out the internal pointers
172 }
173
174private:
175 /// constructor from existing SimPulseObj
176 explicit MutableSimPulse(podio::utils::MaybeSharedPtr<SimPulseObj> obj);
177
178 podio::utils::MaybeSharedPtr<SimPulseObj> m_obj{new SimPulseObj{}, podio::utils::MarkOwned};
179};
180
181#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
182void to_json(nlohmann::json& j, const MutableSimPulse& value);
183#endif
184
185
186} // namespace edm4eic
187
188
189
190template<>
191struct std::hash<edm4eic::MutableSimPulse> {
192 std::size_t operator()(const edm4eic::MutableSimPulse& obj) const {
193 return std::hash<edm4eic::SimPulseObj*>{}(obj.m_obj.get());
194 }
195};
196
197
198#endif
Definition MutableSimPulse.h:39
constexpr bool operator!=(const MutableSimPulse &other) const
Definition MutableSimPulse.h:157
std::vector< edm4hep::SimCalorimeterHit >::const_iterator calorimeterHits_end() const
Definition MutableSimPulse.cc:86
bool operator!=(const SimPulse &other) const
Definition MutableSimPulse.h:158
podio::ObjectID id() const
Definition MutableSimPulse.h:163
void unlink()
disconnect from SimPulseObj instance
Definition MutableSimPulse.h:152
friend class SimPulse
Definition MutableSimPulse.h:43
SimPulseCollection collection_type
Definition MutableSimPulse.h:47
std::vector< float >::const_iterator amplitude_end() const
Definition MutableSimPulse.cc:230
void addToAmplitude(const float &)
Definition MutableSimPulse.cc:219
void addToParticles(const edm4hep::MCParticle &)
Definition MutableSimPulse.cc:183
const edm4hep::Vector3f & getPosition() const
Access the Position the pulse is evaluated in world coordinates [mm].
Definition MutableSimPulse.cc:58
void setCellID(const std::uint64_t cellID)
Set the ID of the readout cell for this pulse.
Definition MutableSimPulse.cc:63
float getTime() const
Access the Start time for the pulse in [ns].
Definition MutableSimPulse.cc:59
podio::RelationRange< edm4hep::SimTrackerHit > getTrackerHits() const
Definition MutableSimPulse.cc:139
constexpr bool operator==(const MutableSimPulse &other) const
Definition MutableSimPulse.h:154
void addToTrackerHits(const edm4hep::SimTrackerHit &)
Definition MutableSimPulse.cc:111
MutableSimPulse()=default
default constructor
friend class SimPulseCollection
Definition MutableSimPulse.h:41
void addToCalorimeterHits(const edm4hep::SimCalorimeterHit &)
Definition MutableSimPulse.cc:75
podio::RelationRange< edm4eic::SimPulse > getPulses() const
Definition MutableSimPulse.cc:175
std::vector< edm4eic::SimPulse >::const_iterator pulses_begin() const
Definition MutableSimPulse.cc:152
std::vector< edm4hep::MCParticle >::const_iterator particles_begin() const
Definition MutableSimPulse.cc:188
bool operator<(const MutableSimPulse &other) const
Definition MutableSimPulse.h:161
podio::RelationRange< edm4hep::SimCalorimeterHit > getCalorimeterHits() const
Definition MutableSimPulse.cc:103
MutableSimPulse clone(bool cloneRelations=true) const
Definition MutableSimPulse.cc:31
std::size_t amplitude_size() const
Definition MutableSimPulse.cc:236
void addToPulses(const edm4eic::SimPulse &)
Definition MutableSimPulse.cc:147
const podio::ObjectID getObjectID() const
Definition MutableSimPulse.cc:264
std::size_t pulses_size() const
Definition MutableSimPulse.cc:164
std::size_t calorimeterHits_size() const
Definition MutableSimPulse.cc:92
std::vector< edm4hep::SimTrackerHit >::const_iterator trackerHits_begin() const
Definition MutableSimPulse.cc:116
float getIntegral() const
Access the Total pulse integral in relevant units.
Definition MutableSimPulse.cc:57
std::vector< float >::const_iterator amplitude_begin() const
Definition MutableSimPulse.cc:224
void setPosition(const edm4hep::Vector3f &position)
Set the Position the pulse is evaluated in world coordinates [mm].
Definition MutableSimPulse.cc:67
void setTime(const float time)
Set the Start time for the pulse in [ns].
Definition MutableSimPulse.cc:69
MutableSimPulse & operator=(MutableSimPulse other) &&=delete
podio::RelationRange< float > getAmplitude() const
Definition MutableSimPulse.cc:247
std::vector< edm4hep::SimCalorimeterHit >::const_iterator calorimeterHits_begin() const
Definition MutableSimPulse.cc:80
std::vector< edm4hep::SimTrackerHit >::const_iterator trackerHits_end() const
Definition MutableSimPulse.cc:122
~MutableSimPulse()=default
destructor
void setIntegral(const float integral)
Set the Total pulse integral in relevant units.
Definition MutableSimPulse.cc:65
SimPulse object_type
Definition MutableSimPulse.h:46
std::vector< edm4hep::MCParticle >::const_iterator particles_end() const
Definition MutableSimPulse.cc:194
std::size_t particles_size() const
Definition MutableSimPulse.cc:200
void setInterval(const float interval)
Set the Time interval between amplitude values [ns].
Definition MutableSimPulse.cc:71
float getInterval() const
Access the Time interval between amplitude values [ns].
Definition MutableSimPulse.cc:60
bool isAvailable() const
check whether the object is actually available
Definition MutableSimPulse.cc:260
MutableSimPulse & operator=(MutableSimPulse other) &
copy-assignment operator
Definition MutableSimPulse.cc:26
std::size_t trackerHits_size() const
Definition MutableSimPulse.cc:128
std::vector< edm4eic::SimPulse >::const_iterator pulses_end() const
Definition MutableSimPulse.cc:158
friend void swap(MutableSimPulse &a, MutableSimPulse &b)
Definition MutableSimPulse.h:169
std::uint64_t getCellID() const
Access the ID of the readout cell for this pulse.
Definition MutableSimPulse.cc:56
podio::RelationRange< edm4hep::MCParticle > getParticles() const
Definition MutableSimPulse.cc:211
MutableSimPulse(const MutableSimPulse &other)=default
copy constructor
friend class SimPulseMutableCollectionIterator
Definition MutableSimPulse.h:42
Definition SimPulseCollection.h:139
Definition SimPulse.h:47
Definition SimPulseObj.h:22
Definition ArrowMapper.cc:61
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::MutableSimPulse &obj) const
Definition MutableSimPulse.h:192