Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-12-03 10:42:10

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_MutableRawTrackerHit_H
0004 #define EDM4EIC_MutableRawTrackerHit_H
0005 
0006 #include "edm4eic/RawTrackerHitObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4eic/RawTrackerHit.h"
0009 
0010 #include <cstdint>
0011 
0012 #include "podio/utilities/MaybeSharedPtr.h"
0013 
0014 #include <cstdint>
0015 
0016 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0017 #include "nlohmann/json_fwd.hpp"
0018 #endif
0019 
0020 // forward declarations
0021 namespace edm4eic {
0022 class RawTrackerHitCollection;
0023 }
0024 
0025 
0026 namespace edm4eic {
0027 
0028 
0029 /** @class MutableRawTrackerHit
0030  *  Raw (digitized) tracker hit
0031  *  @author: W. Armstrong, S. Joosten
0032  */
0033 class MutableRawTrackerHit {
0034 
0035   friend class RawTrackerHitCollection;
0036   friend class RawTrackerHitMutableCollectionIterator;
0037   friend class RawTrackerHit;
0038 
0039 public:
0040   using object_type = RawTrackerHit;
0041   using collection_type = RawTrackerHitCollection;
0042 
0043   /// default constructor
0044   MutableRawTrackerHit() = default;
0045 
0046   /// Constructor initializing all members
0047   MutableRawTrackerHit(const std::uint64_t cellID, const std::int32_t charge, const std::int32_t timeStamp);
0048 
0049   /// copy constructor
0050   MutableRawTrackerHit(const MutableRawTrackerHit& other) noexcept = default;
0051 
0052   /// move constructor
0053   MutableRawTrackerHit(MutableRawTrackerHit&& other) noexcept = default;
0054 
0055   /// copy-assignment operator
0056   MutableRawTrackerHit& operator=(MutableRawTrackerHit other) &; // Rebind this to other's internal object
0057   MutableRawTrackerHit& operator=(MutableRawTrackerHit other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0058 
0059   /// create a mutable deep-copy of the object with identical relations
0060   /// if cloneRelations=false, the relations are not cloned and will be empty
0061   MutableRawTrackerHit clone(bool cloneRelations=true) const;
0062 
0063   /// destructor
0064   ~MutableRawTrackerHit() = default;
0065 
0066 
0067 public:
0068 
0069   /// Access the The detector specific (geometrical) cell id.
0070   std::uint64_t getCellID() const;
0071 
0072   /// Access the ADC value
0073   std::int32_t getCharge() const;
0074 
0075   /// Access the TDC value.
0076   std::int32_t getTimeStamp() const;
0077 
0078 
0079 
0080   /// Set the The detector specific (geometrical) cell id.
0081   void setCellID(const std::uint64_t cellID);
0082   /// Get mutable reference to The detector specific (geometrical) cell id.
0083   std::uint64_t& getCellID();
0084 
0085   /// Set the ADC value
0086   void setCharge(const std::int32_t charge);
0087   /// Get mutable reference to ADC value
0088   std::int32_t& getCharge();
0089 
0090   /// Set the TDC value.
0091   void setTimeStamp(const std::int32_t timeStamp);
0092   /// Get mutable reference to TDC value.
0093   std::int32_t& getTimeStamp();
0094 
0095 
0096 
0097 
0098 
0099 
0100   /// check whether the object is actually available
0101   bool isAvailable() const;
0102   /// disconnect from RawTrackerHitObj instance
0103   void unlink() { m_obj = podio::utils::MaybeSharedPtr<RawTrackerHitObj>{nullptr}; }
0104 
0105   constexpr bool operator==(const MutableRawTrackerHit& other) const { return m_obj == other.m_obj; }
0106   bool operator==(const RawTrackerHit& other) const;
0107 
0108   constexpr bool operator!=(const MutableRawTrackerHit& other) const { return !(*this == other); }
0109   bool operator!=(const RawTrackerHit& other) const { return !(*this == other); }
0110 
0111   // less comparison operator, so that objects can be e.g. stored in sets.
0112   bool operator<(const MutableRawTrackerHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0113 
0114   podio::ObjectID id() const { return getObjectID(); }
0115 
0116   const podio::ObjectID getObjectID() const;
0117 
0118   friend std::hash<MutableRawTrackerHit>;
0119 
0120   friend void swap(MutableRawTrackerHit& a, MutableRawTrackerHit& b) {
0121     using std::swap;
0122     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0123   }
0124 
0125 private:
0126   /// constructor from existing RawTrackerHitObj
0127   explicit MutableRawTrackerHit(podio::utils::MaybeSharedPtr<RawTrackerHitObj> obj);
0128 
0129   podio::utils::MaybeSharedPtr<RawTrackerHitObj> m_obj{new RawTrackerHitObj{}, podio::utils::MarkOwned};
0130 };
0131 
0132 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0133 void to_json(nlohmann::json& j, const MutableRawTrackerHit& value);
0134 #endif
0135 
0136 
0137 } // namespace edm4eic
0138 
0139 
0140 
0141 template<>
0142 struct std::hash<edm4eic::MutableRawTrackerHit> {
0143   std::size_t operator()(const edm4eic::MutableRawTrackerHit& obj) const {
0144     return std::hash<edm4eic::RawTrackerHitObj*>{}(obj.m_obj.get());
0145   }
0146 };
0147 
0148 
0149 #endif