10 #include <phparameter/PHParameterInterface.h>
40 static array<array<PHG4ScintillatorSlat *, COLUMNDIM>,
ROWDIM>
slatarray = {{{
nullptr}}};
45 , m_CheckEnergyConservationFlag(0)
61 std::cout <<
PHWHERE <<
"DST Node missing, doing nothing." << std::endl;
68 string paramnodename =
"G4CELLPARAM_" +
m_Detector;
69 string geonodename =
"G4CELLGEO_" +
m_Detector;
75 cout <<
"Could not locate g4 hit node " <<
m_HitNodeName << endl;
77 se->
Print(
"NODETREE");
125 cout <<
"Could not locate g4 hit node " <<
m_HitNodeName << endl;
136 pair<PHG4HitContainer::LayerIter, PHG4HitContainer::LayerIter> layer_begin_end = g4hit->
getLayers();
137 for (layer = layer_begin_end.first; layer != layer_begin_end.second; ++layer)
141 for (hiter = hit_begin_end.first; hiter != hit_begin_end.second; ++hiter)
143 if (hiter->second->get_t(0) >
m_Tmax)
continue;
144 if (hiter->second->get_t(1) <
m_Tmin)
continue;
145 short icolumn = hiter->second->get_scint_id();
146 short irow = hiter->second->get_row();
147 if (irow >=
ROWDIM || irow < 0)
149 cout <<
"row " << irow
150 <<
" exceed array size: " <<
ROWDIM
151 <<
" adjust ROWDIM and recompile" << endl;
157 cout <<
"column: " << icolumn
159 <<
" adjust COLUMNDIM and recompile" << endl;
167 slatarray[irow][icolumn]->add_edep(hiter->second->get_edep(),
168 hiter->second->get_eion(),
169 hiter->second->get_light_yield());
170 slatarray[irow][icolumn]->add_hit_key(hiter->first);
176 for (
int irow = 0; irow <
ROWDIM; irow++)
178 for (
int icolumn = 0; icolumn <
COLUMNDIM; icolumn++)
191 cout <<
Name() <<
": found " << nslathits <<
" slats with energy deposition" << endl;
206 double sum_energy_g4hit = 0.;
207 double sum_energy_cells = 0.;
210 for (hiter = hit_begin_end.first; hiter != hit_begin_end.second; ++hiter)
212 sum_energy_g4hit += hiter->second->get_edep();
216 for (citer = cell_begin_end.first; citer != cell_begin_end.second; ++citer)
218 sum_energy_cells += citer->second->get_edep();
221 if (fabs(sum_energy_cells - sum_energy_g4hit) / sum_energy_g4hit > 1
e-6)
223 cout <<
"energy mismatch between cells: " << sum_energy_cells
224 <<
" and hits: " << sum_energy_g4hit
225 <<
" diff sum(cells) - sum(hits): " << sum_energy_cells - sum_energy_g4hit
233 cout <<
Name() <<
": total energy for this event: " << sum_energy_g4hit <<
" GeV" << endl;