108 if (!p_design.
is3D()) {
109 return StatusCode::SUCCESS;
113 if (Module.
isPLR()) {
114 return StatusCode::SUCCESS;
117 return StatusCode::SUCCESS;
121 return StatusCode::SUCCESS;
124 return StatusCode::SUCCESS;
127 return StatusCode::SUCCESS;
132 if (initialConditions.size() != 8) {
133 ATH_MSG_ERROR(
"Starting coordinates were not filled correctly in EnergyDepositionSvc.");
134 return StatusCode::FAILURE;
137 double eta_0 = initialConditions[0];
138 double phi_0 = initialConditions[1];
139 double depth_0 = initialConditions[2];
140 double dEta = initialConditions[3];
141 double dPhi = initialConditions[4];
142 double dDepth = initialConditions[5];
143 double ncharges = initialConditions[6];
144 double iTotalLength = initialConditions[7];
154 const double x_bin_size = 0.001;
155 const double y_bin_size = 0.001;
159 double pixel_size_x = Module.
width() / p_design.
rows();
161 double module_size_x = Module.
width();
162 double module_size_y = Module.
length();
165 const double pHitTime =
hitTime(phit);
167 const int layerIndex = Module.
isBarrel() ? 0 : 1;
193 std::vector<double> DtElectron (ncharges, 0.);
194 std::vector<double> DtHole (ncharges, 0.);
195 std::vector<double> rdifElectron (ncharges, 0.);
196 std::vector<double> rdifHole (ncharges, 0.);
198 for (
const auto & iHitRecord : trfHitRecord) {
199 double eta_i = eta_0;
200 double phi_i = phi_0;
201 double depth_i = depth_0;
204 eta_i += 1.0 * iHitRecord.first / iTotalLength *
dEta;
205 phi_i += 1.0 * iHitRecord.first / iTotalLength *
dPhi;
206 depth_i += 1.0 * iHitRecord.first / iTotalLength * dDepth;
209 const double energy_per_step = 1.0 * iHitRecord.second / 1.E+6 / ncharges;
210 ATH_MSG_DEBUG(
"es_current: " << energy_per_step <<
" split between " << ncharges <<
" charges");
212 double dist_electrode = 0.5 * sensorThickness - Module.
design().
readoutSide() * depth_i;
213 if (dist_electrode < 0) dist_electrode = 0;
215 CLHEP::Hep3Vector chargepos;
216 chargepos.setX(phi_i);
217 chargepos.setY(eta_i);
218 chargepos.setZ(dist_electrode);
223 "ismoduleframe " <<
coord <<
" -- startPosition (x,y,z) = " << chargepos.x() <<
", " << chargepos.y() <<
", " <<
227 double x_new = chargepos.x() + 0.5*module_size_x;
228 double y_new = chargepos.y() + 0.5*module_size_y;
231 int nPixX =
int(x_new / pixel_size_x);
232 int nPixY =
int(y_new / pixel_size_y);
233 ATH_MSG_DEBUG(
" -- nPixX = " << nPixX <<
" nPixY = " << nPixY);
236 double x_pix = x_new - pixel_size_x * (nPixX);
237 double y_pix = y_new - pixel_size_y * (nPixY);
239 double x_pix_center = x_pix - pixel_size_x / 2;
240 double y_pix_center = y_pix - pixel_size_y / 2;
241 ATH_MSG_DEBUG(
" -- current hit position w.r.t. pixel corner = " << x_pix <<
" " << y_pix);
242 ATH_MSG_DEBUG(
" -- current hit position w.r.t. pixel center = " << x_pix_center <<
" " << y_pix_center);
249 ATH_MSG_DEBUG(
"Skipping since efield = 0 for x_pix = " << x_pix <<
" y_pix = " << y_pix);
253 const double mobilityElectron =
getMobility(efield,
false);
254 const double mobilityHole =
getMobility(efield,
true);
255 auto driftTimeElectron =
getDriftTime(
false, ncharges, rndmEngine, trappingTimeElectrons, trappingTimeHoles);
256 auto driftTimeHole =
getDriftTime(
true, ncharges, rndmEngine, trappingTimeElectrons, trappingTimeHoles);
258 double chunk_size = energy_per_step * eleholePairEnergy;
260 if (chunk_size < 1) chunk_size = 1;
261 const double kappa = 1. / std::sqrt(chunk_size);
269 const auto prefactor_e = mobilityElectron*0.024*
m_temperature / 273.;
270 const auto prefactor_h = mobilityHole*0.024*
m_temperature / 273.;
272 for(
size_t i = 0;
i < ncharges; ++
i) {
273 DtElectron[
i] = prefactor_e *
std::min(driftTimeElectron[
i], timeToElectrodeElectron);
274 DtHole[
i] = prefactor_h *
std::min(driftTimeHole[
i], timeToElectrodeHole);
275 rdifElectron[
i] = 1
e-3*std::sqrt(DtElectron[
i]);
276 rdifHole[
i] = 1
e-3*std::sqrt(DtHole[
i]);
289 const std::size_t ramo_init_bin_y_pi = ramoPotentialMap.
getBinY(1000*(x_pix + pixel_size_x * 2));
290 const std::size_t ramo_init_bin_y_zi = ramoPotentialMap.
getBinY(1000*(x_pix + pixel_size_x * 3));
291 const std::size_t ramo_init_bin_y_mi = ramoPotentialMap.
getBinY(1000*(x_pix + pixel_size_x * 4));
294 const std::size_t ramo_init_bin_x_pj = ramoPotentialMap.
getBinX(1000*(y_pix - 0.5*pixel_size_y));
295 const std::size_t ramo_init_bin_x_zj = ramoPotentialMap.
getBinX(1000*(y_pix + 0.5*pixel_size_y));
296 const std::size_t ramo_init_bin_x_mj = ramoPotentialMap.
getBinX(1000*(y_pix + 1.5*pixel_size_y));
299 float ramoInit_pipj = ramoPotentialMap.
getContent(ramo_init_bin_x_pj, ramo_init_bin_y_pi);
300 float ramoInit_pizj = ramoPotentialMap.
getContent(ramo_init_bin_x_zj, ramo_init_bin_y_pi);
301 float ramoInit_pimj = ramoPotentialMap.
getContent(ramo_init_bin_x_mj, ramo_init_bin_y_pi);
302 float ramoInit_zipj = ramoPotentialMap.
getContent(ramo_init_bin_x_pj, ramo_init_bin_y_zi);
303 float ramoInit_zizj = ramoPotentialMap.
getContent(ramo_init_bin_x_zj, ramo_init_bin_y_zi);
304 float ramoInit_zimj = ramoPotentialMap.
getContent(ramo_init_bin_x_mj, ramo_init_bin_y_zi);
305 float ramoInit_mipj = ramoPotentialMap.
getContent(ramo_init_bin_x_pj, ramo_init_bin_y_mi);
306 float ramoInit_mizj = ramoPotentialMap.
getContent(ramo_init_bin_x_zj, ramo_init_bin_y_mi);
307 float ramoInit_mimj = ramoPotentialMap.
getContent(ramo_init_bin_x_mj, ramo_init_bin_y_mi);
309 const auto hit_time =
hitTime(phit);
312 for (
int j = 0; j < ncharges; j++) {
314 int extraNPixXElectron = nPixX;
315 int extraNPixYElectron = nPixY;
316 int extraNPixXHole = nPixX;
317 int extraNPixYHole = nPixY;
320 std::array<double, 4> randomNumbers{};
321 CLHEP::RandGaussZiggurat::shootArray(rndmEngine, 4, randomNumbers.data());
323 double xposDiffElectron = x_pix + rdifElectron[j] * randomNumbers[0];
324 double yposDiffElectron = y_pix + rdifElectron[j] * randomNumbers[1];
325 double xposDiffHole = x_pix + rdifHole[j] * randomNumbers[2];
326 double yposDiffHole = y_pix + rdifHole[j] * randomNumbers[3];
329 while (xposDiffElectron > pixel_size_x) {
330 extraNPixXElectron++;
331 xposDiffElectron -= pixel_size_x;
333 while (xposDiffElectron < 0) {
334 extraNPixXElectron--;
335 xposDiffElectron += pixel_size_x;
337 while (yposDiffElectron > pixel_size_y) {
338 extraNPixYElectron++;
339 yposDiffElectron -= pixel_size_y;
341 while (yposDiffElectron < 0) {
342 extraNPixYElectron--;
343 yposDiffElectron += pixel_size_y;
347 while (xposDiffHole > pixel_size_x) {
349 xposDiffHole -= pixel_size_x;
351 while (xposDiffHole < 0) {
353 xposDiffHole += pixel_size_x;
355 while (yposDiffHole > pixel_size_y) {
357 yposDiffHole -= pixel_size_y;
359 while (yposDiffHole < 0) {
361 yposDiffHole += pixel_size_y;
363 auto xposFinalElectron = yPositionMap_e.
getContent(
364 yPositionMap_e.
getBinX(1
e3*yposDiffElectron),
365 yPositionMap_e.
getBinY(1
e3*xposDiffElectron),
366 yPositionMap_e.
getBinZ(
std::min(driftTimeElectron[j],timeToElectrodeElectron))
368 auto yposFinalElectron = xPositionMap_e.
getContent(
369 xPositionMap_e.
getBinX(1
e3*yposDiffElectron),
370 xPositionMap_e.
getBinY(1
e3*xposDiffElectron),
371 xPositionMap_e.
getBinZ(
std::min(driftTimeElectron[j],timeToElectrodeElectron))
374 auto xposFinalHole = yPositionMap_h.
getContent(
375 yPositionMap_h.
getBinX(1
e3*yposDiffHole),
376 yPositionMap_h.
getBinY(1
e3*xposDiffHole),
379 auto yposFinalHole = xPositionMap_h.
getContent(
380 xPositionMap_h.
getBinX(1
e3*yposDiffHole),
381 xPositionMap_h.
getBinY(1
e3*xposDiffHole),
387 const std::size_t ramo_final_bin_y_pi_electrons = ramoPotentialMap.
getBinY(1000*(xposFinalElectron + pixel_size_x * 2));
388 const std::size_t ramo_final_bin_y_pi_holes = ramoPotentialMap.
getBinY(1000*(xposFinalHole + pixel_size_x * 2));
389 const std::size_t ramo_final_bin_y_zi_electrons = ramoPotentialMap.
getBinY(1000*(xposFinalElectron + pixel_size_x * 3));
390 const std::size_t ramo_final_bin_y_zi_holes = ramoPotentialMap.
getBinY(1000*(xposFinalHole + pixel_size_x * 3));
391 const std::size_t ramo_final_bin_y_mi_electrons = ramoPotentialMap.
getBinY(1000*(xposFinalElectron + pixel_size_x * 4));
392 const std::size_t ramo_final_bin_y_mi_holes = ramoPotentialMap.
getBinY(1000*(xposFinalHole + pixel_size_x * 4));
394 const std::size_t ramo_final_bin_x_pj_electrons = ramoPotentialMap.
getBinX(1000*(yposFinalElectron - 0.5*pixel_size_y));
395 const std::size_t ramo_final_bin_x_pj_holes = ramoPotentialMap.
getBinX(1000*(yposFinalHole - 0.5*pixel_size_y));
396 const std::size_t ramo_final_bin_x_zj_electrons = ramoPotentialMap.
getBinX(1000*(yposFinalElectron + 0.5*pixel_size_y));
397 const std::size_t ramo_final_bin_x_zj_holes = ramoPotentialMap.
getBinX(1000*(yposFinalHole + 0.5*pixel_size_y));
398 const std::size_t ramo_final_bin_x_mj_electrons = ramoPotentialMap.
getBinX(1000*(yposFinalElectron + 1.5*pixel_size_y));
399 const std::size_t ramo_final_bin_x_mj_holes = ramoPotentialMap.
getBinX(1000*(yposFinalHole + 1.5*pixel_size_y));
401 float ramoFinal_pipj_electrons = ramoPotentialMap.
getContent(ramo_final_bin_x_pj_electrons, ramo_final_bin_y_pi_electrons);
402 float ramoFinal_pizj_electrons = ramoPotentialMap.
getContent(ramo_final_bin_x_zj_electrons, ramo_final_bin_y_pi_electrons);
403 float ramoFinal_pimj_electrons = ramoPotentialMap.
getContent(ramo_final_bin_x_mj_electrons, ramo_final_bin_y_pi_electrons);
404 float ramoFinal_zipj_electrons = ramoPotentialMap.
getContent(ramo_final_bin_x_pj_electrons, ramo_final_bin_y_zi_electrons);
405 float ramoFinal_zizj_electrons = ramoPotentialMap.
getContent(ramo_final_bin_x_zj_electrons, ramo_final_bin_y_zi_electrons);
406 float ramoFinal_zimj_electrons = ramoPotentialMap.
getContent(ramo_final_bin_x_mj_electrons, ramo_final_bin_y_zi_electrons);
407 float ramoFinal_mipj_electrons = ramoPotentialMap.
getContent(ramo_final_bin_x_pj_electrons, ramo_final_bin_y_mi_electrons);
408 float ramoFinal_mizj_electrons = ramoPotentialMap.
getContent(ramo_final_bin_x_zj_electrons, ramo_final_bin_y_mi_electrons);
409 float ramoFinal_mimj_electrons = ramoPotentialMap.
getContent(ramo_final_bin_x_mj_electrons, ramo_final_bin_y_mi_electrons);
411 float ramoFinal_pipj_holes = ramoPotentialMap.
getContent(ramo_final_bin_x_pj_holes, ramo_final_bin_y_pi_holes);
412 float ramoFinal_pizj_holes = ramoPotentialMap.
getContent(ramo_final_bin_x_zj_holes, ramo_final_bin_y_pi_holes);
413 float ramoFinal_pimj_holes = ramoPotentialMap.
getContent(ramo_final_bin_x_mj_holes, ramo_final_bin_y_pi_holes);
414 float ramoFinal_zipj_holes = ramoPotentialMap.
getContent(ramo_final_bin_x_pj_holes, ramo_final_bin_y_zi_holes);
415 float ramoFinal_zizj_holes = ramoPotentialMap.
getContent(ramo_final_bin_x_zj_holes, ramo_final_bin_y_zi_holes);
416 float ramoFinal_zimj_holes = ramoPotentialMap.
getContent(ramo_final_bin_x_mj_holes, ramo_final_bin_y_zi_holes);
417 float ramoFinal_mipj_holes = ramoPotentialMap.
getContent(ramo_final_bin_x_pj_holes, ramo_final_bin_y_mi_holes);
418 float ramoFinal_mizj_holes = ramoPotentialMap.
getContent(ramo_final_bin_x_zj_holes, ramo_final_bin_y_mi_holes);
419 float ramoFinal_mimj_holes = ramoPotentialMap.
getContent(ramo_final_bin_x_mj_holes, ramo_final_bin_y_mi_holes);
422 double eHitRamo_pipj_electrons = energy_per_step * (ramoFinal_pipj_electrons - ramoInit_pipj);
423 double eHitRamo_pipj_holes = -1. * energy_per_step * (ramoFinal_pipj_holes - ramoInit_pipj);
424 double eHitRamo_pizj_electrons = energy_per_step * (ramoFinal_pizj_electrons - ramoInit_pizj);
425 double eHitRamo_pizj_holes = -1. * energy_per_step * (ramoFinal_pizj_holes - ramoInit_pizj);
426 double eHitRamo_pimj_electrons = energy_per_step * (ramoFinal_pimj_electrons - ramoInit_pimj);
427 double eHitRamo_pimj_holes = -1. * energy_per_step * (ramoFinal_pimj_holes - ramoInit_pimj);
428 double eHitRamo_zipj_electrons = energy_per_step * (ramoFinal_zipj_electrons - ramoInit_zipj);
429 double eHitRamo_zipj_holes = -1. * energy_per_step * (ramoFinal_zipj_holes - ramoInit_zipj);
430 double eHitRamo_zizj_electrons = energy_per_step * (ramoFinal_zizj_electrons - ramoInit_zizj);
431 double eHitRamo_zizj_holes = -1. * energy_per_step * (ramoFinal_zizj_holes - ramoInit_zizj);
432 double eHitRamo_zimj_electrons = energy_per_step * (ramoFinal_zimj_electrons - ramoInit_zimj);
433 double eHitRamo_zimj_holes = -1. * energy_per_step * (ramoFinal_zimj_holes - ramoInit_zimj);
434 double eHitRamo_mipj_electrons = energy_per_step * (ramoFinal_mipj_electrons - ramoInit_mipj);
435 double eHitRamo_mipj_holes = -1. * energy_per_step * (ramoFinal_mipj_holes - ramoInit_mipj);
436 double eHitRamo_mizj_electrons = energy_per_step * (ramoFinal_mizj_electrons - ramoInit_mizj);
437 double eHitRamo_mizj_holes = -1. * energy_per_step * (ramoFinal_mizj_holes - ramoInit_mizj);
438 double eHitRamo_mimj_electrons = energy_per_step * (ramoFinal_mimj_electrons - ramoInit_mimj);
439 double eHitRamo_mimj_holes = -1. * energy_per_step * (ramoFinal_mimj_holes - ramoInit_mimj);
441 if(doChunkCorrection) {
442 eHitRamo_pipj_electrons = energy_per_step * average_chargeElectron + kappa * (eHitRamo_pipj_electrons - energy_per_step * average_chargeElectron);
443 eHitRamo_pipj_holes = energy_per_step * average_chargeHole + kappa * (eHitRamo_pipj_holes - energy_per_step * average_chargeHole);
444 eHitRamo_pizj_electrons = energy_per_step * average_chargeElectron + kappa * (eHitRamo_pizj_electrons - energy_per_step * average_chargeElectron);
445 eHitRamo_pizj_holes = energy_per_step * average_chargeHole + kappa * (eHitRamo_pizj_holes - energy_per_step * average_chargeHole);
446 eHitRamo_pimj_electrons = energy_per_step * average_chargeElectron + kappa * (eHitRamo_pimj_electrons - energy_per_step * average_chargeElectron);
447 eHitRamo_pimj_holes = energy_per_step * average_chargeHole + kappa * (eHitRamo_pimj_holes - energy_per_step * average_chargeHole);
448 eHitRamo_zipj_electrons = energy_per_step * average_chargeElectron + kappa * (eHitRamo_zipj_electrons - energy_per_step * average_chargeElectron);
449 eHitRamo_zipj_holes = energy_per_step * average_chargeHole + kappa * (eHitRamo_zipj_holes - energy_per_step * average_chargeHole);
450 eHitRamo_zizj_electrons = energy_per_step * average_chargeElectron + kappa * (eHitRamo_zizj_electrons - energy_per_step * average_chargeElectron);
451 eHitRamo_zizj_holes = energy_per_step * average_chargeHole + kappa * (eHitRamo_zizj_holes - energy_per_step * average_chargeHole);
452 eHitRamo_zimj_electrons = energy_per_step * average_chargeElectron + kappa * (eHitRamo_zimj_electrons - energy_per_step * average_chargeElectron);
453 eHitRamo_pimj_holes = energy_per_step * average_chargeHole + kappa * (eHitRamo_pimj_holes - energy_per_step * average_chargeHole);
454 eHitRamo_mipj_electrons = energy_per_step * average_chargeElectron + kappa * (eHitRamo_mipj_electrons - energy_per_step * average_chargeElectron);
455 eHitRamo_mipj_holes = energy_per_step * average_chargeHole + kappa * (eHitRamo_mipj_holes - energy_per_step * average_chargeHole);
456 eHitRamo_mizj_electrons = energy_per_step * average_chargeElectron + kappa * (eHitRamo_mizj_electrons - energy_per_step * average_chargeElectron);
457 eHitRamo_mizj_holes = energy_per_step * average_chargeHole + kappa * (eHitRamo_mizj_holes - energy_per_step * average_chargeHole);
458 eHitRamo_mimj_electrons = energy_per_step * average_chargeElectron + kappa * (eHitRamo_mimj_electrons - energy_per_step * average_chargeElectron);
459 eHitRamo_mimj_holes = energy_per_step * average_chargeHole + kappa * (eHitRamo_mimj_holes - energy_per_step * average_chargeHole);
465 double x_mod_pi_electrons = x_pix + pixel_size_x * extraNPixXElectron - 0.5*module_size_x + pixel_size_x;
466 double y_mod_pj_electrons = y_pix + pixel_size_y * extraNPixYElectron - 0.5*module_size_y + pixel_size_y;
467 double x_mod_pi_holes = x_pix + pixel_size_x * extraNPixXHole - 0.5*module_size_x + pixel_size_x;
468 double y_mod_pj_holes = y_pix + pixel_size_y * extraNPixYHole - 0.5*module_size_y + pixel_size_y;
469 double x_mod_zi_electrons = x_pix + pixel_size_x * extraNPixXElectron - 0.5*module_size_x;
470 double y_mod_zj_electrons = y_pix + pixel_size_y * extraNPixYElectron - 0.5*module_size_y;
471 double x_mod_zi_holes = x_pix + pixel_size_x * extraNPixXHole - 0.5*module_size_x;
472 double y_mod_zj_holes = y_pix + pixel_size_y * extraNPixYHole - 0.5*module_size_y;
473 double x_mod_mi_electrons = x_pix + pixel_size_x * extraNPixXElectron - 0.5*module_size_x - pixel_size_x;
474 double y_mod_mj_electrons = y_pix + pixel_size_y * extraNPixYElectron - 0.5*module_size_y - pixel_size_y;
475 double x_mod_mi_holes = x_pix + pixel_size_x * extraNPixXHole - 0.5*module_size_x - pixel_size_x;
476 double y_mod_mj_holes = y_pix + pixel_size_y * extraNPixYHole - 0.5*module_size_y - pixel_size_y;
520 auto addCharge = [&Module, &chargedDiodes](
SiSurfaceCharge const & scharge) {
528 addCharge(scharge_pipj_electrons);
529 addCharge(scharge_pizj_electrons);
530 addCharge(scharge_pimj_electrons);
531 addCharge(scharge_zipj_electrons);
532 addCharge(scharge_zizj_electrons);
533 addCharge(scharge_zimj_electrons);
534 addCharge(scharge_mipj_electrons);
535 addCharge(scharge_mizj_electrons);
536 addCharge(scharge_mimj_electrons);
537 addCharge(scharge_pipj_holes);
538 addCharge(scharge_pizj_holes);
539 addCharge(scharge_pimj_holes);
540 addCharge(scharge_zipj_holes);
541 addCharge(scharge_zizj_holes);
542 addCharge(scharge_zimj_holes);
543 addCharge(scharge_mipj_holes);
544 addCharge(scharge_mizj_holes);
545 addCharge(scharge_mimj_holes);
551 for (
const auto& iHitRecord : trfHitRecord) {
552 double eta_i = eta_0;
553 double phi_i = phi_0;
554 double depth_i = depth_0;
557 eta_i += 1.0 * iHitRecord.first / iTotalLength *
dEta;
558 phi_i += 1.0 * iHitRecord.first / iTotalLength *
dPhi;
559 depth_i += 1.0 * iHitRecord.first / iTotalLength * dDepth;
562 double es_current = 1.0 * iHitRecord.second / 1.E+6;
564 double dist_electrode = 0.5 * sensorThickness - Module.
design().
readoutSide() * depth_i;
565 if (dist_electrode < 0) dist_electrode = 0;
567 CLHEP::Hep3Vector chargepos;
568 chargepos.setX(phi_i);
569 chargepos.setY(eta_i);
570 chargepos.setZ(dist_electrode);
575 "ismoduleframe " <<
coord <<
" -- startPosition (x,y,z) = " << chargepos.x() <<
", " << chargepos.y() <<
", " <<
579 const double x_new = chargepos.x() + 0.5*module_size_x;
580 const double y_new = chargepos.y() + 0.5*module_size_y;
583 const int nPixX =
int(x_new / pixel_size_x);
584 const int nPixY =
int(y_new / pixel_size_y);
585 ATH_MSG_DEBUG(
" -- nPixX = " << nPixX <<
" nPixY = " << nPixY);
586 const double x_pix = x_new - pixel_size_x * (nPixX);
587 const double y_pix = y_new - pixel_size_y * (nPixY);
589 const double x_pix_center = x_pix - pixel_size_x / 2;
590 const double y_pix_center = y_pix - pixel_size_y / 2;
591 ATH_MSG_DEBUG(
" -- current hit position w.r.t. pixel center = " << x_pix_center <<
" " << y_pix_center);
599 const double ed = es_current * eleholePairEnergy * chargeCorrection;
602 const double x_mod = x_pix_center + 0.5*pixel_size_x + pixel_size_x * nPixX - 0.5*module_size_x;
603 const double y_mod = y_pix_center + 0.5*pixel_size_y + pixel_size_y * nPixY - 0.5*module_size_y;
618 for (
const auto& iHitRecord : trfHitRecord) {
619 double eta_i = eta_0;
620 double phi_i = phi_0;
621 double depth_i = depth_0;
624 eta_i += 1.0 * iHitRecord.first / iTotalLength *
dEta;
625 phi_i += 1.0 * iHitRecord.first / iTotalLength *
dPhi;
626 depth_i += 1.0 * iHitRecord.first / iTotalLength * dDepth;
629 double es_current = 1.0 * iHitRecord.second / 1.E+6;
631 double dist_electrode = 0.5 * sensorThickness - Module.
design().
readoutSide() * depth_i;
632 if (dist_electrode < 0) dist_electrode = 0;
634 CLHEP::Hep3Vector chargepos;
635 chargepos.setX(phi_i);
636 chargepos.setY(eta_i);
637 chargepos.setZ(dist_electrode);
642 "ismoduleframe " <<
coord <<
" -- startPosition (x,y,z) = " << chargepos.x() <<
", " << chargepos.y() <<
", " <<
646 double x_new = chargepos.x() + 0.5*module_size_x;
647 double y_new = chargepos.y() + 0.5*module_size_y;
650 int nPixX =
int(x_new / pixel_size_x);
651 int nPixY =
int(y_new / pixel_size_y);
652 ATH_MSG_DEBUG(
" -- nPixX = " << nPixX <<
" nPixY = " << nPixY);
653 double x_pix = x_new - pixel_size_x * (nPixX);
654 double y_pix = y_new - pixel_size_y * (nPixY);
656 double x_pix_center = x_pix - pixel_size_x / 2;
657 double y_pix_center = y_pix - pixel_size_y / 2;
658 ATH_MSG_DEBUG(
" -- current hit position w.r.t. pixel center = " << x_pix_center <<
" " << y_pix_center);
662 CLHEP::Hep3Vector pos_neighbor;
665 for (
int i = -1;
i <= 1;
i++) {
666 x_neighbor = x_pix_center -
i * pixel_size_x;
668 for (
int j = -1; j <= 1; j++) {
669 y_neighbor = y_pix_center - j * pixel_size_y;
672 if ((std::abs(x_neighbor) < pixel_size_x) && (std::abs(y_neighbor) < pixel_size_y)) {
675 double x_neighbor_map = x_neighbor + pixel_size_x;
676 double y_neighbor_map = y_neighbor + pixel_size_y;
678 int x_bin_cc_map = x_neighbor_map / x_bin_size;
679 int y_bin_cc_map = y_neighbor_map / y_bin_size;
684 if (ccprob_neighbor == -1.)
return StatusCode::FAILURE;
686 double ed = es_current * eleholePairEnergy * ccprob_neighbor;
689 double x_mod = x_neighbor + 0.5*pixel_size_x + pixel_size_x * nPixX - 0.5*module_size_x;
690 double y_mod = y_neighbor + 0.5*pixel_size_y + pixel_size_y * nPixY - 0.5*module_size_y;
706 return StatusCode::SUCCESS;