Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 09:10:51

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_EventHeader_H
0004 #define EDM4HEP_EventHeader_H
0005 
0006 #include "edm4hep/EventHeaderObj.h"
0007 
0008 #include "podio/RelationRange.h"
0009 #include <cstdint>
0010 #include <vector>
0011 
0012 #include "podio/utilities/MaybeSharedPtr.h"
0013 #include "podio/detail/OrderKey.h"
0014 
0015 #include <ostream>
0016 #include <cstdint>
0017 
0018 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0019 #include "nlohmann/json_fwd.hpp"
0020 #endif
0021 
0022 // forward declarations
0023 namespace edm4hep {
0024 class EventHeaderCollection;
0025 }
0026 
0027 
0028 namespace podio::detail {
0029 // Internal function used in less comparison operators of the datatypes and interface types
0030 OrderKey getOrderKey(const edm4hep::EventHeader& obj);
0031 };
0032 
0033 namespace edm4hep {
0034 
0035 class MutableEventHeader;
0036 class EventHeaderCollection;
0037 class EventHeaderCollectionData;
0038 
0039 /** @class EventHeader
0040  *  Event Header. Additional parameters are assumed to go into the metadata tree.
0041  *  @author: EDM4hep authors
0042  */
0043 class EventHeader {
0044 
0045   friend class MutableEventHeader;
0046   friend class EventHeaderCollection;
0047   friend class edm4hep::EventHeaderCollectionData;
0048   friend class EventHeaderCollectionIterator;
0049   friend podio::detail::OrderKey podio::detail::getOrderKey(const EventHeader & obj);
0050 
0051 public:
0052   using mutable_type = MutableEventHeader;
0053   using collection_type = EventHeaderCollection;
0054 
0055   /// default constructor
0056   EventHeader();
0057 
0058   /// Constructor initializing all members
0059   EventHeader(const std::int32_t eventNumber, const std::int32_t runNumber, const std::uint64_t timeStamp, const double weight);
0060 
0061   /// copy constructor
0062   EventHeader(const EventHeader& other) = default;
0063 
0064   /// copy-assignment operator
0065   EventHeader& operator=(EventHeader other) &; // Rebind this to other's internal object
0066   EventHeader& operator=(EventHeader other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0067 
0068   /// create a mutable deep-copy of the object with identical relations
0069   /// if cloneRelations=false, the relations are not cloned and will be empty
0070   MutableEventHeader clone(bool cloneRelations=true) const;
0071 
0072   /// destructor
0073   ~EventHeader() = default;
0074 
0075   /// converting constructor from mutable object
0076   EventHeader(const MutableEventHeader& other);
0077 
0078   static EventHeader makeEmpty();
0079 
0080 public:
0081 
0082   static constexpr std::string_view typeName = "edm4hep::EventHeader";
0083 
0084   /// Access the event number
0085   std::int32_t getEventNumber() const;
0086 
0087   /// Access the run number
0088   std::int32_t getRunNumber() const;
0089 
0090   /// Access the time stamp
0091   std::uint64_t getTimeStamp() const;
0092 
0093   /// Access the event weight
0094   double getWeight() const;
0095 
0096 
0097 
0098   std::size_t weights_size() const;
0099   double getWeights(std::size_t) const;
0100   std::vector<double>::const_iterator weights_begin() const;
0101   std::vector<double>::const_iterator weights_end() const;
0102   podio::RelationRange<double> getWeights() const;
0103 
0104 
0105   /// check whether the object is actually available
0106   bool isAvailable() const;
0107   /// disconnect from EventHeaderObj instance
0108   void unlink() { m_obj = podio::utils::MaybeSharedPtr<EventHeaderObj>{nullptr}; }
0109 
0110   bool operator==(const EventHeader& other) const { return m_obj == other.m_obj; }
0111   bool operator==(const MutableEventHeader& other) const;
0112 
0113   bool operator!=(const EventHeader& other) const { return !(*this == other); }
0114   bool operator!=(const MutableEventHeader& other) const { return !(*this == other); }
0115 
0116   // less comparison operator, so that objects can be e.g. stored in sets.
0117   bool operator<(const EventHeader& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0118 
0119   podio::ObjectID id() const { return getObjectID(); }
0120 
0121   const podio::ObjectID getObjectID() const;
0122 
0123   friend std::hash<EventHeader>;
0124 
0125   friend void swap(EventHeader& a, EventHeader& b) {
0126     using std::swap;
0127     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0128   }
0129 
0130 private:
0131   /// constructor from existing EventHeaderObj
0132   explicit EventHeader(podio::utils::MaybeSharedPtr<EventHeaderObj> obj);
0133   EventHeader(EventHeaderObj* obj);
0134 
0135   podio::utils::MaybeSharedPtr<EventHeaderObj> m_obj{nullptr};
0136 };
0137 
0138 std::ostream& operator<<(std::ostream& o, const EventHeader& value);
0139 
0140 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0141 void to_json(nlohmann::json& j, const EventHeader& value);
0142 #endif
0143 
0144 
0145 } // namespace edm4hep
0146 
0147 
0148 
0149 template<>
0150 struct std::hash<edm4hep::EventHeader> {
0151   std::size_t operator()(const edm4hep::EventHeader& obj) const {
0152     return std::hash<edm4hep::EventHeaderObj*>{}(obj.m_obj.get());
0153   }
0154 };
0155 
0156 
0157 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0158 // until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
0159 // and https://github.com/AIDASoft/podio/issues/770
0160 #if defined(__clang__)
0161 #pragma clang diagnostic push
0162 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0163 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0164 #pragma clang diagnostic ignored "-Wdeprecated"
0165 constexpr std::string_view edm4hep::EventHeader::typeName;
0166 #pragma clang diagnostic pop
0167 #elif defined(__GNUC__)
0168 #pragma GCC diagnostic push
0169 #pragma GCC diagnostic ignored "-Wdeprecated"
0170 constexpr std::string_view edm4hep::EventHeader::typeName;
0171 #pragma GCC diagnostic pop
0172 #endif
0173 
0174 #endif