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