Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-29 08:40:42

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_Track_H
0004 #define EDM4HEP_Track_H
0005 
0006 #include "edm4hep/TrackObj.h"
0007 
0008 #include "edm4hep/TrackState.h"
0009 #include "edm4hep/TrackerHit.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 edm4hep {
0026 class TrackCollection;
0027 }
0028 
0029 
0030 namespace podio::detail {
0031 // Internal function used in less comparison operators of the datatypes and interface types
0032 OrderKey getOrderKey(const edm4hep::Track& obj);
0033 };
0034 
0035 namespace edm4hep {
0036 
0037 class MutableTrack;
0038 class TrackCollection;
0039 class TrackCollectionData;
0040 
0041 /** @class Track
0042  *  Reconstructed track
0043  *  @author: EDM4hep authors
0044  */
0045 class Track {
0046 
0047   friend class MutableTrack;
0048   friend class TrackCollection;
0049   friend class edm4hep::TrackCollectionData;
0050   friend class TrackCollectionIterator;
0051   friend podio::detail::OrderKey podio::detail::getOrderKey(const Track & obj);
0052 
0053 public:
0054   using mutable_type = MutableTrack;
0055   using collection_type = TrackCollection;
0056 
0057   /// default constructor
0058   Track();
0059 
0060   /// Constructor initializing all members
0061   Track(const std::int32_t type, const float chi2, const std::int32_t ndf, const std::int32_t Nholes);
0062 
0063   /// copy constructor
0064   Track(const Track& other) = default;
0065 
0066   /// copy-assignment operator
0067   Track& operator=(Track other) &; // Rebind this to other's internal object
0068   Track& operator=(Track other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0069 
0070   /// create a mutable deep-copy of the object with identical relations
0071   /// if cloneRelations=false, the relations are not cloned and will be empty
0072   MutableTrack clone(bool cloneRelations=true) const;
0073 
0074   /// destructor
0075   ~Track() = default;
0076 
0077   /// converting constructor from mutable object
0078   Track(const MutableTrack& other);
0079 
0080   static Track makeEmpty();
0081 
0082 public:
0083 
0084   static constexpr std::string_view typeName = "edm4hep::Track";
0085 
0086   /// Access the flagword that defines the type of track
0087   std::int32_t getType() const;
0088 
0089   /// Access the Chi^2 of the track fit
0090   float getChi2() const;
0091 
0092   /// Access the number of degrees of freedom of the track fit
0093   std::int32_t getNdf() const;
0094 
0095   /// Access the number of holes on track
0096   std::int32_t getNholes() const;
0097 
0098 
0099 
0100   std::size_t trackerHits_size() const;
0101   edm4hep::TrackerHit getTrackerHits(std::size_t) const;
0102   std::vector<edm4hep::TrackerHit>::const_iterator trackerHits_begin() const;
0103   std::vector<edm4hep::TrackerHit>::const_iterator trackerHits_end() const;
0104   podio::RelationRange<edm4hep::TrackerHit> getTrackerHits() const;
0105   std::size_t tracks_size() const;
0106   edm4hep::Track getTracks(std::size_t) const;
0107   std::vector<edm4hep::Track>::const_iterator tracks_begin() const;
0108   std::vector<edm4hep::Track>::const_iterator tracks_end() const;
0109   podio::RelationRange<edm4hep::Track> getTracks() const;
0110   std::size_t subdetectorHitNumbers_size() const;
0111   std::int32_t getSubdetectorHitNumbers(std::size_t) const;
0112   std::vector<std::int32_t>::const_iterator subdetectorHitNumbers_begin() const;
0113   std::vector<std::int32_t>::const_iterator subdetectorHitNumbers_end() const;
0114   podio::RelationRange<std::int32_t> getSubdetectorHitNumbers() const;
0115   std::size_t subdetectorHoleNumbers_size() const;
0116   std::int32_t getSubdetectorHoleNumbers(std::size_t) const;
0117   std::vector<std::int32_t>::const_iterator subdetectorHoleNumbers_begin() const;
0118   std::vector<std::int32_t>::const_iterator subdetectorHoleNumbers_end() const;
0119   podio::RelationRange<std::int32_t> getSubdetectorHoleNumbers() const;
0120   std::size_t trackStates_size() const;
0121   edm4hep::TrackState getTrackStates(std::size_t) const;
0122   std::vector<edm4hep::TrackState>::const_iterator trackStates_begin() const;
0123   std::vector<edm4hep::TrackState>::const_iterator trackStates_end() const;
0124   podio::RelationRange<edm4hep::TrackState> getTrackStates() const;
0125 
0126 
0127   /// check whether the object is actually available
0128   bool isAvailable() const;
0129   /// disconnect from TrackObj instance
0130   void unlink() { m_obj = podio::utils::MaybeSharedPtr<TrackObj>{nullptr}; }
0131 
0132   bool operator==(const Track& other) const { return m_obj == other.m_obj; }
0133   bool operator==(const MutableTrack& other) const;
0134 
0135   bool operator!=(const Track& other) const { return !(*this == other); }
0136   bool operator!=(const MutableTrack& other) const { return !(*this == other); }
0137 
0138   // less comparison operator, so that objects can be e.g. stored in sets.
0139   bool operator<(const Track& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0140 
0141   podio::ObjectID id() const { return getObjectID(); }
0142 
0143   const podio::ObjectID getObjectID() const;
0144 
0145   friend std::hash<Track>;
0146 
0147   friend void swap(Track& a, Track& b) {
0148     using std::swap;
0149     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0150   }
0151 
0152 private:
0153   /// constructor from existing TrackObj
0154   explicit Track(podio::utils::MaybeSharedPtr<TrackObj> obj);
0155   Track(TrackObj* obj);
0156 
0157   podio::utils::MaybeSharedPtr<TrackObj> m_obj{nullptr};
0158 };
0159 
0160 std::ostream& operator<<(std::ostream& o, const Track& value);
0161 
0162 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0163 void to_json(nlohmann::json& j, const Track& value);
0164 #endif
0165 
0166 
0167 } // namespace edm4hep
0168 
0169 
0170 
0171 template<>
0172 struct std::hash<edm4hep::Track> {
0173   std::size_t operator()(const edm4hep::Track& obj) const {
0174     return std::hash<edm4hep::TrackObj*>{}(obj.m_obj.get());
0175   }
0176 };
0177 
0178 
0179 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0180 // until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
0181 // and https://github.com/AIDASoft/podio/issues/770
0182 #if defined(__clang__)
0183 #pragma clang diagnostic push
0184 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0185 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0186 #pragma clang diagnostic ignored "-Wdeprecated"
0187 constexpr std::string_view edm4hep::Track::typeName;
0188 #pragma clang diagnostic pop
0189 #elif defined(__GNUC__)
0190 #pragma GCC diagnostic push
0191 #pragma GCC diagnostic ignored "-Wdeprecated"
0192 constexpr std::string_view edm4hep::Track::typeName;
0193 #pragma GCC diagnostic pop
0194 #endif
0195 
0196 #endif