Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:37

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