ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4Cell.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4Cell.cc
1 #include "PHG4Cell.h"
2 
3 #include <g4main/PHG4HitDefs.h> // for keytype
4 
5 #include <phool/PHObject.h> // for PHObject
6 
7 #include <cassert>
8 #include <cstdlib>
9 
10 using namespace std;
11 
12 void
14 {
15  const PHG4Cell *g4cell = dynamic_cast<const PHG4Cell *> (phobj);
16  assert(g4cell);
17  set_cellid(g4cell->get_cellid());
18  for (unsigned char ic = 0; ic < UCHAR_MAX; ic++)
19  {
20  PROPERTY prop_id = static_cast<PHG4Cell::PROPERTY> (ic);
21  if (g4cell->has_property(prop_id))
22  {
23  set_property_nocheck(prop_id,g4cell->get_property_nocheck(prop_id));
24  }
25  }
26 }
27 
28 
29 void
30 PHG4Cell::identify(ostream& os) const
31 {
32  os << "Class " << this->ClassName() << endl;
33  return;
34 }
35 
36 ostream& operator<<(ostream& stream, const PHG4Cell * /*cell*/){
37  stream << "PHG4Cell" << endl;
38  return stream;
39 }
40 
42 {
43  static map <PHG4HitDefs::keytype, float> dummy;
44  return make_pair(dummy.begin(), dummy.end());
45 }
46 
48 {
49  static map <int, float> dummy;
50  return make_pair(dummy.begin(), dummy.end());
51 }
52 
53 void
55 {
56  cout << "Reset not implemented by daughter class" << endl;
57  return;
58 }
59 
60 std::pair<const std::string,PHG4Cell::PROPERTY_TYPE>
62 {
63  switch (prop_id)
64  {
65  case prop_stave_index:
66  return make_pair("stave index",PHG4Cell::type_int);
67  case prop_half_stave_index:
68  return make_pair("half stave index",PHG4Cell::type_int);
69  case prop_module_index:
70  return make_pair("module index",PHG4Cell::type_int);
71  case prop_chip_index:
72  return make_pair("chip index",PHG4Cell::type_int);
73  case prop_pixel_index:
74  return make_pair("pixel index",PHG4Cell::type_int);
75  case prop_phibin:
76  return make_pair("phibin",PHG4Cell::type_int);
77  case prop_zbin:
78  return make_pair("zbin",PHG4Cell::type_int);
79  case prop_ladder_z_index:
80  return make_pair("ladder z index",PHG4Cell::type_int);
81  case prop_ladder_phi_index:
82  return make_pair("ladder phi index",PHG4Cell::type_int);
83  case prop_edep:
84  return make_pair("energy deposition",PHG4Cell::type_float);
85  case prop_eion:
86  return make_pair("ionizing energy loss",PHG4Cell::type_float);
87  case prop_light_yield:
88  return make_pair("light yield",PHG4Cell::type_float);
89  default:
90  cout << "PHG4Cell::get_property_info - Fatal Error - unknown index " << prop_id << endl;
91  exit(1);
92  }
93 }
94 
95 
96 bool
97 PHG4Cell::check_property(const PROPERTY prop_id, const PROPERTY_TYPE prop_type)
98 {
99  pair<const string,PROPERTY_TYPE> property_info = get_property_info(prop_id);
100  if (property_info.second != prop_type)
101  {
102  return false;
103  }
104  return true;
105 }
106 
107 string
109 {
110  switch(prop_type)
111  {
112  case type_int:
113  return "int";
114  case type_uint:
115  return "unsigned int";
116  case type_float:
117  return "float";
118  default:
119  return "unkown";
120  }
121 }