Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-01 09:08:22

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() = default;
0045 
0046   /// Constructor initializing all members
0047   MutableRawTimeSeries(const std::uint64_t cellID, const std::int32_t quality, const float time, const float charge,
0048                        const float interval);
0049 
0050   /// copy constructor
0051   MutableRawTimeSeries(const MutableRawTimeSeries& other) = default;
0052 
0053   /// copy-assignment operator
0054   MutableRawTimeSeries& operator=(MutableRawTimeSeries other) &; // Rebind this to other's internal object
0055   MutableRawTimeSeries&
0056   operator=(MutableRawTimeSeries other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0057 
0058   /// create a mutable deep-copy of the object with identical relations
0059   /// if cloneRelations=false, the relations are not cloned and will be empty
0060   MutableRawTimeSeries clone(bool cloneRelations = true) const;
0061 
0062   /// destructor
0063   ~MutableRawTimeSeries() = default;
0064 
0065 public:
0066   /// Access the detector specific cell id
0067   std::uint64_t getCellID() const;
0068 
0069   /// Access the quality flag for the hit
0070   std::int32_t getQuality() const;
0071 
0072   /// Access the time of the hit [ns]
0073   float getTime() const;
0074 
0075   /// Access the integrated charge of the hit [fC]
0076   float getCharge() const;
0077 
0078   /// Access the interval of each sampling [ns]
0079   float getInterval() const;
0080 
0081   /// Set the detector specific cell id
0082   void setCellID(const std::uint64_t cellID);
0083   /// Get mutable reference to detector specific cell id
0084   std::uint64_t& getCellID();
0085 
0086   /// Set the quality flag for the hit
0087   void setQuality(const std::int32_t quality);
0088   /// Get mutable reference to quality flag for the hit
0089   std::int32_t& getQuality();
0090 
0091   /// Set the time of the hit [ns]
0092   void setTime(const float time);
0093   /// Get mutable reference to time of the hit [ns]
0094   float& getTime();
0095 
0096   /// Set the integrated charge of the hit [fC]
0097   void setCharge(const float charge);
0098   /// Get mutable reference to integrated charge of the hit [fC]
0099   float& getCharge();
0100 
0101   /// Set the interval of each sampling [ns]
0102   void setInterval(const float interval);
0103   /// Get mutable reference to interval of each sampling [ns]
0104   float& getInterval();
0105 
0106   void addToAdcCounts(const std::int32_t&);
0107   std::size_t adcCounts_size() const;
0108   std::int32_t getAdcCounts(std::size_t) const;
0109   std::vector<std::int32_t>::const_iterator adcCounts_begin() const;
0110   std::vector<std::int32_t>::const_iterator adcCounts_end() const;
0111   podio::RelationRange<std::int32_t> getAdcCounts() const;
0112 
0113   /// check whether the object is actually available
0114   bool isAvailable() const;
0115   /// disconnect from RawTimeSeriesObj instance
0116   void unlink() { m_obj = podio::utils::MaybeSharedPtr<RawTimeSeriesObj>{nullptr}; }
0117 
0118   constexpr bool operator==(const MutableRawTimeSeries& other) const { return m_obj == other.m_obj; }
0119   bool operator==(const RawTimeSeries& other) const;
0120 
0121   constexpr bool operator!=(const MutableRawTimeSeries& other) const { return !(*this == other); }
0122   bool operator!=(const RawTimeSeries& other) const { return !(*this == other); }
0123 
0124   // less comparison operator, so that objects can be e.g. stored in sets.
0125   bool operator<(const MutableRawTimeSeries& other) const {
0126     return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0127   }
0128 
0129   podio::ObjectID id() const { return getObjectID(); }
0130 
0131   const podio::ObjectID getObjectID() const;
0132 
0133   friend std::hash<MutableRawTimeSeries>;
0134 
0135   friend void swap(MutableRawTimeSeries& a, MutableRawTimeSeries& b) {
0136     using std::swap;
0137     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0138   }
0139 
0140 private:
0141   /// constructor from existing RawTimeSeriesObj
0142   explicit MutableRawTimeSeries(podio::utils::MaybeSharedPtr<RawTimeSeriesObj> obj);
0143 
0144   podio::utils::MaybeSharedPtr<RawTimeSeriesObj> m_obj{new RawTimeSeriesObj{}, podio::utils::MarkOwned};
0145 };
0146 
0147 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0148 void to_json(nlohmann::json& j, const MutableRawTimeSeries& value);
0149 #endif
0150 
0151 } // namespace edm4hep
0152 
0153 template <>
0154 struct std::hash<edm4hep::MutableRawTimeSeries> {
0155   std::size_t operator()(const edm4hep::MutableRawTimeSeries& obj) const {
0156     return std::hash<edm4hep::RawTimeSeriesObj*>{}(obj.m_obj.get());
0157   }
0158 };
0159 
0160 #endif