Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:40

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_TrackerHit_H
0004 #define EDM4HEP_TrackerHit_H
0005 
0006 #include "edm4hep/TrackerHitObj.h"
0007 
0008 #include "edm4hep/ObjectID.h"
0009 #include "edm4hep/Vector3d.h"
0010 #include "podio/RelationRange.h"
0011 #include <array>
0012 #include <cstdint>
0013 #include <vector>
0014 
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 namespace edm4hep {
0025 
0026 class MutableTrackerHit;
0027 class TrackerHitCollection;
0028 class TrackerHitCollectionData;
0029 
0030 /** @class TrackerHit
0031  *  Tracker hit
0032  *  @author: F.Gaede, DESY
0033  */
0034 class TrackerHit {
0035 
0036   friend class MutableTrackerHit;
0037   friend class TrackerHitCollection;
0038   friend class edm4hep::TrackerHitCollectionData;
0039   friend class TrackerHitCollectionIterator;
0040 
0041 public:
0042   using mutable_type = MutableTrackerHit;
0043   using collection_type = TrackerHitCollection;
0044 
0045   /// default constructor
0046   TrackerHit();
0047 
0048   /// Constructor initializing all members
0049   TrackerHit(std::uint64_t cellID, std::int32_t type, std::int32_t quality, float time, float eDep, float eDepError,
0050              edm4hep::Vector3d position, std::array<float, 6> covMatrix);
0051 
0052   /// copy constructor
0053   TrackerHit(const TrackerHit& other) = default;
0054 
0055   /// copy-assignment operator
0056   TrackerHit& operator=(TrackerHit other);
0057 
0058   /// create a mutable deep-copy of the object with identical relations
0059   /// if cloneRelations=false, the relations are not cloned and will be empty
0060   MutableTrackerHit clone(bool cloneRelations = true) const;
0061 
0062   /// destructor
0063   ~TrackerHit() = default;
0064 
0065   /// converting constructor from mutable object
0066   TrackerHit(const MutableTrackerHit& other);
0067 
0068   static TrackerHit makeEmpty();
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 raw data hit, either one of edm4hep::RawTimeSeries, edm4hep::SIMTRACKERHIT - see collection
0075   /// parameters "TrackerHitTypeNames" and "TrackerHitTypeValues".
0076   std::int32_t getType() const;
0077 
0078   /// Access the quality bit flag of the hit.
0079   std::int32_t getQuality() const;
0080 
0081   /// Access the time of the hit [ns].
0082   float getTime() const;
0083 
0084   /// Access the energy deposited on the hit [GeV].
0085   float getEDep() const;
0086 
0087   /// Access the error measured on EDep [GeV].
0088   float getEDepError() const;
0089 
0090   /// Access the hit position in [mm].
0091   const edm4hep::Vector3d& getPosition() const;
0092 
0093   /// Access the covariance of the position (x,y,z), stored as lower triangle matrix. i.e. cov(x,x) , cov(y,x) ,
0094   /// cov(y,y) , cov(z,x) , cov(z,y) , cov(z,z)
0095   const std::array<float, 6>& getCovMatrix() const;
0096   /// Access item i of the covariance of the position (x,y,z), stored as lower triangle matrix. i.e. cov(x,x) , cov(y,x)
0097   /// , cov(y,y) , cov(z,x) , cov(z,y) , cov(z,z)
0098   float getCovMatrix(size_t i) const;
0099 
0100   std::size_t rawHits_size() const;
0101   edm4hep::ObjectID getRawHits(std::size_t) const;
0102   std::vector<edm4hep::ObjectID>::const_iterator rawHits_begin() const;
0103   std::vector<edm4hep::ObjectID>::const_iterator rawHits_end() const;
0104   podio::RelationRange<edm4hep::ObjectID> getRawHits() const;
0105 
0106   /// check whether the object is actually available
0107   bool isAvailable() const;
0108   /// disconnect from TrackerHitObj instance
0109   void unlink() {
0110     m_obj = podio::utils::MaybeSharedPtr<TrackerHitObj>{nullptr};
0111   }
0112 
0113   bool operator==(const TrackerHit& other) const {
0114     return m_obj == other.m_obj;
0115   }
0116   bool operator==(const MutableTrackerHit& other) const;
0117 
0118   bool operator!=(const TrackerHit& other) const {
0119     return !(*this == other);
0120   }
0121   bool operator!=(const MutableTrackerHit& other) const {
0122     return !(*this == other);
0123   }
0124 
0125   // less comparison operator, so that objects can be e.g. stored in sets.
0126   bool operator<(const TrackerHit& other) const {
0127     return m_obj < other.m_obj;
0128   }
0129 
0130   podio::ObjectID id() const {
0131     return getObjectID();
0132   }
0133 
0134   const podio::ObjectID getObjectID() const;
0135 
0136   friend void swap(TrackerHit& a, TrackerHit& b) {
0137     using std::swap;
0138     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0139   }
0140 
0141 private:
0142   /// constructor from existing TrackerHitObj
0143   explicit TrackerHit(podio::utils::MaybeSharedPtr<TrackerHitObj> obj);
0144   TrackerHit(TrackerHitObj* obj);
0145 
0146   podio::utils::MaybeSharedPtr<TrackerHitObj> m_obj{nullptr};
0147 };
0148 
0149 std::ostream& operator<<(std::ostream& o, const TrackerHit& value);
0150 
0151 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0152 void to_json(nlohmann::json& j, const TrackerHit& value);
0153 #endif
0154 
0155 } // namespace edm4hep
0156 
0157 #endif