Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:17:45

0001 #include "PHG4CylinderCellv1.h"
0002 
0003 #include <g4main/PHG4HitDefs.h>  // for keytype
0004 
0005 using namespace std;
0006 
0007 PHG4CylinderCellv1::PHG4CylinderCellv1()
0008   : layer(0xFFFFFFFF)
0009   , cellid(0xFFFFFFFF)
0010   , binz(-1)
0011   , binphi(-1)
0012   , edeps()
0013   , showeredeps()
0014   , light_yield(0)
0015 {
0016 }
0017 
0018 void PHG4CylinderCellv1::add_edep(const PHG4HitDefs::keytype g4hitid, const float edep)
0019 {
0020   if (edeps.find(g4hitid) == edeps.end())
0021   {
0022     edeps[g4hitid] = edep;
0023   }
0024   else
0025   {
0026     edeps[g4hitid] += edep;
0027   }
0028 }
0029 
0030 void PHG4CylinderCellv1::add_edep(const PHG4HitDefs::keytype g4hitid, const float edep, const float ly)
0031 {
0032   add_edep(g4hitid, edep);
0033   light_yield += ly;
0034 }
0035 
0036 void PHG4CylinderCellv1::add_shower_edep(const int g4showerid, const float edep)
0037 {
0038   if (showeredeps.find(g4showerid) == showeredeps.end())
0039   {
0040     showeredeps[g4showerid] = edep;
0041   }
0042   else
0043   {
0044     showeredeps[g4showerid] += edep;
0045   }
0046 }
0047 
0048 double PHG4CylinderCellv1::get_edep() const
0049 {
0050   double esum = 0.0;
0051   EdepConstIterator iter;
0052   for (iter = edeps.begin(); iter != edeps.end(); ++iter)
0053   {
0054     esum += iter->second;
0055   }
0056   return esum;
0057 }
0058 
0059 void PHG4CylinderCellv1::identify(std::ostream& os) const
0060 {
0061   os << "PHG4CylinderCellv1: #" << cellid << " ";
0062   os << "(layer,binz,binphi,e) = (";
0063   os << layer << ",";
0064   os << binz << ",";
0065   os << binphi << ",";
0066   os << get_edep();
0067   os << ")";
0068   os << endl;
0069 }