77 auto edep = step->GetTotalEnergyDeposit();
80 G4double stepLength = 0.;
81 if ( step->GetTrack()->GetDefinition()->GetPDGCharge() != 0. ) {
82 stepLength = step->GetStepLength();
85 if ( edep==0. && stepLength == 0. )
return false;
87 auto touchable = (step->GetPreStepPoint()->GetTouchable());
90 auto layerNumber = touchable->GetReplicaNumber(1);
93 auto hit = (*fHitsCollection)[layerNumber];
95 G4ExceptionDescription msg;
96 msg <<
"Cannot access hit " << layerNumber;
97 G4Exception(
"CalorimeterSD::ProcessHits()",
98 "MyCode0004", FatalException, msg);
106 hit->Add(edep, stepLength);
107 hitTotal->Add(edep, stepLength);