Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:35:45

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/utilities/MaybeSharedPtr.h"
0013 
0014 #include <cstddef>
0015 #include <ostream>
0016 
0017 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0018 #include "nlohmann/json_fwd.hpp"
0019 #endif
0020 
0021 namespace edm4hep {
0022 
0023 class MutableTimeSeries;
0024 class TimeSeriesCollection;
0025 class TimeSeriesCollectionData;
0026 
0027 /** @class TimeSeries
0028  *  Calibrated Detector Data
0029  *  @author: Wenxing Fang, IHEP
0030  */
0031 class TimeSeries {
0032 
0033   friend class MutableTimeSeries;
0034   friend class TimeSeriesCollection;
0035   friend class edm4hep::TimeSeriesCollectionData;
0036   friend class TimeSeriesCollectionIterator;
0037 
0038 public:
0039   using mutable_type = MutableTimeSeries;
0040   using collection_type = TimeSeriesCollection;
0041 
0042   /// default constructor
0043   TimeSeries();
0044 
0045   /// Constructor initializing all members
0046   TimeSeries(std::uint64_t cellID, float time, float interval);
0047 
0048   /// copy constructor
0049   TimeSeries(const TimeSeries& other) = default;
0050 
0051   /// copy-assignment operator
0052   TimeSeries& operator=(TimeSeries other);
0053 
0054   /// create a mutable deep-copy of the object with identical relations
0055   MutableTimeSeries clone() const;
0056 
0057   /// destructor
0058   ~TimeSeries() = default;
0059 
0060   static TimeSeries makeEmpty();
0061 
0062 public:
0063   /// Access the cell id.
0064   std::uint64_t getCellID() const;
0065 
0066   /// Access the begin time [ns].
0067   float getTime() const;
0068 
0069   /// Access the interval of each sampling [ns].
0070   float getInterval() const;
0071 
0072   std::size_t amplitude_size() const;
0073   float getAmplitude(std::size_t) const;
0074   std::vector<float>::const_iterator amplitude_begin() const;
0075   std::vector<float>::const_iterator amplitude_end() const;
0076   podio::RelationRange<float> getAmplitude() const;
0077 
0078   /// check whether the object is actually available
0079   bool isAvailable() const;
0080   /// disconnect from TimeSeriesObj instance
0081   void unlink() {
0082     m_obj = podio::utils::MaybeSharedPtr<TimeSeriesObj>{nullptr};
0083   }
0084 
0085   bool operator==(const TimeSeries& other) const {
0086     return m_obj == other.m_obj;
0087   }
0088   bool operator==(const MutableTimeSeries& other) const;
0089 
0090   // less comparison operator, so that objects can be e.g. stored in sets.
0091   bool operator<(const TimeSeries& other) const {
0092     return m_obj < other.m_obj;
0093   }
0094 
0095   podio::ObjectID id() const {
0096     return getObjectID();
0097   }
0098 
0099   const podio::ObjectID getObjectID() const;
0100 
0101   friend void swap(TimeSeries& a, TimeSeries& b) {
0102     using std::swap;
0103     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0104   }
0105 
0106 private:
0107   /// constructor from existing TimeSeriesObj
0108   explicit TimeSeries(podio::utils::MaybeSharedPtr<TimeSeriesObj> obj);
0109   TimeSeries(TimeSeriesObj* obj);
0110 
0111   podio::utils::MaybeSharedPtr<TimeSeriesObj> m_obj{nullptr};
0112 };
0113 
0114 std::ostream& operator<<(std::ostream& o, const TimeSeries& value);
0115 
0116 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0117 void to_json(nlohmann::json& j, const TimeSeries& value);
0118 #endif
0119 
0120 } // namespace edm4hep
0121 
0122 #endif