Analysis Software
Documentation for sPHENIX simulation 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()
13  , showeredeps()
14  , light_yield(0)
15 {
16 }
17 
18 void PHG4CylinderCellv1::add_edep(const PHG4HitDefs::keytype g4hitid, const float edep)
19 {
20  if (edeps.find(g4hitid) == edeps.end())
21  {
22  edeps[g4hitid] = edep;
23  }
24  else
25  {
26  edeps[g4hitid] += edep;
27  }
28 }
29 
30 void PHG4CylinderCellv1::add_edep(const PHG4HitDefs::keytype g4hitid, const float edep, const float ly)
31 {
32  add_edep(g4hitid, edep);
33  light_yield += ly;
34 }
35 
36 void 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  {
54  esum += iter->second;
55  }
56  return esum;
57 }
58 
59 void 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 }