File indexing completed on 2025-08-05 08:16:06
0001 #include "RunHeaderv1.h"
0002
0003 #include <cmath> // for NAN
0004 #include <utility> // for pair
0005
0006 void RunHeaderv1::identify(std::ostream &out) const
0007 {
0008 out << "identify yourself: I am an RunHeaderv1 Object" << std::endl;
0009 out << "Run no: " << RunNumber << std::endl;
0010 auto iter = m_IntRunProperties.begin();
0011 while (iter != m_IntRunProperties.end())
0012 {
0013 out << iter->first << ": " << iter->second << std::endl;
0014 ++iter;
0015 }
0016 auto iterf = m_FloatRunProperties.begin();
0017 while (iterf != m_FloatRunProperties.end())
0018 {
0019 out << iterf->first << ": " << iterf->second << std::endl;
0020 ++iterf;
0021 }
0022 return;
0023 }
0024
0025 int RunHeaderv1::isValid() const
0026 {
0027 return ((RunNumber) ? 1 : 0);
0028 }
0029
0030 void RunHeaderv1::set_floatval(const std::string &name, const float fval)
0031 {
0032 m_FloatRunProperties[name] = fval;
0033 }
0034
0035 float RunHeaderv1::get_floatval(const std::string &name) const
0036 {
0037 std::map<std::string, float>::const_iterator iter = m_FloatRunProperties.find(name);
0038 if (iter != m_FloatRunProperties.end())
0039 {
0040 return iter->second;
0041 }
0042 return NAN;
0043 }
0044
0045 void RunHeaderv1::set_intval(const std::string &name, const int ival)
0046 {
0047 m_IntRunProperties[name] = ival;
0048 }
0049
0050 int RunHeaderv1::get_intval(const std::string &name) const
0051 {
0052 std::map<std::string, int>::const_iterator iter = m_IntRunProperties.find(name);
0053 if (iter != m_IntRunProperties.end())
0054 {
0055 return iter->second;
0056 }
0057 return -999999;
0058 }