Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-17 08:20:52

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