File indexing completed on 2025-05-11 08:50:16
0001
0002
0003 #ifndef EDM4EIC_SimPulse_H
0004 #define EDM4EIC_SimPulse_H
0005
0006 #include "edm4eic/SimPulseObj.h"
0007
0008 #include "edm4hep/MCParticle.h"
0009 #include "edm4hep/SimCalorimeterHit.h"
0010 #include "edm4hep/SimTrackerHit.h"
0011 #include "edm4hep/Vector3f.h"
0012 #include "podio/RelationRange.h"
0013 #include <cstdint>
0014 #include <vector>
0015
0016 #include "podio/utilities/MaybeSharedPtr.h"
0017 #include "podio/detail/OrderKey.h"
0018
0019 #include <ostream>
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 podio::detail {
0033
0034 OrderKey getOrderKey(const edm4eic::SimPulse& obj);
0035 };
0036
0037 namespace edm4eic {
0038
0039 class MutableSimPulse;
0040 class SimPulseCollection;
0041 class SimPulseCollectionData;
0042
0043
0044
0045
0046
0047 class SimPulse {
0048
0049 friend class MutableSimPulse;
0050 friend class SimPulseCollection;
0051 friend class edm4eic::SimPulseCollectionData;
0052 friend class SimPulseCollectionIterator;
0053 friend podio::detail::OrderKey podio::detail::getOrderKey(const SimPulse & obj);
0054
0055 public:
0056 using mutable_type = MutableSimPulse;
0057 using collection_type = SimPulseCollection;
0058
0059
0060 SimPulse();
0061
0062
0063 SimPulse(std::uint64_t cellID, float integral, edm4hep::Vector3f position, float time, float interval);
0064
0065
0066 SimPulse(const SimPulse& other) = default;
0067
0068
0069 SimPulse& operator=(SimPulse other);
0070
0071
0072
0073 MutableSimPulse clone(bool cloneRelations=true) const;
0074
0075
0076 ~SimPulse() = default;
0077
0078
0079 SimPulse(const MutableSimPulse& other);
0080
0081 static SimPulse makeEmpty();
0082
0083 public:
0084
0085 static constexpr auto typeName = "edm4eic::SimPulse";
0086
0087
0088 std::uint64_t getCellID() const;
0089
0090
0091 float getIntegral() const;
0092
0093
0094 const edm4hep::Vector3f& getPosition() const;
0095
0096
0097 float getTime() const;
0098
0099
0100 float getInterval() const;
0101
0102
0103
0104 std::size_t calorimeterHits_size() const;
0105 edm4hep::SimCalorimeterHit getCalorimeterHits(std::size_t) const;
0106 std::vector<edm4hep::SimCalorimeterHit>::const_iterator calorimeterHits_begin() const;
0107 std::vector<edm4hep::SimCalorimeterHit>::const_iterator calorimeterHits_end() const;
0108 podio::RelationRange<edm4hep::SimCalorimeterHit> getCalorimeterHits() const;
0109 std::size_t trackerHits_size() const;
0110 edm4hep::SimTrackerHit getTrackerHits(std::size_t) const;
0111 std::vector<edm4hep::SimTrackerHit>::const_iterator trackerHits_begin() const;
0112 std::vector<edm4hep::SimTrackerHit>::const_iterator trackerHits_end() const;
0113 podio::RelationRange<edm4hep::SimTrackerHit> getTrackerHits() const;
0114 std::size_t pulses_size() const;
0115 edm4eic::SimPulse getPulses(std::size_t) const;
0116 std::vector<edm4eic::SimPulse>::const_iterator pulses_begin() const;
0117 std::vector<edm4eic::SimPulse>::const_iterator pulses_end() const;
0118 podio::RelationRange<edm4eic::SimPulse> getPulses() const;
0119 std::size_t particles_size() const;
0120 edm4hep::MCParticle getParticles(std::size_t) const;
0121 std::vector<edm4hep::MCParticle>::const_iterator particles_begin() const;
0122 std::vector<edm4hep::MCParticle>::const_iterator particles_end() const;
0123 podio::RelationRange<edm4hep::MCParticle> getParticles() const;
0124 std::size_t amplitude_size() const;
0125 float getAmplitude(std::size_t) const;
0126 std::vector<float>::const_iterator amplitude_begin() const;
0127 std::vector<float>::const_iterator amplitude_end() const;
0128 podio::RelationRange<float> getAmplitude() const;
0129
0130
0131
0132 bool isAvailable() const;
0133
0134 void unlink() { m_obj = podio::utils::MaybeSharedPtr<SimPulseObj>{nullptr}; }
0135
0136 bool operator==(const SimPulse& other) const { return m_obj == other.m_obj; }
0137 bool operator==(const MutableSimPulse& other) const;
0138
0139 bool operator!=(const SimPulse& other) const { return !(*this == other); }
0140 bool operator!=(const MutableSimPulse& other) const { return !(*this == other); }
0141
0142
0143 bool operator<(const SimPulse& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0144
0145 podio::ObjectID id() const { return getObjectID(); }
0146
0147 const podio::ObjectID getObjectID() const;
0148
0149 friend void swap(SimPulse& a, SimPulse& b) {
0150 using std::swap;
0151 swap(a.m_obj, b.m_obj);
0152 }
0153
0154 private:
0155
0156 explicit SimPulse(podio::utils::MaybeSharedPtr<SimPulseObj> obj);
0157 SimPulse(SimPulseObj* obj);
0158
0159 podio::utils::MaybeSharedPtr<SimPulseObj> m_obj{nullptr};
0160 };
0161
0162 std::ostream& operator<<(std::ostream& o, const SimPulse& value);
0163
0164 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0165 void to_json(nlohmann::json& j, const SimPulse& value);
0166 #endif
0167
0168
0169 }
0170
0171
0172 #endif