Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_MutableSenseWireHit_H
0004 #define EDM4HEP_MutableSenseWireHit_H
0005 
0006 #include "edm4hep/SenseWireHitObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4hep/SenseWireHit.h"
0009 
0010 #include "edm4hep/Vector3d.h"
0011 #include "podio/RelationRange.h"
0012 #include <cstdint>
0013 #include <vector>
0014 
0015 #include "podio/utilities/MaybeSharedPtr.h"
0016 
0017 #include <cstdint>
0018 
0019 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0020 #include "nlohmann/json_fwd.hpp"
0021 #endif
0022 
0023 // forward declarations
0024 namespace edm4hep {
0025 class SenseWireHitCollection;
0026 class TrackerHit;
0027 } // namespace edm4hep
0028 
0029 namespace edm4hep {
0030 
0031 /** @class MutableSenseWireHit
0032  *  Sense wire hit, knowing only the distance to the wire. The circle representing possible positions is parametrized
0033  * with its center, radius and normal vector (given by the wire direction).
0034  *  @author: EDM4hep authors
0035  */
0036 class MutableSenseWireHit {
0037 
0038   friend class SenseWireHitCollection;
0039   friend class SenseWireHitMutableCollectionIterator;
0040   friend class SenseWireHit;
0041 
0042 public:
0043   using object_type = SenseWireHit;
0044   using collection_type = SenseWireHitCollection;
0045 
0046   /// default constructor
0047   MutableSenseWireHit() = default;
0048 
0049   /// Constructor initializing all members
0050   MutableSenseWireHit(const std::uint64_t cellID, const std::int32_t type, const std::int32_t quality, const float time,
0051                       const float eDep, const float eDepError, const float wireStereoAngle,
0052                       const float wireAzimuthalAngle, const edm4hep::Vector3d& position,
0053                       const double positionAlongWireError, const float distanceToWire, const float distanceToWireError);
0054 
0055   /// copy constructor
0056   MutableSenseWireHit(const MutableSenseWireHit& other) = default;
0057 
0058   /// copy-assignment operator
0059   MutableSenseWireHit& operator=(MutableSenseWireHit other) &; // Rebind this to other's internal object
0060   MutableSenseWireHit&
0061   operator=(MutableSenseWireHit 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   MutableSenseWireHit clone(bool cloneRelations = true) const;
0066 
0067   /// destructor
0068   ~MutableSenseWireHit() = 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 type of the raw data hit
0075   std::int32_t getType() const;
0076 
0077   /// Access the quality bit flag of the hit
0078   std::int32_t getQuality() const;
0079 
0080   /// Access the time of the hit [ns]
0081   float getTime() const;
0082 
0083   /// Access the energy deposited by the hit [GeV]
0084   float getEDep() const;
0085 
0086   /// Access the error on eDep [GeV]
0087   float getEDepError() const;
0088 
0089   /// Access the angle between the sense wire axis and the drift chamber axis (usually the z-axis) - use it together
0090   /// with wireAzimuthalAngle to get the wire direction
0091   float getWireStereoAngle() const;
0092 
0093   /// Access the azimuthal angle at the middle of the sense wire - use it together with wireStereoAngle to get the wire
0094   /// direction
0095   float getWireAzimuthalAngle() const;
0096 
0097   /// Access the point on the sense wire which is closest to the hit (center of the circle) [mm]
0098   const edm4hep::Vector3d& getPosition() const;
0099 
0100   /// Access the error on the hit position along the wire direction [mm]
0101   double getPositionAlongWireError() const;
0102 
0103   /// Access the distance between the hit and the wire (radius of the circle) [mm]
0104   float getDistanceToWire() const;
0105 
0106   /// Access the error on distanceToWire [mm]
0107   float getDistanceToWireError() const;
0108 
0109   /// Set the ID of the sensor that created this hit
0110   void setCellID(const std::uint64_t cellID);
0111   /// Get mutable reference to ID of the sensor that created this hit
0112   std::uint64_t& getCellID();
0113   /// Get reference to ID of the sensor that created this hit
0114   [[deprecated("use getCellID instead")]] std::uint64_t& cellID();
0115 
0116   /// Set the type of the raw data hit
0117   void setType(const std::int32_t type);
0118   /// Get mutable reference to type of the raw data hit
0119   std::int32_t& getType();
0120   /// Get reference to type of the raw data hit
0121   [[deprecated("use getType instead")]] std::int32_t& type();
0122 
0123   /// Set the quality bit flag of the hit
0124   void setQuality(const std::int32_t quality);
0125   /// Get mutable reference to quality bit flag of the hit
0126   std::int32_t& getQuality();
0127   /// Get reference to quality bit flag of the hit
0128   [[deprecated("use getQuality instead")]] std::int32_t& quality();
0129 
0130   /// Set the time of the hit [ns]
0131   void setTime(const float time);
0132   /// Get mutable reference to time of the hit [ns]
0133   float& getTime();
0134   /// Get reference to time of the hit [ns]
0135   [[deprecated("use getTime instead")]] float& time();
0136 
0137   /// Set the energy deposited by the hit [GeV]
0138   void setEDep(const float eDep);
0139   /// Get mutable reference to energy deposited by the hit [GeV]
0140   float& getEDep();
0141   /// Get reference to energy deposited by the hit [GeV]
0142   [[deprecated("use getEDep instead")]] float& eDep();
0143 
0144   /// Set the error on eDep [GeV]
0145   void setEDepError(const float eDepError);
0146   /// Get mutable reference to error on eDep [GeV]
0147   float& getEDepError();
0148   /// Get reference to error on eDep [GeV]
0149   [[deprecated("use getEDepError instead")]] float& eDepError();
0150 
0151   /// Set the angle between the sense wire axis and the drift chamber axis (usually the z-axis) - use it together with
0152   /// wireAzimuthalAngle to get the wire direction
0153   void setWireStereoAngle(const float wireStereoAngle);
0154   /// Get mutable reference to angle between the sense wire axis and the drift chamber axis (usually the z-axis) - use
0155   /// it together with wireAzimuthalAngle to get the wire direction
0156   float& getWireStereoAngle();
0157   /// Get reference to angle between the sense wire axis and the drift chamber axis (usually the z-axis) - use it
0158   /// together with wireAzimuthalAngle to get the wire direction
0159   [[deprecated("use getWireStereoAngle instead")]] float& wireStereoAngle();
0160 
0161   /// Set the azimuthal angle at the middle of the sense wire - use it together with wireStereoAngle to get the wire
0162   /// direction
0163   void setWireAzimuthalAngle(const float wireAzimuthalAngle);
0164   /// Get mutable reference to azimuthal angle at the middle of the sense wire - use it together with wireStereoAngle to
0165   /// get the wire direction
0166   float& getWireAzimuthalAngle();
0167   /// Get reference to azimuthal angle at the middle of the sense wire - use it together with wireStereoAngle to get the
0168   /// wire direction
0169   [[deprecated("use getWireAzimuthalAngle instead")]] float& wireAzimuthalAngle();
0170 
0171   /// Set the point on the sense wire which is closest to the hit (center of the circle) [mm]
0172   void setPosition(const edm4hep::Vector3d& position);
0173   /// Get mutable reference to point on the sense wire which is closest to the hit (center of the circle) [mm]
0174   edm4hep::Vector3d& getPosition();
0175   /// Get reference to point on the sense wire which is closest to the hit (center of the circle) [mm]
0176   [[deprecated("use getPosition instead")]] edm4hep::Vector3d& position();
0177 
0178   /// Set the error on the hit position along the wire direction [mm]
0179   void setPositionAlongWireError(const double positionAlongWireError);
0180   /// Get mutable reference to error on the hit position along the wire direction [mm]
0181   double& getPositionAlongWireError();
0182   /// Get reference to error on the hit position along the wire direction [mm]
0183   [[deprecated("use getPositionAlongWireError instead")]] double& positionAlongWireError();
0184 
0185   /// Set the distance between the hit and the wire (radius of the circle) [mm]
0186   void setDistanceToWire(const float distanceToWire);
0187   /// Get mutable reference to distance between the hit and the wire (radius of the circle) [mm]
0188   float& getDistanceToWire();
0189   /// Get reference to distance between the hit and the wire (radius of the circle) [mm]
0190   [[deprecated("use getDistanceToWire instead")]] float& distanceToWire();
0191 
0192   /// Set the error on distanceToWire [mm]
0193   void setDistanceToWireError(const float distanceToWireError);
0194   /// Get mutable reference to error on distanceToWire [mm]
0195   float& getDistanceToWireError();
0196   /// Get reference to error on distanceToWire [mm]
0197   [[deprecated("use getDistanceToWireError instead")]] float& distanceToWireError();
0198 
0199   void addToNElectrons(const std::uint16_t&);
0200   std::size_t nElectrons_size() const;
0201   std::uint16_t getNElectrons(std::size_t) const;
0202   std::vector<std::uint16_t>::const_iterator nElectrons_begin() const;
0203   std::vector<std::uint16_t>::const_iterator nElectrons_end() const;
0204   podio::RelationRange<std::uint16_t> getNElectrons() const;
0205 
0206   /// Return the number of clusters associated to the hit
0207   auto getNClusters() const { return getNElectrons().size(); }
0208 
0209   /// check whether the object is actually available
0210   bool isAvailable() const;
0211   /// disconnect from SenseWireHitObj instance
0212   void unlink() { m_obj = podio::utils::MaybeSharedPtr<SenseWireHitObj>{nullptr}; }
0213 
0214   bool operator==(const MutableSenseWireHit& other) const { return m_obj == other.m_obj; }
0215   bool operator==(const SenseWireHit& other) const;
0216 
0217   bool operator!=(const MutableSenseWireHit& other) const { return !(*this == other); }
0218   bool operator!=(const SenseWireHit& other) const { return !(*this == other); }
0219 
0220   // less comparison operator, so that objects can be e.g. stored in sets.
0221   bool operator<(const MutableSenseWireHit& other) const {
0222     return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0223   }
0224 
0225   podio::ObjectID id() const { return getObjectID(); }
0226 
0227   const podio::ObjectID getObjectID() const;
0228 
0229   friend std::hash<MutableSenseWireHit>;
0230 
0231   friend void swap(MutableSenseWireHit& a, MutableSenseWireHit& b) {
0232     using std::swap;
0233     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0234   }
0235 
0236 private:
0237   /// constructor from existing SenseWireHitObj
0238   explicit MutableSenseWireHit(podio::utils::MaybeSharedPtr<SenseWireHitObj> obj);
0239 
0240   podio::utils::MaybeSharedPtr<SenseWireHitObj> m_obj{new SenseWireHitObj{}, podio::utils::MarkOwned};
0241 };
0242 
0243 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0244 void to_json(nlohmann::json& j, const MutableSenseWireHit& value);
0245 #endif
0246 
0247 } // namespace edm4hep
0248 
0249 template <>
0250 struct std::hash<edm4hep::MutableSenseWireHit> {
0251   std::size_t operator()(const edm4hep::MutableSenseWireHit& obj) const {
0252     return std::hash<edm4hep::SenseWireHitObj*>{}(obj.m_obj.get());
0253   }
0254 };
0255 
0256 #endif