Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-01 08:35:24

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_MutableCluster_H
0004 #define EDM4HEP_MutableCluster_H
0005 
0006 #include "edm4hep/ClusterObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4hep/Cluster.h"
0009 
0010 #include "edm4hep/CalorimeterHit.h"
0011 #include "edm4hep/CovMatrix3f.h"
0012 #include "edm4hep/Vector3f.h"
0013 #include "podio/RelationRange.h"
0014 #include <cstdint>
0015 #include <edm4hep/Constants.h>
0016 #include <vector>
0017 
0018 #include "podio/utilities/MaybeSharedPtr.h"
0019 
0020 #include <cstdint>
0021 
0022 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0023 #include "nlohmann/json_fwd.hpp"
0024 #endif
0025 
0026 // forward declarations
0027 namespace edm4hep {
0028 class ClusterCollection;
0029 }
0030 
0031 namespace edm4hep {
0032 
0033 /** @class MutableCluster
0034  *  Calorimeter Hit Cluster
0035  *  @author: EDM4hep authors
0036  */
0037 class MutableCluster {
0038 
0039   friend class ClusterCollection;
0040   friend class ClusterMutableCollectionIterator;
0041   friend class Cluster;
0042 
0043 public:
0044   using object_type = Cluster;
0045   using collection_type = ClusterCollection;
0046 
0047   /// default constructor
0048   MutableCluster();
0049 
0050   /// Constructor initializing all members
0051   MutableCluster(std::int32_t type, float energy, float energyError, edm4hep::Vector3f position,
0052                  edm4hep::CovMatrix3f positionError, float iTheta, float phi, edm4hep::Vector3f directionError);
0053 
0054   /// copy constructor
0055   MutableCluster(const MutableCluster& other) = default;
0056 
0057   /// copy-assignment operator
0058   MutableCluster& operator=(MutableCluster other);
0059 
0060   /// create a mutable deep-copy of the object with identical relations
0061   /// if cloneRelations=false, the relations are not cloned and will be empty
0062   MutableCluster clone(bool cloneRelations = true) const;
0063 
0064   /// destructor
0065   ~MutableCluster() = default;
0066 
0067 public:
0068   /// Access the flagword that defines the type of cluster
0069   std::int32_t getType() const;
0070 
0071   /// Access the energy of the cluster [GeV]
0072   float getEnergy() const;
0073 
0074   /// Access the error on the energy [GeV]
0075   float getEnergyError() const;
0076 
0077   /// Access the position of the cluster [mm]
0078   const edm4hep::Vector3f& getPosition() const;
0079 
0080   /// Access the covariance matrix of the position
0081   const edm4hep::CovMatrix3f& getPositionError() const;
0082 
0083   /// Access the intrinsic direction of cluster at position  Theta. Not to be confused with direction cluster is seen
0084   /// from IP
0085   float getITheta() const;
0086 
0087   /// Access the intrinsic direction of cluster at position - Phi. Not to be confused with direction cluster is seen
0088   /// from IP
0089   float getPhi() const;
0090 
0091   /// Access the covariance matrix of the direction [mm**2]
0092   const edm4hep::Vector3f& getDirectionError() const;
0093 
0094   /// Set the flagword that defines the type of cluster
0095   void setType(std::int32_t value);
0096   /// Get mutable reference to flagword that defines the type of cluster
0097   std::int32_t& getType();
0098   /// Get reference to flagword that defines the type of cluster
0099   [[deprecated("use getType instead")]] std::int32_t& type();
0100 
0101   /// Set the energy of the cluster [GeV]
0102   void setEnergy(float value);
0103   /// Get mutable reference to energy of the cluster [GeV]
0104   float& getEnergy();
0105   /// Get reference to energy of the cluster [GeV]
0106   [[deprecated("use getEnergy instead")]] float& energy();
0107 
0108   /// Set the error on the energy [GeV]
0109   void setEnergyError(float value);
0110   /// Get mutable reference to error on the energy [GeV]
0111   float& getEnergyError();
0112   /// Get reference to error on the energy [GeV]
0113   [[deprecated("use getEnergyError instead")]] float& energyError();
0114 
0115   /// Set the position of the cluster [mm]
0116   void setPosition(edm4hep::Vector3f value);
0117   /// Get mutable reference to position of the cluster [mm]
0118   edm4hep::Vector3f& getPosition();
0119   /// Get reference to position of the cluster [mm]
0120   [[deprecated("use getPosition instead")]] edm4hep::Vector3f& position();
0121 
0122   /// Set the covariance matrix of the position
0123   void setPositionError(edm4hep::CovMatrix3f value);
0124   /// Get mutable reference to covariance matrix of the position
0125   edm4hep::CovMatrix3f& getPositionError();
0126   /// Get reference to covariance matrix of the position
0127   [[deprecated("use getPositionError instead")]] edm4hep::CovMatrix3f& positionError();
0128 
0129   /// Set the intrinsic direction of cluster at position  Theta. Not to be confused with direction cluster is seen from
0130   /// IP
0131   void setITheta(float value);
0132   /// Get mutable reference to intrinsic direction of cluster at position  Theta. Not to be confused with direction
0133   /// cluster is seen from IP
0134   float& getITheta();
0135   /// Get reference to intrinsic direction of cluster at position  Theta. Not to be confused with direction cluster is
0136   /// seen from IP
0137   [[deprecated("use getITheta instead")]] float& iTheta();
0138 
0139   /// Set the intrinsic direction of cluster at position - Phi. Not to be confused with direction cluster is seen from
0140   /// IP
0141   void setPhi(float value);
0142   /// Get mutable reference to intrinsic direction of cluster at position - Phi. Not to be confused with direction
0143   /// cluster is seen from IP
0144   float& getPhi();
0145   /// Get reference to intrinsic direction of cluster at position - Phi. Not to be confused with direction cluster is
0146   /// seen from IP
0147   [[deprecated("use getPhi instead")]] float& phi();
0148 
0149   /// Set the covariance matrix of the direction [mm**2]
0150   void setDirectionError(edm4hep::Vector3f value);
0151   /// Get mutable reference to covariance matrix of the direction [mm**2]
0152   edm4hep::Vector3f& getDirectionError();
0153   /// Get reference to covariance matrix of the direction [mm**2]
0154   [[deprecated("use getDirectionError instead")]] edm4hep::Vector3f& directionError();
0155 
0156   void addToClusters(const edm4hep::Cluster&);
0157   std::size_t clusters_size() const;
0158   edm4hep::Cluster getClusters(std::size_t) const;
0159   std::vector<edm4hep::Cluster>::const_iterator clusters_begin() const;
0160   std::vector<edm4hep::Cluster>::const_iterator clusters_end() const;
0161   podio::RelationRange<edm4hep::Cluster> getClusters() const;
0162   void addToHits(const edm4hep::CalorimeterHit&);
0163   std::size_t hits_size() const;
0164   edm4hep::CalorimeterHit getHits(std::size_t) const;
0165   std::vector<edm4hep::CalorimeterHit>::const_iterator hits_begin() const;
0166   std::vector<edm4hep::CalorimeterHit>::const_iterator hits_end() const;
0167   podio::RelationRange<edm4hep::CalorimeterHit> getHits() const;
0168   void addToShapeParameters(const float&);
0169   std::size_t shapeParameters_size() const;
0170   float getShapeParameters(std::size_t) const;
0171   std::vector<float>::const_iterator shapeParameters_begin() const;
0172   std::vector<float>::const_iterator shapeParameters_end() const;
0173   podio::RelationRange<float> getShapeParameters() const;
0174   void addToSubdetectorEnergies(const float&);
0175   std::size_t subdetectorEnergies_size() const;
0176   float getSubdetectorEnergies(std::size_t) const;
0177   std::vector<float>::const_iterator subdetectorEnergies_begin() const;
0178   std::vector<float>::const_iterator subdetectorEnergies_end() const;
0179   podio::RelationRange<float> getSubdetectorEnergies() const;
0180 
0181   /// Get the position error value for the two passed dimensions
0182   float getPositionError(edm4hep::Cartesian dimI, edm4hep::Cartesian dimJ) const {
0183     return getPositionError().getValue(dimI, dimJ);
0184   }
0185 
0186   /// Set the position error value for the two passed dimensions
0187   void setPositionError(float value, edm4hep::Cartesian dimI, edm4hep::Cartesian dimJ) {
0188     return getPositionError().setValue(value, dimI, dimJ);
0189   }
0190 
0191   /// check whether the object is actually available
0192   bool isAvailable() const;
0193   /// disconnect from ClusterObj instance
0194   void unlink() {
0195     m_obj = podio::utils::MaybeSharedPtr<ClusterObj>{nullptr};
0196   }
0197 
0198   bool operator==(const MutableCluster& other) const {
0199     return m_obj == other.m_obj;
0200   }
0201   bool operator==(const Cluster& other) const;
0202 
0203   bool operator!=(const MutableCluster& other) const {
0204     return !(*this == other);
0205   }
0206   bool operator!=(const Cluster& other) const {
0207     return !(*this == other);
0208   }
0209 
0210   // less comparison operator, so that objects can be e.g. stored in sets.
0211   bool operator<(const MutableCluster& other) const {
0212     return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0213   }
0214 
0215   podio::ObjectID id() const {
0216     return getObjectID();
0217   }
0218 
0219   const podio::ObjectID getObjectID() const;
0220 
0221   friend void swap(MutableCluster& a, MutableCluster& b) {
0222     using std::swap;
0223     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0224   }
0225 
0226 private:
0227   /// constructor from existing ClusterObj
0228   explicit MutableCluster(podio::utils::MaybeSharedPtr<ClusterObj> obj);
0229 
0230   podio::utils::MaybeSharedPtr<ClusterObj> m_obj{nullptr};
0231 };
0232 
0233 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0234 void to_json(nlohmann::json& j, const MutableCluster& value);
0235 #endif
0236 
0237 } // namespace edm4hep
0238 
0239 #endif