Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:38

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_RecDqdx_H
0004 #define EDM4HEP_RecDqdx_H
0005 
0006 #include "edm4hep/RecDqdxObj.h"
0007 
0008 #include "edm4hep/HitLevelData.h"
0009 #include "edm4hep/Hypothesis.h"
0010 #include "edm4hep/Quantity.h"
0011 #include "podio/RelationRange.h"
0012 #include <array>
0013 #include <cstdint>
0014 #include <vector>
0015 
0016 #include "podio/utilities/MaybeSharedPtr.h"
0017 
0018 #include <cstdint>
0019 #include <ostream>
0020 
0021 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0022 #include "nlohmann/json_fwd.hpp"
0023 #endif
0024 
0025 // forward declarations
0026 namespace edm4hep {
0027 class Track;
0028 class MutableTrack;
0029 } // namespace edm4hep
0030 
0031 namespace edm4hep {
0032 
0033 class MutableRecDqdx;
0034 class RecDqdxCollection;
0035 class RecDqdxCollectionData;
0036 
0037 /** @class RecDqdx
0038  *  dN/dx or dE/dx info of Track.
0039  *  @author: Wenxing Fang, IHEP
0040  */
0041 class RecDqdx {
0042 
0043   friend class MutableRecDqdx;
0044   friend class RecDqdxCollection;
0045   friend class edm4hep::RecDqdxCollectionData;
0046   friend class RecDqdxCollectionIterator;
0047 
0048 public:
0049   using mutable_type = MutableRecDqdx;
0050   using collection_type = RecDqdxCollection;
0051 
0052   /// default constructor
0053   RecDqdx();
0054 
0055   /// Constructor initializing all members
0056   RecDqdx(edm4hep::Quantity dQdx, std::int16_t particleType, std::int16_t type,
0057           std::array<edm4hep::Hypothesis, 5> hypotheses);
0058 
0059   /// copy constructor
0060   RecDqdx(const RecDqdx& other) = default;
0061 
0062   /// copy-assignment operator
0063   RecDqdx& operator=(RecDqdx other);
0064 
0065   /// create a mutable deep-copy of the object with identical relations
0066   /// if cloneRelations=false, the relations are not cloned and will be empty
0067   MutableRecDqdx clone(bool cloneRelations = true) const;
0068 
0069   /// destructor
0070   ~RecDqdx() = default;
0071 
0072   /// converting constructor from mutable object
0073   RecDqdx(const MutableRecDqdx& other);
0074 
0075   static RecDqdx makeEmpty();
0076 
0077 public:
0078   /// Access the the reconstructed dEdx or dNdx and its error
0079   const edm4hep::Quantity& getDQdx() const;
0080 
0081   /// Access the particle type, e(0),mu(1),pi(2),K(3),p(4).
0082   std::int16_t getParticleType() const;
0083 
0084   /// Access the type.
0085   std::int16_t getType() const;
0086 
0087   /// Access the 5 particle hypothesis
0088   const std::array<edm4hep::Hypothesis, 5>& getHypotheses() const;
0089   /// Access item i of the 5 particle hypothesis
0090   const edm4hep::Hypothesis& getHypotheses(size_t i) const;
0091 
0092   /// Access the the corresponding track.
0093   const edm4hep::Track getTrack() const;
0094 
0095   std::size_t hitData_size() const;
0096   edm4hep::HitLevelData getHitData(std::size_t) const;
0097   std::vector<edm4hep::HitLevelData>::const_iterator hitData_begin() const;
0098   std::vector<edm4hep::HitLevelData>::const_iterator hitData_end() const;
0099   podio::RelationRange<edm4hep::HitLevelData> getHitData() const;
0100 
0101   /// check whether the object is actually available
0102   bool isAvailable() const;
0103   /// disconnect from RecDqdxObj instance
0104   void unlink() {
0105     m_obj = podio::utils::MaybeSharedPtr<RecDqdxObj>{nullptr};
0106   }
0107 
0108   bool operator==(const RecDqdx& other) const {
0109     return m_obj == other.m_obj;
0110   }
0111   bool operator==(const MutableRecDqdx& other) const;
0112 
0113   bool operator!=(const RecDqdx& other) const {
0114     return !(*this == other);
0115   }
0116   bool operator!=(const MutableRecDqdx& other) const {
0117     return !(*this == other);
0118   }
0119 
0120   // less comparison operator, so that objects can be e.g. stored in sets.
0121   bool operator<(const RecDqdx& other) const {
0122     return m_obj < other.m_obj;
0123   }
0124 
0125   podio::ObjectID id() const {
0126     return getObjectID();
0127   }
0128 
0129   const podio::ObjectID getObjectID() const;
0130 
0131   friend void swap(RecDqdx& a, RecDqdx& b) {
0132     using std::swap;
0133     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0134   }
0135 
0136 private:
0137   /// constructor from existing RecDqdxObj
0138   explicit RecDqdx(podio::utils::MaybeSharedPtr<RecDqdxObj> obj);
0139   RecDqdx(RecDqdxObj* obj);
0140 
0141   podio::utils::MaybeSharedPtr<RecDqdxObj> m_obj{nullptr};
0142 };
0143 
0144 std::ostream& operator<<(std::ostream& o, const RecDqdx& value);
0145 
0146 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0147 void to_json(nlohmann::json& j, const RecDqdx& value);
0148 #endif
0149 
0150 } // namespace edm4hep
0151 
0152 #endif