ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EicEventHeader.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EicEventHeader.cc
1 #include "EicEventHeader.h"
2 
3 #include <TSystem.h>
4 
5 #include <cassert>
6 #include <cstdlib>
7 
8 using namespace std;
9 
11 {
12  const EicEventHeader *evthead = dynamic_cast<const EicEventHeader *>(phobj);
13  assert(evthead);
14  // This is a generic copy of ALL properties an eic event header has
15  // do not add explicit copies, they will be added to
16  // the new eic event header with their default value increasing memory use
17  for (unsigned char ic = 0; ic < UCHAR_MAX; ic++)
18  {
19  PROPERTY prop_id = static_cast<EicEventHeader::PROPERTY>(ic);
20  if (evthead->has_property(prop_id))
21  {
22  set_property_nocheck(prop_id, evthead->get_property_nocheck(prop_id));
23  }
24  }
25 }
26 
28 {
29  return;
30 }
31 
33 {
34  cout << "Reset not implemented by daughter class" << endl;
35  return;
36 }
37 
38 std::pair<const std::string, EicEventHeader::PROPERTY_TYPE>
40 {
41  switch (prop_id)
42  {
43  case prop_eventgen:
44  return make_pair("Event Generator", EicEventHeader::type_int);
45  case prop_milou_weight:
46  return make_pair("Milou weight", EicEventHeader::type_float);
47  case prop_milou_truex:
48  return make_pair("Milou True X", EicEventHeader::type_float);
49  case prop_milou_trueq2:
50  return make_pair("Milou True Q2", EicEventHeader::type_float);
51  case prop_demp_weight:
52  return make_pair("DEMP weight", EicEventHeader::type_float);
53 
54  default:
55  cout << "EicEventHeader::get_property_info - Fatal Error - unknown index " << prop_id << endl;
56  gSystem->Exit(1);
57  exit(1);
58  }
59 }
60 
61 bool EicEventHeader::check_property(const PROPERTY prop_id, const PROPERTY_TYPE prop_type)
62 {
63  pair<const string, PROPERTY_TYPE> property_info = get_property_info(prop_id);
64  if (property_info.second != prop_type)
65  {
66  return false;
67  }
68  return true;
69 }
70 
71 string
73 {
74  switch (prop_type)
75  {
76  case type_int:
77  return "int";
78  case type_uint:
79  return "unsigned int";
80  case type_float:
81  return "float";
82  default:
83  return "unkown";
84  }
85 }
86 
87 void EicEventHeader::identify(ostream &os) const
88 {
89  os << "Class " << this->ClassName() << endl;
90  os << "Event Generator: ";
91  switch (get_eventgenerator_type())
92  {
93  case EvtGen::Milou:
94  os << "Milou";
95  break;
96  case EvtGen::DEMP:
97  os << "DEMP";
98  break;
99  default:
100  os << "Unknown";
101  break;
102  }
103  os << endl;
104 }