Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RawTowerv1.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RawTowerv1.cc
1 #include "RawTowerv1.h"
2 
3 #include <cmath>
4 #include <iostream>
5 
6 using namespace std;
7 
9 {
10  towerid = (tower.get_id());
11  energy = (tower.get_energy());
12  time = (tower.get_time());
13 
14  CellConstRange cell_range = tower.get_g4cells();
15 
16  for (CellConstIterator cell_iter = cell_range.first;
17  cell_iter != cell_range.second; ++cell_iter)
18  {
19  add_ecell(cell_iter->first, cell_iter->second);
20  }
21 
22  ShowerConstRange shower_range = tower.get_g4showers();
23 
24  for (ShowerConstIterator shower_iter = shower_range.first;
25  shower_iter != shower_range.second; ++shower_iter)
26  {
27  add_eshower(shower_iter->first, shower_iter->second);
28  }
29 }
30 
32  : towerid(id)
33 {
34 }
35 
36 RawTowerv1::RawTowerv1(const unsigned int ieta, const unsigned int iphi)
37 {
39 }
40 
42  const unsigned int ieta, const unsigned int iphi)
43 {
44  towerid = RawTowerDefs::encode_towerid(caloid, ieta, iphi);
45 }
46 
48 {
49  energy = 0;
50  time = NAN;
51  ecells.clear();
52  eshowers.clear();
53 }
54 
56 {
57  return get_energy() != 0;
58 }
59 
60 void RawTowerv1::identify(std::ostream& os) const
61 {
63  switch (caloid)
64  {
66  os << "RawTowerv1: etabin: " << get_bineta() << ", phibin: " << get_binphi() << ", l-bin: " << get_binl()
67  << " energy=" << get_energy() << std::endl;
68  return;
69  default:
70  os << "RawTowerv1: etabin: " << get_bineta() << ", phibin: " << get_binphi()
71  << " energy=" << get_energy() << std::endl;
72  return;
73  }
74 }
75 
76 void RawTowerv1::add_ecell(const CellKeyType g4cellid,
77  const float ecell)
78 {
79  if (ecells.find(g4cellid) == ecells.end())
80  {
81  ecells[g4cellid] = ecell;
82  }
83  else
84  {
85  ecells[g4cellid] += ecell;
86  }
87 }
88 
89 void RawTowerv1::add_eshower(const int g4showerid, const float eshower)
90 {
91  if (eshowers.find(g4showerid) == eshowers.end())
92  {
93  eshowers[g4showerid] = eshower;
94  }
95  else
96  {
97  eshowers[g4showerid] += eshower;
98  }
99 }
100 
102 {
104  switch (caloid)
105  {
108  default:
110  }
111  return -1;
112 }
113 
115 {
117  switch (caloid)
118  {
121  default:
123  }
124  return -1;
125 }