ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DumpPHG4CellContainer.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DumpPHG4CellContainer.cc
2 
3 #include <phool/PHIODataNode.h>
4 
5 #include <g4detectors/PHG4Cell.h>
8 
9 #include <limits.h>
10 #include <map>
11 #include <ostream>
12 #include <string>
13 #include <utility>
14 
15 using namespace std;
16 
18 
20  : DumpObject(NodeName)
21 {
22  return;
23 }
24 
26 {
27  PHG4CellContainer *phg4cellcontainer = nullptr;
28  MyNode_t *thisNode = static_cast<MyNode_t *>(myNode);
29  if (thisNode)
30  {
31  phg4cellcontainer = thisNode->getData();
32  }
33  if (phg4cellcontainer)
34  {
36  PHG4CellContainer::ConstRange cell_begin_end = phg4cellcontainer->getCells();
37  *fout << "size: " << phg4cellcontainer->size() << endl;
38  for (celler = cell_begin_end.first; celler != cell_begin_end.second; celler++)
39  {
40  *fout << "id: 0x" << hex << celler->second->get_cellid() << dec << endl;
41  if (celler->second->has_binning(PHG4CellDefs::scintillatorslatbinning))
42  {
43  *fout << "get_column: " << PHG4CellDefs::ScintillatorSlatBinning::get_column(celler->second->get_cellid()) << endl;
44  *fout << "get_row: " << PHG4CellDefs::ScintillatorSlatBinning::get_row(celler->second->get_cellid()) << endl;
45  }
46  else if (celler->second->has_binning(PHG4CellDefs::sizebinning))
47  {
48  *fout << "get_phibin: " << PHG4CellDefs::SizeBinning::get_phibin(celler->second->get_cellid()) << endl;
49  *fout << "get_zbin: " << PHG4CellDefs::SizeBinning::get_zbin(celler->second->get_cellid()) << endl;
50  }
51  else if (celler->second->has_binning(PHG4CellDefs::etaphibinning))
52  {
53  *fout << "get_etabin: " << PHG4CellDefs::EtaPhiBinning::get_etabin(celler->second->get_cellid()) << endl;
54  *fout << "get_phibin: " << PHG4CellDefs::EtaPhiBinning::get_phibin(celler->second->get_cellid()) << endl;
55  }
56  else if (celler->second->has_binning(PHG4CellDefs::spacalbinning))
57  {
58  *fout << "get_etabin: " << PHG4CellDefs::SpacalBinning::get_etabin(celler->second->get_cellid()) << endl;
59  *fout << "get_phibin: " << PHG4CellDefs::SpacalBinning::get_phibin(celler->second->get_cellid()) << endl;
60  *fout << "get_fiberid: " << PHG4CellDefs::SpacalBinning::get_fiberid(celler->second->get_cellid()) << endl;
61  }
62  else if (celler->second->has_binning(PHG4CellDefs::etaxsizebinning))
63  {
64  *fout << "get_etabin: " << PHG4CellDefs::EtaXsizeBinning::get_etabin(celler->second->get_cellid()) << endl;
65  *fout << "get_xsizebin: " << PHG4CellDefs::EtaXsizeBinning::get_xsizebin(celler->second->get_cellid()) << endl;
66  }
67  else if (celler->second->has_binning(PHG4CellDefs::mvtxbinning))
68  {
69  *fout << "get_index: " << PHG4CellDefs::MVTXBinning::get_index(celler->second->get_cellid()) << endl;
70  }
71  else if (celler->second->has_binning(PHG4CellDefs::tpcbinning))
72  {
73  *fout << "get_radbin: " << PHG4CellDefs::TPCBinning::get_radbin(celler->second->get_cellid()) << endl;
74  *fout << "get_phibin: " << PHG4CellDefs::TPCBinning::get_phibin(celler->second->get_cellid()) << endl;
75  }
76  else
77  {
78  *fout << "binning "
79  << PHG4CellDefs::get_binning(celler->second->get_cellid())
80  << " for detid: "
81  << PHG4CellDefs::get_detid(celler->second->get_cellid())
82  << " not implemented in DumpPHG4CellContainer" << endl;
83  }
84 
85  for (unsigned char ic = 0; ic < UCHAR_MAX; ic++)
86  {
87  PHG4Cell::PROPERTY prop_id = static_cast<PHG4Cell::PROPERTY>(ic);
88  if (celler->second->has_property(prop_id))
89  {
90  *fout << "prop id: " << static_cast<unsigned int>(ic);
91  pair<const string, PHG4Cell::PROPERTY_TYPE> property_info = PHG4Cell::get_property_info(prop_id);
92  *fout << ", name " << property_info.first << " value ";
93  switch (property_info.second)
94  {
95  case PHG4Cell::type_int:
96  *fout << celler->second->get_property_int(prop_id);
97  break;
99  *fout << celler->second->get_property_uint(prop_id);
100  break;
102  *fout << celler->second->get_property_float(prop_id);
103  break;
104  default:
105  *fout << " unknown type ";
106  }
107  *fout << endl;
108  }
109  }
110  PHG4Cell::EdepConstRange hitedep_begin_end = celler->second->get_g4hits();
111  for (PHG4Cell::EdepConstIterator iter = hitedep_begin_end.first; iter != hitedep_begin_end.second; ++iter)
112  {
113  *fout << "hit 0x" << hex << iter->first << dec << " edep: " << iter->second << endl;
114  }
115  PHG4Cell::ShowerEdepConstRange shower_begin_end = celler->second->get_g4showers();
116  for (PHG4Cell::ShowerEdepConstIterator iter = shower_begin_end.first; iter != shower_begin_end.second; ++iter)
117  {
118  *fout << "shower " << iter->first << " edep: " << iter->second << endl;
119  }
120  }
121  }
122  return 0;
123 }