File indexing completed on 2025-10-17 08:19:25
0001 #include "PhotonClusterv1.h"
0002 #include <iostream>
0003 #include <limits>
0004 #include <map>
0005 #include <string>
0006
0007 PhotonClusterv1::PhotonClusterv1(const RawClusterv1& rawcluster)
0008 : RawClusterv1(rawcluster)
0009 , m_conversion_prob(0.0F)
0010 , m_is_converted(false)
0011
0012 {
0013
0014
0015
0016 }
0017
0018 void PhotonClusterv1::Reset()
0019 {
0020
0021 RawClusterv1::Reset();
0022
0023
0024 reset_photon_properties();
0025 }
0026
0027 void PhotonClusterv1::reset_photon_properties()
0028 {
0029
0030 m_conversion_prob = 0.0F;
0031 m_is_converted = false;
0032 m_shower_shapes.clear();
0033 }
0034
0035 int PhotonClusterv1::isValid() const
0036 {
0037
0038 return RawClusterv1::isValid() && is_valid_photon();
0039 }
0040
0041 bool PhotonClusterv1::is_valid_photon() const
0042 {
0043
0044 return (get_energy() > 0.0F);
0045 }
0046
0047 void PhotonClusterv1::identify(std::ostream& os) const
0048 {
0049
0050 RawClusterv1::identify(os);
0051
0052
0053 identify_photon(os);
0054 }
0055
0056 void PhotonClusterv1::identify_photon(std::ostream& os) const
0057 {
0058 os << "--- PhotonClusterv1 Photon Properties ---" << std::endl;
0059 os << " Photon Energy: " << get_energy() << " GeV" << std::endl;
0060 os << " Conversion Probability: " << get_conversion_probability() << std::endl;
0061 os << " Is Converted: " << (is_converted() ? "Yes" : "No") << std::endl;
0062 os << " Isolation Energy: " << get_et_iso() << " GeV" << std::endl;
0063
0064 for (const auto& kv : m_shower_shapes)
0065 {
0066 os << " shape[" << kv.first << "]: " << kv.second << std::endl;
0067 }
0068 os << " Passes Photon Cuts: " << (pass_photon_cuts() ? "Yes" : "No") << std::endl;
0069 os << "------------------------------------------" << std::endl;
0070 }
0071
0072 bool PhotonClusterv1::pass_photon_cuts() const
0073 {
0074
0075 std::cout << "this is currently unimplemented" << std::endl;
0076
0077 if (get_energy() < 0.5F)
0078 {
0079 return false;
0080 }
0081
0082
0083
0084
0085
0086
0087
0088
0089 if (get_et_iso() > 2.0F)
0090 {
0091 return false;
0092 }
0093
0094
0095
0096
0097 return true;
0098 }
0099
0100 float PhotonClusterv1::get_shower_shape_parameter(const std::string& name) const
0101 {
0102 auto it = m_shower_shapes.find(name);
0103 if (it != m_shower_shapes.end())
0104 {
0105 return it->second;
0106 }
0107 return std::numeric_limits<float>::quiet_NaN();
0108 }