Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-12-04 10:46:36

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