File indexing completed on 2025-09-17 08:55:02
0001
0002
0003 #ifndef EDM4EIC_MutableSimPulse_H
0004 #define EDM4EIC_MutableSimPulse_H
0005
0006 #include "edm4eic/SimPulseObj.h"
0007
0008 #include "edm4eic/SimPulse.h"
0009
0010 #include "edm4hep/MCParticle.h"
0011 #include "edm4hep/SimCalorimeterHit.h"
0012 #include "edm4hep/SimTrackerHit.h"
0013 #include "edm4hep/Vector3f.h"
0014 #include "podio/RelationRange.h"
0015 #include <cstdint>
0016 #include <vector>
0017
0018 #include "podio/utilities/MaybeSharedPtr.h"
0019
0020 #include <cstdint>
0021
0022 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0023 #include "nlohmann/json_fwd.hpp"
0024 #endif
0025
0026
0027 namespace edm4eic {
0028 class SimPulseCollection;
0029 }
0030
0031
0032 namespace edm4eic {
0033
0034
0035
0036
0037
0038
0039 class MutableSimPulse {
0040
0041 friend class SimPulseCollection;
0042 friend class SimPulseMutableCollectionIterator;
0043 friend class SimPulse;
0044
0045 public:
0046 using object_type = SimPulse;
0047 using collection_type = SimPulseCollection;
0048
0049
0050 MutableSimPulse();
0051
0052
0053 MutableSimPulse(const std::uint64_t cellID, const float integral, const edm4hep::Vector3f& position, const float time, const float interval);
0054
0055
0056 MutableSimPulse(const MutableSimPulse& other) = default;
0057
0058
0059 MutableSimPulse& operator=(MutableSimPulse other) &;
0060 MutableSimPulse& operator=(MutableSimPulse other) && = delete;
0061
0062
0063
0064 MutableSimPulse clone(bool cloneRelations=true) const;
0065
0066
0067 ~MutableSimPulse() = default;
0068
0069
0070 public:
0071
0072
0073 std::uint64_t getCellID() const;
0074
0075
0076 float getIntegral() const;
0077
0078
0079 const edm4hep::Vector3f& getPosition() const;
0080
0081
0082 float getTime() const;
0083
0084
0085 float getInterval() const;
0086
0087
0088
0089
0090 void setCellID(const std::uint64_t cellID);
0091
0092 std::uint64_t& getCellID();
0093
0094 [[deprecated("use getCellID instead")]]
0095 std::uint64_t& cellID();
0096
0097
0098 void setIntegral(const float integral);
0099
0100 float& getIntegral();
0101
0102 [[deprecated("use getIntegral instead")]]
0103 float& integral();
0104
0105
0106 void setPosition(const edm4hep::Vector3f& position);
0107
0108 edm4hep::Vector3f& getPosition();
0109
0110 [[deprecated("use getPosition instead")]]
0111 edm4hep::Vector3f& position();
0112
0113
0114 void setTime(const float time);
0115
0116 float& getTime();
0117
0118 [[deprecated("use getTime instead")]]
0119 float& time();
0120
0121
0122 void setInterval(const float interval);
0123
0124 float& getInterval();
0125
0126 [[deprecated("use getInterval instead")]]
0127 float& interval();
0128
0129
0130
0131 void addToCalorimeterHits(const edm4hep::SimCalorimeterHit&);
0132 std::size_t calorimeterHits_size() const;
0133 edm4hep::SimCalorimeterHit getCalorimeterHits(std::size_t) const;
0134 std::vector<edm4hep::SimCalorimeterHit>::const_iterator calorimeterHits_begin() const;
0135 std::vector<edm4hep::SimCalorimeterHit>::const_iterator calorimeterHits_end() const;
0136 podio::RelationRange<edm4hep::SimCalorimeterHit> getCalorimeterHits() const;
0137 void addToTrackerHits(const edm4hep::SimTrackerHit&);
0138 std::size_t trackerHits_size() const;
0139 edm4hep::SimTrackerHit getTrackerHits(std::size_t) const;
0140 std::vector<edm4hep::SimTrackerHit>::const_iterator trackerHits_begin() const;
0141 std::vector<edm4hep::SimTrackerHit>::const_iterator trackerHits_end() const;
0142 podio::RelationRange<edm4hep::SimTrackerHit> getTrackerHits() const;
0143 void addToPulses(const edm4eic::SimPulse&);
0144 std::size_t pulses_size() const;
0145 edm4eic::SimPulse getPulses(std::size_t) const;
0146 std::vector<edm4eic::SimPulse>::const_iterator pulses_begin() const;
0147 std::vector<edm4eic::SimPulse>::const_iterator pulses_end() const;
0148 podio::RelationRange<edm4eic::SimPulse> getPulses() const;
0149 void addToParticles(const edm4hep::MCParticle&);
0150 std::size_t particles_size() const;
0151 edm4hep::MCParticle getParticles(std::size_t) const;
0152 std::vector<edm4hep::MCParticle>::const_iterator particles_begin() const;
0153 std::vector<edm4hep::MCParticle>::const_iterator particles_end() const;
0154 podio::RelationRange<edm4hep::MCParticle> getParticles() const;
0155 void addToAmplitude(const float&);
0156 std::size_t amplitude_size() const;
0157 float getAmplitude(std::size_t) const;
0158 std::vector<float>::const_iterator amplitude_begin() const;
0159 std::vector<float>::const_iterator amplitude_end() const;
0160 podio::RelationRange<float> getAmplitude() const;
0161
0162
0163
0164
0165 bool isAvailable() const;
0166
0167 void unlink() { m_obj = podio::utils::MaybeSharedPtr<SimPulseObj>{nullptr}; }
0168
0169 bool operator==(const MutableSimPulse& other) const { return m_obj == other.m_obj; }
0170 bool operator==(const SimPulse& other) const;
0171
0172 bool operator!=(const MutableSimPulse& other) const { return !(*this == other); }
0173 bool operator!=(const SimPulse& other) const { return !(*this == other); }
0174
0175
0176 bool operator<(const MutableSimPulse& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0177
0178 podio::ObjectID id() const { return getObjectID(); }
0179
0180 const podio::ObjectID getObjectID() const;
0181
0182 friend std::hash<MutableSimPulse>;
0183
0184 friend void swap(MutableSimPulse& a, MutableSimPulse& b) {
0185 using std::swap;
0186 swap(a.m_obj, b.m_obj);
0187 }
0188
0189 private:
0190
0191 explicit MutableSimPulse(podio::utils::MaybeSharedPtr<SimPulseObj> obj);
0192
0193 podio::utils::MaybeSharedPtr<SimPulseObj> m_obj{nullptr};
0194 };
0195
0196 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0197 void to_json(nlohmann::json& j, const MutableSimPulse& value);
0198 #endif
0199
0200
0201 }
0202
0203
0204
0205 template<>
0206 struct std::hash<edm4eic::MutableSimPulse> {
0207 std::size_t operator()(const edm4eic::MutableSimPulse& obj) const {
0208 return std::hash<edm4eic::SimPulseObj*>{}(obj.m_obj.get());
0209 }
0210 };
0211
0212
0213 #endif