Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 09:10:44

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_MutableTrajectory_H
0004 #define EDM4EIC_MutableTrajectory_H
0005 
0006 #include "edm4eic/TrajectoryObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4eic/Trajectory.h"
0009 
0010 #include "edm4eic/Measurement2D.h"
0011 #include "edm4eic/TrackParameters.h"
0012 #include "podio/RelationRange.h"
0013 #include <cstdint>
0014 #include <vector>
0015 
0016 #include "podio/utilities/MaybeSharedPtr.h"
0017 
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 edm4eic {
0033 
0034 
0035 /** @class MutableTrajectory
0036  *  Raw trajectory from the tracking algorithm. What is called hit here is 2d measurement indeed.
0037  *  @author: S. Joosten, S. Li
0038  */
0039 class MutableTrajectory {
0040 
0041   friend class TrajectoryCollection;
0042   friend class TrajectoryMutableCollectionIterator;
0043   friend class Trajectory;
0044 
0045 public:
0046   using object_type = Trajectory;
0047   using collection_type = TrajectoryCollection;
0048 
0049   /// default constructor
0050   MutableTrajectory();
0051 
0052   /// Constructor initializing all members
0053   MutableTrajectory(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);
0054 
0055   /// copy constructor
0056   MutableTrajectory(const MutableTrajectory& other) = default;
0057 
0058   /// copy-assignment operator
0059   MutableTrajectory& operator=(MutableTrajectory other) &; // Rebind this to other's internal object
0060   MutableTrajectory& operator=(MutableTrajectory other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0061 
0062   /// create a mutable deep-copy of the object with identical relations
0063   /// if cloneRelations=false, the relations are not cloned and will be empty
0064   MutableTrajectory clone(bool cloneRelations=true) const;
0065 
0066   /// destructor
0067   ~MutableTrajectory() = default;
0068 
0069 
0070 public:
0071 
0072   /// Access the 0 (does not have good track fit), 1 (has good track fit)
0073   std::uint32_t getType() const;
0074 
0075   /// Access the Number of tracking steps
0076   std::uint32_t getNStates() const;
0077 
0078   /// Access the Number of hits used
0079   std::uint32_t getNMeasurements() const;
0080 
0081   /// Access the Number of hits not considered
0082   std::uint32_t getNOutliers() const;
0083 
0084   /// Access the Number of missing hits
0085   std::uint32_t getNHoles() const;
0086 
0087   /// Access the Number of shared hits with other trajectories
0088   std::uint32_t getNSharedHits() const;
0089 
0090 
0091   /// Access the Corresponding track seed
0092   const edm4eic::TrackSeed getSeed() const;
0093 
0094   /// Set the 0 (does not have good track fit), 1 (has good track fit)
0095   void setType(const std::uint32_t type);
0096   /// Get mutable reference to 0 (does not have good track fit), 1 (has good track fit)
0097   std::uint32_t& getType();
0098   /// Get reference to 0 (does not have good track fit), 1 (has good track fit)
0099   [[deprecated("use getType instead")]]
0100   std::uint32_t& type();
0101 
0102   /// Set the Number of tracking steps
0103   void setNStates(const std::uint32_t nStates);
0104   /// Get mutable reference to Number of tracking steps
0105   std::uint32_t& getNStates();
0106   /// Get reference to Number of tracking steps
0107   [[deprecated("use getNStates instead")]]
0108   std::uint32_t& nStates();
0109 
0110   /// Set the Number of hits used
0111   void setNMeasurements(const std::uint32_t nMeasurements);
0112   /// Get mutable reference to Number of hits used
0113   std::uint32_t& getNMeasurements();
0114   /// Get reference to Number of hits used
0115   [[deprecated("use getNMeasurements instead")]]
0116   std::uint32_t& nMeasurements();
0117 
0118   /// Set the Number of hits not considered
0119   void setNOutliers(const std::uint32_t nOutliers);
0120   /// Get mutable reference to Number of hits not considered
0121   std::uint32_t& getNOutliers();
0122   /// Get reference to Number of hits not considered
0123   [[deprecated("use getNOutliers instead")]]
0124   std::uint32_t& nOutliers();
0125 
0126   /// Set the Number of missing hits
0127   void setNHoles(const std::uint32_t nHoles);
0128   /// Get mutable reference to Number of missing hits
0129   std::uint32_t& getNHoles();
0130   /// Get reference to Number of missing hits
0131   [[deprecated("use getNHoles instead")]]
0132   std::uint32_t& nHoles();
0133 
0134   /// Set the Number of shared hits with other trajectories
0135   void setNSharedHits(const std::uint32_t nSharedHits);
0136   /// Get mutable reference to Number of shared hits with other trajectories
0137   std::uint32_t& getNSharedHits();
0138   /// Get reference to Number of shared hits with other trajectories
0139   [[deprecated("use getNSharedHits instead")]]
0140   std::uint32_t& nSharedHits();
0141 
0142 
0143   /// Set the Corresponding track seed
0144   void setSeed(const edm4eic::TrackSeed& value);
0145 
0146   void addToTrackParameters(const edm4eic::TrackParameters&);
0147   std::size_t trackParameters_size() const;
0148   edm4eic::TrackParameters getTrackParameters(std::size_t) const;
0149   std::vector<edm4eic::TrackParameters>::const_iterator trackParameters_begin() const;
0150   std::vector<edm4eic::TrackParameters>::const_iterator trackParameters_end() const;
0151   podio::RelationRange<edm4eic::TrackParameters> getTrackParameters() const;
0152   void addToMeasurements_deprecated(const edm4eic::Measurement2D&);
0153   std::size_t measurements_deprecated_size() const;
0154   edm4eic::Measurement2D getMeasurements_deprecated(std::size_t) const;
0155   std::vector<edm4eic::Measurement2D>::const_iterator measurements_deprecated_begin() const;
0156   std::vector<edm4eic::Measurement2D>::const_iterator measurements_deprecated_end() const;
0157   podio::RelationRange<edm4eic::Measurement2D> getMeasurements_deprecated() const;
0158   void addToOutliers_deprecated(const edm4eic::Measurement2D&);
0159   std::size_t outliers_deprecated_size() const;
0160   edm4eic::Measurement2D getOutliers_deprecated(std::size_t) const;
0161   std::vector<edm4eic::Measurement2D>::const_iterator outliers_deprecated_begin() const;
0162   std::vector<edm4eic::Measurement2D>::const_iterator outliers_deprecated_end() const;
0163   podio::RelationRange<edm4eic::Measurement2D> getOutliers_deprecated() const;
0164   void addToMeasurementChi2(const float&);
0165   std::size_t measurementChi2_size() const;
0166   float getMeasurementChi2(std::size_t) const;
0167   std::vector<float>::const_iterator measurementChi2_begin() const;
0168   std::vector<float>::const_iterator measurementChi2_end() const;
0169   podio::RelationRange<float> getMeasurementChi2() const;
0170   void addToOutlierChi2(const float&);
0171   std::size_t outlierChi2_size() const;
0172   float getOutlierChi2(std::size_t) const;
0173   std::vector<float>::const_iterator outlierChi2_begin() const;
0174   std::vector<float>::const_iterator outlierChi2_end() const;
0175   podio::RelationRange<float> getOutlierChi2() const;
0176 
0177 
0178 
0179   /// check whether the object is actually available
0180   bool isAvailable() const;
0181   /// disconnect from TrajectoryObj instance
0182   void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrajectoryObj>{nullptr}; }
0183 
0184   bool operator==(const MutableTrajectory& other) const { return m_obj == other.m_obj; }
0185   bool operator==(const Trajectory& other) const;
0186 
0187   bool operator!=(const MutableTrajectory& other) const { return !(*this == other); }
0188   bool operator!=(const Trajectory& other) const { return !(*this == other); }
0189 
0190   // less comparison operator, so that objects can be e.g. stored in sets.
0191   bool operator<(const MutableTrajectory& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0192 
0193   podio::ObjectID id() const { return getObjectID(); }
0194 
0195   const podio::ObjectID getObjectID() const;
0196 
0197   friend std::hash<MutableTrajectory>;
0198 
0199   friend void swap(MutableTrajectory& a, MutableTrajectory& b) {
0200     using std::swap;
0201     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0202   }
0203 
0204 private:
0205   /// constructor from existing TrajectoryObj
0206   explicit MutableTrajectory(podio::utils::MaybeSharedPtr<TrajectoryObj> obj);
0207 
0208   podio::utils::MaybeSharedPtr<TrajectoryObj> m_obj{nullptr};
0209 };
0210 
0211 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0212 void to_json(nlohmann::json& j, const MutableTrajectory& value);
0213 #endif
0214 
0215 
0216 } // namespace edm4eic
0217 
0218 
0219 
0220 template<>
0221 struct std::hash<edm4eic::MutableTrajectory> {
0222   std::size_t operator()(const edm4eic::MutableTrajectory& obj) const {
0223     return std::hash<edm4eic::TrajectoryObj*>{}(obj.m_obj.get());
0224   }
0225 };
0226 
0227 
0228 #endif