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