Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-29 10:41:59

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_RawTimeSeries_H
0004 #define EDM4HEP_RawTimeSeries_H
0005 
0006 #include "edm4hep/RawTimeSeriesObj.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 RawTimeSeriesCollection;
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::RawTimeSeries& obj);
0030 }; // namespace podio::detail
0031 
0032 namespace edm4hep {
0033 
0034 class MutableRawTimeSeries;
0035 class RawTimeSeriesCollection;
0036 class RawTimeSeriesCollectionData;
0037 
0038 /** @class RawTimeSeries
0039  *  Raw data of a detector readout
0040  *  @author: EDM4hep authors
0041  */
0042 class RawTimeSeries {
0043 
0044   friend class MutableRawTimeSeries;
0045   friend class RawTimeSeriesCollection;
0046   friend class edm4hep::RawTimeSeriesCollectionData;
0047   friend class RawTimeSeriesCollectionIterator;
0048   friend podio::detail::OrderKey podio::detail::getOrderKey(const RawTimeSeries& obj);
0049 
0050 public:
0051   using mutable_type = MutableRawTimeSeries;
0052   using collection_type = RawTimeSeriesCollection;
0053 
0054   /// default constructor
0055   RawTimeSeries() = default;
0056 
0057   /// Constructor initializing all members
0058   RawTimeSeries(const std::uint64_t cellID, const std::int32_t quality, const float time, const float charge,
0059                 const float interval);
0060 
0061   /// copy constructor
0062   RawTimeSeries(const RawTimeSeries& other) noexcept = default;
0063 
0064   /// move constructor
0065   RawTimeSeries(RawTimeSeries&& other) noexcept = default;
0066 
0067   /// copy-assignment operator
0068   RawTimeSeries& operator=(RawTimeSeries other) &; // Rebind this to other's internal object
0069   RawTimeSeries&
0070   operator=(RawTimeSeries other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0071 
0072   /// create a mutable deep-copy of the object with identical relations
0073   /// if cloneRelations=false, the relations are not cloned and will be empty
0074   MutableRawTimeSeries clone(bool cloneRelations = true) const;
0075 
0076   /// destructor
0077   ~RawTimeSeries() = default;
0078 
0079   /// converting constructor from mutable object
0080   RawTimeSeries(const MutableRawTimeSeries& other);
0081 
0082   static RawTimeSeries makeEmpty();
0083 
0084 public:
0085   static constexpr std::string_view typeName = "edm4hep::RawTimeSeries";
0086 
0087   /// Access the detector specific cell id
0088   std::uint64_t getCellID() const;
0089 
0090   /// Access the quality flag for the hit
0091   std::int32_t getQuality() const;
0092 
0093   /// Access the time of the hit [ns]
0094   float getTime() const;
0095 
0096   /// Access the integrated charge of the hit [fC]
0097   float getCharge() const;
0098 
0099   /// Access the interval of each sampling [ns]
0100   float getInterval() const;
0101 
0102   std::size_t adcCounts_size() const;
0103   std::int32_t getAdcCounts(std::size_t) const;
0104   std::vector<std::int32_t>::const_iterator adcCounts_begin() const;
0105   std::vector<std::int32_t>::const_iterator adcCounts_end() const;
0106   podio::RelationRange<std::int32_t> getAdcCounts() const;
0107 
0108   /// check whether the object is actually available
0109   bool isAvailable() const;
0110   /// disconnect from RawTimeSeriesObj instance
0111   void unlink() { m_obj = podio::utils::MaybeSharedPtr<RawTimeSeriesObj>{nullptr}; }
0112 
0113   constexpr bool operator==(const RawTimeSeries& other) const { return m_obj == other.m_obj; }
0114   bool operator==(const MutableRawTimeSeries& other) const;
0115 
0116   constexpr bool operator!=(const RawTimeSeries& other) const { return !(*this == other); }
0117   bool operator!=(const MutableRawTimeSeries& other) const { return !(*this == other); }
0118 
0119   // less comparison operator, so that objects can be e.g. stored in sets.
0120   bool operator<(const RawTimeSeries& other) const {
0121     return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other);
0122   }
0123 
0124   podio::ObjectID id() const { return getObjectID(); }
0125 
0126   const podio::ObjectID getObjectID() const;
0127 
0128   friend std::hash<RawTimeSeries>;
0129 
0130   friend void swap(RawTimeSeries& a, RawTimeSeries& b) {
0131     using std::swap;
0132     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0133   }
0134 
0135 private:
0136   /// constructor from existing RawTimeSeriesObj
0137   explicit RawTimeSeries(podio::utils::MaybeSharedPtr<RawTimeSeriesObj> obj);
0138   RawTimeSeries(RawTimeSeriesObj* obj);
0139 
0140   podio::utils::MaybeSharedPtr<RawTimeSeriesObj> m_obj{new RawTimeSeriesObj{}, podio::utils::MarkOwned};
0141 };
0142 
0143 std::ostream& operator<<(std::ostream& o, const RawTimeSeries& value);
0144 
0145 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0146 void to_json(nlohmann::json& j, const RawTimeSeries& value);
0147 #endif
0148 
0149 } // namespace edm4hep
0150 
0151 template <>
0152 struct std::hash<edm4hep::RawTimeSeries> {
0153   std::size_t operator()(const edm4hep::RawTimeSeries& obj) const {
0154     return std::hash<edm4hep::RawTimeSeriesObj*>{}(obj.m_obj.get());
0155   }
0156 };
0157 
0158 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0159 // until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
0160 // and https://github.com/AIDASoft/podio/issues/770
0161 #if defined(__clang__)
0162 #pragma clang diagnostic push
0163 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0164 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0165 #pragma clang diagnostic ignored "-Wdeprecated"
0166 constexpr std::string_view edm4hep::RawTimeSeries::typeName;
0167 #pragma clang diagnostic pop
0168 #elif defined(__GNUC__)
0169 #pragma GCC diagnostic push
0170 #pragma GCC diagnostic ignored "-Wdeprecated"
0171 constexpr std::string_view edm4hep::RawTimeSeries::typeName;
0172 #pragma GCC diagnostic pop
0173 #endif
0174 
0175 #endif