ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RunHeaderv1.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RunHeaderv1.cc
1 #include "RunHeaderv1.h"
2 
3 #include <cmath> // for NAN
4 #include <utility> // for pair
5 
6 void RunHeaderv1::identify(std::ostream &out) const
7 {
8  out << "identify yourself: I am an RunHeaderv1 Object" << std::endl;
9  out << "Run no: " << RunNumber << std::endl;
10  auto iter = m_IntRunProperties.begin();
11  while (iter != m_IntRunProperties.end())
12  {
13  out << iter->first << ": " << iter->second << std::endl;
14  ++iter;
15  }
16  auto iterf = m_FloatRunProperties.begin();
17  while (iterf != m_FloatRunProperties.end())
18  {
19  out << iterf->first << ": " << iterf->second << std::endl;
20  ++iterf;
21  }
22  return;
23 }
24 
26 {
27  return ((RunNumber) ? 1 : 0); // return 1 if runnumber not zero
28 }
29 
30 void RunHeaderv1::set_floatval(const std::string &name, const float fval)
31 {
32  m_FloatRunProperties[name] = fval;
33 }
34 
35 float RunHeaderv1::get_floatval(const std::string &name) const
36 {
37  std::map<std::string, float>::const_iterator iter = m_FloatRunProperties.find(name);
38  if (iter != m_FloatRunProperties.end())
39  {
40  return iter->second;
41  }
42  return NAN;
43 }
44 
45 void RunHeaderv1::set_intval(const std::string &name, const int ival)
46 {
47  m_IntRunProperties[name] = ival;
48 }
49 
50 int RunHeaderv1::get_intval(const std::string &name) const
51 {
52  std::map<std::string, int>::const_iterator iter = m_IntRunProperties.find(name);
53  if (iter != m_IntRunProperties.end())
54  {
55  return iter->second;
56  }
57  return -999999;
58 }