Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_RawHGCROCHit_H
0004 #define EDM4EIC_RawHGCROCHit_H
0005 
0006 #include "edm4eic/RawHGCROCHitObj.h"
0007 
0008 #include "edm4eic/HGCROCSample.h"
0009 #include "podio/RelationRange.h"
0010 #include <cstdint>
0011 #include <vector>
0012 
0013 #include "podio/utilities/MaybeSharedPtr.h"
0014 #include "podio/detail/OrderKey.h"
0015 
0016 #include <ostream>
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 podio::detail {
0030 // Internal function used in less comparison operators of the datatypes and interface types
0031 OrderKey getOrderKey(const edm4eic::RawHGCROCHit& obj);
0032 };
0033 
0034 namespace edm4eic {
0035 
0036 class MutableRawHGCROCHit;
0037 class RawHGCROCHitCollection;
0038 class RawHGCROCHitCollectionData;
0039 
0040 /** @class RawHGCROCHit
0041  *  Raw hit from an HGCROC chip
0042  *  @author: D. Anderson, S. Joosten, T. Protzman, N. Novitzky, D. Kalinkin
0043  */
0044 class RawHGCROCHit {
0045 
0046   friend class MutableRawHGCROCHit;
0047   friend class RawHGCROCHitCollection;
0048   friend class edm4eic::RawHGCROCHitCollectionData;
0049   friend class RawHGCROCHitCollectionIterator;
0050   friend podio::detail::OrderKey podio::detail::getOrderKey(const RawHGCROCHit & obj);
0051 
0052 public:
0053   using mutable_type = MutableRawHGCROCHit;
0054   using collection_type = RawHGCROCHitCollection;
0055 
0056   /// default constructor
0057   RawHGCROCHit();
0058 
0059   /// Constructor initializing all members
0060   RawHGCROCHit(const std::uint64_t cellID, const std::int32_t samplePhase, const std::int32_t timeStamp);
0061 
0062   /// copy constructor
0063   RawHGCROCHit(const RawHGCROCHit& other) = default;
0064 
0065   /// copy-assignment operator
0066   RawHGCROCHit& operator=(RawHGCROCHit other) &; // Rebind this to other's internal object
0067   RawHGCROCHit& operator=(RawHGCROCHit other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0068 
0069   /// create a mutable deep-copy of the object with identical relations
0070   /// if cloneRelations=false, the relations are not cloned and will be empty
0071   MutableRawHGCROCHit clone(bool cloneRelations=true) const;
0072 
0073   /// destructor
0074   ~RawHGCROCHit() = default;
0075 
0076   /// converting constructor from mutable object
0077   RawHGCROCHit(const MutableRawHGCROCHit& other);
0078 
0079   static RawHGCROCHit makeEmpty();
0080 
0081 public:
0082 
0083   static constexpr std::string_view typeName = "edm4eic::RawHGCROCHit";
0084 
0085   /// Access the Detector specific (geometrical) cell id
0086   std::uint64_t getCellID() const;
0087 
0088   /// Access the Phase of samples in [# samples], for synchronizing across chips
0089   std::int32_t getSamplePhase() const;
0090 
0091   /// Access the [TDC counts]
0092   std::int32_t getTimeStamp() const;
0093 
0094 
0095 
0096   std::size_t samples_size() const;
0097   edm4eic::HGCROCSample getSamples(std::size_t) const;
0098   std::vector<edm4eic::HGCROCSample>::const_iterator samples_begin() const;
0099   std::vector<edm4eic::HGCROCSample>::const_iterator samples_end() const;
0100   podio::RelationRange<edm4eic::HGCROCSample> getSamples() const;
0101 
0102 
0103   /// check whether the object is actually available
0104   bool isAvailable() const;
0105   /// disconnect from RawHGCROCHitObj instance
0106   void unlink() { m_obj = podio::utils::MaybeSharedPtr<RawHGCROCHitObj>{nullptr}; }
0107 
0108   bool operator==(const RawHGCROCHit& other) const { return m_obj == other.m_obj; }
0109   bool operator==(const MutableRawHGCROCHit& other) const;
0110 
0111   bool operator!=(const RawHGCROCHit& other) const { return !(*this == other); }
0112   bool operator!=(const MutableRawHGCROCHit& other) const { return !(*this == other); }
0113 
0114   // less comparison operator, so that objects can be e.g. stored in sets.
0115   bool operator<(const RawHGCROCHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0116 
0117   podio::ObjectID id() const { return getObjectID(); }
0118 
0119   const podio::ObjectID getObjectID() const;
0120 
0121   friend std::hash<RawHGCROCHit>;
0122 
0123   friend void swap(RawHGCROCHit& a, RawHGCROCHit& b) {
0124     using std::swap;
0125     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0126   }
0127 
0128 private:
0129   /// constructor from existing RawHGCROCHitObj
0130   explicit RawHGCROCHit(podio::utils::MaybeSharedPtr<RawHGCROCHitObj> obj);
0131   RawHGCROCHit(RawHGCROCHitObj* obj);
0132 
0133   podio::utils::MaybeSharedPtr<RawHGCROCHitObj> m_obj{nullptr};
0134 };
0135 
0136 std::ostream& operator<<(std::ostream& o, const RawHGCROCHit& value);
0137 
0138 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0139 void to_json(nlohmann::json& j, const RawHGCROCHit& value);
0140 #endif
0141 
0142 
0143 } // namespace edm4eic
0144 
0145 
0146 
0147 template<>
0148 struct std::hash<edm4eic::RawHGCROCHit> {
0149   std::size_t operator()(const edm4eic::RawHGCROCHit& obj) const {
0150     return std::hash<edm4eic::RawHGCROCHitObj*>{}(obj.m_obj.get());
0151   }
0152 };
0153 
0154 
0155 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0156 // until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
0157 // and https://github.com/AIDASoft/podio/issues/770
0158 #if defined(__clang__)
0159 #pragma clang diagnostic push
0160 #pragma clang diagnostic ignored "-Wunknown-warning-option"
0161 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0162 #pragma clang diagnostic ignored "-Wdeprecated"
0163 constexpr std::string_view edm4eic::RawHGCROCHit::typeName;
0164 #pragma clang diagnostic pop
0165 #elif defined(__GNUC__)
0166 #pragma GCC diagnostic push
0167 #pragma GCC diagnostic ignored "-Wdeprecated"
0168 constexpr std::string_view edm4eic::RawHGCROCHit::typeName;
0169 #pragma GCC diagnostic pop
0170 #endif
0171 
0172 #endif