Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 08:53:33

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