Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-12 09:51:38

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_Truthiness_H
0004 #define EDM4EIC_Truthiness_H
0005 
0006 #include "edm4eic/TruthinessObj.h"
0007 
0008 #include "edm4eic/MCRecoParticleAssociation.h"
0009 #include "edm4eic/ReconstructedParticle.h"
0010 #include "edm4eic/TruthinessContribution.h"
0011 #include "edm4hep/MCParticle.h"
0012 #include "podio/RelationRange.h"
0013 #include <vector>
0014 
0015 #include "podio/utilities/MaybeSharedPtr.h"
0016 #include "podio/detail/OrderKey.h"
0017 
0018 #include <ostream>
0019 #include <cstdint>
0020 
0021 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0022 #include "nlohmann/json_fwd.hpp"
0023 #endif
0024 
0025 // forward declarations
0026 namespace edm4eic {
0027 class TruthinessCollection;
0028 }
0029 
0030 
0031 namespace podio::detail {
0032 // Internal function used in less comparison operators of the datatypes and interface types
0033 OrderKey getOrderKey(const edm4eic::Truthiness& obj);
0034 };
0035 
0036 namespace edm4eic {
0037 
0038 class MutableTruthiness;
0039 class TruthinessCollection;
0040 class TruthinessCollectionData;
0041 
0042 /** @class Truthiness
0043  *  Positive-definite convex norm of how confidently wrong the reconstruction is, with non-negative contributions from various aspects of the reconstruction, where a zero value indicates a perfect reconstruction.
0044  *  @author: W. Deconinck, S. Colbert
0045  */
0046 class Truthiness {
0047 
0048   friend class MutableTruthiness;
0049   friend class TruthinessCollection;
0050   friend class edm4eic::TruthinessCollectionData;
0051   friend class TruthinessCollectionIterator;
0052   friend podio::detail::OrderKey podio::detail::getOrderKey(const Truthiness & obj);
0053 
0054 public:
0055   using mutable_type = MutableTruthiness;
0056   using collection_type = TruthinessCollection;
0057 
0058   /// default constructor
0059   Truthiness() = default;
0060 
0061   /// Constructor initializing all members
0062   Truthiness(const float truthiness, const edm4eic::TruthinessContribution& associationContribution, const float unassociatedMCParticlesContribution, const float unassociatedRecoParticlesContribution);
0063 
0064   /// copy constructor
0065   Truthiness(const Truthiness& other) = default;
0066 
0067   /// copy-assignment operator
0068   Truthiness& operator=(Truthiness other) &; // Rebind this to other's internal object
0069   Truthiness& operator=(Truthiness other) && = delete; // Prevent rebinding temporary as the changes wouldn't persist
0070 
0071   /// create a mutable deep-copy of the object with identical relations
0072   /// if cloneRelations=false, the relations are not cloned and will be empty
0073   MutableTruthiness clone(bool cloneRelations=true) const;
0074 
0075   /// destructor
0076   ~Truthiness() = default;
0077 
0078   /// converting constructor from mutable object
0079   Truthiness(const MutableTruthiness& other);
0080 
0081   static Truthiness makeEmpty();
0082 
0083 public:
0084 
0085   static constexpr std::string_view typeName = "edm4eic::Truthiness";
0086 
0087   /// Access the Overall truthiness of the entire event
0088   float getTruthiness() const;
0089 
0090   /// Access the Contribution from all associated particles
0091   const edm4eic::TruthinessContribution& getAssociationContribution() const;
0092 
0093   /// Access the Contribution from unassociated MC particles
0094   float getUnassociatedMCParticlesContribution() const;
0095 
0096   /// Access the Contribution from unassociated reconstructed particles
0097   float getUnassociatedRecoParticlesContribution() const;
0098 
0099 
0100 
0101   std::size_t associations_size() const;
0102   edm4eic::MCRecoParticleAssociation getAssociations(std::size_t) const;
0103   std::vector<edm4eic::MCRecoParticleAssociation>::const_iterator associations_begin() const;
0104   std::vector<edm4eic::MCRecoParticleAssociation>::const_iterator associations_end() const;
0105   podio::RelationRange<edm4eic::MCRecoParticleAssociation> getAssociations() const;
0106   std::size_t unassociatedMCParticles_size() const;
0107   edm4hep::MCParticle getUnassociatedMCParticles(std::size_t) const;
0108   std::vector<edm4hep::MCParticle>::const_iterator unassociatedMCParticles_begin() const;
0109   std::vector<edm4hep::MCParticle>::const_iterator unassociatedMCParticles_end() const;
0110   podio::RelationRange<edm4hep::MCParticle> getUnassociatedMCParticles() const;
0111   std::size_t unassociatedRecoParticles_size() const;
0112   edm4eic::ReconstructedParticle getUnassociatedRecoParticles(std::size_t) const;
0113   std::vector<edm4eic::ReconstructedParticle>::const_iterator unassociatedRecoParticles_begin() const;
0114   std::vector<edm4eic::ReconstructedParticle>::const_iterator unassociatedRecoParticles_end() const;
0115   podio::RelationRange<edm4eic::ReconstructedParticle> getUnassociatedRecoParticles() const;
0116   std::size_t associationContributions_size() const;
0117   edm4eic::TruthinessContribution getAssociationContributions(std::size_t) const;
0118   std::vector<edm4eic::TruthinessContribution>::const_iterator associationContributions_begin() const;
0119   std::vector<edm4eic::TruthinessContribution>::const_iterator associationContributions_end() const;
0120   podio::RelationRange<edm4eic::TruthinessContribution> getAssociationContributions() const;
0121 
0122 
0123   /// check whether the object is actually available
0124   bool isAvailable() const;
0125   /// disconnect from TruthinessObj instance
0126   void unlink() { m_obj = podio::utils::MaybeSharedPtr<TruthinessObj>{nullptr}; }
0127 
0128   bool operator==(const Truthiness& other) const { return m_obj == other.m_obj; }
0129   bool operator==(const MutableTruthiness& other) const;
0130 
0131   bool operator!=(const Truthiness& other) const { return !(*this == other); }
0132   bool operator!=(const MutableTruthiness& other) const { return !(*this == other); }
0133 
0134   // less comparison operator, so that objects can be e.g. stored in sets.
0135   bool operator<(const Truthiness& other) const { return podio::detail::getOrderKey(*this) < podio::detail::getOrderKey(other); }
0136 
0137   podio::ObjectID id() const { return getObjectID(); }
0138 
0139   const podio::ObjectID getObjectID() const;
0140 
0141   friend std::hash<Truthiness>;
0142 
0143   friend void swap(Truthiness& a, Truthiness& b) {
0144     using std::swap;
0145     swap(a.m_obj, b.m_obj); // swap out the internal pointers
0146   }
0147 
0148 private:
0149   /// constructor from existing TruthinessObj
0150   explicit Truthiness(podio::utils::MaybeSharedPtr<TruthinessObj> obj);
0151   Truthiness(TruthinessObj* obj);
0152 
0153   podio::utils::MaybeSharedPtr<TruthinessObj> m_obj{new TruthinessObj{}, podio::utils::MarkOwned};
0154 };
0155 
0156 std::ostream& operator<<(std::ostream& o, const Truthiness& value);
0157 
0158 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0159 void to_json(nlohmann::json& j, const Truthiness& value);
0160 #endif
0161 
0162 
0163 } // namespace edm4eic
0164 
0165 
0166 
0167 template<>
0168 struct std::hash<edm4eic::Truthiness> {
0169   std::size_t operator()(const edm4eic::Truthiness& obj) const {
0170     return std::hash<edm4eic::TruthinessObj*>{}(obj.m_obj.get());
0171   }
0172 };
0173 
0174 
0175 // This is needed to avoid triggering opening every library in LD_LIBRARY_PATH
0176 // until it's fixed in ROOT. See https://github.com/root-project/root/issues/18489
0177 // and https://github.com/AIDASoft/podio/issues/770
0178 #if defined(__clang__)
0179   #pragma clang diagnostic push
0180   #pragma clang diagnostic ignored "-Wunknown-warning-option"
0181   #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
0182   #pragma clang diagnostic ignored "-Wdeprecated"
0183 constexpr std::string_view edm4eic::Truthiness::typeName;
0184   #pragma clang diagnostic pop
0185 #elif defined(__GNUC__)
0186   #pragma GCC diagnostic push
0187   #pragma GCC diagnostic ignored "-Wdeprecated"
0188 constexpr std::string_view edm4eic::Truthiness::typeName;
0189   #pragma GCC diagnostic pop
0190 #endif
0191 
0192 
0193 #endif