File indexing completed on 2025-05-11 08:50:15
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(std::uint64_t cellID, float integral, edm4hep::Vector3f position, float time, float interval);
0054
0055
0056 MutableSimPulse(const MutableSimPulse& other) = default;
0057
0058
0059 MutableSimPulse& operator=(MutableSimPulse other);
0060
0061
0062
0063 MutableSimPulse clone(bool cloneRelations=true) const;
0064
0065
0066 ~MutableSimPulse() = default;
0067
0068
0069 public:
0070
0071
0072 std::uint64_t getCellID() const;
0073
0074
0075 float getIntegral() const;
0076
0077
0078 const edm4hep::Vector3f& getPosition() const;
0079
0080
0081 float getTime() const;
0082
0083
0084 float getInterval() const;
0085
0086
0087
0088
0089 void setCellID(std::uint64_t value);
0090
0091 std::uint64_t& getCellID();
0092
0093 [[deprecated("use getCellID instead")]]
0094 std::uint64_t& cellID();
0095
0096
0097 void setIntegral(float value);
0098
0099 float& getIntegral();
0100
0101 [[deprecated("use getIntegral instead")]]
0102 float& integral();
0103
0104
0105 void setPosition(edm4hep::Vector3f value);
0106
0107 edm4hep::Vector3f& getPosition();
0108
0109 [[deprecated("use getPosition instead")]]
0110 edm4hep::Vector3f& position();
0111
0112
0113 void setTime(float value);
0114
0115 float& getTime();
0116
0117 [[deprecated("use getTime instead")]]
0118 float& time();
0119
0120
0121 void setInterval(float value);
0122
0123 float& getInterval();
0124
0125 [[deprecated("use getInterval instead")]]
0126 float& interval();
0127
0128
0129
0130 void addToCalorimeterHits(const edm4hep::SimCalorimeterHit&);
0131 std::size_t calorimeterHits_size() const;
0132 edm4hep::SimCalorimeterHit getCalorimeterHits(std::size_t) const;
0133 std::vector<edm4hep::SimCalorimeterHit>::const_iterator calorimeterHits_begin() const;
0134 std::vector<edm4hep::SimCalorimeterHit>::const_iterator calorimeterHits_end() const;
0135 podio::RelationRange<edm4hep::SimCalorimeterHit> getCalorimeterHits() const;
0136 void addToTrackerHits(const edm4hep::SimTrackerHit&);
0137 std::size_t trackerHits_size() const;
0138 edm4hep::SimTrackerHit getTrackerHits(std::size_t) const;
0139 std::vector<edm4hep::SimTrackerHit>::const_iterator trackerHits_begin() const;
0140 std::vector<edm4hep::SimTrackerHit>::const_iterator trackerHits_end() const;
0141 podio::RelationRange<edm4hep::SimTrackerHit> getTrackerHits() const;
0142 void addToPulses(const edm4eic::SimPulse&);
0143 std::size_t pulses_size() const;
0144 edm4eic::SimPulse getPulses(std::size_t) const;
0145 std::vector<edm4eic::SimPulse>::const_iterator pulses_begin() const;
0146 std::vector<edm4eic::SimPulse>::const_iterator pulses_end() const;
0147 podio::RelationRange<edm4eic::SimPulse> getPulses() const;
0148 void addToParticles(const edm4hep::MCParticle&);
0149 std::size_t particles_size() const;
0150 edm4hep::MCParticle getParticles(std::size_t) const;
0151 std::vector<edm4hep::MCParticle>::const_iterator particles_begin() const;
0152 std::vector<edm4hep::MCParticle>::const_iterator particles_end() const;
0153 podio::RelationRange<edm4hep::MCParticle> getParticles() const;
0154 void addToAmplitude(const float&);
0155 std::size_t amplitude_size() const;
0156 float getAmplitude(std::size_t) const;
0157 std::vector<float>::const_iterator amplitude_begin() const;
0158 std::vector<float>::const_iterator amplitude_end() const;
0159 podio::RelationRange<float> getAmplitude() const;
0160
0161
0162
0163
0164 bool isAvailable() const;
0165
0166 void unlink() { m_obj = podio::utils::MaybeSharedPtr<SimPulseObj>{nullptr}; }
0167
0168 bool operator==(const MutableSimPulse& other) const { return m_obj == other.m_obj; }
0169 bool operator==(const SimPulse& other) const;
0170
0171 bool operator!=(const MutableSimPulse& other) const { return !(*this == other); }
0172 bool operator!=(const SimPulse& other) const { return !(*this == other); }
0173
0174
0175 bool operator<(const MutableSimPulse& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0176
0177 podio::ObjectID id() const { return getObjectID(); }
0178
0179 const podio::ObjectID getObjectID() const;
0180
0181 friend void swap(MutableSimPulse& a, MutableSimPulse& b) {
0182 using std::swap;
0183 swap(a.m_obj, b.m_obj);
0184 }
0185
0186 private:
0187
0188 explicit MutableSimPulse(podio::utils::MaybeSharedPtr<SimPulseObj> obj);
0189
0190 podio::utils::MaybeSharedPtr<SimPulseObj> m_obj{nullptr};
0191 };
0192
0193 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0194 void to_json(nlohmann::json& j, const MutableSimPulse& value);
0195 #endif
0196
0197
0198 }
0199
0200
0201 #endif