Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:55:02

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_MutableSimPulse_H
0004 #define EDM4EIC_MutableSimPulse_H
0005 
0006 #include "edm4eic/SimPulseObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4eic/SimPulse.h"
0009 
0010 #include "edm4hep/MCParticle.h"
0011 #include "edm4hep/SimCalorimeterHit.h"
0012 #include "edm4hep/SimTrackerHit.h"
0013 #include "edm4hep/Vector3f.h"
0014 #include "podio/RelationRange.h"
0015 #include <cstdint>
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 edm4eic {
0028 class SimPulseCollection;
0029 }
0030 
0031 
0032 namespace edm4eic {
0033 
0034 
0035 /** @class MutableSimPulse
0036  *  Simulated pulse prior to digitization.
0037  *  @author: D. Anderson, S. Gardner, S. Joosten., D. Kalinkin
0038  */
0039 class MutableSimPulse {
0040 
0041   friend class SimPulseCollection;
0042   friend class SimPulseMutableCollectionIterator;
0043   friend class SimPulse;
0044 
0045 public:
0046   using object_type = SimPulse;
0047   using collection_type = SimPulseCollection;
0048 
0049   /// default constructor
0050   MutableSimPulse();
0051 
0052   /// Constructor initializing all members
0053   MutableSimPulse(const std::uint64_t cellID, const float integral, const edm4hep::Vector3f& position, const float time, const float interval);
0054 
0055   /// copy constructor
0056   MutableSimPulse(const MutableSimPulse& other) = default;
0057 
0058   /// copy-assignment operator
0059   MutableSimPulse& operator=(MutableSimPulse other) &; // Rebind this to other's internal object
0060   MutableSimPulse& operator=(MutableSimPulse other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0061 
0062   /// create a mutable deep-copy of the object with identical relations
0063   /// if cloneRelations=false, the relations are not cloned and will be empty
0064   MutableSimPulse clone(bool cloneRelations=true) const;
0065 
0066   /// destructor
0067   ~MutableSimPulse() = default;
0068 
0069 
0070 public:
0071 
0072   /// Access the ID of the readout cell for this pulse.
0073   std::uint64_t getCellID() const;
0074 
0075   /// Access the Total pulse integral in relevant units.
0076   float getIntegral() const;
0077 
0078   /// Access the Position the pulse is evaluated in world coordinates [mm].
0079   const edm4hep::Vector3f& getPosition() const;
0080 
0081   /// Access the Start time for the pulse in [ns].
0082   float getTime() const;
0083 
0084   /// Access the Time interval between amplitude values [ns].
0085   float getInterval() const;
0086 
0087 
0088 
0089   /// Set the ID of the readout cell for this pulse.
0090   void setCellID(const std::uint64_t cellID);
0091   /// Get mutable reference to ID of the readout cell for this pulse.
0092   std::uint64_t& getCellID();
0093   /// Get reference to ID of the readout cell for this pulse.
0094   [[deprecated("use getCellID instead")]]
0095   std::uint64_t& cellID();
0096 
0097   /// Set the Total pulse integral in relevant units.
0098   void setIntegral(const float integral);
0099   /// Get mutable reference to Total pulse integral in relevant units.
0100   float& getIntegral();
0101   /// Get reference to Total pulse integral in relevant units.
0102   [[deprecated("use getIntegral instead")]]
0103   float& integral();
0104 
0105   /// Set the Position the pulse is evaluated in world coordinates [mm].
0106   void setPosition(const edm4hep::Vector3f& position);
0107   /// Get mutable reference to Position the pulse is evaluated in world coordinates [mm].
0108   edm4hep::Vector3f& getPosition();
0109   /// Get reference to Position the pulse is evaluated in world coordinates [mm].
0110   [[deprecated("use getPosition instead")]]
0111   edm4hep::Vector3f& position();
0112 
0113   /// Set the Start time for the pulse in [ns].
0114   void setTime(const float time);
0115   /// Get mutable reference to Start time for the pulse in [ns].
0116   float& getTime();
0117   /// Get reference to Start time for the pulse in [ns].
0118   [[deprecated("use getTime instead")]]
0119   float& time();
0120 
0121   /// Set the Time interval between amplitude values [ns].
0122   void setInterval(const float interval);
0123   /// Get mutable reference to Time interval between amplitude values [ns].
0124   float& getInterval();
0125   /// Get reference to Time interval between amplitude values [ns].
0126   [[deprecated("use getInterval instead")]]
0127   float& interval();
0128 
0129 
0130 
0131   void addToCalorimeterHits(const edm4hep::SimCalorimeterHit&);
0132   std::size_t calorimeterHits_size() const;
0133   edm4hep::SimCalorimeterHit getCalorimeterHits(std::size_t) const;
0134   std::vector<edm4hep::SimCalorimeterHit>::const_iterator calorimeterHits_begin() const;
0135   std::vector<edm4hep::SimCalorimeterHit>::const_iterator calorimeterHits_end() const;
0136   podio::RelationRange<edm4hep::SimCalorimeterHit> getCalorimeterHits() const;
0137   void addToTrackerHits(const edm4hep::SimTrackerHit&);
0138   std::size_t trackerHits_size() const;
0139   edm4hep::SimTrackerHit getTrackerHits(std::size_t) const;
0140   std::vector<edm4hep::SimTrackerHit>::const_iterator trackerHits_begin() const;
0141   std::vector<edm4hep::SimTrackerHit>::const_iterator trackerHits_end() const;
0142   podio::RelationRange<edm4hep::SimTrackerHit> getTrackerHits() const;
0143   void addToPulses(const edm4eic::SimPulse&);
0144   std::size_t pulses_size() const;
0145   edm4eic::SimPulse getPulses(std::size_t) const;
0146   std::vector<edm4eic::SimPulse>::const_iterator pulses_begin() const;
0147   std::vector<edm4eic::SimPulse>::const_iterator pulses_end() const;
0148   podio::RelationRange<edm4eic::SimPulse> getPulses() const;
0149   void addToParticles(const edm4hep::MCParticle&);
0150   std::size_t particles_size() const;
0151   edm4hep::MCParticle getParticles(std::size_t) const;
0152   std::vector<edm4hep::MCParticle>::const_iterator particles_begin() const;
0153   std::vector<edm4hep::MCParticle>::const_iterator particles_end() const;
0154   podio::RelationRange<edm4hep::MCParticle> getParticles() const;
0155   void addToAmplitude(const float&);
0156   std::size_t amplitude_size() const;
0157   float getAmplitude(std::size_t) const;
0158   std::vector<float>::const_iterator amplitude_begin() const;
0159   std::vector<float>::const_iterator amplitude_end() const;
0160   podio::RelationRange<float> getAmplitude() const;
0161 
0162 
0163 
0164   /// check whether the object is actually available
0165   bool isAvailable() const;
0166   /// disconnect from SimPulseObj instance
0167   void unlink() { m_obj = podio::utils::MaybeSharedPtr<SimPulseObj>{nullptr}; }
0168 
0169   bool operator==(const MutableSimPulse& other) const { return m_obj == other.m_obj; }
0170   bool operator==(const SimPulse& other) const;
0171 
0172   bool operator!=(const MutableSimPulse& other) const { return !(*this == other); }
0173   bool operator!=(const SimPulse& other) const { return !(*this == other); }
0174 
0175   // less comparison operator, so that objects can be e.g. stored in sets.
0176   bool operator<(const MutableSimPulse& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0177 
0178   podio::ObjectID id() const { return getObjectID(); }
0179 
0180   const podio::ObjectID getObjectID() const;
0181 
0182   friend std::hash<MutableSimPulse>;
0183 
0184   friend void swap(MutableSimPulse& a, MutableSimPulse& b) {
0185     using std::swap;
0186     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0187   }
0188 
0189 private:
0190   /// constructor from existing SimPulseObj
0191   explicit MutableSimPulse(podio::utils::MaybeSharedPtr<SimPulseObj> obj);
0192 
0193   podio::utils::MaybeSharedPtr<SimPulseObj> m_obj{nullptr};
0194 };
0195 
0196 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0197 void to_json(nlohmann::json& j, const MutableSimPulse& value);
0198 #endif
0199 
0200 
0201 } // namespace edm4eic
0202 
0203 
0204 
0205 template<>
0206 struct std::hash<edm4eic::MutableSimPulse> {
0207   std::size_t operator()(const edm4eic::MutableSimPulse& obj) const {
0208     return std::hash<edm4eic::SimPulseObj*>{}(obj.m_obj.get());
0209   }
0210 };
0211 
0212 
0213 #endif