Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-03 08:34:33

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_MutableTrack_H
0004 #define EDM4EIC_MutableTrack_H
0005 
0006 #include "edm4eic/TrackObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4eic/Track.h"
0009 
0010 #include "edm4eic/Cov6f.h"
0011 #include "edm4eic/Measurement2D.h"
0012 #include "edm4hep/Vector3f.h"
0013 #include "podio/RelationRange.h"
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 // forward declarations
0026 namespace edm4eic {
0027 class TrackCollection;
0028 class Trajectory;
0029 class MutableTrajectory;
0030 }
0031 
0032 
0033 namespace edm4eic {
0034 
0035 
0036 /** @class MutableTrack
0037  *  Track information at the vertex
0038  *  @author: S. Joosten, J. Osborn
0039  */
0040 class MutableTrack {
0041 
0042   friend class TrackCollection;
0043   friend class TrackMutableCollectionIterator;
0044   friend class Track;
0045 
0046 public:
0047   using object_type = Track;
0048   using collection_type = TrackCollection;
0049 
0050   /// default constructor
0051   MutableTrack();
0052 
0053   /// Constructor initializing all members
0054   MutableTrack(std::int32_t type, edm4hep::Vector3f position, edm4hep::Vector3f momentum, edm4eic::Cov6f positionMomentumCovariance, float time, float timeError, float charge, float chi2, std::uint32_t ndf, std::int32_t pdg);
0055 
0056   /// copy constructor
0057   MutableTrack(const MutableTrack& other) = default;
0058 
0059   /// copy-assignment operator
0060   MutableTrack& operator=(MutableTrack other);
0061 
0062   /// create a mutable deep-copy of the object with identical relations
0063   /// if cloneRelations=false, the relations are not cloned and will be empty
0064   MutableTrack clone(bool cloneRelations=true) const;
0065 
0066   /// destructor
0067   ~MutableTrack() = default;
0068 
0069 
0070 public:
0071 
0072   /// Access the Flag that defines the type of track
0073   std::int32_t getType() const;
0074 
0075   /// Access the Track 3-position at the vertex
0076   const edm4hep::Vector3f& getPosition() const;
0077 
0078   /// Access the Track 3-momentum at the vertex [GeV]
0079   const edm4hep::Vector3f& getMomentum() const;
0080 
0081   /// Access the Covariance matrix in basis [x,y,z,px,py,pz]
0082   const edm4eic::Cov6f& getPositionMomentumCovariance() const;
0083 
0084   /// Access the Track time at the vertex [ns]
0085   float getTime() const;
0086 
0087   /// Access the Error on the track vertex time
0088   float getTimeError() const;
0089 
0090   /// Access the Particle charge
0091   float getCharge() const;
0092 
0093   /// Access the Total chi2
0094   float getChi2() const;
0095 
0096   /// Access the Number of degrees of freedom
0097   std::uint32_t getNdf() const;
0098 
0099   /// Access the PDG particle ID hypothesis
0100   std::int32_t getPdg() const;
0101 
0102 
0103   /// Access the Trajectory of this track
0104   const edm4eic::Trajectory getTrajectory() const;
0105 
0106   /// Set the Flag that defines the type of track
0107   void setType(std::int32_t value);
0108   /// Get mutable reference to Flag that defines the type of track
0109   std::int32_t& getType();
0110   /// Get reference to Flag that defines the type of track
0111   [[deprecated("use getType instead")]]
0112   std::int32_t& type();
0113 
0114   /// Set the Track 3-position at the vertex
0115   void setPosition(edm4hep::Vector3f value);
0116   /// Get mutable reference to Track 3-position at the vertex
0117   edm4hep::Vector3f& getPosition();
0118   /// Get reference to Track 3-position at the vertex
0119   [[deprecated("use getPosition instead")]]
0120   edm4hep::Vector3f& position();
0121 
0122   /// Set the Track 3-momentum at the vertex [GeV]
0123   void setMomentum(edm4hep::Vector3f value);
0124   /// Get mutable reference to Track 3-momentum at the vertex [GeV]
0125   edm4hep::Vector3f& getMomentum();
0126   /// Get reference to Track 3-momentum at the vertex [GeV]
0127   [[deprecated("use getMomentum instead")]]
0128   edm4hep::Vector3f& momentum();
0129 
0130   /// Set the Covariance matrix in basis [x,y,z,px,py,pz]
0131   void setPositionMomentumCovariance(edm4eic::Cov6f value);
0132   /// Get mutable reference to Covariance matrix in basis [x,y,z,px,py,pz]
0133   edm4eic::Cov6f& getPositionMomentumCovariance();
0134   /// Get reference to Covariance matrix in basis [x,y,z,px,py,pz]
0135   [[deprecated("use getPositionMomentumCovariance instead")]]
0136   edm4eic::Cov6f& positionMomentumCovariance();
0137 
0138   /// Set the Track time at the vertex [ns]
0139   void setTime(float value);
0140   /// Get mutable reference to Track time at the vertex [ns]
0141   float& getTime();
0142   /// Get reference to Track time at the vertex [ns]
0143   [[deprecated("use getTime instead")]]
0144   float& time();
0145 
0146   /// Set the Error on the track vertex time
0147   void setTimeError(float value);
0148   /// Get mutable reference to Error on the track vertex time
0149   float& getTimeError();
0150   /// Get reference to Error on the track vertex time
0151   [[deprecated("use getTimeError instead")]]
0152   float& timeError();
0153 
0154   /// Set the Particle charge
0155   void setCharge(float value);
0156   /// Get mutable reference to Particle charge
0157   float& getCharge();
0158   /// Get reference to Particle charge
0159   [[deprecated("use getCharge instead")]]
0160   float& charge();
0161 
0162   /// Set the Total chi2
0163   void setChi2(float value);
0164   /// Get mutable reference to Total chi2
0165   float& getChi2();
0166   /// Get reference to Total chi2
0167   [[deprecated("use getChi2 instead")]]
0168   float& chi2();
0169 
0170   /// Set the Number of degrees of freedom
0171   void setNdf(std::uint32_t value);
0172   /// Get mutable reference to Number of degrees of freedom
0173   std::uint32_t& getNdf();
0174   /// Get reference to Number of degrees of freedom
0175   [[deprecated("use getNdf instead")]]
0176   std::uint32_t& ndf();
0177 
0178   /// Set the PDG particle ID hypothesis
0179   void setPdg(std::int32_t value);
0180   /// Get mutable reference to PDG particle ID hypothesis
0181   std::int32_t& getPdg();
0182   /// Get reference to PDG particle ID hypothesis
0183   [[deprecated("use getPdg instead")]]
0184   std::int32_t& pdg();
0185 
0186 
0187   /// Set the Trajectory of this track
0188   void setTrajectory(const edm4eic::Trajectory& value);
0189 
0190   void addToMeasurements(const edm4eic::Measurement2D&);
0191   std::size_t measurements_size() const;
0192   edm4eic::Measurement2D getMeasurements(std::size_t) const;
0193   std::vector<edm4eic::Measurement2D>::const_iterator measurements_begin() const;
0194   std::vector<edm4eic::Measurement2D>::const_iterator measurements_end() const;
0195   podio::RelationRange<edm4eic::Measurement2D> getMeasurements() const;
0196   void addToTracks(const edm4eic::Track&);
0197   std::size_t tracks_size() const;
0198   edm4eic::Track getTracks(std::size_t) const;
0199   std::vector<edm4eic::Track>::const_iterator tracks_begin() const;
0200   std::vector<edm4eic::Track>::const_iterator tracks_end() const;
0201   podio::RelationRange<edm4eic::Track> getTracks() const;
0202 
0203 
0204 
0205   /// check whether the object is actually available
0206   bool isAvailable() const;
0207   /// disconnect from TrackObj instance
0208   void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackObj>{nullptr}; }
0209 
0210   bool operator==(const MutableTrack& other) const { return m_obj == other.m_obj; }
0211   bool operator==(const Track& other) const;
0212 
0213   bool operator!=(const MutableTrack& other) const { return !(*this == other); }
0214   bool operator!=(const Track& other) const { return !(*this == other); }
0215 
0216   // less comparison operator, so that objects can be e.g. stored in sets.
0217   bool operator<(const MutableTrack& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0218 
0219   podio::ObjectID id() const { return getObjectID(); }
0220 
0221   const podio::ObjectID getObjectID() const;
0222 
0223   friend void swap(MutableTrack& a, MutableTrack& b) {
0224     using std::swap;
0225     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0226   }
0227 
0228 private:
0229   /// constructor from existing TrackObj
0230   explicit MutableTrack(podio::utils::MaybeSharedPtr<TrackObj> obj);
0231 
0232   podio::utils::MaybeSharedPtr<TrackObj> m_obj{nullptr};
0233 };
0234 
0235 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0236 void to_json(nlohmann::json& j, const MutableTrack& value);
0237 #endif
0238 
0239 
0240 } // namespace edm4eic
0241 
0242 
0243 #endif