Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 09:19:52

0001 #include "PhotonClusterv1.h"
0002 #include <cmath>
0003 #include <iostream>
0004 #include <limits>
0005 #include <map>
0006 #include <string>
0007 
0008 PhotonClusterv1::PhotonClusterv1(const RawCluster& rc)
0009   : RawClusterv1(rc)
0010 {
0011   if (const auto* photon = dynamic_cast<const PhotonClusterv1*>(&rc))
0012   {
0013     m_shower_shapes = photon->get_all_shower_shapes();
0014   }
0015 }
0016 
0017 void PhotonClusterv1::Reset()
0018 {
0019   // @warning: Call base class reset first to avoid issues with virtual dispatch
0020   RawClusterv1::Reset();
0021 
0022   // Reset photon-specific members
0023   reset_photon_properties();
0024 }
0025 
0026 void PhotonClusterv1::reset_photon_properties()
0027 {
0028   m_shower_shapes.clear();
0029   return;
0030 }
0031 
0032 
0033 
0034 
0035 void PhotonClusterv1::identify(std::ostream& os) const
0036 {
0037   // @warning: Call base class identify first to maintain output order
0038   RawClusterv1::identify(os);
0039 
0040   // Add photon-specific information
0041   identify_photon(os);
0042 }
0043 
0044 void PhotonClusterv1::identify_photon(std::ostream& os) const
0045 {
0046   os << "--- PhotonClusterv1 Photon Properties ---" << std::endl;
0047   os << "  Photon Energy: " << get_energy() << " GeV" << std::endl;
0048   // List all named shower shapes
0049   for (const auto& kv : m_shower_shapes)
0050   {
0051     os << "    shape[" << kv.first << "]: " << kv.second << std::endl;
0052   }
0053   os << "------------------------------------------" << std::endl;
0054 }
0055 
0056 bool PhotonClusterv1::pass_photon_cuts() const
0057 {
0058   // @warning: These are example cuts - customize based on your analysis needs
0059   std::cout << "PhotonClusterv1::pass_photon_cuts() is currently unimplemented" << std::endl;
0060   // Minimum energy cut
0061 
0062   // Shower shape cut: if a shape named "core" exists, apply cut
0063   // auto it_core = m_shower_shapes.find("core");
0064   // if (it_core != m_shower_shapes.end()) {
0065   //  if (it_core->second > 0.3f) return false;
0066   //}
0067 
0068 
0069   // @warning: Add more sophisticated photon ID cuts as needed
0070   // Consider using cluster properties like get_ecore(), get_prob(), etc.
0071 
0072   return true;
0073 }
0074 
0075 float PhotonClusterv1::get_shower_shape_parameter(const std::string& name) const
0076 {
0077   auto it = m_shower_shapes.find(name);
0078   if (it != m_shower_shapes.end())
0079   {
0080     return it->second;
0081   }
0082   return std::numeric_limits<float>::quiet_NaN();
0083 }