Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:38

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_MutableTrackerPulse_H
0004 #define EDM4HEP_MutableTrackerPulse_H
0005 
0006 #include "edm4hep/TrackerPulseObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4hep/TrackerPulse.h"
0009 
0010 #include <array>
0011 #include <cstdint>
0012 
0013 #include "podio/utilities/MaybeSharedPtr.h"
0014 
0015 #include <cstdint>
0016 
0017 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0018 #include "nlohmann/json_fwd.hpp"
0019 #endif
0020 
0021 // forward declarations
0022 namespace edm4hep {
0023 class TimeSeries;
0024 class MutableTimeSeries;
0025 } // namespace edm4hep
0026 
0027 namespace edm4hep {
0028 
0029 /** @class MutableTrackerPulse
0030  *  Reconstructed Tracker Pulse
0031  *  @author: Wenxing Fang, IHEP
0032  */
0033 class MutableTrackerPulse {
0034 
0035   friend class TrackerPulseCollection;
0036   friend class TrackerPulseMutableCollectionIterator;
0037   friend class TrackerPulse;
0038 
0039 public:
0040   using object_type = TrackerPulse;
0041   using collection_type = TrackerPulseCollection;
0042 
0043   /// default constructor
0044   MutableTrackerPulse();
0045 
0046   /// Constructor initializing all members
0047   MutableTrackerPulse(std::uint64_t cellID, float time, float charge, std::int16_t quality,
0048                       std::array<float, 3> covMatrix);
0049 
0050   /// copy constructor
0051   MutableTrackerPulse(const MutableTrackerPulse& other) = default;
0052 
0053   /// copy-assignment operator
0054   MutableTrackerPulse& operator=(MutableTrackerPulse other);
0055 
0056   /// create a mutable deep-copy of the object with identical relations
0057   /// if cloneRelations=false, the relations are not cloned and will be empty
0058   MutableTrackerPulse clone(bool cloneRelations = true) const;
0059 
0060   /// destructor
0061   ~MutableTrackerPulse() = default;
0062 
0063 public:
0064   /// Access the cell id.
0065   std::uint64_t getCellID() const;
0066 
0067   /// Access the time [ns].
0068   float getTime() const;
0069 
0070   /// Access the charge [fC].
0071   float getCharge() const;
0072 
0073   /// Access the quality.
0074   std::int16_t getQuality() const;
0075 
0076   /// Access the lower triangle covariance matrix of the charge(c) and time(t) measurements.
0077   const std::array<float, 3>& getCovMatrix() const;
0078   /// Access item i of the lower triangle covariance matrix of the charge(c) and time(t) measurements.
0079   float getCovMatrix(size_t i) const;
0080 
0081   /// Access the Optionally, the timeSeries that has been used to create the pulse can be stored with the pulse.
0082   const edm4hep::TimeSeries getTimeSeries() const;
0083 
0084   /// Set the cell id.
0085   void setCellID(std::uint64_t value);
0086   /// Get mutable reference to cell id.
0087   std::uint64_t& getCellID();
0088   /// Get reference to cell id.
0089   [[deprecated("use getCellID instead")]] std::uint64_t& cellID();
0090 
0091   /// Set the time [ns].
0092   void setTime(float value);
0093   /// Get mutable reference to time [ns].
0094   float& getTime();
0095   /// Get reference to time [ns].
0096   [[deprecated("use getTime instead")]] float& time();
0097 
0098   /// Set the charge [fC].
0099   void setCharge(float value);
0100   /// Get mutable reference to charge [fC].
0101   float& getCharge();
0102   /// Get reference to charge [fC].
0103   [[deprecated("use getCharge instead")]] float& charge();
0104 
0105   /// Set the quality.
0106   void setQuality(std::int16_t value);
0107   /// Get mutable reference to quality.
0108   std::int16_t& getQuality();
0109   /// Get reference to quality.
0110   [[deprecated("use getQuality instead")]] std::int16_t& quality();
0111 
0112   /// Set the lower triangle covariance matrix of the charge(c) and time(t) measurements.
0113   void setCovMatrix(std::array<float, 3> value);
0114   void setCovMatrix(size_t i, float value);
0115   /// Get mutable reference to lower triangle covariance matrix of the charge(c) and time(t) measurements.
0116   std::array<float, 3>& getCovMatrix();
0117   /// Get reference to lower triangle covariance matrix of the charge(c) and time(t) measurements.
0118   [[deprecated("use getCovMatrix instead")]] std::array<float, 3>& covMatrix();
0119 
0120   /// Set the Optionally, the timeSeries that has been used to create the pulse can be stored with the pulse.
0121   void setTimeSeries(const edm4hep::TimeSeries& value);
0122 
0123   /// check whether the object is actually available
0124   bool isAvailable() const;
0125   /// disconnect from TrackerPulseObj instance
0126   void unlink() {
0127     m_obj = podio::utils::MaybeSharedPtr<TrackerPulseObj>{nullptr};
0128   }
0129 
0130   bool operator==(const MutableTrackerPulse& other) const {
0131     return m_obj == other.m_obj;
0132   }
0133   bool operator==(const TrackerPulse& other) const;
0134 
0135   bool operator!=(const MutableTrackerPulse& other) const {
0136     return !(*this == other);
0137   }
0138   bool operator!=(const TrackerPulse& other) const {
0139     return !(*this == other);
0140   }
0141 
0142   // less comparison operator, so that objects can be e.g. stored in sets.
0143   bool operator<(const MutableTrackerPulse& other) const {
0144     return m_obj < other.m_obj;
0145   }
0146 
0147   podio::ObjectID id() const {
0148     return getObjectID();
0149   }
0150 
0151   const podio::ObjectID getObjectID() const;
0152 
0153   friend void swap(MutableTrackerPulse& a, MutableTrackerPulse& b) {
0154     using std::swap;
0155     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0156   }
0157 
0158 private:
0159   /// constructor from existing TrackerPulseObj
0160   explicit MutableTrackerPulse(podio::utils::MaybeSharedPtr<TrackerPulseObj> obj);
0161 
0162   podio::utils::MaybeSharedPtr<TrackerPulseObj> m_obj{nullptr};
0163 };
0164 
0165 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0166 void to_json(nlohmann::json& j, const MutableTrackerPulse& value);
0167 #endif
0168 
0169 } // namespace edm4hep
0170 
0171 #endif