Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-11 10:20:46

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef JANA2_TUTORIAL_PODIO_DATAMODEL_CalorimeterHit_H
0004 #define JANA2_TUTORIAL_PODIO_DATAMODEL_CalorimeterHit_H
0005 
0006 #include "jana2_tutorial_podio_datamodel/CalorimeterHitObj.h"
0007 
0008 #include <cstdint>
0009 
0010 #include "podio/utilities/MaybeSharedPtr.h"
0011 #include "podio/detail/OrderKey.h"
0012 
0013 #include <ostream>
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 class CalorimeterHitCollection;
0022 
0023 
0024 namespace podio::detail {
0025 // Internal function used in less comparison operators of the datatypes and interface types
0026 OrderKey getOrderKey(const ::CalorimeterHit& obj);
0027 };
0028 
0029 
0030 class MutableCalorimeterHit;
0031 class CalorimeterHitCollection;
0032 class CalorimeterHitCollectionData;
0033 
0034 /** @class CalorimeterHit
0035  *  A simple calorimeter hit
0036  *  @author: N. Brei
0037  */
0038 class CalorimeterHit {
0039 
0040   friend class MutableCalorimeterHit;
0041   friend class CalorimeterHitCollection;
0042   friend class CalorimeterHitCollectionData;
0043   friend class CalorimeterHitCollectionIterator;
0044   friend podio::detail::OrderKey podio::detail::getOrderKey(const CalorimeterHit & obj);
0045 
0046 public:
0047   using mutable_type = MutableCalorimeterHit;
0048   using collection_type = CalorimeterHitCollection;
0049 
0050   /// default constructor
0051   CalorimeterHit() = default;
0052 
0053   /// Constructor initializing all members
0054   CalorimeterHit(const std::uint64_t cell_id, const std::uint64_t row, const std::uint64_t col, const double x, const double y, const double z, const double energy, const std::uint64_t time);
0055 
0056   /// copy constructor
0057   CalorimeterHit(const CalorimeterHit& other) = default;
0058 
0059   /// copy-assignment operator
0060   CalorimeterHit& operator=(CalorimeterHit other) &; // Rebind this to other's internal object
0061   CalorimeterHit& operator=(CalorimeterHit other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0062 
0063   /// create a mutable deep-copy of the object with identical relations
0064   /// if cloneRelations=false, the relations are not cloned and will be empty
0065   MutableCalorimeterHit clone(bool cloneRelations=true) const;
0066 
0067   /// destructor
0068   ~CalorimeterHit() = default;
0069 
0070   /// converting constructor from mutable object
0071   CalorimeterHit(const MutableCalorimeterHit& other);
0072 
0073   static CalorimeterHit makeEmpty();
0074 
0075 public:
0076 
0077   static constexpr std::string_view typeName = "CalorimeterHit";
0078 
0079   /// Access the Cell ID
0080   std::uint64_t getCell_id() const;
0081 
0082   /// Access the Cell row (zero-indexed)
0083   std::uint64_t getRow() const;
0084 
0085   /// Access the Cell column (zero-indexed)
0086   std::uint64_t getCol() const;
0087 
0088   /// Access the x coordinate of cell center [cm]
0089   double getX() const;
0090 
0091   /// Access the y coordinate of cell center [cm]
0092   double getY() const;
0093 
0094   /// Access the z coordinate of cell center [cm]
0095   double getZ() const;
0096 
0097   /// Access the Measured energy deposit [GeV]
0098   double getEnergy() const;
0099 
0100   /// Access the Time [ns]
0101   std::uint64_t getTime() const;
0102 
0103 
0104 
0105 
0106 
0107   /// check whether the object is actually available
0108   bool isAvailable() const;
0109   /// disconnect from CalorimeterHitObj instance
0110   void unlink() { m_obj = podio::utils::MaybeSharedPtr<CalorimeterHitObj>{nullptr}; }
0111 
0112   bool operator==(const CalorimeterHit& other) const { return m_obj == other.m_obj; }
0113   bool operator==(const MutableCalorimeterHit& other) const;
0114 
0115   bool operator!=(const CalorimeterHit& other) const { return !(*this == other); }
0116   bool operator!=(const MutableCalorimeterHit& other) const { return !(*this == other); }
0117 
0118   // less comparison operator, so that objects can be e.g. stored in sets.
0119   bool operator<(const CalorimeterHit& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0120 
0121   podio::ObjectID id() const { return getObjectID(); }
0122 
0123   const podio::ObjectID getObjectID() const;
0124 
0125   friend std::hash<CalorimeterHit>;
0126 
0127   friend void swap(CalorimeterHit& a, CalorimeterHit& b) {
0128     using std::swap;
0129     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0130   }
0131 
0132 private:
0133   /// constructor from existing CalorimeterHitObj
0134   explicit CalorimeterHit(podio::utils::MaybeSharedPtr<CalorimeterHitObj> obj);
0135   CalorimeterHit(CalorimeterHitObj* obj);
0136 
0137   podio::utils::MaybeSharedPtr<CalorimeterHitObj> m_obj{new CalorimeterHitObj{}, podio::utils::MarkOwned};
0138 };
0139 
0140 std::ostream& operator<<(std::ostream& o, const CalorimeterHit& value);
0141 
0142 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0143 void to_json(nlohmann::json& j, const CalorimeterHit& value);
0144 #endif
0145 
0146 
0147 
0148 
0149 
0150 template<>
0151 struct std::hash<CalorimeterHit> {
0152   std::size_t operator()(const CalorimeterHit& obj) const {
0153     return std::hash<CalorimeterHitObj*>{}(obj.m_obj.get());
0154   }
0155 };
0156 
0157 
0158 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0159 // until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
0160 // and https://github.com/AIDASoft/podio/issues/770
0161 #if defined(__clang__)
0162   #pragma clang diagnostic push
0163   #pragma clang diagnostic ignored "-Wunknown-warning-option"
0164   #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0165   #pragma clang diagnostic ignored "-Wdeprecated"
0166 constexpr std::string_view CalorimeterHit::typeName;
0167   #pragma clang diagnostic pop
0168 #elif defined(__GNUC__)
0169   #pragma GCC diagnostic push
0170   #pragma GCC diagnostic ignored "-Wdeprecated"
0171 constexpr std::string_view CalorimeterHit::typeName;
0172   #pragma GCC diagnostic pop
0173 #endif
0174 
0175 
0176 #endif