File indexing completed on 2025-07-03 08:34:32
0001
0002
0003 #ifndef EDM4EIC_MutableCalorimeterHit_H
0004 #define EDM4EIC_MutableCalorimeterHit_H
0005
0006 #include "edm4eic/CalorimeterHitObj.h"
0007
0008 #include "edm4eic/CalorimeterHit.h"
0009
0010 #include "edm4hep/Vector3f.h"
0011 #include <cstdint>
0012
0013 #include "podio/utilities/MaybeSharedPtr.h"
0014
0015 #include <cstdint>
0016
0017 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0018 #include "nlohmann/json_fwd.hpp"
0019 #endif
0020
0021
0022 namespace edm4eic {
0023 class CalorimeterHitCollection;
0024 }
0025 namespace edm4hep {
0026 class RawCalorimeterHit;
0027 class MutableRawCalorimeterHit;
0028 }
0029
0030
0031 namespace edm4eic {
0032
0033
0034
0035
0036
0037
0038 class MutableCalorimeterHit {
0039
0040 friend class CalorimeterHitCollection;
0041 friend class CalorimeterHitMutableCollectionIterator;
0042 friend class CalorimeterHit;
0043
0044 public:
0045 using object_type = CalorimeterHit;
0046 using collection_type = CalorimeterHitCollection;
0047
0048
0049 MutableCalorimeterHit();
0050
0051
0052 MutableCalorimeterHit(std::uint64_t cellID, float energy, float energyError, float time, float timeError, edm4hep::Vector3f position, edm4hep::Vector3f dimension, std::int32_t sector, std::int32_t layer, edm4hep::Vector3f local);
0053
0054
0055 MutableCalorimeterHit(const MutableCalorimeterHit& other) = default;
0056
0057
0058 MutableCalorimeterHit& operator=(MutableCalorimeterHit other);
0059
0060
0061
0062 MutableCalorimeterHit clone(bool cloneRelations=true) const;
0063
0064
0065 ~MutableCalorimeterHit() = default;
0066
0067
0068 public:
0069
0070
0071 std::uint64_t getCellID() const;
0072
0073
0074 float getEnergy() const;
0075
0076
0077 float getEnergyError() const;
0078
0079
0080 float getTime() const;
0081
0082
0083 float getTimeError() const;
0084
0085
0086 const edm4hep::Vector3f& getPosition() const;
0087
0088
0089 const edm4hep::Vector3f& getDimension() const;
0090
0091
0092 std::int32_t getSector() const;
0093
0094
0095 std::int32_t getLayer() const;
0096
0097
0098 const edm4hep::Vector3f& getLocal() const;
0099
0100
0101
0102 const edm4hep::RawCalorimeterHit getRawHit() const;
0103
0104
0105 void setCellID(std::uint64_t value);
0106
0107 std::uint64_t& getCellID();
0108
0109 [[deprecated("use getCellID instead")]]
0110 std::uint64_t& cellID();
0111
0112
0113 void setEnergy(float value);
0114
0115 float& getEnergy();
0116
0117 [[deprecated("use getEnergy instead")]]
0118 float& energy();
0119
0120
0121 void setEnergyError(float value);
0122
0123 float& getEnergyError();
0124
0125 [[deprecated("use getEnergyError instead")]]
0126 float& energyError();
0127
0128
0129 void setTime(float value);
0130
0131 float& getTime();
0132
0133 [[deprecated("use getTime instead")]]
0134 float& time();
0135
0136
0137 void setTimeError(float value);
0138
0139 float& getTimeError();
0140
0141 [[deprecated("use getTimeError instead")]]
0142 float& timeError();
0143
0144
0145 void setPosition(edm4hep::Vector3f value);
0146
0147 edm4hep::Vector3f& getPosition();
0148
0149 [[deprecated("use getPosition instead")]]
0150 edm4hep::Vector3f& position();
0151
0152
0153 void setDimension(edm4hep::Vector3f value);
0154
0155 edm4hep::Vector3f& getDimension();
0156
0157 [[deprecated("use getDimension instead")]]
0158 edm4hep::Vector3f& dimension();
0159
0160
0161 void setSector(std::int32_t value);
0162
0163 std::int32_t& getSector();
0164
0165 [[deprecated("use getSector instead")]]
0166 std::int32_t& sector();
0167
0168
0169 void setLayer(std::int32_t value);
0170
0171 std::int32_t& getLayer();
0172
0173 [[deprecated("use getLayer instead")]]
0174 std::int32_t& layer();
0175
0176
0177 void setLocal(edm4hep::Vector3f value);
0178
0179 edm4hep::Vector3f& getLocal();
0180
0181 [[deprecated("use getLocal instead")]]
0182 edm4hep::Vector3f& local();
0183
0184
0185
0186 void setRawHit(const edm4hep::RawCalorimeterHit& value);
0187
0188
0189
0190
0191
0192 bool isAvailable() const;
0193
0194 void unlink() { m_obj = podio::utils::MaybeSharedPtr<CalorimeterHitObj>{nullptr}; }
0195
0196 bool operator==(const MutableCalorimeterHit& other) const { return m_obj == other.m_obj; }
0197 bool operator==(const CalorimeterHit& other) const;
0198
0199 bool operator!=(const MutableCalorimeterHit& other) const { return !(*this == other); }
0200 bool operator!=(const CalorimeterHit& other) const { return !(*this == other); }
0201
0202
0203 bool operator<(const MutableCalorimeterHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0204
0205 podio::ObjectID id() const { return getObjectID(); }
0206
0207 const podio::ObjectID getObjectID() const;
0208
0209 friend void swap(MutableCalorimeterHit& a, MutableCalorimeterHit& b) {
0210 using std::swap;
0211 swap(a.m_obj, b.m_obj);
0212 }
0213
0214 private:
0215
0216 explicit MutableCalorimeterHit(podio::utils::MaybeSharedPtr<CalorimeterHitObj> obj);
0217
0218 podio::utils::MaybeSharedPtr<CalorimeterHitObj> m_obj{nullptr};
0219 };
0220
0221 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0222 void to_json(nlohmann::json& j, const MutableCalorimeterHit& value);
0223 #endif
0224
0225
0226 }
0227
0228
0229 #endif