Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 08:53:32

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