File indexing completed on 2025-06-03 08:33:24
0001
0002
0003 #ifndef EDM4HEP_MutableGeneratorPdfInfo_H
0004 #define EDM4HEP_MutableGeneratorPdfInfo_H
0005
0006 #include "edm4hep/GeneratorPdfInfoObj.h"
0007
0008 #include "edm4hep/GeneratorPdfInfo.h"
0009
0010 #include <array>
0011
0012 #include "podio/utilities/MaybeSharedPtr.h"
0013
0014 #include <cstdint>
0015
0016 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0017 #include "nlohmann/json_fwd.hpp"
0018 #endif
0019
0020
0021 namespace edm4hep {
0022 class GeneratorPdfInfoCollection;
0023 }
0024
0025 namespace edm4hep {
0026
0027
0028
0029
0030
0031 class MutableGeneratorPdfInfo {
0032
0033 friend class GeneratorPdfInfoCollection;
0034 friend class GeneratorPdfInfoMutableCollectionIterator;
0035 friend class GeneratorPdfInfo;
0036
0037 public:
0038 using object_type = GeneratorPdfInfo;
0039 using collection_type = GeneratorPdfInfoCollection;
0040
0041
0042 MutableGeneratorPdfInfo();
0043
0044
0045 MutableGeneratorPdfInfo(std::array<int, 2> partonId, std::array<int, 2> lhapdfId, std::array<double, 2> x,
0046 std::array<double, 2> xf, double scale);
0047
0048
0049 MutableGeneratorPdfInfo(const MutableGeneratorPdfInfo& other) = default;
0050
0051
0052 MutableGeneratorPdfInfo& operator=(MutableGeneratorPdfInfo other);
0053
0054
0055
0056 MutableGeneratorPdfInfo clone(bool cloneRelations = true) const;
0057
0058
0059 ~MutableGeneratorPdfInfo() = default;
0060
0061 public:
0062
0063 const std::array<int, 2>& getPartonId() const;
0064
0065 int getPartonId(size_t i) const;
0066
0067 const std::array<int, 2>& getLhapdfId() const;
0068
0069 int getLhapdfId(size_t i) const;
0070
0071 const std::array<double, 2>& getX() const;
0072
0073 double getX(size_t i) const;
0074
0075 const std::array<double, 2>& getXf() const;
0076
0077 double getXf(size_t i) const;
0078
0079 double getScale() const;
0080
0081
0082 void setPartonId(std::array<int, 2> value);
0083 void setPartonId(size_t i, int value);
0084
0085 std::array<int, 2>& getPartonId();
0086
0087 [[deprecated("use getPartonId instead")]] std::array<int, 2>& partonId();
0088
0089
0090 void setLhapdfId(std::array<int, 2> value);
0091 void setLhapdfId(size_t i, int value);
0092
0093 std::array<int, 2>& getLhapdfId();
0094
0095 [[deprecated("use getLhapdfId instead")]] std::array<int, 2>& lhapdfId();
0096
0097
0098 void setX(std::array<double, 2> value);
0099 void setX(size_t i, double value);
0100
0101 std::array<double, 2>& getX();
0102
0103 [[deprecated("use getX instead")]] std::array<double, 2>& x();
0104
0105
0106 void setXf(std::array<double, 2> value);
0107 void setXf(size_t i, double value);
0108
0109 std::array<double, 2>& getXf();
0110
0111 [[deprecated("use getXf instead")]] std::array<double, 2>& xf();
0112
0113
0114 void setScale(double value);
0115
0116 double& getScale();
0117
0118 [[deprecated("use getScale instead")]] double& scale();
0119
0120
0121 bool isAvailable() const;
0122
0123 void unlink() {
0124 m_obj = podio::utils::MaybeSharedPtr<GeneratorPdfInfoObj>{nullptr};
0125 }
0126
0127 bool operator==(const MutableGeneratorPdfInfo& other) const {
0128 return m_obj == other.m_obj;
0129 }
0130 bool operator==(const GeneratorPdfInfo& other) const;
0131
0132 bool operator!=(const MutableGeneratorPdfInfo& other) const {
0133 return !(*this == other);
0134 }
0135 bool operator!=(const GeneratorPdfInfo& other) const {
0136 return !(*this == other);
0137 }
0138
0139
0140 bool operator<(const MutableGeneratorPdfInfo& other) const {
0141 return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0142 }
0143
0144 podio::ObjectID id() const {
0145 return getObjectID();
0146 }
0147
0148 const podio::ObjectID getObjectID() const;
0149
0150 friend void swap(MutableGeneratorPdfInfo& a, MutableGeneratorPdfInfo& b) {
0151 using std::swap;
0152 swap(a.m_obj, b.m_obj);
0153 }
0154
0155 private:
0156
0157 explicit MutableGeneratorPdfInfo(podio::utils::MaybeSharedPtr<GeneratorPdfInfoObj> obj);
0158
0159 podio::utils::MaybeSharedPtr<GeneratorPdfInfoObj> m_obj{nullptr};
0160 };
0161
0162 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0163 void to_json(nlohmann::json& j, const MutableGeneratorPdfInfo& value);
0164 #endif
0165
0166 }
0167
0168 #endif