Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 08:55:50

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_MutableHadronicFinalState_H
0004 #define EDM4EIC_MutableHadronicFinalState_H
0005 
0006 #include "edm4eic/HadronicFinalStateObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4eic/HadronicFinalState.h"
0009 
0010 #include "edm4eic/ReconstructedParticle.h"
0011 #include "podio/RelationRange.h"
0012 #include <vector>
0013 
0014 #include "podio/utilities/MaybeSharedPtr.h"
0015 
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 edm4eic {
0029 
0030 
0031 /** @class MutableHadronicFinalState
0032  *  Summed quantities of the hadronic final state
0033  *  @author: T. Kutz
0034  */
0035 class MutableHadronicFinalState {
0036 
0037   friend class HadronicFinalStateCollection;
0038   friend class HadronicFinalStateMutableCollectionIterator;
0039   friend class HadronicFinalState;
0040 
0041 public:
0042   using object_type = HadronicFinalState;
0043   using collection_type = HadronicFinalStateCollection;
0044 
0045   /// default constructor
0046   MutableHadronicFinalState();
0047 
0048   /// Constructor initializing all members
0049   MutableHadronicFinalState(const float sigma, const float pT, const float gamma);
0050 
0051   /// copy constructor
0052   MutableHadronicFinalState(const MutableHadronicFinalState& other) = default;
0053 
0054   /// copy-assignment operator
0055   MutableHadronicFinalState& operator=(MutableHadronicFinalState other) &; // Rebind this to other's internal object
0056   MutableHadronicFinalState& operator=(MutableHadronicFinalState other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0057 
0058   /// create a mutable deep-copy of the object with identical relations
0059   /// if cloneRelations=false, the relations are not cloned and will be empty
0060   MutableHadronicFinalState clone(bool cloneRelations=true) const;
0061 
0062   /// destructor
0063   ~MutableHadronicFinalState() = default;
0064 
0065 
0066 public:
0067 
0068   /// Access the Longitudinal energy-momentum balance (aka E - pz)
0069   float getSigma() const;
0070 
0071   /// Access the Transverse momentum
0072   float getPT() const;
0073 
0074   /// Access the Hadronic angle
0075   float getGamma() const;
0076 
0077 
0078 
0079   /// Set the Longitudinal energy-momentum balance (aka E - pz)
0080   void setSigma(const float sigma);
0081   /// Get mutable reference to Longitudinal energy-momentum balance (aka E - pz)
0082   float& getSigma();
0083   /// Get reference to Longitudinal energy-momentum balance (aka E - pz)
0084   [[deprecated("use getSigma instead")]]
0085   float& sigma();
0086 
0087   /// Set the Transverse momentum
0088   void setPT(const float pT);
0089   /// Get mutable reference to Transverse momentum
0090   float& getPT();
0091   /// Get reference to Transverse momentum
0092   [[deprecated("use getPT instead")]]
0093   float& pT();
0094 
0095   /// Set the Hadronic angle
0096   void setGamma(const float gamma);
0097   /// Get mutable reference to Hadronic angle
0098   float& getGamma();
0099   /// Get reference to Hadronic angle
0100   [[deprecated("use getGamma instead")]]
0101   float& gamma();
0102 
0103 
0104 
0105   void addToHadrons(const edm4eic::ReconstructedParticle&);
0106   std::size_t hadrons_size() const;
0107   edm4eic::ReconstructedParticle getHadrons(std::size_t) const;
0108   std::vector<edm4eic::ReconstructedParticle>::const_iterator hadrons_begin() const;
0109   std::vector<edm4eic::ReconstructedParticle>::const_iterator hadrons_end() const;
0110   podio::RelationRange<edm4eic::ReconstructedParticle> getHadrons() const;
0111 
0112 
0113 
0114   /// check whether the object is actually available
0115   bool isAvailable() const;
0116   /// disconnect from HadronicFinalStateObj instance
0117   void unlink() { m_obj = podio::utils::MaybeSharedPtr<HadronicFinalStateObj>{nullptr}; }
0118 
0119   bool operator==(const MutableHadronicFinalState& other) const { return m_obj == other.m_obj; }
0120   bool operator==(const HadronicFinalState& other) const;
0121 
0122   bool operator!=(const MutableHadronicFinalState& other) const { return !(*this == other); }
0123   bool operator!=(const HadronicFinalState& other) const { return !(*this == other); }
0124 
0125   // less comparison operator, so that objects can be e.g. stored in sets.
0126   bool operator<(const MutableHadronicFinalState& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0127 
0128   podio::ObjectID id() const { return getObjectID(); }
0129 
0130   const podio::ObjectID getObjectID() const;
0131 
0132   friend std::hash<MutableHadronicFinalState>;
0133 
0134   friend void swap(MutableHadronicFinalState& a, MutableHadronicFinalState& b) {
0135     using std::swap;
0136     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0137   }
0138 
0139 private:
0140   /// constructor from existing HadronicFinalStateObj
0141   explicit MutableHadronicFinalState(podio::utils::MaybeSharedPtr<HadronicFinalStateObj> obj);
0142 
0143   podio::utils::MaybeSharedPtr<HadronicFinalStateObj> m_obj{nullptr};
0144 };
0145 
0146 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0147 void to_json(nlohmann::json& j, const MutableHadronicFinalState& value);
0148 #endif
0149 
0150 
0151 } // namespace edm4eic
0152 
0153 
0154 
0155 template<>
0156 struct std::hash<edm4eic::MutableHadronicFinalState> {
0157   std::size_t operator()(const edm4eic::MutableHadronicFinalState& obj) const {
0158     return std::hash<edm4eic::HadronicFinalStateObj*>{}(obj.m_obj.get());
0159   }
0160 };
0161 
0162 
0163 #endif