Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_HadronicFinalState_H
0004 #define EDM4EIC_HadronicFinalState_H
0005 
0006 #include "edm4eic/HadronicFinalStateObj.h"
0007 
0008 #include "edm4eic/ReconstructedParticle.h"
0009 #include "podio/RelationRange.h"
0010 #include <vector>
0011 
0012 #include "podio/utilities/MaybeSharedPtr.h"
0013 #include "podio/detail/OrderKey.h"
0014 
0015 #include <ostream>
0016 #include <cstdint>
0017 
0018 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0019 #include "nlohmann/json_fwd.hpp"
0020 #endif
0021 
0022 // forward declarations
0023 namespace edm4eic {
0024 class HadronicFinalStateCollection;
0025 }
0026 
0027 
0028 namespace podio::detail {
0029 // Internal function used in less comparison operators of the datatypes and interface types
0030 OrderKey getOrderKey(const edm4eic::HadronicFinalState& obj);
0031 };
0032 
0033 namespace edm4eic {
0034 
0035 class MutableHadronicFinalState;
0036 class HadronicFinalStateCollection;
0037 class HadronicFinalStateCollectionData;
0038 
0039 /** @class HadronicFinalState
0040  *  Summed quantities of the hadronic final state
0041  *  @author: T. Kutz
0042  */
0043 class HadronicFinalState {
0044 
0045   friend class MutableHadronicFinalState;
0046   friend class HadronicFinalStateCollection;
0047   friend class edm4eic::HadronicFinalStateCollectionData;
0048   friend class HadronicFinalStateCollectionIterator;
0049   friend podio::detail::OrderKey podio::detail::getOrderKey(const HadronicFinalState & obj);
0050 
0051 public:
0052   using mutable_type = MutableHadronicFinalState;
0053   using collection_type = HadronicFinalStateCollection;
0054 
0055   /// default constructor
0056   HadronicFinalState();
0057 
0058   /// Constructor initializing all members
0059   HadronicFinalState(const float sigma, const float pT, const float gamma);
0060 
0061   /// copy constructor
0062   HadronicFinalState(const HadronicFinalState& other) = default;
0063 
0064   /// copy-assignment operator
0065   HadronicFinalState& operator=(HadronicFinalState other) &; // Rebind this to other's internal object
0066   HadronicFinalState& operator=(HadronicFinalState other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0067 
0068   /// create a mutable deep-copy of the object with identical relations
0069   /// if cloneRelations=false, the relations are not cloned and will be empty
0070   MutableHadronicFinalState clone(bool cloneRelations=true) const;
0071 
0072   /// destructor
0073   ~HadronicFinalState() = default;
0074 
0075   /// converting constructor from mutable object
0076   HadronicFinalState(const MutableHadronicFinalState& other);
0077 
0078   static HadronicFinalState makeEmpty();
0079 
0080 public:
0081 
0082   static constexpr std::string_view typeName = "edm4eic::HadronicFinalState";
0083 
0084   /// Access the Longitudinal energy-momentum balance (aka E - pz)
0085   float getSigma() const;
0086 
0087   /// Access the Transverse momentum
0088   float getPT() const;
0089 
0090   /// Access the Hadronic angle
0091   float getGamma() const;
0092 
0093 
0094 
0095   std::size_t hadrons_size() const;
0096   edm4eic::ReconstructedParticle getHadrons(std::size_t) const;
0097   std::vector<edm4eic::ReconstructedParticle>::const_iterator hadrons_begin() const;
0098   std::vector<edm4eic::ReconstructedParticle>::const_iterator hadrons_end() const;
0099   podio::RelationRange<edm4eic::ReconstructedParticle> getHadrons() const;
0100 
0101 
0102   /// check whether the object is actually available
0103   bool isAvailable() const;
0104   /// disconnect from HadronicFinalStateObj instance
0105   void unlink() { m_obj = podio::utils::MaybeSharedPtr<HadronicFinalStateObj>{nullptr}; }
0106 
0107   bool operator==(const HadronicFinalState& other) const { return m_obj == other.m_obj; }
0108   bool operator==(const MutableHadronicFinalState& other) const;
0109 
0110   bool operator!=(const HadronicFinalState& other) const { return !(*this == other); }
0111   bool operator!=(const MutableHadronicFinalState& other) const { return !(*this == other); }
0112 
0113   // less comparison operator, so that objects can be e.g. stored in sets.
0114   bool operator<(const HadronicFinalState& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0115 
0116   podio::ObjectID id() const { return getObjectID(); }
0117 
0118   const podio::ObjectID getObjectID() const;
0119 
0120   friend std::hash<HadronicFinalState>;
0121 
0122   friend void swap(HadronicFinalState& a, HadronicFinalState& b) {
0123     using std::swap;
0124     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0125   }
0126 
0127 private:
0128   /// constructor from existing HadronicFinalStateObj
0129   explicit HadronicFinalState(podio::utils::MaybeSharedPtr<HadronicFinalStateObj> obj);
0130   HadronicFinalState(HadronicFinalStateObj* obj);
0131 
0132   podio::utils::MaybeSharedPtr<HadronicFinalStateObj> m_obj{nullptr};
0133 };
0134 
0135 std::ostream& operator<<(std::ostream& o, const HadronicFinalState& value);
0136 
0137 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0138 void to_json(nlohmann::json& j, const HadronicFinalState& value);
0139 #endif
0140 
0141 
0142 } // namespace edm4eic
0143 
0144 
0145 
0146 template<>
0147 struct std::hash<edm4eic::HadronicFinalState> {
0148   std::size_t operator()(const edm4eic::HadronicFinalState& obj) const {
0149     return std::hash<edm4eic::HadronicFinalStateObj*>{}(obj.m_obj.get());
0150   }
0151 };
0152 
0153 
0154 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0155 // until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
0156 // and https://github.com/AIDASoft/podio/issues/770
0157 #if defined(__clang__)
0158 #pragma clang diagnostic push
0159 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0160 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0161 #pragma clang diagnostic ignored "-Wdeprecated"
0162 constexpr std::string_view edm4eic::HadronicFinalState::typeName;
0163 #pragma clang diagnostic pop
0164 #elif defined(__GNUC__)
0165 #pragma GCC diagnostic push
0166 #pragma GCC diagnostic ignored "-Wdeprecated"
0167 constexpr std::string_view edm4eic::HadronicFinalState::typeName;
0168 #pragma GCC diagnostic pop
0169 #endif
0170 
0171 #endif