Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:18:09

0001 #include "MvtxEventInfo.h"
0002 
0003 #include <phool/phool.h>
0004 #include <cmath>    // for NAN
0005 #include <utility>  // for pair
0006 
0007 PHObject *MvtxEventInfo::CloneMe() const
0008 {
0009   std::cout << PHWHERE << "::" << __func__ << " is not implemented in base class" << std::endl;
0010   return nullptr;
0011 }
0012 
0013 void MvtxEventInfo::Reset()
0014 {
0015   std::cout << PHWHERE << "::" << __func__ << " is not implemented in base class" << std::endl;
0016   return;
0017 }
0018 
0019 void MvtxEventInfo::identify(std::ostream &out) const
0020 {
0021   out << "MvtxEventInfo information" << std::endl;
0022 
0023   auto iters = m_StringEventProperties.begin();
0024   while (iters != m_StringEventProperties.end())
0025   {
0026     out << iters->first << ": " << iters->second << std::endl;
0027     ++iters;
0028   }
0029 
0030   auto iteri = m_IntEventProperties.begin();
0031   while (iteri != m_IntEventProperties.end())
0032   {
0033     out << iteri->first << ": " << iteri->second << std::endl;
0034     ++iteri;
0035   }
0036 
0037   auto iteri64 = m_Int64EventProperties.begin();
0038   while (iteri64 != m_Int64EventProperties.end())
0039   {
0040     out << iteri64->first << ": " << iteri64->second << std::endl;
0041     ++iteri64;
0042   }
0043 
0044   auto iteru = m_UintEventProperties.begin();
0045   while (iteru != m_UintEventProperties.end())
0046   {
0047     out << iteru->first << ": " << iteru->second << std::endl;
0048     ++iteru;
0049   }
0050 
0051   auto iteru64 = m_Uint64EventProperties.begin();
0052   while (iteru64 != m_Uint64EventProperties.end())
0053   {
0054     out << iteru64->first << ": " << iteru64->second << std::endl;
0055     ++iteru64;
0056   }
0057 
0058   auto iterf = m_FloatEventProperties.begin();
0059   while (iterf != m_FloatEventProperties.end())
0060   {
0061     out << iterf->first << ": " << iterf->second << std::endl;
0062     ++iterf;
0063   }
0064   return;
0065 }
0066 
0067 int MvtxEventInfo::isValid() const
0068 {
0069   std::cout << PHWHERE << " isValid not implemented by base class" << std::endl;
0070   return 0;
0071 }
0072 
0073 void MvtxEventInfo::set_floatval(const std::string &name, const float fval)
0074 {
0075   m_FloatEventProperties[name] = fval;
0076 }
0077 
0078 float MvtxEventInfo::get_floatval(const std::string &name) const
0079 {
0080   std::map<std::string, float>::const_iterator iter = m_FloatEventProperties.find(name);
0081   if (iter != m_FloatEventProperties.end())
0082   {
0083     return iter->second;
0084   }
0085   return NAN;
0086 }
0087 
0088 void MvtxEventInfo::set_intval(const std::string &name, const int32_t ival)
0089 {
0090   m_IntEventProperties[name] = ival;
0091 }
0092 
0093 int MvtxEventInfo::get_intval(const std::string &name) const
0094 {
0095   std::map<std::string, int32_t>::const_iterator iter = m_IntEventProperties.find(name);
0096   if (iter != m_IntEventProperties.end())
0097   {
0098     return iter->second;
0099   }
0100   return -999999;
0101 }
0102 
0103 void MvtxEventInfo::set_int64val(const std::string &name, const int64_t ival)
0104 {
0105   m_Int64EventProperties[name] = ival;
0106 }
0107 
0108 int MvtxEventInfo::get_int64val(const std::string &name) const
0109 {
0110   std::map<std::string, int64_t>::const_iterator iter = m_Int64EventProperties.find(name);
0111   if (iter != m_Int64EventProperties.end())
0112   {
0113     return iter->second;
0114   }
0115   return -999999;
0116 }
0117 
0118 void MvtxEventInfo::set_uintval(const std::string &name, const uint32_t ival)
0119 {
0120   m_UintEventProperties[name] = ival;
0121 }
0122 
0123 int MvtxEventInfo::get_uintval(const std::string &name) const
0124 {
0125   std::map<std::string, uint32_t>::const_iterator iter = m_UintEventProperties.find(name);
0126   if (iter != m_UintEventProperties.end())
0127   {
0128     return iter->second;
0129   }
0130   return 999999;
0131 }
0132 
0133 void MvtxEventInfo::set_uint64val(const std::string &name, const uint64_t ival)
0134 {
0135   m_Int64EventProperties[name] = ival;
0136 }
0137 
0138 int MvtxEventInfo::get_uint64val(const std::string &name) const
0139 {
0140   std::map<std::string, uint64_t>::const_iterator iter = m_Uint64EventProperties.find(name);
0141   if (iter != m_Uint64EventProperties.end())
0142   {
0143     return iter->second;
0144   }
0145   return 999999;
0146 }
0147 
0148 void MvtxEventInfo::set_stringval(const std::string &name, const std::string &sval)
0149 {
0150   m_StringEventProperties[name] = sval;
0151 }
0152 
0153 std::string MvtxEventInfo::get_stringval(const std::string &name) const
0154 {
0155   std::map<std::string, std::string>::const_iterator iter = m_StringEventProperties.find(name);
0156   if (iter != m_StringEventProperties.end())
0157   {
0158     return iter->second;
0159   }
0160   return "Empty";
0161 }