Back to home page

EIC code displayed by LXR

 
 

    


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

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