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;
68 std::cout <<
Name() <<
" Could not locate G4HIT node " <<
hitnodename << std::endl;
118 std::cout <<
"Could not locate g4 hit node " <<
hitnodename << std::endl;
124 std::cout <<
"could not locate cell node " <<
cellnodename << std::endl;
135 for (
int icolumn = 0; icolumn < maxcolumn; icolumn++)
137 for (
int irow = 0; irow < maxrow; irow++)
152 for (hiter = hit_begin_end.first; hiter != hit_begin_end.second; ++hiter)
154 if (hiter->second->get_t(0) >
tmax)
continue;
155 if (hiter->second->get_t(1) <
tmin)
continue;
156 if (hiter->second->get_t(1) - hiter->second->get_t(0) >
m_DeltaT)
continue;
158 short icolumn = hiter->second->get_scint_id();
160 if (introw >=
ROWDIM || introw < 0)
162 std::cout << __PRETTY_FUNCTION__ <<
" row " << introw
163 <<
" exceed array size: " <<
ROWDIM
164 <<
" adjust ROWDIM and recompile" << std::endl;
172 std::cout << __PRETTY_FUNCTION__ <<
" column: " << icolumn
174 <<
" adjust COLUMNDIM and recompile" << std::endl;
178 if (!slatarray[irow][icolumn])
183 slatarray[irow][icolumn] =
new PHG4Cellv1(key);
185 slatarray[irow][icolumn]->add_edep(hiter->second->get_edep());
186 slatarray[irow][icolumn]->add_eion(hiter->second->get_eion());
187 slatarray[irow][icolumn]->add_light_yield(hiter->second->get_light_yield());
188 float raw_light = hiter->second->get_raw_light_yield();
189 if (std::isfinite(raw_light))
191 slatarray[irow][icolumn]->add_raw_light_yield(raw_light);
193 slatarray[irow][icolumn]->add_edep(hiter->first, hiter->second->get_edep());
194 slatarray[irow][icolumn]->add_shower_edep(hiter->second->get_shower_id(), hiter->second->get_edep());
197 for (
int irow = 0; irow <
ROWDIM; irow++)
199 for (
int icolumn = 0; icolumn <
COLUMNDIM; icolumn++)
201 if (slatarray[irow][icolumn])
203 slats->
AddCell(slatarray[irow][icolumn]);
204 slatarray[irow][icolumn] =
nullptr;
211 std::cout <<
Name() <<
": found " << nslathits <<
" slats with energy deposition" << std::endl;
225 double sum_energy_g4hit = 0.;
226 double sum_energy_cells = 0.;
229 for (hiter = hit_begin_end.first; hiter != hit_begin_end.second; ++hiter)
231 sum_energy_g4hit += hiter->second->get_edep();
235 for (citer = cell_begin_end.first; citer != cell_begin_end.second; ++citer)
237 sum_energy_cells += citer->second->get_edep();
240 if (fabs(sum_energy_cells - sum_energy_g4hit) / sum_energy_g4hit > 1
e-6)
242 std::cout <<
"hint: timing cuts tmin/tmax will do this to you" << std::endl;
243 std::cout <<
"energy mismatch between cells: " << sum_energy_cells
244 <<
" and hits: " << sum_energy_g4hit
245 <<
" diff sum(cells) - sum(hits): " << sum_energy_cells - sum_energy_g4hit
253 std::cout <<
Name() <<
": total energy for this event: " << sum_energy_g4hit <<
" GeV" << std::endl;