Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_MutableTrackerHit_H
0004 #define EDM4HEP_MutableTrackerHit_H
0005 
0006 #include "edm4hep/TrackerHitObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4hep/TrackerHit.h"
0009 
0010 #include "edm4hep/ObjectID.h"
0011 #include "edm4hep/Vector3d.h"
0012 #include "podio/RelationRange.h"
0013 #include <array>
0014 #include <cstdint>
0015 #include <vector>
0016 
0017 #include "podio/utilities/MaybeSharedPtr.h"
0018 
0019 #include <cstdint>
0020 
0021 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0022 #include "nlohmann/json_fwd.hpp"
0023 #endif
0024 
0025 namespace edm4hep {
0026 
0027 /** @class MutableTrackerHit
0028  *  Tracker hit
0029  *  @author: F.Gaede, DESY
0030  */
0031 class MutableTrackerHit {
0032 
0033   friend class TrackerHitCollection;
0034   friend class TrackerHitMutableCollectionIterator;
0035   friend class TrackerHit;
0036 
0037 public:
0038   using object_type = TrackerHit;
0039   using collection_type = TrackerHitCollection;
0040 
0041   /// default constructor
0042   MutableTrackerHit();
0043 
0044   /// Constructor initializing all members
0045   MutableTrackerHit(std::uint64_t cellID, std::int32_t type, std::int32_t quality, float time, float eDep,
0046                     float eDepError, edm4hep::Vector3d position, std::array<float, 6> covMatrix);
0047 
0048   /// copy constructor
0049   MutableTrackerHit(const MutableTrackerHit& other) = default;
0050 
0051   /// copy-assignment operator
0052   MutableTrackerHit& operator=(MutableTrackerHit other);
0053 
0054   /// create a mutable deep-copy of the object with identical relations
0055   /// if cloneRelations=false, the relations are not cloned and will be empty
0056   MutableTrackerHit clone(bool cloneRelations = true) const;
0057 
0058   /// destructor
0059   ~MutableTrackerHit() = default;
0060 
0061 public:
0062   /// Access the ID of the sensor that created this hit
0063   std::uint64_t getCellID() const;
0064 
0065   /// Access the type of raw data hit, either one of edm4hep::RawTimeSeries, edm4hep::SIMTRACKERHIT - see collection
0066   /// parameters "TrackerHitTypeNames" and "TrackerHitTypeValues".
0067   std::int32_t getType() const;
0068 
0069   /// Access the quality bit flag of the hit.
0070   std::int32_t getQuality() const;
0071 
0072   /// Access the time of the hit [ns].
0073   float getTime() const;
0074 
0075   /// Access the energy deposited on the hit [GeV].
0076   float getEDep() const;
0077 
0078   /// Access the error measured on EDep [GeV].
0079   float getEDepError() const;
0080 
0081   /// Access the hit position in [mm].
0082   const edm4hep::Vector3d& getPosition() const;
0083 
0084   /// Access the covariance of the position (x,y,z), stored as lower triangle matrix. i.e. cov(x,x) , cov(y,x) ,
0085   /// cov(y,y) , cov(z,x) , cov(z,y) , cov(z,z)
0086   const std::array<float, 6>& getCovMatrix() const;
0087   /// 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)
0088   /// , cov(y,y) , cov(z,x) , cov(z,y) , cov(z,z)
0089   float getCovMatrix(size_t i) const;
0090 
0091   /// Set the ID of the sensor that created this hit
0092   void setCellID(std::uint64_t value);
0093   /// Get mutable reference to ID of the sensor that created this hit
0094   std::uint64_t& getCellID();
0095   /// Get reference to ID of the sensor that created this hit
0096   [[deprecated("use getCellID instead")]] std::uint64_t& cellID();
0097 
0098   /// Set the type of raw data hit, either one of edm4hep::RawTimeSeries, edm4hep::SIMTRACKERHIT - see collection
0099   /// parameters "TrackerHitTypeNames" and "TrackerHitTypeValues".
0100   void setType(std::int32_t value);
0101   /// Get mutable reference to type of raw data hit, either one of edm4hep::RawTimeSeries, edm4hep::SIMTRACKERHIT - see
0102   /// collection parameters "TrackerHitTypeNames" and "TrackerHitTypeValues".
0103   std::int32_t& getType();
0104   /// Get reference to type of raw data hit, either one of edm4hep::RawTimeSeries, edm4hep::SIMTRACKERHIT - see
0105   /// collection parameters "TrackerHitTypeNames" and "TrackerHitTypeValues".
0106   [[deprecated("use getType instead")]] std::int32_t& type();
0107 
0108   /// Set the quality bit flag of the hit.
0109   void setQuality(std::int32_t value);
0110   /// Get mutable reference to quality bit flag of the hit.
0111   std::int32_t& getQuality();
0112   /// Get reference to quality bit flag of the hit.
0113   [[deprecated("use getQuality instead")]] std::int32_t& quality();
0114 
0115   /// Set the time of the hit [ns].
0116   void setTime(float value);
0117   /// Get mutable reference to time of the hit [ns].
0118   float& getTime();
0119   /// Get reference to time of the hit [ns].
0120   [[deprecated("use getTime instead")]] float& time();
0121 
0122   /// Set the energy deposited on the hit [GeV].
0123   void setEDep(float value);
0124   /// Get mutable reference to energy deposited on the hit [GeV].
0125   float& getEDep();
0126   /// Get reference to energy deposited on the hit [GeV].
0127   [[deprecated("use getEDep instead")]] float& eDep();
0128 
0129   /// Set the error measured on EDep [GeV].
0130   void setEDepError(float value);
0131   /// Get mutable reference to error measured on EDep [GeV].
0132   float& getEDepError();
0133   /// Get reference to error measured on EDep [GeV].
0134   [[deprecated("use getEDepError instead")]] float& eDepError();
0135 
0136   /// Set the hit position in [mm].
0137   void setPosition(edm4hep::Vector3d value);
0138   /// Get mutable reference to hit position in [mm].
0139   edm4hep::Vector3d& getPosition();
0140   /// Get reference to hit position in [mm].
0141   [[deprecated("use getPosition instead")]] edm4hep::Vector3d& position();
0142 
0143   /// Set the covariance of the position (x,y,z), stored as lower triangle matrix. i.e. cov(x,x) , cov(y,x) , cov(y,y) ,
0144   /// cov(z,x) , cov(z,y) , cov(z,z)
0145   void setCovMatrix(std::array<float, 6> value);
0146   void setCovMatrix(size_t i, float value);
0147   /// Get mutable reference to covariance of the position (x,y,z), stored as lower triangle matrix. i.e. cov(x,x) ,
0148   /// cov(y,x) , cov(y,y) , cov(z,x) , cov(z,y) , cov(z,z)
0149   std::array<float, 6>& getCovMatrix();
0150   /// Get reference to covariance of the position (x,y,z), stored as lower triangle matrix. i.e. cov(x,x) , cov(y,x) ,
0151   /// cov(y,y) , cov(z,x) , cov(z,y) , cov(z,z)
0152   [[deprecated("use getCovMatrix instead")]] std::array<float, 6>& covMatrix();
0153 
0154   void addToRawHits(const edm4hep::ObjectID&);
0155   std::size_t rawHits_size() const;
0156   edm4hep::ObjectID getRawHits(std::size_t) const;
0157   std::vector<edm4hep::ObjectID>::const_iterator rawHits_begin() const;
0158   std::vector<edm4hep::ObjectID>::const_iterator rawHits_end() const;
0159   podio::RelationRange<edm4hep::ObjectID> getRawHits() const;
0160 
0161   /// check whether the object is actually available
0162   bool isAvailable() const;
0163   /// disconnect from TrackerHitObj instance
0164   void unlink() {
0165     m_obj = podio::utils::MaybeSharedPtr<TrackerHitObj>{nullptr};
0166   }
0167 
0168   bool operator==(const MutableTrackerHit& other) const {
0169     return m_obj == other.m_obj;
0170   }
0171   bool operator==(const TrackerHit& other) const;
0172 
0173   bool operator!=(const MutableTrackerHit& other) const {
0174     return !(*this == other);
0175   }
0176   bool operator!=(const TrackerHit& other) const {
0177     return !(*this == other);
0178   }
0179 
0180   // less comparison operator, so that objects can be e.g. stored in sets.
0181   bool operator<(const MutableTrackerHit& other) const {
0182     return m_obj < other.m_obj;
0183   }
0184 
0185   podio::ObjectID id() const {
0186     return getObjectID();
0187   }
0188 
0189   const podio::ObjectID getObjectID() const;
0190 
0191   friend void swap(MutableTrackerHit& a, MutableTrackerHit& b) {
0192     using std::swap;
0193     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0194   }
0195 
0196 private:
0197   /// constructor from existing TrackerHitObj
0198   explicit MutableTrackerHit(podio::utils::MaybeSharedPtr<TrackerHitObj> obj);
0199 
0200   podio::utils::MaybeSharedPtr<TrackerHitObj> m_obj{nullptr};
0201 };
0202 
0203 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0204 void to_json(nlohmann::json& j, const MutableTrackerHit& value);
0205 #endif
0206 
0207 } // namespace edm4hep
0208 
0209 #endif