Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_TrackerHit_H
0004 #define EDM4EIC_TrackerHit_H
0005 
0006 #include "edm4eic/TrackerHitObj.h"
0007 
0008 #include "edm4eic/CovDiag3f.h"
0009 #include "edm4hep/Vector3f.h"
0010 #include <cstdint>
0011 
0012 #include "podio/utilities/MaybeSharedPtr.h"
0013 
0014 #include <ostream>
0015 #include <cstdint>
0016 
0017 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0018 #include "nlohmann/json_fwd.hpp"
0019 #endif
0020 
0021 // forward declarations
0022 namespace edm4eic {
0023 class RawTrackerHit;
0024 class MutableRawTrackerHit;
0025 }
0026 
0027 
0028 namespace edm4eic {
0029 
0030 class MutableTrackerHit;
0031 class TrackerHitCollection;
0032 class TrackerHitCollectionData;
0033 
0034 /** @class TrackerHit
0035  *  Tracker hit (reconstructed from Raw)
0036  *  @author: W. Armstrong, S. Joosten
0037  */
0038 class TrackerHit {
0039 
0040   friend class MutableTrackerHit;
0041   friend class TrackerHitCollection;
0042   friend class edm4eic::TrackerHitCollectionData;
0043   friend class TrackerHitCollectionIterator;
0044 
0045 public:
0046   using mutable_type = MutableTrackerHit;
0047   using collection_type = TrackerHitCollection;
0048 
0049   /// default constructor
0050   TrackerHit();
0051 
0052   /// Constructor initializing all members
0053   TrackerHit(std::uint64_t cellID, edm4hep::Vector3f position, edm4eic::CovDiag3f positionError, float time, float timeError, float edep, float edepError);
0054 
0055   /// copy constructor
0056   TrackerHit(const TrackerHit& other) = default;
0057 
0058   /// copy-assignment operator
0059   TrackerHit& operator=(TrackerHit other);
0060 
0061   /// create a mutable deep-copy of the object with identical relations
0062   /// if cloneRelations=false, the relations are not cloned and will be empty
0063   MutableTrackerHit clone(bool cloneRelations=true) const;
0064 
0065   /// destructor
0066   ~TrackerHit() = default;
0067 
0068   /// converting constructor from mutable object
0069   TrackerHit(const MutableTrackerHit& other);
0070 
0071   static TrackerHit makeEmpty();
0072 
0073 public:
0074 
0075   /// Access the The detector specific (geometrical) cell id.
0076   std::uint64_t getCellID() const;
0077 
0078   /// Access the Hit (cell) position [mm]
0079   const edm4hep::Vector3f& getPosition() const;
0080 
0081   /// Access the Covariance Matrix
0082   const edm4eic::CovDiag3f& getPositionError() const;
0083 
0084   /// Access the Hit time [ns]
0085   float getTime() const;
0086 
0087   /// Access the Error on the time
0088   float getTimeError() const;
0089 
0090   /// Access the Energy deposit in this hit [GeV]
0091   float getEdep() const;
0092 
0093   /// Access the Error on the energy deposit [GeV]
0094   float getEdepError() const;
0095 
0096 
0097   /// Access the Related raw tracker hit
0098   const edm4eic::RawTrackerHit getRawHit() const;
0099 
0100 
0101 
0102   /// check whether the object is actually available
0103   bool isAvailable() const;
0104   /// disconnect from TrackerHitObj instance
0105   void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackerHitObj>{nullptr}; }
0106 
0107   bool operator==(const TrackerHit& other) const { return m_obj == other.m_obj; }
0108   bool operator==(const MutableTrackerHit& other) const;
0109 
0110   bool operator!=(const TrackerHit& other) const { return !(*this == other); }
0111   bool operator!=(const MutableTrackerHit& other) const { return !(*this == other); }
0112 
0113   // less comparison operator, so that objects can be e.g. stored in sets.
0114   bool operator<(const TrackerHit& other) const { return m_obj < other.m_obj; }
0115 
0116   podio::ObjectID id() const { return getObjectID(); }
0117 
0118   const podio::ObjectID getObjectID() const;
0119 
0120   friend void swap(TrackerHit& a, TrackerHit& b) {
0121     using std::swap;
0122     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0123   }
0124 
0125 private:
0126   /// constructor from existing TrackerHitObj
0127   explicit TrackerHit(podio::utils::MaybeSharedPtr<TrackerHitObj> obj);
0128   TrackerHit(TrackerHitObj* obj);
0129 
0130   podio::utils::MaybeSharedPtr<TrackerHitObj> m_obj{nullptr};
0131 };
0132 
0133 std::ostream& operator<<(std::ostream& o, const TrackerHit& value);
0134 
0135 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0136 void to_json(nlohmann::json& j, const TrackerHit& value);
0137 #endif
0138 
0139 
0140 } // namespace edm4eic
0141 
0142 
0143 #endif