Print error for SD information

Hi everyone,
this is my code, my problem is that i got every step printed and not only the one on the boundary, where is the problem? thank you so much.

if (step->GetPostStepPoint()->GetStepStatus() == fGeomBoundary){
auto touchable = (step->GetPreStepPoint()->GetTouchable());
auto layerNumber = touchable->GetReplicaNumber(1);
auto edep = step->GetTotalEnergyDeposit();
if (edep==0.) return false;
B4cCalorHit* newHit = new B4cCalorHit();
newHit->SetPos (step->GetPostStepPoint()->GetPosition());
fHitsCollection->insert( newHit );
return true;