Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-03 08:34:42

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_TimeSeries_H
0004 #define EDM4HEP_TimeSeries_H
0005 
0006 #include "edm4hep/TimeSeriesObj.h"
0007 
0008 #include "podio/RelationRange.h"
0009 #include <cstdint>
0010 #include <vector>
0011 
0012 #include "podio/detail/OrderKey.h"
0013 #include "podio/utilities/MaybeSharedPtr.h"
0014 
0015 #include <cstdint>
0016 #include <ostream>
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 TimeSeriesCollection;
0025 }
0026 
0027 namespace podio::detail {
0028 // Internal function used in less comparison operators of the datatypes and interface types
0029 OrderKey getOrderKey(const edm4hep::TimeSeries& obj);
0030 }; // namespace podio::detail
0031 
0032 namespace edm4hep {
0033 
0034 class MutableTimeSeries;
0035 class TimeSeriesCollection;
0036 class TimeSeriesCollectionData;
0037 
0038 /** @class TimeSeries
0039  *  Calibrated Detector Data
0040  *  @author: EDM4hep authors
0041  */
0042 class TimeSeries {
0043 
0044   friend class MutableTimeSeries;
0045   friend class TimeSeriesCollection;
0046   friend class edm4hep::TimeSeriesCollectionData;
0047   friend class TimeSeriesCollectionIterator;
0048   friend podio::detail::OrderKey podio::detail::getOrderKey(const TimeSeries& obj);
0049 
0050 public:
0051   using mutable_type = MutableTimeSeries;
0052   using collection_type = TimeSeriesCollection;
0053 
0054   /// default constructor
0055   TimeSeries();
0056 
0057   /// Constructor initializing all members
0058   TimeSeries(std::uint64_t cellID, float time, float interval);
0059 
0060   /// copy constructor
0061   TimeSeries(const TimeSeries& other) = default;
0062 
0063   /// copy-assignment operator
0064   TimeSeries& operator=(TimeSeries other);
0065 
0066   /// create a mutable deep-copy of the object with identical relations
0067   /// if cloneRelations=false, the relations are not cloned and will be empty
0068   MutableTimeSeries clone(bool cloneRelations = true) const;
0069 
0070   /// destructor
0071   ~TimeSeries() = default;
0072 
0073   /// converting constructor from mutable object
0074   TimeSeries(const MutableTimeSeries& other);
0075 
0076   static TimeSeries makeEmpty();
0077 
0078 public:
0079   static constexpr auto typeName = "edm4hep::TimeSeries";
0080 
0081   /// Access the cell id
0082   std::uint64_t getCellID() const;
0083 
0084   /// Access the begin time [ns]
0085   float getTime() const;
0086 
0087   /// Access the interval of each sampling [ns]
0088   float getInterval() const;
0089 
0090   std::size_t amplitude_size() const;
0091   float getAmplitude(std::size_t) const;
0092   std::vector<float>::const_iterator amplitude_begin() const;
0093   std::vector<float>::const_iterator amplitude_end() const;
0094   podio::RelationRange<float> getAmplitude() const;
0095 
0096   /// check whether the object is actually available
0097   bool isAvailable() const;
0098   /// disconnect from TimeSeriesObj instance
0099   void unlink() {
0100     m_obj = podio::utils::MaybeSharedPtr<TimeSeriesObj>{nullptr};
0101   }
0102 
0103   bool operator==(const TimeSeries& other) const {
0104     return m_obj == other.m_obj;
0105   }
0106   bool operator==(const MutableTimeSeries& other) const;
0107 
0108   bool operator!=(const TimeSeries& other) const {
0109     return !(*this == other);
0110   }
0111   bool operator!=(const MutableTimeSeries& other) const {
0112     return !(*this == other);
0113   }
0114 
0115   // less comparison operator, so that objects can be e.g. stored in sets.
0116   bool operator<(const TimeSeries& other) const {
0117     return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0118   }
0119 
0120   podio::ObjectID id() const {
0121     return getObjectID();
0122   }
0123 
0124   const podio::ObjectID getObjectID() const;
0125 
0126   friend void swap(TimeSeries& a, TimeSeries& b) {
0127     using std::swap;
0128     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0129   }
0130 
0131 private:
0132   /// constructor from existing TimeSeriesObj
0133   explicit TimeSeries(podio::utils::MaybeSharedPtr<TimeSeriesObj> obj);
0134   TimeSeries(TimeSeriesObj* obj);
0135 
0136   podio::utils::MaybeSharedPtr<TimeSeriesObj> m_obj{nullptr};
0137 };
0138 
0139 std::ostream& operator<<(std::ostream& o, const TimeSeries& value);
0140 
0141 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0142 void to_json(nlohmann::json& j, const TimeSeries& value);
0143 #endif
0144 
0145 } // namespace edm4hep
0146 
0147 #endif