Back to home page

EIC code displayed by LXR

 
 

    


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

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