EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RawTowerv2.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RawTowerv2.cc
1 #include "RawTowerv2.h"
2 
3 #include <climits> // for UCHAR_MAX
4 #include <cmath>
5 #include <iostream>
6 #include <string> // for operator<<, string
7 #include <utility> // for pair
8 
9 using namespace std;
10 
12 {
13 }
14 
16  : RawTowerv1(tower)
17 {
18  // This is a generic copy of ALL properties a hit has
19  // do not add explicit copies, they will be added to
20  // the new hits with their default value increasing memory use
21  for (unsigned char ic = 0; ic < UCHAR_MAX; ic++)
22  {
23  PROPERTY prop_id = static_cast<PROPERTY>(ic);
24  if (tower.has_property(prop_id))
25  {
26  set_property(prop_id, tower.get_property(prop_id));
27  }
28  }
29 }
30 
32  : RawTowerv1(id)
33 {
34 }
35 
36 RawTowerv2::RawTowerv2(const unsigned int ieta, const unsigned int iphi)
37  : RawTowerv1(ieta, iphi)
38 {
39 }
40 
42  const unsigned int ieta, const unsigned int iphi)
43  : RawTowerv1(caloid, ieta, iphi)
44 {
45 }
46 
48 {
50  prop_map.clear();
51 }
52 
54 {
55  return RawTowerv1::isValid();
56 }
57 
58 void RawTowerv2::identify(std::ostream& os) const
59 {
60  os << "RawTowerv2: etabin: " << get_bineta() << ", phibin: " << get_binphi()
61  << " energy=" << get_energy() << std::endl;
62 
63  for (prop_map_t::const_iterator i = prop_map.begin(); i != prop_map.end(); ++i)
64  {
65  PROPERTY prop_id = static_cast<PROPERTY>(i->first);
66  const string property_info = get_property_info(prop_id);
67  cout << "\t" << prop_id << ":\t" << property_info << " = \t" << get_property(prop_id) << endl;
68  }
69 }
70 
71 bool RawTowerv2::has_property(const PROPERTY prop_id) const
72 {
73  prop_map_t::const_iterator i = prop_map.find(prop_id);
74  return i != prop_map.end();
75 }
76 
77 double
78 RawTowerv2::get_property(const PROPERTY prop_id) const
79 {
80  prop_map_t::const_iterator i = prop_map.find(prop_id);
81 
82  if (i != prop_map.end()) return i->second;
83 
84  return NAN;
85 }
86 
87 void RawTowerv2::set_property(const PROPERTY prop_id, const double value)
88 {
89  prop_map[prop_id] = value;
90 }