Back to home page

EIC code displayed by LXR

 
 

    


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

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