Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:35:42

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_MutableSimCalorimeterHit_H
0004 #define EDM4HEP_MutableSimCalorimeterHit_H
0005 
0006 #include "edm4hep/SimCalorimeterHitObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4hep/SimCalorimeterHit.h"
0009 
0010 #include "edm4hep/CaloHitContribution.h"
0011 #include "edm4hep/Vector3f.h"
0012 #include "podio/RelationRange.h"
0013 #include <cstdint>
0014 #include <vector>
0015 
0016 #include "podio/utilities/MaybeSharedPtr.h"
0017 
0018 #include <cstddef>
0019 #include <ostream>
0020 
0021 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0022 #include "nlohmann/json_fwd.hpp"
0023 #endif
0024 
0025 namespace edm4hep {
0026 
0027 /** @class MutableSimCalorimeterHit
0028  *  Simulated calorimeter hit
0029  *  @author: F.Gaede, DESY
0030  */
0031 class MutableSimCalorimeterHit {
0032 
0033   friend class SimCalorimeterHitCollection;
0034   friend class SimCalorimeterHitMutableCollectionIterator;
0035   friend class SimCalorimeterHit;
0036 
0037 public:
0038   using object_type = SimCalorimeterHit;
0039   using collection_type = SimCalorimeterHitCollection;
0040 
0041   /// default constructor
0042   MutableSimCalorimeterHit();
0043 
0044   /// Constructor initializing all members
0045   MutableSimCalorimeterHit(std::uint64_t cellID, float energy, edm4hep::Vector3f position);
0046 
0047   /// copy constructor
0048   MutableSimCalorimeterHit(const MutableSimCalorimeterHit& other) = default;
0049 
0050   /// copy-assignment operator
0051   MutableSimCalorimeterHit& operator=(MutableSimCalorimeterHit other);
0052 
0053   /// create a mutable deep-copy of the object with identical relations
0054   MutableSimCalorimeterHit clone() const;
0055 
0056   /// destructor
0057   ~MutableSimCalorimeterHit() = default;
0058 
0059   /// conversion to const object
0060   operator SimCalorimeterHit() const;
0061 
0062 public:
0063   /// Access the ID of the sensor that created this hit
0064   std::uint64_t getCellID() const;
0065 
0066   /// Access the energy of the hit in [GeV].
0067   float getEnergy() const;
0068 
0069   /// Access the position of the hit in world coordinates in [mm].
0070   const edm4hep::Vector3f& getPosition() const;
0071 
0072   /// Set the ID of the sensor that created this hit
0073   void setCellID(std::uint64_t value);
0074 
0075   /// Set the energy of the hit in [GeV].
0076   void setEnergy(float value);
0077 
0078   /// Set the position of the hit in world coordinates in [mm].
0079   void setPosition(edm4hep::Vector3f value);
0080   /// Get reference to position of the hit in world coordinates in [mm].
0081   edm4hep::Vector3f& position();
0082 
0083   void addToContributions(edm4hep::CaloHitContribution);
0084   std::size_t contributions_size() const;
0085   edm4hep::CaloHitContribution getContributions(std::size_t) const;
0086   std::vector<edm4hep::CaloHitContribution>::const_iterator contributions_begin() const;
0087   std::vector<edm4hep::CaloHitContribution>::const_iterator contributions_end() const;
0088   podio::RelationRange<edm4hep::CaloHitContribution> getContributions() const;
0089 
0090   /// check whether the object is actually available
0091   bool isAvailable() const;
0092   /// disconnect from SimCalorimeterHitObj instance
0093   void unlink() {
0094     m_obj = podio::utils::MaybeSharedPtr<SimCalorimeterHitObj>{nullptr};
0095   }
0096 
0097   bool operator==(const MutableSimCalorimeterHit& other) const {
0098     return m_obj == other.m_obj;
0099   }
0100   bool operator==(const SimCalorimeterHit& other) const;
0101 
0102   // less comparison operator, so that objects can be e.g. stored in sets.
0103   bool operator<(const MutableSimCalorimeterHit& other) const {
0104     return m_obj < other.m_obj;
0105   }
0106 
0107   podio::ObjectID id() const {
0108     return getObjectID();
0109   }
0110 
0111   const podio::ObjectID getObjectID() const;
0112 
0113   friend void swap(MutableSimCalorimeterHit& a, MutableSimCalorimeterHit& b) {
0114     using std::swap;
0115     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0116   }
0117 
0118 private:
0119   /// constructor from existing SimCalorimeterHitObj
0120   explicit MutableSimCalorimeterHit(podio::utils::MaybeSharedPtr<SimCalorimeterHitObj> obj);
0121 
0122   podio::utils::MaybeSharedPtr<SimCalorimeterHitObj> m_obj{nullptr};
0123 };
0124 
0125 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0126 void to_json(nlohmann::json& j, const MutableSimCalorimeterHit& value);
0127 #endif
0128 
0129 } // namespace edm4hep
0130 
0131 #endif