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