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