Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-06 08:38:03

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() = default;
0056 
0057   /// Constructor initializing all members
0058   TimeSeries(const std::uint64_t cellID, const float time, const float interval);
0059 
0060   /// copy constructor
0061   TimeSeries(const TimeSeries& other) = default;
0062 
0063   /// copy-assignment operator
0064   TimeSeries& operator=(TimeSeries other) &;           // Rebind this to other's internal object
0065   TimeSeries& operator=(TimeSeries other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0066 
0067   /// create a mutable deep-copy of the object with identical relations
0068   /// if cloneRelations=false, the relations are not cloned and will be empty
0069   MutableTimeSeries clone(bool cloneRelations = true) const;
0070 
0071   /// destructor
0072   ~TimeSeries() = default;
0073 
0074   /// converting constructor from mutable object
0075   TimeSeries(const MutableTimeSeries& other);
0076 
0077   static TimeSeries makeEmpty();
0078 
0079 public:
0080   static constexpr std::string_view typeName = "edm4hep::TimeSeries";
0081 
0082   /// Access the cell id
0083   std::uint64_t getCellID() const;
0084 
0085   /// Access the begin time [ns]
0086   float getTime() const;
0087 
0088   /// Access the interval of each sampling [ns]
0089   float getInterval() const;
0090 
0091   std::size_t amplitude_size() const;
0092   float getAmplitude(std::size_t) const;
0093   std::vector<float>::const_iterator amplitude_begin() const;
0094   std::vector<float>::const_iterator amplitude_end() const;
0095   podio::RelationRange<float> getAmplitude() const;
0096 
0097   /// check whether the object is actually available
0098   bool isAvailable() const;
0099   /// disconnect from TimeSeriesObj instance
0100   void unlink() { m_obj = podio::utils::MaybeSharedPtr<TimeSeriesObj>{nullptr}; }
0101 
0102   bool operator==(const TimeSeries& other) const { return m_obj == other.m_obj; }
0103   bool operator==(const MutableTimeSeries& other) const;
0104 
0105   bool operator!=(const TimeSeries& other) const { return !(*this == other); }
0106   bool operator!=(const MutableTimeSeries& other) const { return !(*this == other); }
0107 
0108   // less comparison operator, so that objects can be e.g. stored in sets.
0109   bool operator<(const TimeSeries& other) const {
0110     return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0111   }
0112 
0113   podio::ObjectID id() const { return getObjectID(); }
0114 
0115   const podio::ObjectID getObjectID() const;
0116 
0117   friend std::hash<TimeSeries>;
0118 
0119   friend void swap(TimeSeries& a, TimeSeries& b) {
0120     using std::swap;
0121     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0122   }
0123 
0124 private:
0125   /// constructor from existing TimeSeriesObj
0126   explicit TimeSeries(podio::utils::MaybeSharedPtr<TimeSeriesObj> obj);
0127   TimeSeries(TimeSeriesObj* obj);
0128 
0129   podio::utils::MaybeSharedPtr<TimeSeriesObj> m_obj{new TimeSeriesObj{}, podio::utils::MarkOwned};
0130 };
0131 
0132 std::ostream& operator<<(std::ostream& o, const TimeSeries& value);
0133 
0134 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0135 void to_json(nlohmann::json& j, const TimeSeries& value);
0136 #endif
0137 
0138 } // namespace edm4hep
0139 
0140 template <>
0141 struct std::hash<edm4hep::TimeSeries> {
0142   std::size_t operator()(const edm4hep::TimeSeries& obj) const {
0143     return std::hash<edm4hep::TimeSeriesObj*>{}(obj.m_obj.get());
0144   }
0145 };
0146 
0147 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0148 // until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
0149 // and https://github.com/AIDASoft/podio/issues/770
0150 #if defined(__clang__)
0151 #pragma clang diagnostic push
0152 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0153 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0154 #pragma clang diagnostic ignored "-Wdeprecated"
0155 constexpr std::string_view edm4hep::TimeSeries::typeName;
0156 #pragma clang diagnostic pop
0157 #elif defined(__GNUC__)
0158 #pragma GCC diagnostic push
0159 #pragma GCC diagnostic ignored "-Wdeprecated"
0160 constexpr std::string_view edm4hep::TimeSeries::typeName;
0161 #pragma GCC diagnostic pop
0162 #endif
0163 
0164 #endif