Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:36

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_MutableCalorimeterHit_H
0004 #define EDM4HEP_MutableCalorimeterHit_H
0005 
0006 #include "edm4hep/CalorimeterHitObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4hep/CalorimeterHit.h"
0009 
0010 #include "edm4hep/Vector3f.h"
0011 #include <cstdint>
0012 
0013 #include "podio/utilities/MaybeSharedPtr.h"
0014 
0015 #include <cstdint>
0016 
0017 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0018 #include "nlohmann/json_fwd.hpp"
0019 #endif
0020 
0021 namespace edm4hep {
0022 
0023 /** @class MutableCalorimeterHit
0024  *  Calorimeter hit
0025  *  @author: F.Gaede, DESY
0026  */
0027 class MutableCalorimeterHit {
0028 
0029   friend class CalorimeterHitCollection;
0030   friend class CalorimeterHitMutableCollectionIterator;
0031   friend class CalorimeterHit;
0032 
0033 public:
0034   using object_type = CalorimeterHit;
0035   using collection_type = CalorimeterHitCollection;
0036 
0037   /// default constructor
0038   MutableCalorimeterHit();
0039 
0040   /// Constructor initializing all members
0041   MutableCalorimeterHit(std::uint64_t cellID, float energy, float energyError, float time, edm4hep::Vector3f position,
0042                         std::int32_t type);
0043 
0044   /// copy constructor
0045   MutableCalorimeterHit(const MutableCalorimeterHit& other) = default;
0046 
0047   /// copy-assignment operator
0048   MutableCalorimeterHit& operator=(MutableCalorimeterHit other);
0049 
0050   /// create a mutable deep-copy of the object with identical relations
0051   /// if cloneRelations=false, the relations are not cloned and will be empty
0052   MutableCalorimeterHit clone(bool cloneRelations = true) const;
0053 
0054   /// destructor
0055   ~MutableCalorimeterHit() = default;
0056 
0057 public:
0058   /// Access the detector specific (geometrical) cell id.
0059   std::uint64_t getCellID() const;
0060 
0061   /// Access the energy of the hit in [GeV].
0062   float getEnergy() const;
0063 
0064   /// Access the error of the hit energy in [GeV].
0065   float getEnergyError() const;
0066 
0067   /// Access the time of the hit in [ns].
0068   float getTime() const;
0069 
0070   /// Access the position of the hit in world coordinates in [mm].
0071   const edm4hep::Vector3f& getPosition() const;
0072 
0073   /// Access the type of hit. Mapping of integer types to names via collection parameters "CalorimeterHitTypeNames" and
0074   /// "CalorimeterHitTypeValues".
0075   std::int32_t getType() const;
0076 
0077   /// Set the detector specific (geometrical) cell id.
0078   void setCellID(std::uint64_t value);
0079   /// Get mutable reference to detector specific (geometrical) cell id.
0080   std::uint64_t& getCellID();
0081   /// Get reference to detector specific (geometrical) cell id.
0082   [[deprecated("use getCellID instead")]] std::uint64_t& cellID();
0083 
0084   /// Set the energy of the hit in [GeV].
0085   void setEnergy(float value);
0086   /// Get mutable reference to energy of the hit in [GeV].
0087   float& getEnergy();
0088   /// Get reference to energy of the hit in [GeV].
0089   [[deprecated("use getEnergy instead")]] float& energy();
0090 
0091   /// Set the error of the hit energy in [GeV].
0092   void setEnergyError(float value);
0093   /// Get mutable reference to error of the hit energy in [GeV].
0094   float& getEnergyError();
0095   /// Get reference to error of the hit energy in [GeV].
0096   [[deprecated("use getEnergyError instead")]] float& energyError();
0097 
0098   /// Set the time of the hit in [ns].
0099   void setTime(float value);
0100   /// Get mutable reference to time of the hit in [ns].
0101   float& getTime();
0102   /// Get reference to time of the hit in [ns].
0103   [[deprecated("use getTime instead")]] float& time();
0104 
0105   /// Set the position of the hit in world coordinates in [mm].
0106   void setPosition(edm4hep::Vector3f value);
0107   /// Get mutable reference to position of the hit in world coordinates in [mm].
0108   edm4hep::Vector3f& getPosition();
0109   /// Get reference to position of the hit in world coordinates in [mm].
0110   [[deprecated("use getPosition instead")]] edm4hep::Vector3f& position();
0111 
0112   /// Set the type of hit. Mapping of integer types to names via collection parameters "CalorimeterHitTypeNames" and
0113   /// "CalorimeterHitTypeValues".
0114   void setType(std::int32_t value);
0115   /// Get mutable reference to type of hit. Mapping of integer types to names via collection parameters
0116   /// "CalorimeterHitTypeNames" and "CalorimeterHitTypeValues".
0117   std::int32_t& getType();
0118   /// Get reference to type of hit. Mapping of integer types to names via collection parameters
0119   /// "CalorimeterHitTypeNames" and "CalorimeterHitTypeValues".
0120   [[deprecated("use getType instead")]] std::int32_t& type();
0121 
0122   /// check whether the object is actually available
0123   bool isAvailable() const;
0124   /// disconnect from CalorimeterHitObj instance
0125   void unlink() {
0126     m_obj = podio::utils::MaybeSharedPtr<CalorimeterHitObj>{nullptr};
0127   }
0128 
0129   bool operator==(const MutableCalorimeterHit& other) const {
0130     return m_obj == other.m_obj;
0131   }
0132   bool operator==(const CalorimeterHit& other) const;
0133 
0134   bool operator!=(const MutableCalorimeterHit& other) const {
0135     return !(*this == other);
0136   }
0137   bool operator!=(const CalorimeterHit& other) const {
0138     return !(*this == other);
0139   }
0140 
0141   // less comparison operator, so that objects can be e.g. stored in sets.
0142   bool operator<(const MutableCalorimeterHit& other) const {
0143     return m_obj < other.m_obj;
0144   }
0145 
0146   podio::ObjectID id() const {
0147     return getObjectID();
0148   }
0149 
0150   const podio::ObjectID getObjectID() const;
0151 
0152   friend void swap(MutableCalorimeterHit& a, MutableCalorimeterHit& b) {
0153     using std::swap;
0154     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0155   }
0156 
0157 private:
0158   /// constructor from existing CalorimeterHitObj
0159   explicit MutableCalorimeterHit(podio::utils::MaybeSharedPtr<CalorimeterHitObj> obj);
0160 
0161   podio::utils::MaybeSharedPtr<CalorimeterHitObj> m_obj{nullptr};
0162 };
0163 
0164 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0165 void to_json(nlohmann::json& j, const MutableCalorimeterHit& value);
0166 #endif
0167 
0168 } // namespace edm4hep
0169 
0170 #endif