Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-01-09 10:09:21

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_MutableTrack_H
0004 #define EDM4HEP_MutableTrack_H
0005 
0006 #include "edm4hep/TrackObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4hep/Track.h"
0009 
0010 #include "edm4hep/TrackState.h"
0011 #include "edm4hep/TrackerHit.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 edm4hep {
0026 class TrackCollection;
0027 }
0028 
0029 namespace edm4hep {
0030 
0031 /** @class MutableTrack
0032  *  Reconstructed track
0033  *  @author: EDM4hep authors
0034  */
0035 class MutableTrack {
0036 
0037   friend class TrackCollection;
0038   friend class TrackMutableCollectionIterator;
0039   friend class Track;
0040 
0041 public:
0042   using object_type = Track;
0043   using collection_type = TrackCollection;
0044 
0045   /// default constructor
0046   MutableTrack() = default;
0047 
0048   /// Constructor initializing all members
0049   MutableTrack(const std::int32_t type, const float chi2, const std::int32_t ndf, const std::int32_t Nholes);
0050 
0051   /// copy constructor
0052   MutableTrack(const MutableTrack& other) = default;
0053 
0054   /// copy-assignment operator
0055   MutableTrack& operator=(MutableTrack other) &; // Rebind this to other's internal object
0056   MutableTrack&
0057   operator=(MutableTrack other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0058 
0059   /// create a mutable deep-copy of the object with identical relations
0060   /// if cloneRelations=false, the relations are not cloned and will be empty
0061   MutableTrack clone(bool cloneRelations = true) const;
0062 
0063   /// destructor
0064   ~MutableTrack() = default;
0065 
0066 public:
0067   /// Access the flagword that defines the type of track
0068   std::int32_t getType() const;
0069 
0070   /// Access the chi-squared of the track fit
0071   float getChi2() const;
0072 
0073   /// Access the number of degrees of freedom of the track fit
0074   std::int32_t getNdf() const;
0075 
0076   /// Access the number of holes on track
0077   std::int32_t getNholes() const;
0078 
0079   /// Set the flagword that defines the type of track
0080   void setType(const std::int32_t type);
0081   /// Get mutable reference to flagword that defines the type of track
0082   std::int32_t& getType();
0083   /// Get reference to flagword that defines the type of track
0084   [[deprecated("use getType instead")]] std::int32_t& type();
0085 
0086   /// Set the chi-squared of the track fit
0087   void setChi2(const float chi2);
0088   /// Get mutable reference to chi-squared of the track fit
0089   float& getChi2();
0090   /// Get reference to chi-squared of the track fit
0091   [[deprecated("use getChi2 instead")]] float& chi2();
0092 
0093   /// Set the number of degrees of freedom of the track fit
0094   void setNdf(const std::int32_t ndf);
0095   /// Get mutable reference to number of degrees of freedom of the track fit
0096   std::int32_t& getNdf();
0097   /// Get reference to number of degrees of freedom of the track fit
0098   [[deprecated("use getNdf instead")]] std::int32_t& ndf();
0099 
0100   /// Set the number of holes on track
0101   void setNholes(const std::int32_t Nholes);
0102   /// Get mutable reference to number of holes on track
0103   std::int32_t& getNholes();
0104   /// Get reference to number of holes on track
0105   [[deprecated("use getNholes instead")]] std::int32_t& Nholes();
0106 
0107   void addToTrackerHits(const edm4hep::TrackerHit&);
0108   std::size_t trackerHits_size() const;
0109   edm4hep::TrackerHit getTrackerHits(std::size_t) const;
0110   std::vector<edm4hep::TrackerHit>::const_iterator trackerHits_begin() const;
0111   std::vector<edm4hep::TrackerHit>::const_iterator trackerHits_end() const;
0112   podio::RelationRange<edm4hep::TrackerHit> getTrackerHits() const;
0113   void addToTracks(const edm4hep::Track&);
0114   std::size_t tracks_size() const;
0115   edm4hep::Track getTracks(std::size_t) const;
0116   std::vector<edm4hep::Track>::const_iterator tracks_begin() const;
0117   std::vector<edm4hep::Track>::const_iterator tracks_end() const;
0118   podio::RelationRange<edm4hep::Track> getTracks() const;
0119   void addToSubdetectorHitNumbers(const std::int32_t&);
0120   std::size_t subdetectorHitNumbers_size() const;
0121   std::int32_t getSubdetectorHitNumbers(std::size_t) const;
0122   std::vector<std::int32_t>::const_iterator subdetectorHitNumbers_begin() const;
0123   std::vector<std::int32_t>::const_iterator subdetectorHitNumbers_end() const;
0124   podio::RelationRange<std::int32_t> getSubdetectorHitNumbers() const;
0125   void addToSubdetectorHoleNumbers(const std::int32_t&);
0126   std::size_t subdetectorHoleNumbers_size() const;
0127   std::int32_t getSubdetectorHoleNumbers(std::size_t) const;
0128   std::vector<std::int32_t>::const_iterator subdetectorHoleNumbers_begin() const;
0129   std::vector<std::int32_t>::const_iterator subdetectorHoleNumbers_end() const;
0130   podio::RelationRange<std::int32_t> getSubdetectorHoleNumbers() const;
0131   void addToTrackStates(const edm4hep::TrackState&);
0132   std::size_t trackStates_size() const;
0133   edm4hep::TrackState getTrackStates(std::size_t) const;
0134   std::vector<edm4hep::TrackState>::const_iterator trackStates_begin() const;
0135   std::vector<edm4hep::TrackState>::const_iterator trackStates_end() const;
0136   podio::RelationRange<edm4hep::TrackState> getTrackStates() const;
0137 
0138   /// check whether the object is actually available
0139   bool isAvailable() const;
0140   /// disconnect from TrackObj instance
0141   void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackObj>{nullptr}; }
0142 
0143   bool operator==(const MutableTrack& other) const { return m_obj == other.m_obj; }
0144   bool operator==(const Track& other) const;
0145 
0146   bool operator!=(const MutableTrack& other) const { return !(*this == other); }
0147   bool operator!=(const Track& other) const { return !(*this == other); }
0148 
0149   // less comparison operator, so that objects can be e.g. stored in sets.
0150   bool operator<(const MutableTrack& other) const {
0151     return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0152   }
0153 
0154   podio::ObjectID id() const { return getObjectID(); }
0155 
0156   const podio::ObjectID getObjectID() const;
0157 
0158   friend std::hash<MutableTrack>;
0159 
0160   friend void swap(MutableTrack& a, MutableTrack& 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 TrackObj
0167   explicit MutableTrack(podio::utils::MaybeSharedPtr<TrackObj> obj);
0168 
0169   podio::utils::MaybeSharedPtr<TrackObj> m_obj{new TrackObj{}, podio::utils::MarkOwned};
0170 };
0171 
0172 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0173 void to_json(nlohmann::json& j, const MutableTrack& value);
0174 #endif
0175 
0176 } // namespace edm4hep
0177 
0178 template <>
0179 struct std::hash<edm4hep::MutableTrack> {
0180   std::size_t operator()(const edm4hep::MutableTrack& obj) const {
0181     return std::hash<edm4hep::TrackObj*>{}(obj.m_obj.get());
0182   }
0183 };
0184 
0185 #endif