Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:13:01

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_SenseWireHit_H
0004 #define EDM4HEP_SenseWireHit_H
0005 
0006 #include "edm4hep/SenseWireHitObj.h"
0007 
0008 #include "edm4hep/Vector3d.h"
0009 #include "podio/RelationRange.h"
0010 #include <cstdint>
0011 #include <vector>
0012 
0013 #include "podio/detail/OrderKey.h"
0014 #include "podio/utilities/MaybeSharedPtr.h"
0015 
0016 #include <cstdint>
0017 #include <ostream>
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 podio::detail {
0030 // Internal function used in less comparison operators of the datatypes and interface types
0031 OrderKey getOrderKey(const edm4hep::SenseWireHit& obj);
0032 }; // namespace podio::detail
0033 
0034 namespace edm4hep {
0035 
0036 class MutableSenseWireHit;
0037 class SenseWireHitCollection;
0038 class SenseWireHitCollectionData;
0039 
0040 /** @class SenseWireHit
0041  *  Sense wire hit, knowing only the distance to the wire. The circle representing possible positions is parametrized
0042  * with its center, radius and normal vector (given by the wire direction).
0043  *  @author: EDM4hep authors
0044  */
0045 class SenseWireHit {
0046 
0047   friend class MutableSenseWireHit;
0048   friend class SenseWireHitCollection;
0049   friend class edm4hep::SenseWireHitCollectionData;
0050   friend class SenseWireHitCollectionIterator;
0051   friend podio::detail::OrderKey podio::detail::getOrderKey(const SenseWireHit& obj);
0052 
0053 public:
0054   using mutable_type = MutableSenseWireHit;
0055   using collection_type = SenseWireHitCollection;
0056 
0057   /// default constructor
0058   SenseWireHit() = default;
0059 
0060   /// Constructor initializing all members
0061   SenseWireHit(const std::uint64_t cellID, const std::int32_t type, const std::int32_t quality, const float time,
0062                const float eDep, const float eDepError, const float wireStereoAngle, const float wireAzimuthalAngle,
0063                const edm4hep::Vector3d& position, const double positionAlongWireError, const float distanceToWire,
0064                const float distanceToWireError);
0065 
0066   /// copy constructor
0067   SenseWireHit(const SenseWireHit& other) = default;
0068 
0069   /// copy-assignment operator
0070   SenseWireHit& operator=(SenseWireHit other) &; // Rebind this to other's internal object
0071   SenseWireHit&
0072   operator=(SenseWireHit other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0073 
0074   /// create a mutable deep-copy of the object with identical relations
0075   /// if cloneRelations=false, the relations are not cloned and will be empty
0076   MutableSenseWireHit clone(bool cloneRelations = true) const;
0077 
0078   /// destructor
0079   ~SenseWireHit() = default;
0080 
0081   /// converting constructor from mutable object
0082   SenseWireHit(const MutableSenseWireHit& other);
0083 
0084   static SenseWireHit makeEmpty();
0085 
0086 public:
0087   static constexpr std::string_view typeName = "edm4hep::SenseWireHit";
0088 
0089   /// Access the ID of the sensor that created this hit
0090   std::uint64_t getCellID() const;
0091 
0092   /// Access the type of the raw data hit
0093   std::int32_t getType() const;
0094 
0095   /// Access the quality bit flag of the hit
0096   std::int32_t getQuality() const;
0097 
0098   /// Access the time of the hit [ns]
0099   float getTime() const;
0100 
0101   /// Access the energy deposited by the hit [GeV]
0102   float getEDep() const;
0103 
0104   /// Access the error on eDep [GeV]
0105   float getEDepError() const;
0106 
0107   /// Access the angle between the sense wire axis and the drift chamber axis (usually the z-axis) - use it together
0108   /// with wireAzimuthalAngle to get the wire direction
0109   float getWireStereoAngle() const;
0110 
0111   /// Access the azimuthal angle at the middle of the sense wire - use it together with wireStereoAngle to get the wire
0112   /// direction
0113   float getWireAzimuthalAngle() const;
0114 
0115   /// Access the point on the sense wire which is closest to the hit (center of the circle) [mm]
0116   const edm4hep::Vector3d& getPosition() const;
0117 
0118   /// Access the error on the hit position along the wire direction [mm]
0119   double getPositionAlongWireError() const;
0120 
0121   /// Access the distance between the hit and the wire (radius of the circle) [mm]
0122   float getDistanceToWire() const;
0123 
0124   /// Access the error on distanceToWire [mm]
0125   float getDistanceToWireError() const;
0126 
0127   std::size_t nElectrons_size() const;
0128   std::uint16_t getNElectrons(std::size_t) const;
0129   std::vector<std::uint16_t>::const_iterator nElectrons_begin() const;
0130   std::vector<std::uint16_t>::const_iterator nElectrons_end() const;
0131   podio::RelationRange<std::uint16_t> getNElectrons() const;
0132 
0133   /// Return the number of clusters associated to the hit
0134   auto getNClusters() const { return getNElectrons().size(); }
0135 
0136   /// check whether the object is actually available
0137   bool isAvailable() const;
0138   /// disconnect from SenseWireHitObj instance
0139   void unlink() { m_obj = podio::utils::MaybeSharedPtr<SenseWireHitObj>{nullptr}; }
0140 
0141   bool operator==(const SenseWireHit& other) const { return m_obj == other.m_obj; }
0142   bool operator==(const MutableSenseWireHit& other) const;
0143 
0144   bool operator!=(const SenseWireHit& other) const { return !(*this == other); }
0145   bool operator!=(const MutableSenseWireHit& other) const { return !(*this == other); }
0146 
0147   // less comparison operator, so that objects can be e.g. stored in sets.
0148   bool operator<(const SenseWireHit& other) const {
0149     return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0150   }
0151 
0152   podio::ObjectID id() const { return getObjectID(); }
0153 
0154   const podio::ObjectID getObjectID() const;
0155 
0156   friend std::hash<SenseWireHit>;
0157 
0158   friend void swap(SenseWireHit& a, SenseWireHit& b) {
0159     using std::swap;
0160     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0161   }
0162 
0163 private:
0164   /// constructor from existing SenseWireHitObj
0165   explicit SenseWireHit(podio::utils::MaybeSharedPtr<SenseWireHitObj> obj);
0166   SenseWireHit(SenseWireHitObj* obj);
0167 
0168   podio::utils::MaybeSharedPtr<SenseWireHitObj> m_obj{new SenseWireHitObj{}, podio::utils::MarkOwned};
0169 };
0170 
0171 std::ostream& operator<<(std::ostream& o, const SenseWireHit& value);
0172 
0173 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0174 void to_json(nlohmann::json& j, const SenseWireHit& value);
0175 #endif
0176 
0177 } // namespace edm4hep
0178 
0179 template <>
0180 struct std::hash<edm4hep::SenseWireHit> {
0181   std::size_t operator()(const edm4hep::SenseWireHit& obj) const {
0182     return std::hash<edm4hep::SenseWireHitObj*>{}(obj.m_obj.get());
0183   }
0184 };
0185 
0186 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0187 // until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
0188 // and https://github.com/AIDASoft/podio/issues/770
0189 #if defined(__clang__)
0190 #pragma clang diagnostic push
0191 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0192 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0193 #pragma clang diagnostic ignored "-Wdeprecated"
0194 constexpr std::string_view edm4hep::SenseWireHit::typeName;
0195 #pragma clang diagnostic pop
0196 #elif defined(__GNUC__)
0197 #pragma GCC diagnostic push
0198 #pragma GCC diagnostic ignored "-Wdeprecated"
0199 constexpr std::string_view edm4hep::SenseWireHit::typeName;
0200 #pragma GCC diagnostic pop
0201 #endif
0202 
0203 #endif