Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-04 10:09:30

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_SimPulse_H
0004 #define EDM4EIC_SimPulse_H
0005 
0006 #include "edm4eic/SimPulseObj.h"
0007 
0008 #include "edm4hep/MCParticle.h"
0009 #include "edm4hep/SimCalorimeterHit.h"
0010 #include "edm4hep/SimTrackerHit.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 #include "podio/detail/OrderKey.h"
0018 
0019 #include <ostream>
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 podio::detail {
0033 // Internal function used in less comparison operators of the datatypes and interface types
0034 OrderKey getOrderKey(const edm4eic::SimPulse& obj);
0035 };
0036 
0037 namespace edm4eic {
0038 
0039 class MutableSimPulse;
0040 class SimPulseCollection;
0041 class SimPulseCollectionData;
0042 
0043 /** @class SimPulse
0044  *  Simulated pulse prior to digitization.
0045  *  @author: D. Anderson, S. Gardner, S. Joosten., D. Kalinkin
0046  */
0047 class SimPulse {
0048 
0049   friend class MutableSimPulse;
0050   friend class SimPulseCollection;
0051   friend class edm4eic::SimPulseCollectionData;
0052   friend class SimPulseCollectionIterator;
0053   friend podio::detail::OrderKey podio::detail::getOrderKey(const SimPulse & obj);
0054 
0055 public:
0056   using mutable_type = MutableSimPulse;
0057   using collection_type = SimPulseCollection;
0058 
0059   /// default constructor
0060   SimPulse();
0061 
0062   /// Constructor initializing all members
0063   SimPulse(const std::uint64_t cellID, const float integral, const edm4hep::Vector3f& position, const float time, const float interval);
0064 
0065   /// copy constructor
0066   SimPulse(const SimPulse& other) = default;
0067 
0068   /// copy-assignment operator
0069   SimPulse& operator=(SimPulse other) &; // Rebind this to other's internal object
0070   SimPulse& operator=(SimPulse other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0071 
0072   /// create a mutable deep-copy of the object with identical relations
0073   /// if cloneRelations=false, the relations are not cloned and will be empty
0074   MutableSimPulse clone(bool cloneRelations=true) const;
0075 
0076   /// destructor
0077   ~SimPulse() = default;
0078 
0079   /// converting constructor from mutable object
0080   SimPulse(const MutableSimPulse& other);
0081 
0082   static SimPulse makeEmpty();
0083 
0084 public:
0085 
0086   static constexpr std::string_view typeName = "edm4eic::SimPulse";
0087 
0088   /// Access the ID of the readout cell for this pulse.
0089   std::uint64_t getCellID() const;
0090 
0091   /// Access the Total pulse integral in relevant units.
0092   float getIntegral() const;
0093 
0094   /// Access the Position the pulse is evaluated in world coordinates [mm].
0095   const edm4hep::Vector3f& getPosition() const;
0096 
0097   /// Access the Start time for the pulse in [ns].
0098   float getTime() const;
0099 
0100   /// Access the Time interval between amplitude values [ns].
0101   float getInterval() const;
0102 
0103 
0104 
0105   std::size_t calorimeterHits_size() const;
0106   edm4hep::SimCalorimeterHit getCalorimeterHits(std::size_t) const;
0107   std::vector<edm4hep::SimCalorimeterHit>::const_iterator calorimeterHits_begin() const;
0108   std::vector<edm4hep::SimCalorimeterHit>::const_iterator calorimeterHits_end() const;
0109   podio::RelationRange<edm4hep::SimCalorimeterHit> getCalorimeterHits() const;
0110   std::size_t trackerHits_size() const;
0111   edm4hep::SimTrackerHit getTrackerHits(std::size_t) const;
0112   std::vector<edm4hep::SimTrackerHit>::const_iterator trackerHits_begin() const;
0113   std::vector<edm4hep::SimTrackerHit>::const_iterator trackerHits_end() const;
0114   podio::RelationRange<edm4hep::SimTrackerHit> getTrackerHits() const;
0115   std::size_t pulses_size() const;
0116   edm4eic::SimPulse getPulses(std::size_t) const;
0117   std::vector<edm4eic::SimPulse>::const_iterator pulses_begin() const;
0118   std::vector<edm4eic::SimPulse>::const_iterator pulses_end() const;
0119   podio::RelationRange<edm4eic::SimPulse> getPulses() const;
0120   std::size_t particles_size() const;
0121   edm4hep::MCParticle getParticles(std::size_t) const;
0122   std::vector<edm4hep::MCParticle>::const_iterator particles_begin() const;
0123   std::vector<edm4hep::MCParticle>::const_iterator particles_end() const;
0124   podio::RelationRange<edm4hep::MCParticle> getParticles() const;
0125   std::size_t amplitude_size() const;
0126   float getAmplitude(std::size_t) const;
0127   std::vector<float>::const_iterator amplitude_begin() const;
0128   std::vector<float>::const_iterator amplitude_end() const;
0129   podio::RelationRange<float> getAmplitude() const;
0130 
0131 
0132   /// check whether the object is actually available
0133   bool isAvailable() const;
0134   /// disconnect from SimPulseObj instance
0135   void unlink() { m_obj = podio::utils::MaybeSharedPtr<SimPulseObj>{nullptr}; }
0136 
0137   bool operator==(const SimPulse& other) const { return m_obj == other.m_obj; }
0138   bool operator==(const MutableSimPulse& other) const;
0139 
0140   bool operator!=(const SimPulse& other) const { return !(*this == other); }
0141   bool operator!=(const MutableSimPulse& other) const { return !(*this == other); }
0142 
0143   // less comparison operator, so that objects can be e.g. stored in sets.
0144   bool operator<(const SimPulse& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0145 
0146   podio::ObjectID id() const { return getObjectID(); }
0147 
0148   const podio::ObjectID getObjectID() const;
0149 
0150   friend std::hash<SimPulse>;
0151 
0152   friend void swap(SimPulse& a, SimPulse& 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 SimPulseObj
0159   explicit SimPulse(podio::utils::MaybeSharedPtr<SimPulseObj> obj);
0160   SimPulse(SimPulseObj* obj);
0161 
0162   podio::utils::MaybeSharedPtr<SimPulseObj> m_obj{nullptr};
0163 };
0164 
0165 std::ostream& operator<<(std::ostream& o, const SimPulse& value);
0166 
0167 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0168 void to_json(nlohmann::json& j, const SimPulse& value);
0169 #endif
0170 
0171 
0172 } // namespace edm4eic
0173 
0174 
0175 
0176 template<>
0177 struct std::hash<edm4eic::SimPulse> {
0178   std::size_t operator()(const edm4eic::SimPulse& obj) const {
0179     return std::hash<edm4eic::SimPulseObj*>{}(obj.m_obj.get());
0180   }
0181 };
0182 
0183 
0184 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0185 // until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
0186 // and https://github.com/AIDASoft/podio/issues/770
0187 #if defined(__clang__)
0188 #pragma clang diagnostic push
0189 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0190 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0191 #pragma clang diagnostic ignored "-Wdeprecated"
0192 constexpr std::string_view edm4eic::SimPulse::typeName;
0193 #pragma clang diagnostic pop
0194 #elif defined(__GNUC__)
0195 #pragma GCC diagnostic push
0196 #pragma GCC diagnostic ignored "-Wdeprecated"
0197 constexpr std::string_view edm4eic::SimPulse::typeName;
0198 #pragma GCC diagnostic pop
0199 #endif
0200 
0201 #endif