Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-05 08:52:28

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(float sigma, float pT, float gamma);
0050 
0051   /// copy constructor
0052   MutableHadronicFinalState(const MutableHadronicFinalState& other) = default;
0053 
0054   /// copy-assignment operator
0055   MutableHadronicFinalState& operator=(MutableHadronicFinalState other);
0056 
0057   /// create a mutable deep-copy of the object with identical relations
0058   /// if cloneRelations=false, the relations are not cloned and will be empty
0059   MutableHadronicFinalState clone(bool cloneRelations=true) const;
0060 
0061   /// destructor
0062   ~MutableHadronicFinalState() = default;
0063 
0064 
0065 public:
0066 
0067   /// Access the Longitudinal energy-momentum balance (aka E - pz)
0068   float getSigma() const;
0069 
0070   /// Access the Transverse momentum
0071   float getPT() const;
0072 
0073   /// Access the Hadronic angle
0074   float getGamma() const;
0075 
0076 
0077 
0078   /// Set the Longitudinal energy-momentum balance (aka E - pz)
0079   void setSigma(float value);
0080   /// Get mutable reference to Longitudinal energy-momentum balance (aka E - pz)
0081   float& getSigma();
0082   /// Get reference to Longitudinal energy-momentum balance (aka E - pz)
0083   [[deprecated("use getSigma instead")]]
0084   float& sigma();
0085 
0086   /// Set the Transverse momentum
0087   void setPT(float value);
0088   /// Get mutable reference to Transverse momentum
0089   float& getPT();
0090   /// Get reference to Transverse momentum
0091   [[deprecated("use getPT instead")]]
0092   float& pT();
0093 
0094   /// Set the Hadronic angle
0095   void setGamma(float value);
0096   /// Get mutable reference to Hadronic angle
0097   float& getGamma();
0098   /// Get reference to Hadronic angle
0099   [[deprecated("use getGamma instead")]]
0100   float& gamma();
0101 
0102 
0103 
0104   void addToHadrons(const edm4eic::ReconstructedParticle&);
0105   std::size_t hadrons_size() const;
0106   edm4eic::ReconstructedParticle getHadrons(std::size_t) const;
0107   std::vector<edm4eic::ReconstructedParticle>::const_iterator hadrons_begin() const;
0108   std::vector<edm4eic::ReconstructedParticle>::const_iterator hadrons_end() const;
0109   podio::RelationRange<edm4eic::ReconstructedParticle> getHadrons() const;
0110 
0111 
0112 
0113   /// check whether the object is actually available
0114   bool isAvailable() const;
0115   /// disconnect from HadronicFinalStateObj instance
0116   void unlink() { m_obj = podio::utils::MaybeSharedPtr<HadronicFinalStateObj>{nullptr}; }
0117 
0118   bool operator==(const MutableHadronicFinalState& other) const { return m_obj == other.m_obj; }
0119   bool operator==(const HadronicFinalState& other) const;
0120 
0121   bool operator!=(const MutableHadronicFinalState& other) const { return !(*this == other); }
0122   bool operator!=(const HadronicFinalState& other) const { return !(*this == other); }
0123 
0124   // less comparison operator, so that objects can be e.g. stored in sets.
0125   bool operator<(const MutableHadronicFinalState& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0126 
0127   podio::ObjectID id() const { return getObjectID(); }
0128 
0129   const podio::ObjectID getObjectID() const;
0130 
0131   friend void swap(MutableHadronicFinalState& a, MutableHadronicFinalState& 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 HadronicFinalStateObj
0138   explicit MutableHadronicFinalState(podio::utils::MaybeSharedPtr<HadronicFinalStateObj> obj);
0139 
0140   podio::utils::MaybeSharedPtr<HadronicFinalStateObj> m_obj{nullptr};
0141 };
0142 
0143 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0144 void to_json(nlohmann::json& j, const MutableHadronicFinalState& value);
0145 #endif
0146 
0147 
0148 } // namespace edm4eic
0149 
0150 
0151 #endif