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) noexcept = default;
57
58 /// move constructor
59 MutableSimPulse(MutableSimPulse&& other) noexcept = default;
60
61 /// copy-assignment operator
62 MutableSimPulse& operator=(MutableSimPulse other) &; // Rebind this to other's internal object
63 MutableSimPulse& operator=(MutableSimPulse other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
64
65 /// create a mutable deep-copy of the object with identical relations
66 /// if cloneRelations=false, the relations are not cloned and will be empty
67 MutableSimPulse clone(bool cloneRelations=true) const;
68
69 /// destructor
70 ~MutableSimPulse() = default;
71
72
73public:
74
75 /// Access the ID of the readout cell for this pulse.
76 std::uint64_t getCellID() const;
77
78 /// Access the Total pulse integral in relevant units.
79 float getIntegral() const;
80
81 /// Access the Position the pulse is evaluated in world coordinates [mm].
82 const edm4hep::Vector3f& getPosition() const;
83
84 /// Access the Start time for the pulse in [ns].
85 float getTime() const;
86
87 /// Access the Time interval between amplitude values [ns].
88 float getInterval() const;
89
90
91
92 /// Set the ID of the readout cell for this pulse.
93 void setCellID(const std::uint64_t cellID);
94 /// Get mutable reference to ID of the readout cell for this pulse.
95 std::uint64_t& getCellID();
96
97 /// Set the Total pulse integral in relevant units.
98 void setIntegral(const float integral);
99 /// Get mutable reference to Total pulse integral in relevant units.
100 float& getIntegral();
101
102 /// Set the Position the pulse is evaluated in world coordinates [mm].
103 void setPosition(const edm4hep::Vector3f& position);
104 /// Get mutable reference to Position the pulse is evaluated in world coordinates [mm].
105 edm4hep::Vector3f& getPosition();
106
107 /// Set the Start time for the pulse in [ns].
108 void setTime(const float time);
109 /// Get mutable reference to Start time for the pulse in [ns].
110 float& getTime();
111
112 /// Set the Time interval between amplitude values [ns].
113 void setInterval(const float interval);
114 /// Get mutable reference to Time interval between amplitude values [ns].
115 float& getInterval();
116
117
118
119 void addToCalorimeterHits(const edm4hep::SimCalorimeterHit&);
120 std::size_t calorimeterHits_size() const;
121 edm4hep::SimCalorimeterHit getCalorimeterHits(std::size_t) const;
122 std::vector<edm4hep::SimCalorimeterHit>::const_iterator calorimeterHits_begin() const;
123 std::vector<edm4hep::SimCalorimeterHit>::const_iterator calorimeterHits_end() const;
124 podio::RelationRange<edm4hep::SimCalorimeterHit> getCalorimeterHits() const;
125 void addToTrackerHits(const edm4hep::SimTrackerHit&);
126 std::size_t trackerHits_size() const;
127 edm4hep::SimTrackerHit getTrackerHits(std::size_t) const;
128 std::vector<edm4hep::SimTrackerHit>::const_iterator trackerHits_begin() const;
129 std::vector<edm4hep::SimTrackerHit>::const_iterator trackerHits_end() const;
130 podio::RelationRange<edm4hep::SimTrackerHit> getTrackerHits() const;
131 void addToPulses(const edm4eic::SimPulse&);
132 std::size_t pulses_size() const;
133 edm4eic::SimPulse getPulses(std::size_t) const;
134 std::vector<edm4eic::SimPulse>::const_iterator pulses_begin() const;
135 std::vector<edm4eic::SimPulse>::const_iterator pulses_end() const;
136 podio::RelationRange<edm4eic::SimPulse> getPulses() const;
137 void addToParticles(const edm4hep::MCParticle&);
138 std::size_t particles_size() const;
139 edm4hep::MCParticle getParticles(std::size_t) const;
140 std::vector<edm4hep::MCParticle>::const_iterator particles_begin() const;
141 std::vector<edm4hep::MCParticle>::const_iterator particles_end() const;
142 podio::RelationRange<edm4hep::MCParticle> getParticles() const;
143 void addToAmplitude(const float&);
144 std::size_t amplitude_size() const;
145 float getAmplitude(std::size_t) const;
146 std::vector<float>::const_iterator amplitude_begin() const;
147 std::vector<float>::const_iterator amplitude_end() const;
148 podio::RelationRange<float> getAmplitude() const;
149
150
151
152 /// check whether the object is actually available
153 bool isAvailable() const;
154 /// disconnect from SimPulseObj instance
155 void unlink() { m_obj = podio::utils::MaybeSharedPtr<SimPulseObj>{nullptr}; }
156
157 constexpr bool operator==(const MutableSimPulse& other) const { return m_obj == other.m_obj; }
158 bool operator==(const SimPulse& other) const;
159
160 constexpr bool operator!=(const MutableSimPulse& other) const { return !(*this == other); }
161 bool operator!=(const SimPulse& other) const { return !(*this == other); }
162
163 // less comparison operator, so that objects can be e.g. stored in sets.
164 bool operator<(const MutableSimPulse& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
165
166 podio::ObjectID id() const { return getObjectID(); }
167
168 const podio::ObjectID getObjectID() const;
169
170 friend std::hash<MutableSimPulse>;
171
173 using std::swap;
174 swap(a.m_obj, b.m_obj); // swap out the internal pointers
175 }
176
177private:
178 /// constructor from existing SimPulseObj
179 explicit MutableSimPulse(podio::utils::MaybeSharedPtr<SimPulseObj> obj);
180
181 podio::utils::MaybeSharedPtr<SimPulseObj> m_obj{new SimPulseObj{}, podio::utils::MarkOwned};
182};
183
184#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
185void to_json(nlohmann::json& j, const MutableSimPulse& value);
186#endif
187
188
189} // namespace edm4eic
190
191
192
193template<>
194struct std::hash<edm4eic::MutableSimPulse> {
195 std::size_t operator()(const edm4eic::MutableSimPulse& obj) const {
196 return std::hash<edm4eic::SimPulseObj*>{}(obj.m_obj.get());
197 }
198};
199
200
201#endif
Definition MutableSimPulse.h:39
constexpr bool operator!=(const MutableSimPulse &other) const
Definition MutableSimPulse.h:160
std::vector< edm4hep::SimCalorimeterHit >::const_iterator calorimeterHits_end() const
Definition MutableSimPulse.cc:86
bool operator!=(const SimPulse &other) const
Definition MutableSimPulse.h:161
podio::ObjectID id() const
Definition MutableSimPulse.h:166
void unlink()
disconnect from SimPulseObj instance
Definition MutableSimPulse.h:155
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:157
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
MutableSimPulse(MutableSimPulse &&other) noexcept=default
move constructor
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:164
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:172
std::uint64_t getCellID() const
Access the ID of the readout cell for this pulse.
Definition MutableSimPulse.cc:56
MutableSimPulse(const MutableSimPulse &other) noexcept=default
copy constructor
podio::RelationRange< edm4hep::MCParticle > getParticles() const
Definition MutableSimPulse.cc:211
friend class SimPulseMutableCollectionIterator
Definition MutableSimPulse.h:42
Definition SimPulseCollection.h:139
Definition SimPulse.h:47
Definition SimPulseObj.h:22
Definition ArrowMapper.cc:63
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::MutableSimPulse &obj) const
Definition MutableSimPulse.h:195