332 {
333 const SCT_ModuleSideDesign* design;
334 const SCT_ModuleSideDesign* initialDesign{
dynamic_cast<const SCT_ModuleSideDesign*
>(&(element->
design()))};
335 if (initialDesign==nullptr) {
336 ATH_MSG_ERROR(
"StripSurfaceChargesGenerator::process can not get " << initialDesign);
337 return;
338 }
339
340
341
342
343
344 const SCT_ModuleSideDesign* motherDesign = initialDesign->
getMother();
345
346 if(motherDesign!=nullptr){
348 design = motherDesign;
349 }
350 else {
351 ATH_MSG_DEBUG(
"No Mother Design - Using Design from DetElement directly!");
352 design = initialDesign;
353 }
354
355 const double thickness{design->
thickness()};
358
359
360
361
362
363 float timeOfFlight{p_eventTime +
hitTime(phit)};
364
365
366 timeOfFlight -= (element->
center().
mag()) / CLHEP::c_light;
367
368
369
372 }
373
374
379
381 const float cEta{
static_cast<float>(endPos[
SiHit::xEta]) - xEta};
382 const float cPhi{
static_cast<float>(endPos[
SiHit::xPhi]) - xPhi};
383 const float cDep{
static_cast<float>(endPos[
SiHit::xDep]) - xDep};
384
385
386
387 const float largeStep{std::sqrt(cEta*cEta + cPhi*cPhi + cDep*cDep)};
390 const float e1{
static_cast<float>(phit.
energyLoss() / steps)};
391 const float q1{
static_cast<float>(
e1 *
m_siPropertiesTool->getSiProperties(hashId, ctx).electronHolePairsPerEnergy())};
392
393
394
395
396
397
398
399
400
401 float xhit{xDep};
402 float yhit{xPhi};
403 float zhit{xEta};
404 float cX{cDep};
405 float cY{cPhi};
406 float cZ{cEta};
407
408 InducedChargeModel::SCT_InducedChargeModelData*
data{
nullptr};
411 const AtlasFieldCacheCondObj* fieldCondObj{*readHandle};
417 }
419 vbias,
420 element,
421 fieldCondObj,
423 rndmEngine,
424 ctx);
425 }
426
427 const float stepX{cX / numberOfSteps};
428 const float stepY{cY / numberOfSteps};
429 const float stepZ{cZ / numberOfSteps};
430
431
432
437
438
439
440
442 }
443 }
444
445 float dstep{-0.5};
446 for (int istep{0}; istep < numberOfSteps; ++istep) {
447 dstep += 1.0;
448 float z1{zhit + stepZ * dstep};
449
450
451
452 float zReadout{
static_cast<float>(0.5 * thickness - design->
readoutSide() * z1)};
453 const double spess{zReadout};
454
457 h.m_h_depD->Fill(z1);
458 h.m_h_spess->Fill(spess);
459 }
460
461 float t_drift{
driftTime(zReadout, element, ctx)};
462 if (t_drift>-2.0000002 and t_drift<-1.9999998) {
463 ATH_MSG_DEBUG(
"Checking for rounding errors in compression");
464 if ((std::abs(z1) - 0.5 * thickness) < 0.000010) {
465 ATH_MSG_DEBUG(
"Rounding error found attempting to correct it. z1 = " << std::fixed << std::setprecision(8) << z1);
466 if (z1 < 0.0) {
467 z1 = 0.0000005 - 0.5 * thickness;
468
469 } else {
470 z1 = 0.5 * thickness - 0.0000005;
471
472 }
473 zReadout = 0.5 * thickness - design->
readoutSide() * z1;
474 t_drift =
driftTime(zReadout, element, ctx);
475 if (t_drift>-2.0000002 and t_drift<-1.9999998) {
477 } else {
478 ATH_MSG_DEBUG(
"Correction Successful! z1 = " << std::fixed << std::setprecision(8) << z1 <<
", zReadout = " << zReadout <<
", t_drift = " << t_drift);
479 }
480 } else {
481 ATH_MSG_DEBUG(
"No rounding error found. Making no correction.");
482 }
483 }
484 if (t_drift > 0.0) {
485 const float x1{xhit + stepX * dstep};
486 float y1{yhit + stepY * dstep};
487
491 y1 += tanLorentz * zReadout;
492 }
493
495 const float rx{CLHEP::RandGaussZiggurat::shoot(rndmEngine)};
497 const float ry{CLHEP::RandGaussZiggurat::shoot(rndmEngine)};
498 const float yd{
y1 +
sigma * ry};
499
500
501 const double stripPitch{0.080};
502 double dstrip{
y1 / stripPitch};
503 if (dstrip > 0.) {
504 dstrip = dstrip - std::trunc(dstrip);
505 } else {
506 dstrip = dstrip - std::trunc(dstrip) + 1;
507 }
508
509
510 double y0{dstrip * stripPitch};
511 double z0{thickness - zReadout};
512
513
517 h.m_h_zhit->Fill(zhit);
518 }
519 double trap_pos{-999999.}, drift_time{-999999.};
522 break;
523 } else {
524 double Q_m2{0.}, Q_m1{0.}, Q_00{0.}, Q_p1{0.}, Q_p2{0.};
525
526 dstrip =
y1 / stripPitch;
527
528
529
530
531 if (dstrip > 0.) {
532 dstrip -= static_cast<double>(static_cast<int>(dstrip));
533 } else {
534 dstrip -= static_cast<double>(static_cast<int>(dstrip)) + 1;
535 }
536
537
538 double yfin{dstrip * stripPitch};
539 double zfin{thickness - trap_pos};
540
541 m_radDamageTool->holeTransport(y0, z0, yfin, zfin, Q_m2, Q_m1, Q_00, Q_p1, Q_p2);
543 const double ystrip{yd +
strip * stripPitch};
552 const double time{drift_time};
554 inserter(SiSurfaceCharge(position, SiCharge(q1*
charge, time, hitproc, trklink)));
555 continue;
556 }
557 }
558 }
560 }
561 }
562 }
563
566
572
573 const double mm2cm = 0.1;
574
576 y0*mm2cm, z0*mm2cm,
577 Q_m2, Q_m1, Q_00, Q_p1, Q_p2,
579 ctx);
581 y0*mm2cm, z0*mm2cm,
582 Q_m2, Q_m1, Q_00, Q_p1, Q_p2,
584 ctx);
585
587 if (Q_00[it] == 0.0) continue;
588 double ICM_time{(
it+0.5)*0.5 + timeOfFlight};
590 Q_m2[
it], Q_m1[
it], Q_00[
it], Q_p1[
it], Q_p2[
it]
591 };
593 double ystrip{
y1 +
strip * stripPitch};
596 inserter(SiSurfaceCharge(position,
598 ICM_time, hitproc, trklink)));
599 }
600 }
601 }
602 } else {
606
608 const float totaltime{(
m_tfix > -998.) ?
m_tfix.value() : t_drift + timeOfFlight + t_surf};
609 inserter(SiSurfaceCharge(position, SiCharge(q1, totaltime, hitproc, trklink)));
610 } else {
611 ATH_MSG_VERBOSE(std::fixed << std::setprecision(8) <<
"Local position (phi, eta, depth): ("
612 << position.
xPhi() <<
", " << position.
xEta() <<
", " << position.
xDepth()
613 << ") of the element is out of active area, charge = " << q1);
614 }
615 }
616 }
617 }
618 }
619 }
620 }
float hitTime(const AFP_SIDSimHit &hit)
Scalar mag() const
mag method
#define ATH_MSG_WARNING(x)
double charge(const T &p)
char data[hepevt_bytes_allocation_ATLAS]
bool isValid() const
Validity check.
static HepMcParticleLink getRedirectedLink(const HepMcParticleLink &particleLink, uint32_t eventIndex, const EventContext &ctx)
Return a HepMcParticleLink pointing at the same particle, but in a different GenEvent.
bool chargeIsTrapped(double spess, const InDetDD::SiDetectorElement *element, double &trap_pos, double &drift_time) const
float surfaceDriftTime(float ysurf) const
Calculate of the surface drift time.
IntegerProperty m_numberOfCharges
FloatProperty m_smallStepLength
int readoutSide() const
ReadoutSide.
virtual double scaledDistanceToNearestDiode(const SiLocalPosition &chargePos) const =0
give distance to the nearest diode in units of pitch, from 0.0 to 0.5, this method should be fast as ...
const SCT_ModuleSideDesign * getMother() const
virtual bool inActiveArea(const SiLocalPosition &chargePos, bool checkBondGap=true) const =0
check if the position is in active area
double xDepth() const
position along depth direction:
double xPhi() const
position along phi direction:
double xEta() const
position along eta direction:
virtual const Amg::Vector3D & center() const override final
Center in global coordinates.
Amg::Vector2D hitLocalToLocal(double xEta, double xPhi) const
Simulation/Hit local frame to reconstruction local frame.
double energyLoss() const
HepGeom::Point3D< double > localStartPosition() const
const HepMcParticleLink & particleLink() const
HepGeom::Point3D< double > localEndPosition() const
time(flags, cells_name, *args, **kw)
double e1(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 1st sampling