17 #include "CLHEP/Random/RandGaussZiggurat.h"
18 #include "CLHEP/Random/RandomEngine.h"
19 #include "CLHEP/Units/SystemOfUnits.h"
20 #include "GaudiKernel/PhysicalConstants.h"
28 const std::string &
type,
const std::string &
name,
const IInterface *
parent)
39 return StatusCode::SUCCESS;
46 CLHEP::HepRandomEngine* rndm_engine,
47 const EventContext& ctx)
const {
49 const SiHit& hit = *timed_hit_ptr;
57 << hit.
meanTime() <<
", tof =" << time_of_flight
58 <<
", tof exp =" << tof_expected);
88 ATH_MSG_DEBUG(
"x and y, z are: " << element_center.x() <<
", "
89 << element_center.y() <<
", "
90 << element_center.z());
91 float element_r = sqrt(element_center.x() * element_center.x() +
92 element_center.y() * element_center.y());
101 CLHEP::Hep3Vector direction = end_pos - start_pos;
102 float deposit_length = direction.mag();
106 if (deposit_length > 1.
e-10) {
107 direction.setMag(deposit_length /
static_cast<float>(n_steps));
112 const float tot_charge = tot_eloss / (3.62 *
CLHEP::eV);
114 float charge_per_step = tot_charge /
static_cast<float>(n_steps);
118 ATH_MSG_DEBUG(
">>>>>>> before processing, event_t, t, E, r: "
120 << tot_eloss <<
", " << element_r);
126 time_of_flight, tot_eloss, element_r, rndm_engine) -
129 ATH_MSG_DEBUG(
">>>>>>> after processing, t: " << time_of_flight);
134 float xphi_offset = 9.75;
135 float xeta_offset = 19.5;
139 for (
int i_step = 0; i_step < n_steps; i_step++) {
140 CLHEP::Hep3Vector surface_pos = start_pos + i_step * direction;
142 <<
", y=" << surface_pos.y()
143 <<
", z=" << surface_pos.z());
156 0.5 * sensor_thickness - readout_side * surface_pos[
SiHit::xDep];
167 rdif * CLHEP::RandGaussZiggurat::shoot(rndm_engine);
169 rdif * CLHEP::RandGaussZiggurat::shoot(rndm_engine);
172 if (fabs(surf_pos_xphi) > xphi_offset or
173 fabs(surf_pos_xeta) > xeta_offset) {
178 int bin_xphi = floor(fabs(surf_pos_xphi + xphi_offset) / pixel_size_xphi);
179 int bin_xeta = floor(fabs(surf_pos_xeta + xeta_offset) / pixel_size_xeta);
181 float pos_xphi_inpixel =
182 fabs(surf_pos_xphi + xphi_offset) -
float(bin_xphi) * pixel_size_xphi;
183 float pos_xeta_inpixel =
184 fabs(surf_pos_xeta + xeta_offset) -
float(bin_xeta) * pixel_size_xeta;
186 bool is_interpad_xphi = (pos_xphi_inpixel < interpad or
187 pos_xphi_inpixel > (pixel_size_xphi - interpad));
188 bool is_interpad_xeta = (pos_xeta_inpixel < interpad or
189 pos_xeta_inpixel > (pixel_size_xeta - interpad));
192 if (is_interpad_xphi or is_interpad_xeta) {
201 position,
SiCharge(charge_per_step, time_of_flight, hitproc,
209 diode_coll->
add(cell_id, surface_charge.
charge());