Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-30 08:34:18

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_Track_H
0004 #define EDM4EIC_Track_H
0005 
0006 #include "edm4eic/TrackObj.h"
0007 
0008 #include "edm4eic/Cov6f.h"
0009 #include "edm4eic/Measurement2D.h"
0010 #include "edm4hep/Vector3f.h"
0011 #include "podio/RelationRange.h"
0012 #include <cstdint>
0013 #include <vector>
0014 
0015 #include "podio/utilities/MaybeSharedPtr.h"
0016 #include "podio/detail/OrderKey.h"
0017 
0018 #include <ostream>
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 podio::detail {
0034 // Internal function used in less comparison operators of the datatypes and interface types
0035 OrderKey getOrderKey(const edm4eic::Track& obj);
0036 };
0037 
0038 namespace edm4eic {
0039 
0040 class MutableTrack;
0041 class TrackCollection;
0042 class TrackCollectionData;
0043 
0044 /** @class Track
0045  *  Track information at the vertex
0046  *  @author: S. Joosten, J. Osborn
0047  */
0048 class Track {
0049 
0050   friend class MutableTrack;
0051   friend class TrackCollection;
0052   friend class edm4eic::TrackCollectionData;
0053   friend class TrackCollectionIterator;
0054   friend podio::detail::OrderKey podio::detail::getOrderKey(const Track & obj);
0055 
0056 public:
0057   using mutable_type = MutableTrack;
0058   using collection_type = TrackCollection;
0059 
0060   /// default constructor
0061   Track();
0062 
0063   /// Constructor initializing all members
0064   Track(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);
0065 
0066   /// copy constructor
0067   Track(const Track& other) = default;
0068 
0069   /// copy-assignment operator
0070   Track& operator=(Track other);
0071 
0072   /// create a mutable deep-copy of the object with identical relations
0073   /// if cloneRelations=false, the relations are not cloned and will be empty
0074   MutableTrack clone(bool cloneRelations=true) const;
0075 
0076   /// destructor
0077   ~Track() = default;
0078 
0079   /// converting constructor from mutable object
0080   Track(const MutableTrack& other);
0081 
0082   static Track makeEmpty();
0083 
0084 public:
0085 
0086   static constexpr auto typeName = "edm4eic::Track";
0087 
0088   /// Access the Flag that defines the type of track
0089   std::int32_t getType() const;
0090 
0091   /// Access the Track 3-position at the vertex
0092   const edm4hep::Vector3f& getPosition() const;
0093 
0094   /// Access the Track 3-momentum at the vertex [GeV]
0095   const edm4hep::Vector3f& getMomentum() const;
0096 
0097   /// Access the Covariance matrix in basis [x,y,z,px,py,pz]
0098   const edm4eic::Cov6f& getPositionMomentumCovariance() const;
0099 
0100   /// Access the Track time at the vertex [ns]
0101   float getTime() const;
0102 
0103   /// Access the Error on the track vertex time
0104   float getTimeError() const;
0105 
0106   /// Access the Particle charge
0107   float getCharge() const;
0108 
0109   /// Access the Total chi2
0110   float getChi2() const;
0111 
0112   /// Access the Number of degrees of freedom
0113   std::uint32_t getNdf() const;
0114 
0115   /// Access the PDG particle ID hypothesis
0116   std::int32_t getPdg() const;
0117 
0118 
0119   /// Access the Trajectory of this track
0120   const edm4eic::Trajectory getTrajectory() const;
0121 
0122   std::size_t measurements_size() const;
0123   edm4eic::Measurement2D getMeasurements(std::size_t) const;
0124   std::vector<edm4eic::Measurement2D>::const_iterator measurements_begin() const;
0125   std::vector<edm4eic::Measurement2D>::const_iterator measurements_end() const;
0126   podio::RelationRange<edm4eic::Measurement2D> getMeasurements() const;
0127   std::size_t tracks_size() const;
0128   edm4eic::Track getTracks(std::size_t) const;
0129   std::vector<edm4eic::Track>::const_iterator tracks_begin() const;
0130   std::vector<edm4eic::Track>::const_iterator tracks_end() const;
0131   podio::RelationRange<edm4eic::Track> getTracks() const;
0132 
0133 
0134   /// check whether the object is actually available
0135   bool isAvailable() const;
0136   /// disconnect from TrackObj instance
0137   void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackObj>{nullptr}; }
0138 
0139   bool operator==(const Track& other) const { return m_obj == other.m_obj; }
0140   bool operator==(const MutableTrack& other) const;
0141 
0142   bool operator!=(const Track& other) const { return !(*this == other); }
0143   bool operator!=(const MutableTrack& other) const { return !(*this == other); }
0144 
0145   // less comparison operator, so that objects can be e.g. stored in sets.
0146   bool operator<(const Track& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0147 
0148   podio::ObjectID id() const { return getObjectID(); }
0149 
0150   const podio::ObjectID getObjectID() const;
0151 
0152   friend void swap(Track& a, Track& b) {
0153     using std::swap;
0154     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0155   }
0156 
0157 private:
0158   /// constructor from existing TrackObj
0159   explicit Track(podio::utils::MaybeSharedPtr<TrackObj> obj);
0160   Track(TrackObj* obj);
0161 
0162   podio::utils::MaybeSharedPtr<TrackObj> m_obj{nullptr};
0163 };
0164 
0165 std::ostream& operator<<(std::ostream& o, const Track& value);
0166 
0167 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0168 void to_json(nlohmann::json& j, const Track& value);
0169 #endif
0170 
0171 
0172 } // namespace edm4eic
0173 
0174 
0175 #endif