Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 09:10:54

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 
0028 namespace edm4hep {
0029 
0030 
0031 /** @class MutableRawTimeSeries
0032  *  Raw data of a detector readout
0033  *  @author: EDM4hep authors
0034  */
0035 class MutableRawTimeSeries {
0036 
0037   friend class RawTimeSeriesCollection;
0038   friend class RawTimeSeriesMutableCollectionIterator;
0039   friend class RawTimeSeries;
0040 
0041 public:
0042   using object_type = RawTimeSeries;
0043   using collection_type = RawTimeSeriesCollection;
0044 
0045   /// default constructor
0046   MutableRawTimeSeries();
0047 
0048   /// Constructor initializing all members
0049   MutableRawTimeSeries(const std::uint64_t cellID, const std::int32_t quality, const float time, const float charge, const float interval);
0050 
0051   /// copy constructor
0052   MutableRawTimeSeries(const MutableRawTimeSeries& other) = default;
0053 
0054   /// copy-assignment operator
0055   MutableRawTimeSeries& operator=(MutableRawTimeSeries other) &; // Rebind this to other's internal object
0056   MutableRawTimeSeries& 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 
0066 public:
0067 
0068   /// Access the detector specific cell id
0069   std::uint64_t getCellID() const;
0070 
0071   /// Access the quality flag for the hit
0072   std::int32_t getQuality() const;
0073 
0074   /// Access the time of the hit [ns]
0075   float getTime() const;
0076 
0077   /// Access the integrated charge of the hit [fC]
0078   float getCharge() const;
0079 
0080   /// Access the interval of each sampling [ns]
0081   float getInterval() const;
0082 
0083 
0084 
0085   /// Set the detector specific cell id
0086   void setCellID(const std::uint64_t cellID);
0087   /// Get mutable reference to detector specific cell id
0088   std::uint64_t& getCellID();
0089   /// Get reference to detector specific cell id
0090   [[deprecated("use getCellID instead")]]
0091   std::uint64_t& cellID();
0092 
0093   /// Set the quality flag for the hit
0094   void setQuality(const std::int32_t quality);
0095   /// Get mutable reference to quality flag for the hit
0096   std::int32_t& getQuality();
0097   /// Get reference to quality flag for the hit
0098   [[deprecated("use getQuality instead")]]
0099   std::int32_t& quality();
0100 
0101   /// Set the time of the hit [ns]
0102   void setTime(const float time);
0103   /// Get mutable reference to time of the hit [ns]
0104   float& getTime();
0105   /// Get reference to time of the hit [ns]
0106   [[deprecated("use getTime instead")]]
0107   float& time();
0108 
0109   /// Set the integrated charge of the hit [fC]
0110   void setCharge(const float charge);
0111   /// Get mutable reference to integrated charge of the hit [fC]
0112   float& getCharge();
0113   /// Get reference to integrated charge of the hit [fC]
0114   [[deprecated("use getCharge instead")]]
0115   float& charge();
0116 
0117   /// Set the interval of each sampling [ns]
0118   void setInterval(const float interval);
0119   /// Get mutable reference to interval of each sampling [ns]
0120   float& getInterval();
0121   /// Get reference to interval of each sampling [ns]
0122   [[deprecated("use getInterval instead")]]
0123   float& interval();
0124 
0125 
0126 
0127   void addToAdcCounts(const std::int32_t&);
0128   std::size_t adcCounts_size() const;
0129   std::int32_t getAdcCounts(std::size_t) const;
0130   std::vector<std::int32_t>::const_iterator adcCounts_begin() const;
0131   std::vector<std::int32_t>::const_iterator adcCounts_end() const;
0132   podio::RelationRange<std::int32_t> getAdcCounts() const;
0133 
0134 
0135 
0136   /// check whether the object is actually available
0137   bool isAvailable() const;
0138   /// disconnect from RawTimeSeriesObj instance
0139   void unlink() { m_obj = podio::utils::MaybeSharedPtr<RawTimeSeriesObj>{nullptr}; }
0140 
0141   bool operator==(const MutableRawTimeSeries& other) const { return m_obj == other.m_obj; }
0142   bool operator==(const RawTimeSeries& other) const;
0143 
0144   bool operator!=(const MutableRawTimeSeries& other) const { return !(*this == other); }
0145   bool operator!=(const RawTimeSeries& other) const { return !(*this == other); }
0146 
0147   // less comparison operator, so that objects can be e.g. stored in sets.
0148   bool operator<(const MutableRawTimeSeries& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0149 
0150   podio::ObjectID id() const { return getObjectID(); }
0151 
0152   const podio::ObjectID getObjectID() const;
0153 
0154   friend std::hash<MutableRawTimeSeries>;
0155 
0156   friend void swap(MutableRawTimeSeries& a, MutableRawTimeSeries& b) {
0157     using std::swap;
0158     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0159   }
0160 
0161 private:
0162   /// constructor from existing RawTimeSeriesObj
0163   explicit MutableRawTimeSeries(podio::utils::MaybeSharedPtr<RawTimeSeriesObj> obj);
0164 
0165   podio::utils::MaybeSharedPtr<RawTimeSeriesObj> m_obj{nullptr};
0166 };
0167 
0168 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0169 void to_json(nlohmann::json& j, const MutableRawTimeSeries& value);
0170 #endif
0171 
0172 
0173 } // namespace edm4hep
0174 
0175 
0176 
0177 template<>
0178 struct std::hash<edm4hep::MutableRawTimeSeries> {
0179   std::size_t operator()(const edm4hep::MutableRawTimeSeries& obj) const {
0180     return std::hash<edm4hep::RawTimeSeriesObj*>{}(obj.m_obj.get());
0181   }
0182 };
0183 
0184 
0185 #endif