File indexing completed on 2025-06-03 08:33:23
0001
0002
0003 #ifndef EDM4HEP_GeneratorPdfInfo_H
0004 #define EDM4HEP_GeneratorPdfInfo_H
0005
0006 #include "edm4hep/GeneratorPdfInfoObj.h"
0007
0008 #include <array>
0009
0010 #include "podio/detail/OrderKey.h"
0011 #include "podio/utilities/MaybeSharedPtr.h"
0012
0013 #include <cstdint>
0014 #include <ostream>
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 podio::detail {
0026
0027 OrderKey getOrderKey(const edm4hep::GeneratorPdfInfo& obj);
0028 };
0029
0030 namespace edm4hep {
0031
0032 class MutableGeneratorPdfInfo;
0033 class GeneratorPdfInfoCollection;
0034 class GeneratorPdfInfoCollectionData;
0035
0036
0037
0038
0039
0040 class GeneratorPdfInfo {
0041
0042 friend class MutableGeneratorPdfInfo;
0043 friend class GeneratorPdfInfoCollection;
0044 friend class edm4hep::GeneratorPdfInfoCollectionData;
0045 friend class GeneratorPdfInfoCollectionIterator;
0046 friend podio::detail::OrderKey podio::detail::getOrderKey(const GeneratorPdfInfo& obj);
0047
0048 public:
0049 using mutable_type = MutableGeneratorPdfInfo;
0050 using collection_type = GeneratorPdfInfoCollection;
0051
0052
0053 GeneratorPdfInfo();
0054
0055
0056 GeneratorPdfInfo(std::array<int, 2> partonId, std::array<int, 2> lhapdfId, std::array<double, 2> x,
0057 std::array<double, 2> xf, double scale);
0058
0059
0060 GeneratorPdfInfo(const GeneratorPdfInfo& other) = default;
0061
0062
0063 GeneratorPdfInfo& operator=(GeneratorPdfInfo other);
0064
0065
0066
0067 MutableGeneratorPdfInfo clone(bool cloneRelations = true) const;
0068
0069
0070 ~GeneratorPdfInfo() = default;
0071
0072
0073 GeneratorPdfInfo(const MutableGeneratorPdfInfo& other);
0074
0075 static GeneratorPdfInfo makeEmpty();
0076
0077 public:
0078 static constexpr auto typeName = "edm4hep::GeneratorPdfInfo";
0079
0080
0081 const std::array<int, 2>& getPartonId() const;
0082
0083 int getPartonId(size_t i) const;
0084
0085 const std::array<int, 2>& getLhapdfId() const;
0086
0087 int getLhapdfId(size_t i) const;
0088
0089 const std::array<double, 2>& getX() const;
0090
0091 double getX(size_t i) const;
0092
0093 const std::array<double, 2>& getXf() const;
0094
0095 double getXf(size_t i) const;
0096
0097 double getScale() const;
0098
0099
0100 bool isAvailable() const;
0101
0102 void unlink() {
0103 m_obj = podio::utils::MaybeSharedPtr<GeneratorPdfInfoObj>{nullptr};
0104 }
0105
0106 bool operator==(const GeneratorPdfInfo& other) const {
0107 return m_obj == other.m_obj;
0108 }
0109 bool operator==(const MutableGeneratorPdfInfo& other) const;
0110
0111 bool operator!=(const GeneratorPdfInfo& other) const {
0112 return !(*this == other);
0113 }
0114 bool operator!=(const MutableGeneratorPdfInfo& other) const {
0115 return !(*this == other);
0116 }
0117
0118
0119 bool operator<(const GeneratorPdfInfo& other) const {
0120 return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0121 }
0122
0123 podio::ObjectID id() const {
0124 return getObjectID();
0125 }
0126
0127 const podio::ObjectID getObjectID() const;
0128
0129 friend void swap(GeneratorPdfInfo& a, GeneratorPdfInfo& b) {
0130 using std::swap;
0131 swap(a.m_obj, b.m_obj);
0132 }
0133
0134 private:
0135
0136 explicit GeneratorPdfInfo(podio::utils::MaybeSharedPtr<GeneratorPdfInfoObj> obj);
0137 GeneratorPdfInfo(GeneratorPdfInfoObj* obj);
0138
0139 podio::utils::MaybeSharedPtr<GeneratorPdfInfoObj> m_obj{nullptr};
0140 };
0141
0142 std::ostream& operator<<(std::ostream& o, const GeneratorPdfInfo& value);
0143
0144 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0145 void to_json(nlohmann::json& j, const GeneratorPdfInfo& value);
0146 #endif
0147
0148 }
0149
0150 #endif