65 auto edep = step->GetTotalEnergyDeposit();
68 G4double stepLength = 0.;
69 if (step->GetTrack()->GetDefinition()->GetPDGCharge() != 0.) {
70 stepLength = step->GetStepLength();
73 if (edep == 0. && stepLength == 0.)
76 auto touchable = (step->GetPreStepPoint()->GetTouchable());
79 auto layerNumber = touchable->GetReplicaNumber(1);
82 auto hit = (*fHitsCollection)[layerNumber];
84 G4ExceptionDescription msg;
85 msg <<
"Cannot access hit " << layerNumber;
86 G4Exception(
"CalorimeterSD::ProcessHits()",
"MyCode0004", FatalException, msg);
90 auto hitTotal = (*fHitsCollection)[fHitsCollection->entries() - 1];
93 hit->Add(edep, stepLength);
94 hitTotal->Add(edep, stepLength);