Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/edm4hep/MutableRawTimeSeries.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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   /// Get reference to detector specific cell id
0086   [[deprecated("use getCellID instead")]] std::uint64_t& cellID();
0087 
0088   /// Set the quality flag for the hit
0089   void setQuality(const std::int32_t quality);
0090   /// Get mutable reference to quality flag for the hit
0091   std::int32_t& getQuality();
0092   /// Get reference to quality flag for the hit
0093   [[deprecated("use getQuality instead")]] std::int32_t& quality();
0094 
0095   /// Set the time of the hit [ns]
0096   void setTime(const float time);
0097   /// Get mutable reference to time of the hit [ns]
0098   float& getTime();
0099   /// Get reference to time of the hit [ns]
0100   [[deprecated("use getTime instead")]] float& time();
0101 
0102   /// Set the integrated charge of the hit [fC]
0103   void setCharge(const float charge);
0104   /// Get mutable reference to integrated charge of the hit [fC]
0105   float& getCharge();
0106   /// Get reference to integrated charge of the hit [fC]
0107   [[deprecated("use getCharge instead")]] float& charge();
0108 
0109   /// Set the interval of each sampling [ns]
0110   void setInterval(const float interval);
0111   /// Get mutable reference to interval of each sampling [ns]
0112   float& getInterval();
0113   /// Get reference to interval of each sampling [ns]
0114   [[deprecated("use getInterval instead")]] float& interval();
0115 
0116   void addToAdcCounts(const std::int32_t&);
0117   std::size_t adcCounts_size() const;
0118   std::int32_t getAdcCounts(std::size_t) const;
0119   std::vector<std::int32_t>::const_iterator adcCounts_begin() const;
0120   std::vector<std::int32_t>::const_iterator adcCounts_end() const;
0121   podio::RelationRange<std::int32_t> getAdcCounts() const;
0122 
0123   /// check whether the object is actually available
0124   bool isAvailable() const;
0125   /// disconnect from RawTimeSeriesObj instance
0126   void unlink() { m_obj = podio::utils::MaybeSharedPtr<RawTimeSeriesObj>{nullptr}; }
0127 
0128   bool operator==(const MutableRawTimeSeries& other) const { return m_obj == other.m_obj; }
0129   bool operator==(const RawTimeSeries& other) const;
0130 
0131   bool operator!=(const MutableRawTimeSeries& other) const { return !(*this == other); }
0132   bool operator!=(const RawTimeSeries& other) const { return !(*this == other); }
0133 
0134   // less comparison operator, so that objects can be e.g. stored in sets.
0135   bool operator<(const MutableRawTimeSeries& other) const {
0136     return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0137   }
0138 
0139   podio::ObjectID id() const { return getObjectID(); }
0140 
0141   const podio::ObjectID getObjectID() const;
0142 
0143   friend std::hash<MutableRawTimeSeries>;
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{new RawTimeSeriesObj{}, podio::utils::MarkOwned};
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 template <>
0164 struct std::hash<edm4hep::MutableRawTimeSeries> {
0165   std::size_t operator()(const edm4hep::MutableRawTimeSeries& obj) const {
0166     return std::hash<edm4hep::RawTimeSeriesObj*>{}(obj.m_obj.get());
0167   }
0168 };
0169 
0170 #endif