PostStep positions not corresponding to volume location

Hello.
I am generating electrons in a volume sampling their energy from a spectrum.
The neutrons are homogeneously generated in a cylinder (TargetPhys) filed with a certain material.
This cylinder is inserted in a second cylinder filled with “galactic material” (GasPhys2).
Finally this second cylinder is inserted in a third cylinder filled with “galactic material” (GasPhys1).

I want to check how many electrons exit the 1st cylinder and to do so, in the SteppingAction I ask that if the prestep-point is in TargetPhys and the poststep-point is in GasPhys2 an integer number is increased by 1 unit.
But the results I obtained were “weird”,in the sense that if i ask instead to increase the counter when the prestep-point is in GasPhys2 and the second in GasPhys1, I obtain a larger number (I was instead expecting the same number since both GasPhys1 and GasPhys2 are filled with galactic).

Therefore I started checking what’s happening.
My TargetPhys cylinder is centered in (0,0,0) and it has a radius of 0.2 cm and total height of 4 cm along the z axis (half height = 2 cm)
In SteppingAction,if the prestep-point is in TargetPhys and the poststep-point is in GasPhys2, the prestep and poststep coordinates are asked.
But from the printout I get that postep coorinates are inside the TagetPhys, sometimes even in the middle.
Here below is the part of the code inserted in SteppingAction.
If no visible mistake is found, is there anyone available to run and countercheck my full code, please?

Thanks,
best regards,
Fra

G4String oldVolumeName = “old”;
G4String newVolumeName = “new”;
if (!aStep->GetTrack()->GetNextVolume()) {
aStep->GetTrack()->SetTrackStatus(fStopAndKill);
// G4cout << “************ particle almost goes out op the world volume, killed.” << G4endl;
// getchar();
}

else{
if(aStep → GetPreStepPoint()->GetPhysicalVolume()!=NULL) oldVolumeName = aStep → GetPreStepPoint()-> GetPhysicalVolume()-> GetName();

if(aStep -> GetPostStepPoint()->GetPhysicalVolume()!=NULL)    newVolumeName = aStep -> GetPostStepPoint()->  GetPhysicalVolume()-> GetName(); 
 
G4String filen = "../output/Crossing_Target_Gas.dat";

FILE *fout = fopen(filen,“a”);
G4double dE = aStep->GetTotalEnergyDeposit()/eV;

if(oldVolumeName == “TargetPhys” && newVolumeName == “GasPhys2”&&dE>0.)
{
G4String particleName = (aStep → GetTrack() → GetDynamicParticle()-> GetDefinition() → GetParticleName());
G4String primaryPartName=eventAction->GetPrimName();
if(particleName==primaryPartName){
fprintf(fout, “%d %d %.10lf %.10lf %.10lf %.10lf %.10lf %.10lf %.10lf %d %d\n”,
eventID,
NumCross,
aStep → GetPreStepPoint()->GetPosition().getX()/cm,
aStep → GetPreStepPoint()->GetPosition().getY()/cm,
aStep → GetPreStepPoint()->GetPosition().getZ()/cm,
aStep → GetPostStepPoint()->GetPosition().getX()/cm,
aStep → GetPostStepPoint()->GetPosition().getY()/cm,
aStep → GetPostStepPoint()->GetPosition().getZ()/cm,
aStep → GetPreStepPoint()->GetKineticEnergy()/eV,
aStep->GetTrack()->GetTrackID(),
aStep->GetTrack()->GetParentID() );
NumCross++;
G4cout << aStep → GetPreStepPoint()->GetPosition().getX()/cm<<" " << aStep → GetPreStepPoint()->GetPosition().x()/cm<<G4endl;
/if(abs(aStep → GetPostStepPoint()->GetPosition().getZ()/cm)<1 && (sqrt( (aStep → GetPostStepPoint()->GetPosition().getX()/cm)(aStep → GetPostStepPoint()->GetPosition().getX()/cm) + (aStep → GetPostStepPoint()->GetPosition().getY()/cm)*(aStep → GetPostStepPoint()->GetPosition().getY()/cm))< 0.2)

                                    ) {
                                         G4cout << "     Z ending position " << aStep -> GetPostStepPoint()->GetPosition().getZ()/cm <<
                                                   "     Z starting position " << aStep -> GetPreStepPoint()->GetPosition().getZ()/cm <<
                                                   "     Z_distance           " <<(aStep -> GetPostStepPoint()->GetPosition().getZ()/cm -aStep -> GetPreStepPoint()->GetPosition().getZ()/cm)<<
                                                   "     Initial Vol " <<aStep -> GetPreStepPoint()-> GetPhysicalVolume()-> GetName()<<
                                                   "     Final Vol "   <<aStep -> GetPostStepPoint()-> GetPhysicalVolume()-> GetName()<< 
                                                   "     Z ending position " << aStep -> GetPostStepPoint()->GetPosition().getZ() <<
                                                   //"     Z starting position " << aStep -> GetPreStepPoint()->GetPosition().getZ() <<
                                                   //"     Z_distance           " <<(aStep -> GetPostStepPoint()->GetPosition().getZ() -aStep -> GetPreStepPoint()->GetPosition().getZ())
                                                   << G4endl;
                                         exit(0);          
                                                     
                                    }
                                    */
                                   
                                      }

}

fclose(fout);

Hello.
I solved it.
The issues were dealing with the DefaultCutValue (too little) and the fact that I was separately checking coordinates.

Cheers,
Francesca