Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-13 09:14:37

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_MutableRawHGCROCHit_H
0004 #define EDM4EIC_MutableRawHGCROCHit_H
0005 
0006 #include "edm4eic/RawHGCROCHitObj.h"
0007 // Make the immutable class available from its mutable version but not vice versa
0008 #include "edm4eic/RawHGCROCHit.h"
0009 
0010 #include "edm4eic/HGCROCSample.h"
0011 #include "podio/RelationRange.h"
0012 #include <cstdint>
0013 #include <vector>
0014 
0015 #include "podio/utilities/MaybeSharedPtr.h"
0016 
0017 #include <cstdint>
0018 
0019 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0020 #include "nlohmann/json_fwd.hpp"
0021 #endif
0022 
0023 // forward declarations
0024 namespace edm4eic {
0025 class RawHGCROCHitCollection;
0026 }
0027 
0028 
0029 namespace edm4eic {
0030 
0031 
0032 /** @class MutableRawHGCROCHit
0033  *  Raw hit from an HGCROC chip
0034  *  @author: D. Anderson, S. Joosten, T. Protzman, N. Novitzky, D. Kalinkin
0035  */
0036 class MutableRawHGCROCHit {
0037 
0038   friend class RawHGCROCHitCollection;
0039   friend class RawHGCROCHitMutableCollectionIterator;
0040   friend class RawHGCROCHit;
0041 
0042 public:
0043   using object_type = RawHGCROCHit;
0044   using collection_type = RawHGCROCHitCollection;
0045 
0046   /// default constructor
0047   MutableRawHGCROCHit();
0048 
0049   /// Constructor initializing all members
0050   MutableRawHGCROCHit(const std::uint64_t cellID, const std::int32_t samplePhase, const std::int32_t timeStamp);
0051 
0052   /// copy constructor
0053   MutableRawHGCROCHit(const MutableRawHGCROCHit& other) = default;
0054 
0055   /// copy-assignment operator
0056   MutableRawHGCROCHit& operator=(MutableRawHGCROCHit other) &; // Rebind this to other's internal object
0057   MutableRawHGCROCHit& operator=(MutableRawHGCROCHit 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   MutableRawHGCROCHit clone(bool cloneRelations=true) const;
0062 
0063   /// destructor
0064   ~MutableRawHGCROCHit() = default;
0065 
0066 
0067 public:
0068 
0069   /// Access the Detector specific (geometrical) cell id
0070   std::uint64_t getCellID() const;
0071 
0072   /// Access the Phase of samples in [# samples], for synchronizing across chips
0073   std::int32_t getSamplePhase() const;
0074 
0075   /// Access the [TDC counts]
0076   std::int32_t getTimeStamp() const;
0077 
0078 
0079 
0080   /// Set the Detector specific (geometrical) cell id
0081   void setCellID(const std::uint64_t cellID);
0082   /// Get mutable reference to Detector specific (geometrical) cell id
0083   std::uint64_t& getCellID();
0084   /// Get reference to Detector specific (geometrical) cell id
0085   [[deprecated("use getCellID instead")]]
0086   std::uint64_t& cellID();
0087 
0088   /// Set the Phase of samples in [# samples], for synchronizing across chips
0089   void setSamplePhase(const std::int32_t samplePhase);
0090   /// Get mutable reference to Phase of samples in [# samples], for synchronizing across chips
0091   std::int32_t& getSamplePhase();
0092   /// Get reference to Phase of samples in [# samples], for synchronizing across chips
0093   [[deprecated("use getSamplePhase instead")]]
0094   std::int32_t& samplePhase();
0095 
0096   /// Set the [TDC counts]
0097   void setTimeStamp(const std::int32_t timeStamp);
0098   /// Get mutable reference to [TDC counts]
0099   std::int32_t& getTimeStamp();
0100   /// Get reference to [TDC counts]
0101   [[deprecated("use getTimeStamp instead")]]
0102   std::int32_t& timeStamp();
0103 
0104 
0105 
0106   void addToSamples(const edm4eic::HGCROCSample&);
0107   std::size_t samples_size() const;
0108   edm4eic::HGCROCSample getSamples(std::size_t) const;
0109   std::vector<edm4eic::HGCROCSample>::const_iterator samples_begin() const;
0110   std::vector<edm4eic::HGCROCSample>::const_iterator samples_end() const;
0111   podio::RelationRange<edm4eic::HGCROCSample> getSamples() const;
0112 
0113 
0114 
0115   /// check whether the object is actually available
0116   bool isAvailable() const;
0117   /// disconnect from RawHGCROCHitObj instance
0118   void unlink() { m_obj = podio::utils::MaybeSharedPtr<RawHGCROCHitObj>{nullptr}; }
0119 
0120   bool operator==(const MutableRawHGCROCHit& other) const { return m_obj == other.m_obj; }
0121   bool operator==(const RawHGCROCHit& other) const;
0122 
0123   bool operator!=(const MutableRawHGCROCHit& other) const { return !(*this == other); }
0124   bool operator!=(const RawHGCROCHit& other) const { return !(*this == other); }
0125 
0126   // less comparison operator, so that objects can be e.g. stored in sets.
0127   bool operator<(const MutableRawHGCROCHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0128 
0129   podio::ObjectID id() const { return getObjectID(); }
0130 
0131   const podio::ObjectID getObjectID() const;
0132 
0133   friend std::hash<MutableRawHGCROCHit>;
0134 
0135   friend void swap(MutableRawHGCROCHit& a, MutableRawHGCROCHit& b) {
0136     using std::swap;
0137     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0138   }
0139 
0140 private:
0141   /// constructor from existing RawHGCROCHitObj
0142   explicit MutableRawHGCROCHit(podio::utils::MaybeSharedPtr<RawHGCROCHitObj> obj);
0143 
0144   podio::utils::MaybeSharedPtr<RawHGCROCHitObj> m_obj{nullptr};
0145 };
0146 
0147 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0148 void to_json(nlohmann::json& j, const MutableRawHGCROCHit& value);
0149 #endif
0150 
0151 
0152 } // namespace edm4eic
0153 
0154 
0155 
0156 template<>
0157 struct std::hash<edm4eic::MutableRawHGCROCHit> {
0158   std::size_t operator()(const edm4eic::MutableRawHGCROCHit& obj) const {
0159     return std::hash<edm4eic::RawHGCROCHitObj*>{}(obj.m_obj.get());
0160   }
0161 };
0162 
0163 
0164 #endif