Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:55:07

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();
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) = default;
0067 
0068   /// copy-assignment operator
0069   Trajectory& operator=(Trajectory other) &; // Rebind this to other's internal object
0070   Trajectory& operator=(Trajectory other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
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   MutableTrajectory clone(bool cloneRelations=true) const;
0075 
0076   /// destructor
0077   ~Trajectory() = default;
0078 
0079   /// converting constructor from mutable object
0080   Trajectory(const MutableTrajectory& other);
0081 
0082   static Trajectory makeEmpty();
0083 
0084 public:
0085 
0086   static constexpr std::string_view typeName = "edm4eic::Trajectory";
0087 
0088   /// Access the 0 (does not have good track fit), 1 (has good track fit)
0089   std::uint32_t getType() const;
0090 
0091   /// Access the Number of tracking steps
0092   std::uint32_t getNStates() const;
0093 
0094   /// Access the Number of hits used
0095   std::uint32_t getNMeasurements() const;
0096 
0097   /// Access the Number of hits not considered
0098   std::uint32_t getNOutliers() const;
0099 
0100   /// Access the Number of missing hits
0101   std::uint32_t getNHoles() const;
0102 
0103   /// Access the Number of shared hits with other trajectories
0104   std::uint32_t getNSharedHits() const;
0105 
0106 
0107   /// Access the Corresponding track seed
0108   const edm4eic::TrackSeed getSeed() const;
0109 
0110   std::size_t trackParameters_size() const;
0111   edm4eic::TrackParameters getTrackParameters(std::size_t) const;
0112   std::vector<edm4eic::TrackParameters>::const_iterator trackParameters_begin() const;
0113   std::vector<edm4eic::TrackParameters>::const_iterator trackParameters_end() const;
0114   podio::RelationRange<edm4eic::TrackParameters> getTrackParameters() const;
0115   std::size_t measurements_deprecated_size() const;
0116   edm4eic::Measurement2D getMeasurements_deprecated(std::size_t) const;
0117   std::vector<edm4eic::Measurement2D>::const_iterator measurements_deprecated_begin() const;
0118   std::vector<edm4eic::Measurement2D>::const_iterator measurements_deprecated_end() const;
0119   podio::RelationRange<edm4eic::Measurement2D> getMeasurements_deprecated() const;
0120   std::size_t outliers_deprecated_size() const;
0121   edm4eic::Measurement2D getOutliers_deprecated(std::size_t) const;
0122   std::vector<edm4eic::Measurement2D>::const_iterator outliers_deprecated_begin() const;
0123   std::vector<edm4eic::Measurement2D>::const_iterator outliers_deprecated_end() const;
0124   podio::RelationRange<edm4eic::Measurement2D> getOutliers_deprecated() const;
0125   std::size_t measurementChi2_size() const;
0126   float getMeasurementChi2(std::size_t) const;
0127   std::vector<float>::const_iterator measurementChi2_begin() const;
0128   std::vector<float>::const_iterator measurementChi2_end() const;
0129   podio::RelationRange<float> getMeasurementChi2() const;
0130   std::size_t outlierChi2_size() const;
0131   float getOutlierChi2(std::size_t) const;
0132   std::vector<float>::const_iterator outlierChi2_begin() const;
0133   std::vector<float>::const_iterator outlierChi2_end() const;
0134   podio::RelationRange<float> getOutlierChi2() const;
0135 
0136 
0137   /// check whether the object is actually available
0138   bool isAvailable() const;
0139   /// disconnect from TrajectoryObj instance
0140   void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrajectoryObj>{nullptr}; }
0141 
0142   bool operator==(const Trajectory& other) const { return m_obj == other.m_obj; }
0143   bool operator==(const MutableTrajectory& other) const;
0144 
0145   bool operator!=(const Trajectory& other) const { return !(*this == other); }
0146   bool operator!=(const MutableTrajectory& other) const { return !(*this == other); }
0147 
0148   // less comparison operator, so that objects can be e.g. stored in sets.
0149   bool operator<(const Trajectory& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0150 
0151   podio::ObjectID id() const { return getObjectID(); }
0152 
0153   const podio::ObjectID getObjectID() const;
0154 
0155   friend std::hash<Trajectory>;
0156 
0157   friend void swap(Trajectory& a, Trajectory& b) {
0158     using std::swap;
0159     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0160   }
0161 
0162 private:
0163   /// constructor from existing TrajectoryObj
0164   explicit Trajectory(podio::utils::MaybeSharedPtr<TrajectoryObj> obj);
0165   Trajectory(TrajectoryObj* obj);
0166 
0167   podio::utils::MaybeSharedPtr<TrajectoryObj> m_obj{nullptr};
0168 };
0169 
0170 std::ostream& operator<<(std::ostream& o, const Trajectory& value);
0171 
0172 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0173 void to_json(nlohmann::json& j, const Trajectory& value);
0174 #endif
0175 
0176 
0177 } // namespace edm4eic
0178 
0179 
0180 
0181 template<>
0182 struct std::hash<edm4eic::Trajectory> {
0183   std::size_t operator()(const edm4eic::Trajectory& obj) const {
0184     return std::hash<edm4eic::TrajectoryObj*>{}(obj.m_obj.get());
0185   }
0186 };
0187 
0188 
0189 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0190 // until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
0191 // and https://github.com/AIDASoft/podio/issues/770
0192 #if defined(__clang__)
0193 #pragma clang diagnostic push
0194 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0195 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0196 #pragma clang diagnostic ignored "-Wdeprecated"
0197 constexpr std::string_view edm4eic::Trajectory::typeName;
0198 #pragma clang diagnostic pop
0199 #elif defined(__GNUC__)
0200 #pragma GCC diagnostic push
0201 #pragma GCC diagnostic ignored "-Wdeprecated"
0202 constexpr std::string_view edm4eic::Trajectory::typeName;
0203 #pragma GCC diagnostic pop
0204 #endif
0205 
0206 #endif