Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/edm4hep/MutableCluster.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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() = default;
0049 
0050   /// Constructor initializing all members
0051   MutableCluster(const std::int32_t type, const float energy, const float energyError,
0052                  const edm4hep::Vector3f& position, const edm4hep::CovMatrix3f& positionError, const float iTheta,
0053                  const float phi, const edm4hep::Vector3f& directionError);
0054 
0055   /// copy constructor
0056   MutableCluster(const MutableCluster& other) = default;
0057 
0058   /// copy-assignment operator
0059   MutableCluster& operator=(MutableCluster other) &; // Rebind this to other's internal object
0060   MutableCluster&
0061   operator=(MutableCluster other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0062 
0063   /// create a mutable deep-copy of the object with identical relations
0064   /// if cloneRelations=false, the relations are not cloned and will be empty
0065   MutableCluster clone(bool cloneRelations = true) const;
0066 
0067   /// destructor
0068   ~MutableCluster() = default;
0069 
0070 public:
0071   /// Access the flagword that defines the type of cluster
0072   std::int32_t getType() const;
0073 
0074   /// Access the energy of the cluster [GeV]
0075   float getEnergy() const;
0076 
0077   /// Access the error on the energy [GeV]
0078   float getEnergyError() const;
0079 
0080   /// Access the position of the cluster [mm]
0081   const edm4hep::Vector3f& getPosition() const;
0082 
0083   /// Access the covariance matrix of the position [mm^2]
0084   const edm4hep::CovMatrix3f& getPositionError() const;
0085 
0086   /// Access the Polar angle of the cluster's intrinsic direction (used e.g. for vertexing). Not to be confused with the
0087   /// cluster position seen from IP [rad]
0088   float getITheta() const;
0089 
0090   /// Access the Azimuthal angle of the cluster's intrinsic direction (used e.g. for vertexing). Not to be confused with
0091   /// the cluster position seen from IP [rad]
0092   float getPhi() const;
0093 
0094   /// Access the covariance matrix of the direction [mm^2]
0095   const edm4hep::Vector3f& getDirectionError() const;
0096 
0097   /// Set the flagword that defines the type of cluster
0098   void setType(const std::int32_t type);
0099   /// Get mutable reference to flagword that defines the type of cluster
0100   std::int32_t& getType();
0101   /// Get reference to flagword that defines the type of cluster
0102   [[deprecated("use getType instead")]] std::int32_t& type();
0103 
0104   /// Set the energy of the cluster [GeV]
0105   void setEnergy(const float energy);
0106   /// Get mutable reference to energy of the cluster [GeV]
0107   float& getEnergy();
0108   /// Get reference to energy of the cluster [GeV]
0109   [[deprecated("use getEnergy instead")]] float& energy();
0110 
0111   /// Set the error on the energy [GeV]
0112   void setEnergyError(const float energyError);
0113   /// Get mutable reference to error on the energy [GeV]
0114   float& getEnergyError();
0115   /// Get reference to error on the energy [GeV]
0116   [[deprecated("use getEnergyError instead")]] float& energyError();
0117 
0118   /// Set the position of the cluster [mm]
0119   void setPosition(const edm4hep::Vector3f& position);
0120   /// Get mutable reference to position of the cluster [mm]
0121   edm4hep::Vector3f& getPosition();
0122   /// Get reference to position of the cluster [mm]
0123   [[deprecated("use getPosition instead")]] edm4hep::Vector3f& position();
0124 
0125   /// Set the covariance matrix of the position [mm^2]
0126   void setPositionError(const edm4hep::CovMatrix3f& positionError);
0127   /// Get mutable reference to covariance matrix of the position [mm^2]
0128   edm4hep::CovMatrix3f& getPositionError();
0129   /// Get reference to covariance matrix of the position [mm^2]
0130   [[deprecated("use getPositionError instead")]] edm4hep::CovMatrix3f& positionError();
0131 
0132   /// Set the Polar angle of the cluster's intrinsic direction (used e.g. for vertexing). Not to be confused with the
0133   /// cluster position seen from IP [rad]
0134   void setITheta(const float iTheta);
0135   /// Get mutable reference to Polar angle of the cluster's intrinsic direction (used e.g. for vertexing). Not to be
0136   /// confused with the cluster position seen from IP [rad]
0137   float& getITheta();
0138   /// Get reference to Polar angle of the cluster's intrinsic direction (used e.g. for vertexing). Not to be confused
0139   /// with the cluster position seen from IP [rad]
0140   [[deprecated("use getITheta instead")]] float& iTheta();
0141 
0142   /// Set the Azimuthal angle of the cluster's intrinsic direction (used e.g. for vertexing). Not to be confused with
0143   /// the cluster position seen from IP [rad]
0144   void setPhi(const float phi);
0145   /// Get mutable reference to Azimuthal angle of the cluster's intrinsic direction (used e.g. for vertexing). Not to be
0146   /// confused with the cluster position seen from IP [rad]
0147   float& getPhi();
0148   /// Get reference to Azimuthal angle of the cluster's intrinsic direction (used e.g. for vertexing). Not to be
0149   /// confused with the cluster position seen from IP [rad]
0150   [[deprecated("use getPhi instead")]] float& phi();
0151 
0152   /// Set the covariance matrix of the direction [mm^2]
0153   void setDirectionError(const edm4hep::Vector3f& directionError);
0154   /// Get mutable reference to covariance matrix of the direction [mm^2]
0155   edm4hep::Vector3f& getDirectionError();
0156   /// Get reference to covariance matrix of the direction [mm^2]
0157   [[deprecated("use getDirectionError instead")]] edm4hep::Vector3f& directionError();
0158 
0159   void addToClusters(const edm4hep::Cluster&);
0160   std::size_t clusters_size() const;
0161   edm4hep::Cluster getClusters(std::size_t) const;
0162   std::vector<edm4hep::Cluster>::const_iterator clusters_begin() const;
0163   std::vector<edm4hep::Cluster>::const_iterator clusters_end() const;
0164   podio::RelationRange<edm4hep::Cluster> getClusters() const;
0165   void addToHits(const edm4hep::CalorimeterHit&);
0166   std::size_t hits_size() const;
0167   edm4hep::CalorimeterHit getHits(std::size_t) const;
0168   std::vector<edm4hep::CalorimeterHit>::const_iterator hits_begin() const;
0169   std::vector<edm4hep::CalorimeterHit>::const_iterator hits_end() const;
0170   podio::RelationRange<edm4hep::CalorimeterHit> getHits() const;
0171   void addToShapeParameters(const float&);
0172   std::size_t shapeParameters_size() const;
0173   float getShapeParameters(std::size_t) const;
0174   std::vector<float>::const_iterator shapeParameters_begin() const;
0175   std::vector<float>::const_iterator shapeParameters_end() const;
0176   podio::RelationRange<float> getShapeParameters() const;
0177   void addToSubdetectorEnergies(const float&);
0178   std::size_t subdetectorEnergies_size() const;
0179   float getSubdetectorEnergies(std::size_t) const;
0180   std::vector<float>::const_iterator subdetectorEnergies_begin() const;
0181   std::vector<float>::const_iterator subdetectorEnergies_end() const;
0182   podio::RelationRange<float> getSubdetectorEnergies() const;
0183 
0184   /// Get the position error value for the two passed dimensions
0185   float getPositionError(edm4hep::Cartesian dimI, edm4hep::Cartesian dimJ) const {
0186     return getPositionError().getValue(dimI, dimJ);
0187   }
0188 
0189   /// Set the position error value for the two passed dimensions
0190   void setPositionError(float value, edm4hep::Cartesian dimI, edm4hep::Cartesian dimJ) {
0191     return getPositionError().setValue(value, dimI, dimJ);
0192   }
0193 
0194   /// check whether the object is actually available
0195   bool isAvailable() const;
0196   /// disconnect from ClusterObj instance
0197   void unlink() { m_obj = podio::utils::MaybeSharedPtr<ClusterObj>{nullptr}; }
0198 
0199   bool operator==(const MutableCluster& other) const { return m_obj == other.m_obj; }
0200   bool operator==(const Cluster& other) const;
0201 
0202   bool operator!=(const MutableCluster& other) const { return !(*this == other); }
0203   bool operator!=(const Cluster& other) const { return !(*this == other); }
0204 
0205   // less comparison operator, so that objects can be e.g. stored in sets.
0206   bool operator<(const MutableCluster& other) const {
0207     return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0208   }
0209 
0210   podio::ObjectID id() const { return getObjectID(); }
0211 
0212   const podio::ObjectID getObjectID() const;
0213 
0214   friend std::hash<MutableCluster>;
0215 
0216   friend void swap(MutableCluster& a, MutableCluster& b) {
0217     using std::swap;
0218     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0219   }
0220 
0221 private:
0222   /// constructor from existing ClusterObj
0223   explicit MutableCluster(podio::utils::MaybeSharedPtr<ClusterObj> obj);
0224 
0225   podio::utils::MaybeSharedPtr<ClusterObj> m_obj{new ClusterObj{}, podio::utils::MarkOwned};
0226 };
0227 
0228 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0229 void to_json(nlohmann::json& j, const MutableCluster& value);
0230 #endif
0231 
0232 } // namespace edm4hep
0233 
0234 template <>
0235 struct std::hash<edm4hep::MutableCluster> {
0236   std::size_t operator()(const edm4hep::MutableCluster& obj) const {
0237     return std::hash<edm4hep::ClusterObj*>{}(obj.m_obj.get());
0238   }
0239 };
0240 
0241 #endif