Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-25 09:56:43

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_Trajectory_H
0004 #define EDM4EIC_Trajectory_H
0005 
0006 #include "edm4eic/TrajectoryObj.h"
0007 
0008 #include "edm4eic/Measurement2D.h"
0009 #include "edm4eic/TrackParameters.h"
0010 #include "podio/RelationRange.h"
0011 #include <cstdint>
0012 #include <vector>
0013 
0014 #include "podio/utilities/MaybeSharedPtr.h"
0015 #include "podio/detail/OrderKey.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 TrajectoryCollection;
0027 class TrackSeed;
0028 class MutableTrackSeed;
0029 }
0030 
0031 
0032 namespace podio::detail {
0033 // Internal function used in less comparison operators of the datatypes and interface types
0034 OrderKey getOrderKey(const edm4eic::Trajectory& obj);
0035 };
0036 
0037 namespace edm4eic {
0038 
0039 class MutableTrajectory;
0040 class TrajectoryCollection;
0041 class TrajectoryCollectionData;
0042 
0043 /** @class Trajectory
0044  *  Raw trajectory from the tracking algorithm. What is called hit here is 2d measurement indeed.
0045  *  @author: S. Joosten, S. Li
0046  */
0047 class Trajectory {
0048 
0049   friend class MutableTrajectory;
0050   friend class TrajectoryCollection;
0051   friend class edm4eic::TrajectoryCollectionData;
0052   friend class TrajectoryCollectionIterator;
0053   friend podio::detail::OrderKey podio::detail::getOrderKey(const Trajectory & obj);
0054 
0055 public:
0056   using mutable_type = MutableTrajectory;
0057   using collection_type = TrajectoryCollection;
0058 
0059   /// default constructor
0060   Trajectory() = default;
0061 
0062   /// Constructor initializing all members
0063   Trajectory(const std::uint32_t type, const std::uint32_t nStates, const std::uint32_t nMeasurements, const std::uint32_t nOutliers, const std::uint32_t nHoles, const std::uint32_t nSharedHits);
0064 
0065   /// copy constructor
0066   Trajectory(const Trajectory& other) noexcept = default;
0067 
0068   /// move constructor
0069   Trajectory(Trajectory&& other) noexcept = default;
0070 
0071   /// copy-assignment operator
0072   Trajectory& operator=(Trajectory other) &; // Rebind this to other's internal object
0073   Trajectory& operator=(Trajectory other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0074 
0075   /// create a mutable deep-copy of the object with identical relations
0076   /// if cloneRelations=false, the relations are not cloned and will be empty
0077   MutableTrajectory clone(bool cloneRelations=true) const;
0078 
0079   /// destructor
0080   ~Trajectory() = default;
0081 
0082   /// converting constructor from mutable object
0083   Trajectory(const MutableTrajectory& other);
0084 
0085   static Trajectory makeEmpty();
0086 
0087 public:
0088 
0089   static constexpr std::string_view typeName = "edm4eic::Trajectory";
0090 
0091   /// Access the 0 (does not have good track fit), 1 (has good track fit)
0092   std::uint32_t getType() const;
0093 
0094   /// Access the Number of tracking steps
0095   std::uint32_t getNStates() const;
0096 
0097   /// Access the Number of hits used
0098   std::uint32_t getNMeasurements() const;
0099 
0100   /// Access the Number of hits not considered
0101   std::uint32_t getNOutliers() const;
0102 
0103   /// Access the Number of missing hits
0104   std::uint32_t getNHoles() const;
0105 
0106   /// Access the Number of shared hits with other trajectories
0107   std::uint32_t getNSharedHits() const;
0108 
0109 
0110   /// Access the Corresponding track seed
0111   const edm4eic::TrackSeed getSeed() const;
0112 
0113   std::size_t trackParameters_size() const;
0114   edm4eic::TrackParameters getTrackParameters(std::size_t) const;
0115   std::vector<edm4eic::TrackParameters>::const_iterator trackParameters_begin() const;
0116   std::vector<edm4eic::TrackParameters>::const_iterator trackParameters_end() const;
0117   podio::RelationRange<edm4eic::TrackParameters> getTrackParameters() const;
0118   std::size_t measurements_deprecated_size() const;
0119   edm4eic::Measurement2D getMeasurements_deprecated(std::size_t) const;
0120   std::vector<edm4eic::Measurement2D>::const_iterator measurements_deprecated_begin() const;
0121   std::vector<edm4eic::Measurement2D>::const_iterator measurements_deprecated_end() const;
0122   podio::RelationRange<edm4eic::Measurement2D> getMeasurements_deprecated() const;
0123   std::size_t outliers_deprecated_size() const;
0124   edm4eic::Measurement2D getOutliers_deprecated(std::size_t) const;
0125   std::vector<edm4eic::Measurement2D>::const_iterator outliers_deprecated_begin() const;
0126   std::vector<edm4eic::Measurement2D>::const_iterator outliers_deprecated_end() const;
0127   podio::RelationRange<edm4eic::Measurement2D> getOutliers_deprecated() const;
0128   std::size_t measurementChi2_size() const;
0129   float getMeasurementChi2(std::size_t) const;
0130   std::vector<float>::const_iterator measurementChi2_begin() const;
0131   std::vector<float>::const_iterator measurementChi2_end() const;
0132   podio::RelationRange<float> getMeasurementChi2() const;
0133   std::size_t outlierChi2_size() const;
0134   float getOutlierChi2(std::size_t) const;
0135   std::vector<float>::const_iterator outlierChi2_begin() const;
0136   std::vector<float>::const_iterator outlierChi2_end() const;
0137   podio::RelationRange<float> getOutlierChi2() const;
0138 
0139 
0140   /// check whether the object is actually available
0141   bool isAvailable() const;
0142   /// disconnect from TrajectoryObj instance
0143   void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrajectoryObj>{nullptr}; }
0144 
0145   constexpr bool operator==(const Trajectory& other) const { return m_obj == other.m_obj; }
0146   bool operator==(const MutableTrajectory& other) const;
0147 
0148   constexpr bool operator!=(const Trajectory& other) const { return !(*this == other); }
0149   bool operator!=(const MutableTrajectory& other) const { return !(*this == other); }
0150 
0151   // less comparison operator, so that objects can be e.g. stored in sets.
0152   bool operator<(const Trajectory& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0153 
0154   podio::ObjectID id() const { return getObjectID(); }
0155 
0156   const podio::ObjectID getObjectID() const;
0157 
0158   friend std::hash<Trajectory>;
0159 
0160   friend void swap(Trajectory& a, Trajectory& b) {
0161     using std::swap;
0162     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0163   }
0164 
0165 private:
0166   /// constructor from existing TrajectoryObj
0167   explicit Trajectory(podio::utils::MaybeSharedPtr<TrajectoryObj> obj);
0168   Trajectory(TrajectoryObj* obj);
0169 
0170   podio::utils::MaybeSharedPtr<TrajectoryObj> m_obj{new TrajectoryObj{}, podio::utils::MarkOwned};
0171 };
0172 
0173 std::ostream& operator<<(std::ostream& o, const Trajectory& value);
0174 
0175 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0176 void to_json(nlohmann::json& j, const Trajectory& value);
0177 #endif
0178 
0179 
0180 } // namespace edm4eic
0181 
0182 
0183 
0184 template<>
0185 struct std::hash<edm4eic::Trajectory> {
0186   std::size_t operator()(const edm4eic::Trajectory& obj) const {
0187     return std::hash<edm4eic::TrajectoryObj*>{}(obj.m_obj.get());
0188   }
0189 };
0190 
0191 
0192 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0193 // until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
0194 // and https://github.com/AIDASoft/podio/issues/770
0195 #if defined(__clang__)
0196   #pragma clang diagnostic push
0197   #pragma clang diagnostic ignored "-Wunknown-warning-option"
0198   #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0199   #pragma clang diagnostic ignored "-Wdeprecated"
0200 constexpr std::string_view edm4eic::Trajectory::typeName;
0201   #pragma clang diagnostic pop
0202 #elif defined(__GNUC__)
0203   #pragma GCC diagnostic push
0204   #pragma GCC diagnostic ignored "-Wdeprecated"
0205 constexpr std::string_view edm4eic::Trajectory::typeName;
0206   #pragma GCC diagnostic pop
0207 #endif
0208 
0209 
0210 #endif