8 #include <phparameter/PHParameterInterface.h>
39 static std::array<std::array<PHG4Cell *, COLUMNDIM>,
ROWDIM>
slatarray = {{{
nullptr}}};
56 std::cout <<
PHWHERE <<
"DST Node missing, doing nothing." << std::endl;
62 std::string paramnodename =
"G4CELLPARAM_" +
detector;
63 std::string geonodename =
"G4CELLGEO_" +
detector;
68 std::cout <<
Name() <<
" Could not locate G4HIT node " <<
hitnodename << std::endl;
117 std::cout <<
"Could not locate g4 hit node " <<
hitnodename << std::endl;
123 std::cout <<
"could not locate cell node " <<
cellnodename << std::endl;
134 for (
int icolumn = 0 ; icolumn < maxcolumn; icolumn++)
136 for (
int irow = 0; irow < maxrow; irow++)
150 for (hiter = hit_begin_end.first; hiter != hit_begin_end.second; ++hiter)
152 if (hiter->second->get_t(0) >
tmax)
continue;
153 if (hiter->second->get_t(1) <
tmin)
continue;
154 short icolumn = hiter->second->get_scint_id();
156 if (introw >=
ROWDIM || introw < 0)
158 std::cout << __PRETTY_FUNCTION__ <<
" row " << introw
159 <<
" exceed array size: " <<
ROWDIM
160 <<
" adjust ROWDIM and recompile" << std::endl;
168 std::cout << __PRETTY_FUNCTION__ <<
" column: " << icolumn
170 <<
" adjust COLUMNDIM and recompile" << std::endl;
174 if (!slatarray[irow][icolumn])
179 slatarray[irow][icolumn] =
new PHG4Cellv1(key);
181 slatarray[irow][icolumn]->add_edep(hiter->second->get_edep());
182 slatarray[irow][icolumn]->add_eion(hiter->second->get_eion());
183 slatarray[irow][icolumn]->add_light_yield(hiter->second->get_light_yield());
184 slatarray[irow][icolumn]->add_edep(hiter->first, hiter->second->get_edep());
185 slatarray[irow][icolumn]->add_shower_edep(hiter->second->get_shower_id(), hiter->second->get_edep());
188 for (
int irow = 0; irow <
ROWDIM; irow++)
190 for (
int icolumn = 0; icolumn <
COLUMNDIM; icolumn++)
192 if (slatarray[irow][icolumn])
194 slats->
AddCell(slatarray[irow][icolumn]);
195 slatarray[irow][icolumn] =
nullptr;
202 std::cout <<
Name() <<
": found " << nslathits <<
" slats with energy deposition" << std::endl;
221 double sum_energy_g4hit = 0.;
222 double sum_energy_cells = 0.;
225 for (hiter = hit_begin_end.first; hiter != hit_begin_end.second; ++hiter)
227 sum_energy_g4hit += hiter->second->get_edep();
231 for (citer = cell_begin_end.first; citer != cell_begin_end.second; ++citer)
233 sum_energy_cells += citer->second->get_edep();
236 if (fabs(sum_energy_cells - sum_energy_g4hit) / sum_energy_g4hit > 1
e-6)
238 std::cout <<
"hint: timing cuts tmin/tmax will do this to you" << std::endl;
239 std::cout <<
"energy mismatch between cells: " << sum_energy_cells
240 <<
" and hits: " << sum_energy_g4hit
241 <<
" diff sum(cells) - sum(hits): " << sum_energy_cells - sum_energy_g4hit
249 std::cout <<
Name() <<
": total energy for this event: " << sum_energy_g4hit <<
" GeV" << std::endl;