File indexing completed on 2025-01-18 09:55:30
0001
0002
0003 #ifndef EDM4EIC_MutableHadronicFinalState_H
0004 #define EDM4EIC_MutableHadronicFinalState_H
0005
0006 #include "edm4eic/HadronicFinalStateObj.h"
0007
0008 #include "edm4eic/HadronicFinalState.h"
0009
0010 #include "edm4eic/ReconstructedParticle.h"
0011 #include "podio/RelationRange.h"
0012 #include <vector>
0013
0014 #include "podio/utilities/MaybeSharedPtr.h"
0015
0016 #include <cstdint>
0017
0018 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0019 #include "nlohmann/json_fwd.hpp"
0020 #endif
0021
0022
0023
0024 namespace edm4eic {
0025
0026
0027
0028
0029
0030
0031 class MutableHadronicFinalState {
0032
0033 friend class HadronicFinalStateCollection;
0034 friend class HadronicFinalStateMutableCollectionIterator;
0035 friend class HadronicFinalState;
0036
0037 public:
0038 using object_type = HadronicFinalState;
0039 using collection_type = HadronicFinalStateCollection;
0040
0041
0042 MutableHadronicFinalState();
0043
0044
0045 MutableHadronicFinalState(float sigma, float pT, float gamma);
0046
0047
0048 MutableHadronicFinalState(const MutableHadronicFinalState& other) = default;
0049
0050
0051 MutableHadronicFinalState& operator=(MutableHadronicFinalState other);
0052
0053
0054
0055 MutableHadronicFinalState clone(bool cloneRelations=true) const;
0056
0057
0058 ~MutableHadronicFinalState() = default;
0059
0060
0061 public:
0062
0063
0064 float getSigma() const;
0065
0066
0067 float getPT() const;
0068
0069
0070 float getGamma() const;
0071
0072
0073
0074
0075 void setSigma(float value);
0076
0077 float& getSigma();
0078
0079 [[deprecated("use getSigma instead")]]
0080 float& sigma();
0081
0082
0083 void setPT(float value);
0084
0085 float& getPT();
0086
0087 [[deprecated("use getPT instead")]]
0088 float& pT();
0089
0090
0091 void setGamma(float value);
0092
0093 float& getGamma();
0094
0095 [[deprecated("use getGamma instead")]]
0096 float& gamma();
0097
0098
0099
0100 void addToHadrons(const edm4eic::ReconstructedParticle&);
0101 std::size_t hadrons_size() const;
0102 edm4eic::ReconstructedParticle getHadrons(std::size_t) const;
0103 std::vector<edm4eic::ReconstructedParticle>::const_iterator hadrons_begin() const;
0104 std::vector<edm4eic::ReconstructedParticle>::const_iterator hadrons_end() const;
0105 podio::RelationRange<edm4eic::ReconstructedParticle> getHadrons() const;
0106
0107
0108
0109
0110 bool isAvailable() const;
0111
0112 void unlink() { m_obj = podio::utils::MaybeSharedPtr<HadronicFinalStateObj>{nullptr}; }
0113
0114 bool operator==(const MutableHadronicFinalState& other) const { return m_obj == other.m_obj; }
0115 bool operator==(const HadronicFinalState& other) const;
0116
0117 bool operator!=(const MutableHadronicFinalState& other) const { return !(*this == other); }
0118 bool operator!=(const HadronicFinalState& other) const { return !(*this == other); }
0119
0120
0121 bool operator<(const MutableHadronicFinalState& other) const { return m_obj < other.m_obj; }
0122
0123 podio::ObjectID id() const { return getObjectID(); }
0124
0125 const podio::ObjectID getObjectID() const;
0126
0127 friend void swap(MutableHadronicFinalState& a, MutableHadronicFinalState& b) {
0128 using std::swap;
0129 swap(a.m_obj, b.m_obj);
0130 }
0131
0132 private:
0133
0134 explicit MutableHadronicFinalState(podio::utils::MaybeSharedPtr<HadronicFinalStateObj> obj);
0135
0136 podio::utils::MaybeSharedPtr<HadronicFinalStateObj> m_obj{nullptr};
0137 };
0138
0139 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0140 void to_json(nlohmann::json& j, const MutableHadronicFinalState& value);
0141 #endif
0142
0143
0144 }
0145
0146
0147 #endif