Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-14 08:50:44

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/detail/OrderKey.h"
0013 #include "podio/utilities/MaybeSharedPtr.h"
0014 
0015 #include <cstdint>
0016 #include <ostream>
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 namespace podio::detail {
0028 // Internal function used in less comparison operators of the datatypes and interface types
0029 OrderKey getOrderKey(const edm4hep::EventHeader& obj);
0030 }; // namespace podio::detail
0031 
0032 namespace edm4hep {
0033 
0034 class MutableEventHeader;
0035 class EventHeaderCollection;
0036 class EventHeaderCollectionData;
0037 
0038 /** @class EventHeader
0039  *  Event Header. Additional parameters are assumed to go into the metadata tree.
0040  *  @author: EDM4hep authors
0041  */
0042 class EventHeader {
0043 
0044   friend class MutableEventHeader;
0045   friend class EventHeaderCollection;
0046   friend class edm4hep::EventHeaderCollectionData;
0047   friend class EventHeaderCollectionIterator;
0048   friend podio::detail::OrderKey podio::detail::getOrderKey(const EventHeader& obj);
0049 
0050 public:
0051   using mutable_type = MutableEventHeader;
0052   using collection_type = EventHeaderCollection;
0053 
0054   /// default constructor
0055   EventHeader();
0056 
0057   /// Constructor initializing all members
0058   EventHeader(std::int32_t eventNumber, std::int32_t runNumber, std::uint64_t timeStamp, double weight);
0059 
0060   /// copy constructor
0061   EventHeader(const EventHeader& other) = default;
0062 
0063   /// copy-assignment operator
0064   EventHeader& operator=(EventHeader other);
0065 
0066   /// create a mutable deep-copy of the object with identical relations
0067   /// if cloneRelations=false, the relations are not cloned and will be empty
0068   MutableEventHeader clone(bool cloneRelations = true) const;
0069 
0070   /// destructor
0071   ~EventHeader() = default;
0072 
0073   /// converting constructor from mutable object
0074   EventHeader(const MutableEventHeader& other);
0075 
0076   static EventHeader makeEmpty();
0077 
0078 public:
0079   static constexpr auto typeName = "edm4hep::EventHeader";
0080 
0081   /// Access the event number
0082   std::int32_t getEventNumber() const;
0083 
0084   /// Access the run number
0085   std::int32_t getRunNumber() const;
0086 
0087   /// Access the time stamp
0088   std::uint64_t getTimeStamp() const;
0089 
0090   /// Access the event weight
0091   double getWeight() const;
0092 
0093   std::size_t weights_size() const;
0094   double getWeights(std::size_t) const;
0095   std::vector<double>::const_iterator weights_begin() const;
0096   std::vector<double>::const_iterator weights_end() const;
0097   podio::RelationRange<double> getWeights() const;
0098 
0099   /// check whether the object is actually available
0100   bool isAvailable() const;
0101   /// disconnect from EventHeaderObj instance
0102   void unlink() {
0103     m_obj = podio::utils::MaybeSharedPtr<EventHeaderObj>{nullptr};
0104   }
0105 
0106   bool operator==(const EventHeader& other) const {
0107     return m_obj == other.m_obj;
0108   }
0109   bool operator==(const MutableEventHeader& other) const;
0110 
0111   bool operator!=(const EventHeader& other) const {
0112     return !(*this == other);
0113   }
0114   bool operator!=(const MutableEventHeader& other) const {
0115     return !(*this == other);
0116   }
0117 
0118   // less comparison operator, so that objects can be e.g. stored in sets.
0119   bool operator<(const EventHeader& 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(EventHeader& a, EventHeader& b) {
0130     using std::swap;
0131     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0132   }
0133 
0134 private:
0135   /// constructor from existing EventHeaderObj
0136   explicit EventHeader(podio::utils::MaybeSharedPtr<EventHeaderObj> obj);
0137   EventHeader(EventHeaderObj* obj);
0138 
0139   podio::utils::MaybeSharedPtr<EventHeaderObj> m_obj{nullptr};
0140 };
0141 
0142 std::ostream& operator<<(std::ostream& o, const EventHeader& value);
0143 
0144 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0145 void to_json(nlohmann::json& j, const EventHeader& value);
0146 #endif
0147 
0148 } // namespace edm4hep
0149 
0150 #endif