Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-13 09:00:20

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