Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 10:12:01

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_CalorimeterHit_H
0004 #define EDM4EIC_CalorimeterHit_H
0005 
0006 #include "edm4eic/CalorimeterHitObj.h"
0007 
0008 #include "edm4hep/Vector3f.h"
0009 #include <cstdint>
0010 
0011 #include "podio/utilities/MaybeSharedPtr.h"
0012 #include "podio/detail/OrderKey.h"
0013 
0014 #include <ostream>
0015 #include <cstdint>
0016 
0017 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0018 #include "nlohmann/json_fwd.hpp"
0019 #endif
0020 
0021 // forward declarations
0022 namespace edm4eic {
0023 class CalorimeterHitCollection;
0024 }
0025 namespace edm4hep {
0026 class RawCalorimeterHit;
0027 class MutableRawCalorimeterHit;
0028 }
0029 
0030 
0031 namespace podio::detail {
0032 // Internal function used in less comparison operators of the datatypes and interface types
0033 OrderKey getOrderKey(const edm4eic::CalorimeterHit& obj);
0034 };
0035 
0036 namespace edm4eic {
0037 
0038 class MutableCalorimeterHit;
0039 class CalorimeterHitCollection;
0040 class CalorimeterHitCollectionData;
0041 
0042 /** @class CalorimeterHit
0043  *  Calorimeter hit
0044  *  @author: W. Armstrong, S. Joosten
0045  */
0046 class CalorimeterHit {
0047 
0048   friend class MutableCalorimeterHit;
0049   friend class CalorimeterHitCollection;
0050   friend class edm4eic::CalorimeterHitCollectionData;
0051   friend class CalorimeterHitCollectionIterator;
0052   friend podio::detail::OrderKey podio::detail::getOrderKey(const CalorimeterHit & obj);
0053 
0054 public:
0055   using mutable_type = MutableCalorimeterHit;
0056   using collection_type = CalorimeterHitCollection;
0057 
0058   /// default constructor
0059   CalorimeterHit() = default;
0060 
0061   /// Constructor initializing all members
0062   CalorimeterHit(const std::uint64_t cellID, const float energy, const float energyError, const float time, const float timeError, const edm4hep::Vector3f& position, const edm4hep::Vector3f& dimension, const std::int32_t sector, const std::int32_t layer, const edm4hep::Vector3f& local);
0063 
0064   /// copy constructor
0065   CalorimeterHit(const CalorimeterHit& other) = default;
0066 
0067   /// copy-assignment operator
0068   CalorimeterHit& operator=(CalorimeterHit other) &; // Rebind this to other's internal object
0069   CalorimeterHit& operator=(CalorimeterHit other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0070 
0071   /// create a mutable deep-copy of the object with identical relations
0072   /// if cloneRelations=false, the relations are not cloned and will be empty
0073   MutableCalorimeterHit clone(bool cloneRelations=true) const;
0074 
0075   /// destructor
0076   ~CalorimeterHit() = default;
0077 
0078   /// converting constructor from mutable object
0079   CalorimeterHit(const MutableCalorimeterHit& other);
0080 
0081   static CalorimeterHit makeEmpty();
0082 
0083 public:
0084 
0085   static constexpr std::string_view typeName = "edm4eic::CalorimeterHit";
0086 
0087   /// Access the The detector specific (geometrical) cell id.
0088   std::uint64_t getCellID() const;
0089 
0090   /// Access the The energy for this hit in [GeV].
0091   float getEnergy() const;
0092 
0093   /// Access the Error on energy [GeV].
0094   float getEnergyError() const;
0095 
0096   /// Access the The time of the hit in [ns].
0097   float getTime() const;
0098 
0099   /// Access the Error on the time
0100   float getTimeError() const;
0101 
0102   /// Access the The global position of the hit in world coordinates [mm].
0103   const edm4hep::Vector3f& getPosition() const;
0104 
0105   /// Access the The dimension information of the cell [mm].
0106   const edm4hep::Vector3f& getDimension() const;
0107 
0108   /// Access the Sector that this hit occurred in
0109   std::int32_t getSector() const;
0110 
0111   /// Access the Layer that the hit occurred in
0112   std::int32_t getLayer() const;
0113 
0114   /// Access the The local coordinates of the hit in the detector segment [mm].
0115   const edm4hep::Vector3f& getLocal() const;
0116 
0117 
0118   /// Access the Related raw calorimeter hit
0119   const edm4hep::RawCalorimeterHit getRawHit() const;
0120 
0121 
0122 
0123   /// check whether the object is actually available
0124   bool isAvailable() const;
0125   /// disconnect from CalorimeterHitObj instance
0126   void unlink() { m_obj = podio::utils::MaybeSharedPtr<CalorimeterHitObj>{nullptr}; }
0127 
0128   bool operator==(const CalorimeterHit& other) const { return m_obj == other.m_obj; }
0129   bool operator==(const MutableCalorimeterHit& other) const;
0130 
0131   bool operator!=(const CalorimeterHit& other) const { return !(*this == other); }
0132   bool operator!=(const MutableCalorimeterHit& other) const { return !(*this == other); }
0133 
0134   // less comparison operator, so that objects can be e.g. stored in sets.
0135   bool operator<(const CalorimeterHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0136 
0137   podio::ObjectID id() const { return getObjectID(); }
0138 
0139   const podio::ObjectID getObjectID() const;
0140 
0141   friend std::hash<CalorimeterHit>;
0142 
0143   friend void swap(CalorimeterHit& a, CalorimeterHit& b) {
0144     using std::swap;
0145     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0146   }
0147 
0148 private:
0149   /// constructor from existing CalorimeterHitObj
0150   explicit CalorimeterHit(podio::utils::MaybeSharedPtr<CalorimeterHitObj> obj);
0151   CalorimeterHit(CalorimeterHitObj* obj);
0152 
0153   podio::utils::MaybeSharedPtr<CalorimeterHitObj> m_obj{new CalorimeterHitObj{}, podio::utils::MarkOwned};
0154 };
0155 
0156 std::ostream& operator<<(std::ostream& o, const CalorimeterHit& value);
0157 
0158 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0159 void to_json(nlohmann::json& j, const CalorimeterHit& value);
0160 #endif
0161 
0162 
0163 } // namespace edm4eic
0164 
0165 
0166 
0167 template<>
0168 struct std::hash<edm4eic::CalorimeterHit> {
0169   std::size_t operator()(const edm4eic::CalorimeterHit& obj) const {
0170     return std::hash<edm4eic::CalorimeterHitObj*>{}(obj.m_obj.get());
0171   }
0172 };
0173 
0174 
0175 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0176 // until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
0177 // and https://github.com/AIDASoft/podio/issues/770
0178 #if defined(__clang__)
0179   #pragma clang diagnostic push
0180   #pragma clang diagnostic ignored "-Wunknown-warning-option"
0181   #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0182   #pragma clang diagnostic ignored "-Wdeprecated"
0183 constexpr std::string_view edm4eic::CalorimeterHit::typeName;
0184   #pragma clang diagnostic pop
0185 #elif defined(__GNUC__)
0186   #pragma GCC diagnostic push
0187   #pragma GCC diagnostic ignored "-Wdeprecated"
0188 constexpr std::string_view edm4eic::CalorimeterHit::typeName;
0189   #pragma GCC diagnostic pop
0190 #endif
0191 
0192 
0193 #endif