Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-05 08:52:35

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