Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/edm4hep/SimTrackerHit.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_SimTrackerHit_H
0004 #define EDM4HEP_SimTrackerHit_H
0005 
0006 #include "edm4hep/SimTrackerHitObj.h"
0007 
0008 #include "edm4hep/Vector3d.h"
0009 #include "edm4hep/Vector3f.h"
0010 #include <cmath>
0011 #include <cstdint>
0012 #include <edm4hep/MCParticle.h>
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 SimTrackerHitCollection;
0027 class MCParticle;
0028 class MutableMCParticle;
0029 } // namespace edm4hep
0030 
0031 namespace podio::detail {
0032 // Internal function used in less comparison operators of the datatypes and interface types
0033 OrderKey getOrderKey(const edm4hep::SimTrackerHit& obj);
0034 }; // namespace podio::detail
0035 
0036 namespace edm4hep {
0037 
0038 class MutableSimTrackerHit;
0039 class SimTrackerHitCollection;
0040 class SimTrackerHitCollectionData;
0041 
0042 /** @class SimTrackerHit
0043  *  Simulated tracker hit
0044  *  @author: EDM4hep authors
0045  */
0046 class SimTrackerHit {
0047 
0048   friend class MutableSimTrackerHit;
0049   friend class SimTrackerHitCollection;
0050   friend class edm4hep::SimTrackerHitCollectionData;
0051   friend class SimTrackerHitCollectionIterator;
0052   friend podio::detail::OrderKey podio::detail::getOrderKey(const SimTrackerHit& obj);
0053 
0054 public:
0055   using mutable_type = MutableSimTrackerHit;
0056   using collection_type = SimTrackerHitCollection;
0057 
0058   /// default constructor
0059   SimTrackerHit() = default;
0060 
0061   /// Constructor initializing all members
0062   SimTrackerHit(const std::uint64_t cellID, const float eDep, const float time, const float pathLength,
0063                 const std::int32_t quality, const edm4hep::Vector3d& position, const edm4hep::Vector3f& momentum);
0064 
0065   /// copy constructor
0066   SimTrackerHit(const SimTrackerHit& other) = default;
0067 
0068   /// copy-assignment operator
0069   SimTrackerHit& operator=(SimTrackerHit other) &; // Rebind this to other's internal object
0070   SimTrackerHit&
0071   operator=(SimTrackerHit other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0072 
0073   /// create a mutable deep-copy of the object with identical relations
0074   /// if cloneRelations=false, the relations are not cloned and will be empty
0075   MutableSimTrackerHit clone(bool cloneRelations = true) const;
0076 
0077   /// destructor
0078   ~SimTrackerHit() = default;
0079 
0080   /// converting constructor from mutable object
0081   SimTrackerHit(const MutableSimTrackerHit& other);
0082 
0083   static SimTrackerHit makeEmpty();
0084 
0085 public:
0086   static constexpr std::string_view typeName = "edm4hep::SimTrackerHit";
0087 
0088   /// Access the ID of the sensor that created this hit
0089   std::uint64_t getCellID() const;
0090 
0091   /// Access the energy deposited in the hit [GeV]
0092   float getEDep() const;
0093 
0094   /// Access the proper time of the hit in the lab frame [ns]
0095   float getTime() const;
0096 
0097   /// Access the path length of the particle in the sensitive material that resulted in this hit
0098   float getPathLength() const;
0099 
0100   /// Access the quality bit flag
0101   std::int32_t getQuality() const;
0102 
0103   /// Access the the hit position [mm]
0104   const edm4hep::Vector3d& getPosition() const;
0105 
0106   /// Access the the 3-momentum of the particle at the hits position [GeV]
0107   const edm4hep::Vector3f& getMomentum() const;
0108 
0109   /// Access the MCParticle that caused the hit
0110   const edm4hep::MCParticle getParticle() const;
0111 
0112   static const int BITOverlay = 31;
0113   static const int BITProducedBySecondary = 30;
0114   bool isOverlay() const { return getQuality() & (1 << BITOverlay); }
0115   bool isProducedBySecondary() const { return getQuality() & (1 << BITProducedBySecondary); }
0116   double x() const { return getPosition()[0]; }
0117   double y() const { return getPosition()[1]; }
0118   double z() const { return getPosition()[2]; }
0119   double rho() const { return std::hypot(x(), y()); }
0120 
0121   /// check whether the object is actually available
0122   bool isAvailable() const;
0123   /// disconnect from SimTrackerHitObj instance
0124   void unlink() { m_obj = podio::utils::MaybeSharedPtr<SimTrackerHitObj>{nullptr}; }
0125 
0126   bool operator==(const SimTrackerHit& other) const { return m_obj == other.m_obj; }
0127   bool operator==(const MutableSimTrackerHit& other) const;
0128 
0129   bool operator!=(const SimTrackerHit& other) const { return !(*this == other); }
0130   bool operator!=(const MutableSimTrackerHit& other) const { return !(*this == other); }
0131 
0132   // less comparison operator, so that objects can be e.g. stored in sets.
0133   bool operator<(const SimTrackerHit& other) const {
0134     return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0135   }
0136 
0137   podio::ObjectID id() const { return getObjectID(); }
0138 
0139   const podio::ObjectID getObjectID() const;
0140 
0141   friend std::hash<SimTrackerHit>;
0142 
0143   friend void swap(SimTrackerHit& a, SimTrackerHit& 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 SimTrackerHitObj
0150   explicit SimTrackerHit(podio::utils::MaybeSharedPtr<SimTrackerHitObj> obj);
0151   SimTrackerHit(SimTrackerHitObj* obj);
0152 
0153   podio::utils::MaybeSharedPtr<SimTrackerHitObj> m_obj{new SimTrackerHitObj{}, podio::utils::MarkOwned};
0154 };
0155 
0156 std::ostream& operator<<(std::ostream& o, const SimTrackerHit& value);
0157 
0158 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0159 void to_json(nlohmann::json& j, const SimTrackerHit& value);
0160 #endif
0161 
0162 } // namespace edm4hep
0163 
0164 template <>
0165 struct std::hash<edm4hep::SimTrackerHit> {
0166   std::size_t operator()(const edm4hep::SimTrackerHit& obj) const {
0167     return std::hash<edm4hep::SimTrackerHitObj*>{}(obj.m_obj.get());
0168   }
0169 };
0170 
0171 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0172 // until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
0173 // and https://github.com/AIDASoft/podio/issues/770
0174 #if defined(__clang__)
0175 #pragma clang diagnostic push
0176 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0177 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0178 #pragma clang diagnostic ignored "-Wdeprecated"
0179 constexpr std::string_view edm4hep::SimTrackerHit::typeName;
0180 #pragma clang diagnostic pop
0181 #elif defined(__GNUC__)
0182 #pragma GCC diagnostic push
0183 #pragma GCC diagnostic ignored "-Wdeprecated"
0184 constexpr std::string_view edm4hep::SimTrackerHit::typeName;
0185 #pragma GCC diagnostic pop
0186 #endif
0187 
0188 #endif