Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DumpPHG4CylinderCellContainer.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DumpPHG4CylinderCellContainer.cc
2 
3 #include <phool/PHIODataNode.h>
4 
5 #include <g4detectors/PHG4Cell.h> // for PHG4Cell::EdepCon...
8 
9 #include <cmath>
10 #include <map>
11 #include <ostream>
12 #include <string>
13 #include <utility>
14 
16 
18  : DumpObject(NodeName)
19 {
20  return;
21 }
22 
24 {
25  PHG4CylinderCellContainer *phg4cellcontainer = nullptr;
26  MyNode_t *thisNode = static_cast<MyNode_t *>(myNode);
27  if (thisNode)
28  {
29  phg4cellcontainer = thisNode->getData();
30  }
31  if (phg4cellcontainer)
32  {
34  PHG4CylinderCellContainer::ConstRange cell_begin_end = phg4cellcontainer->getCylinderCells();
35  *fout << "size: " << phg4cellcontainer->size() << std::endl;
36  for (hiter = cell_begin_end.first; hiter != cell_begin_end.second; hiter++)
37  {
38  *fout << "id: 0x" << std::hex << hiter->second->get_cell_id() << std::dec << std::endl;
39  *fout << "layer: " << hiter->second->get_layer() << std::endl;
40  *fout << "edep: " << hiter->second->get_edep() << std::endl;
41  int tmp = hiter->second->get_binz();
42  if (tmp != -1)
43  {
44  *fout << "binz: " << tmp << std::endl;
45  }
46  tmp = hiter->second->get_binphi();
47  if (tmp != -1)
48  {
49  *fout << "binphi: " << tmp << std::endl;
50  }
51  tmp = hiter->second->get_bineta();
52  if (tmp != -1)
53  {
54  *fout << "bineta: " << tmp << std::endl;
55  }
56  float dtmp = hiter->second->get_light_yield();
57  if (std::isfinite(dtmp))
58  {
59  *fout << "get_light_yield(): " << dtmp << std::endl;
60  }
61  tmp = hiter->second->get_fiber_ID();
62  if (tmp != -1)
63  {
64  *fout << "get_fiber_ID(): " << hiter->second->get_fiber_ID() << std::endl;
65  }
66  std::string tmpstr = hiter->second->get_sensor_index();
67  if (!tmpstr.empty())
68  {
69  *fout << "get_sensor_index(): " << hiter->second->get_sensor_index() << std::endl;
70  }
71  tmp = hiter->second->get_ladder_phi_index();
72  if (tmp != -9999)
73  {
74  *fout << "get_ladder_phi_index(): " << hiter->second->get_ladder_phi_index() << std::endl;
75  }
76  tmp = hiter->second->get_ladder_z_index();
77  if (tmp != -9999)
78  {
79  *fout << "get_ladder_z_index(): " << hiter->second->get_ladder_z_index() << std::endl;
80  }
81  tmp = hiter->second->get_j_index();
82  if (tmp != -9999)
83  {
84  *fout << "get_j_index(): " << hiter->second->get_j_index() << std::endl;
85  }
86  tmp = hiter->second->get_k_index();
87  if (tmp != -9999)
88  {
89  *fout << "get_k_index(): " << hiter->second->get_k_index() << std::endl;
90  }
91  tmp = hiter->second->get_l_index();
92  if (tmp != -9999)
93  {
94  *fout << "get_l_index(): " << hiter->second->get_l_index() << std::endl;
95  }
96  tmp = hiter->second->get_pixel_index();
97  if (tmp != -9999)
98  {
99  *fout << "get_pixel_index(): " << hiter->second->get_pixel_index() << std::endl;
100  }
101  tmp = hiter->second->get_chip_index();
102  if (tmp != -9999)
103  {
104  *fout << "get_chip_index(): " << hiter->second->get_chip_index() << std::endl;
105  }
106  tmp = hiter->second->get_module_index();
107  if (tmp != -9999)
108  {
109  *fout << "get_module_index(): " << hiter->second->get_module_index() << std::endl;
110  }
111  tmp = hiter->second->get_half_stave_index();
112  if (tmp != -9999)
113  {
114  *fout << "get_half_stave_index(): " << hiter->second->get_half_stave_index() << std::endl;
115  }
116  tmp = hiter->second->get_stave_index();
117  if (tmp != -9999)
118  {
119  *fout << "get_stave_index(): " << hiter->second->get_stave_index() << std::endl;
120  }
121 
122  PHG4CylinderCell::EdepConstRange hitedep_begin_end = hiter->second->get_g4hits();
123  for (PHG4CylinderCell::EdepConstIterator iter = hitedep_begin_end.first; iter != hitedep_begin_end.second; ++iter)
124  {
125  *fout << "hit 0x" << std::hex << iter->first << std::dec << " edep: " << iter->second << std::endl;
126  }
127  PHG4CylinderCell::ShowerEdepConstRange shower_begin_end = hiter->second->get_g4showers();
128  for (PHG4CylinderCell::ShowerEdepConstIterator iter = shower_begin_end.first; iter != shower_begin_end.second; ++iter)
129  {
130  *fout << "shower " << iter->first << " edep: " << iter->second << std::endl;
131  }
132  }
133  }
134  return 0;
135 }