ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4CylinderCellv1.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4CylinderCellv1.cc
1 #include "PHG4CylinderCellv1.h"
2 
3 #include <g4main/PHG4HitDefs.h> // for keytype
4 
5 using namespace std;
6 
8  layer(0xFFFFFFFF),
9  cellid(0xFFFFFFFF),
10  binz(-1),
11  binphi(-1),
12  edeps(), showeredeps(), light_yield(0)
13 {}
14 
15 void
17 {
18  if (edeps.find(g4hitid) == edeps.end())
19  {
20  edeps[g4hitid] = edep;
21  }
22  else
23  {
24  edeps[g4hitid]+= edep;
25  }
26 }
27 
28 void
29 PHG4CylinderCellv1::add_edep(const PHG4HitDefs::keytype g4hitid, const float edep, const float ly)
30 {
31  add_edep(g4hitid, edep);
32  light_yield += ly;
33 }
34 
35 void
36 PHG4CylinderCellv1::add_shower_edep(const int g4showerid, const float edep)
37 {
38  if (showeredeps.find(g4showerid) == showeredeps.end())
39  {
40  showeredeps[g4showerid] = edep;
41  }
42  else
43  {
44  showeredeps[g4showerid]+= edep;
45  }
46 }
47 
49 
50  double esum = 0.0;
51  EdepConstIterator iter;
52  for (iter = edeps.begin(); iter != edeps.end(); ++iter) {
53  esum += iter->second;
54  }
55  return esum;
56 }
57 
58 void
59 PHG4CylinderCellv1::identify(std::ostream& os) const
60 {
61  os << "PHG4CylinderCellv1: #" << cellid << " ";
62  os << "(layer,binz,binphi,e) = (";
63  os << layer << ",";
64  os << binz << ",";
65  os << binphi << ",";
66  os << get_edep();
67  os << ")";
68  os << endl;
69 }