Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 08:53:25

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