Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/edm4hep/MutableSimTrackerHit.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_MutableSimTrackerHit_H
0004 #define EDM4HEP_MutableSimTrackerHit_H
0005 
0006 #include "edm4hep/SimTrackerHitObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4hep/SimTrackerHit.h"
0009 
0010 #include "edm4hep/Vector3d.h"
0011 #include "edm4hep/Vector3f.h"
0012 #include <cmath>
0013 #include <cstdint>
0014 #include <edm4hep/MCParticle.h>
0015 
0016 #include "podio/utilities/MaybeSharedPtr.h"
0017 
0018 #include <cstdint>
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 edm4hep {
0032 
0033 /** @class MutableSimTrackerHit
0034  *  Simulated tracker hit
0035  *  @author: EDM4hep authors
0036  */
0037 class MutableSimTrackerHit {
0038 
0039   friend class SimTrackerHitCollection;
0040   friend class SimTrackerHitMutableCollectionIterator;
0041   friend class SimTrackerHit;
0042 
0043 public:
0044   using object_type = SimTrackerHit;
0045   using collection_type = SimTrackerHitCollection;
0046 
0047   /// default constructor
0048   MutableSimTrackerHit() = default;
0049 
0050   /// Constructor initializing all members
0051   MutableSimTrackerHit(const std::uint64_t cellID, const float eDep, const float time, const float pathLength,
0052                        const std::int32_t quality, const edm4hep::Vector3d& position,
0053                        const edm4hep::Vector3f& momentum);
0054 
0055   /// copy constructor
0056   MutableSimTrackerHit(const MutableSimTrackerHit& other) = default;
0057 
0058   /// copy-assignment operator
0059   MutableSimTrackerHit& operator=(MutableSimTrackerHit other) &; // Rebind this to other's internal object
0060   MutableSimTrackerHit&
0061   operator=(MutableSimTrackerHit other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0062 
0063   /// create a mutable deep-copy of the object with identical relations
0064   /// if cloneRelations=false, the relations are not cloned and will be empty
0065   MutableSimTrackerHit clone(bool cloneRelations = true) const;
0066 
0067   /// destructor
0068   ~MutableSimTrackerHit() = default;
0069 
0070 public:
0071   /// Access the ID of the sensor that created this hit
0072   std::uint64_t getCellID() const;
0073 
0074   /// Access the energy deposited in the hit [GeV]
0075   float getEDep() const;
0076 
0077   /// Access the proper time of the hit in the lab frame [ns]
0078   float getTime() const;
0079 
0080   /// Access the path length of the particle in the sensitive material that resulted in this hit
0081   float getPathLength() const;
0082 
0083   /// Access the quality bit flag
0084   std::int32_t getQuality() const;
0085 
0086   /// Access the the hit position [mm]
0087   const edm4hep::Vector3d& getPosition() const;
0088 
0089   /// Access the the 3-momentum of the particle at the hits position [GeV]
0090   const edm4hep::Vector3f& getMomentum() const;
0091 
0092   /// Access the MCParticle that caused the hit
0093   const edm4hep::MCParticle getParticle() const;
0094 
0095   /// Set the ID of the sensor that created this hit
0096   void setCellID(const std::uint64_t cellID);
0097   /// Get mutable reference to ID of the sensor that created this hit
0098   std::uint64_t& getCellID();
0099   /// Get reference to ID of the sensor that created this hit
0100   [[deprecated("use getCellID instead")]] std::uint64_t& cellID();
0101 
0102   /// Set the energy deposited in the hit [GeV]
0103   void setEDep(const float eDep);
0104   /// Get mutable reference to energy deposited in the hit [GeV]
0105   float& getEDep();
0106   /// Get reference to energy deposited in the hit [GeV]
0107   [[deprecated("use getEDep instead")]] float& eDep();
0108 
0109   /// Set the proper time of the hit in the lab frame [ns]
0110   void setTime(const float time);
0111   /// Get mutable reference to proper time of the hit in the lab frame [ns]
0112   float& getTime();
0113   /// Get reference to proper time of the hit in the lab frame [ns]
0114   [[deprecated("use getTime instead")]] float& time();
0115 
0116   /// Set the path length of the particle in the sensitive material that resulted in this hit
0117   void setPathLength(const float pathLength);
0118   /// Get mutable reference to path length of the particle in the sensitive material that resulted in this hit
0119   float& getPathLength();
0120   /// Get reference to path length of the particle in the sensitive material that resulted in this hit
0121   [[deprecated("use getPathLength instead")]] float& pathLength();
0122 
0123   /// Set the quality bit flag
0124   void setQuality(const std::int32_t quality);
0125   /// Get mutable reference to quality bit flag
0126   std::int32_t& getQuality();
0127   /// Get reference to quality bit flag
0128   [[deprecated("use getQuality instead")]] std::int32_t& quality();
0129 
0130   /// Set the the hit position [mm]
0131   void setPosition(const edm4hep::Vector3d& position);
0132   /// Get mutable reference to the hit position [mm]
0133   edm4hep::Vector3d& getPosition();
0134   /// Get reference to the hit position [mm]
0135   [[deprecated("use getPosition instead")]] edm4hep::Vector3d& position();
0136 
0137   /// Set the the 3-momentum of the particle at the hits position [GeV]
0138   void setMomentum(const edm4hep::Vector3f& momentum);
0139   /// Get mutable reference to the 3-momentum of the particle at the hits position [GeV]
0140   edm4hep::Vector3f& getMomentum();
0141   /// Get reference to the 3-momentum of the particle at the hits position [GeV]
0142   [[deprecated("use getMomentum instead")]] edm4hep::Vector3f& momentum();
0143 
0144   /// Set the MCParticle that caused the hit
0145   void setParticle(const edm4hep::MCParticle& value);
0146 
0147   static const int BITOverlay = 31;
0148   static const int BITProducedBySecondary = 30;
0149   bool isOverlay() const { return getQuality() & (1 << BITOverlay); }
0150   bool isProducedBySecondary() const { return getQuality() & (1 << BITProducedBySecondary); }
0151   double x() const { return getPosition()[0]; }
0152   double y() const { return getPosition()[1]; }
0153   double z() const { return getPosition()[2]; }
0154   double rho() const { return std::hypot(x(), y()); }
0155 
0156   int32_t set_bit(int32_t val, int num, bool bitval) { return (val & ~(1 << num)) | (bitval << num); }
0157   void setOverlay(bool val) { setQuality(set_bit(getQuality(), BITOverlay, val)); }
0158   void setProducedBySecondary(bool val) { setQuality(set_bit(getQuality(), BITProducedBySecondary, val)); }
0159 
0160   /// check whether the object is actually available
0161   bool isAvailable() const;
0162   /// disconnect from SimTrackerHitObj instance
0163   void unlink() { m_obj = podio::utils::MaybeSharedPtr<SimTrackerHitObj>{nullptr}; }
0164 
0165   bool operator==(const MutableSimTrackerHit& other) const { return m_obj == other.m_obj; }
0166   bool operator==(const SimTrackerHit& other) const;
0167 
0168   bool operator!=(const MutableSimTrackerHit& other) const { return !(*this == other); }
0169   bool operator!=(const SimTrackerHit& other) const { return !(*this == other); }
0170 
0171   // less comparison operator, so that objects can be e.g. stored in sets.
0172   bool operator<(const MutableSimTrackerHit& other) const {
0173     return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0174   }
0175 
0176   podio::ObjectID id() const { return getObjectID(); }
0177 
0178   const podio::ObjectID getObjectID() const;
0179 
0180   friend std::hash<MutableSimTrackerHit>;
0181 
0182   friend void swap(MutableSimTrackerHit& a, MutableSimTrackerHit& b) {
0183     using std::swap;
0184     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0185   }
0186 
0187 private:
0188   /// constructor from existing SimTrackerHitObj
0189   explicit MutableSimTrackerHit(podio::utils::MaybeSharedPtr<SimTrackerHitObj> obj);
0190 
0191   podio::utils::MaybeSharedPtr<SimTrackerHitObj> m_obj{new SimTrackerHitObj{}, podio::utils::MarkOwned};
0192 };
0193 
0194 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0195 void to_json(nlohmann::json& j, const MutableSimTrackerHit& value);
0196 #endif
0197 
0198 } // namespace edm4hep
0199 
0200 template <>
0201 struct std::hash<edm4hep::MutableSimTrackerHit> {
0202   std::size_t operator()(const edm4hep::MutableSimTrackerHit& obj) const {
0203     return std::hash<edm4hep::SimTrackerHitObj*>{}(obj.m_obj.get());
0204   }
0205 };
0206 
0207 #endif