Back to home page

EIC code displayed by LXR

 
 

    


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

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