StepStatus depending on scoring mesh

Hi everyone,
particles entering a cylinder in the geometry world don’t pass the step fGeomBoundary, when a scoring mesh is placed on top.

Having a sensitive detector attached to cylinders in the first world:

G4RotationMatrix* filterRotation = new G4RotationMatrix();
G4Tubs* ssg = new G4Tubs("theName", 0, 32.*mm, 1.5*mm, 0, CLHEP::twopi);
auto l_ssg = new G4LogicalVolume(ssg, theMaterial, ssg->GetName());
new G4PVPlacement( filterRotation, position + sensorPosition1 + G4ThreeVector(0,170,0)*mm, l_ssg, ssg->GetName(), fWorldVolume, false, 0, checkOverlap);
new G4PVPlacement( filterRotation, position + sensorPosition2 - G4ThreeVector(0,170,0)*mm, l_ssg, ssg->GetName(), fWorldVolume, false, 1, checkOverlap);

and a cylinder mesh:

/score/create/cylinderMesh ssg1
/score/mesh/cylinderSize 32 5 mm
/score/mesh/translate/xyz -25 183.554 82.796 mm
/score/mesh/rotate/rotateX 90 deg
/score/mesh/nBin 11 100 31
/score/quantity/volumeFlux flux

the sensitive detector:

G4bool fluxSD::ProcessHits(G4Step* aStep, G4TouchableHistory* /*touchables*/)
    G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
    G4cerr << "stepStatus: " << preStepPoint->GetStepStatus() << G4endl;
    if (preStepPoint->GetStepStatus() == fGeomBoundary ) {     // inbound particles only
        if(aStep->GetTrack()->GetParticleDefinition() == G4Gamma::Gamma()) {
            auto hit = new fluxHit();

  return true;

without the cylinder mesh, I get events that pass the preStepPoint->GetStepStatus() == fGeomBoundary check, but when I do have the cylinder mesh, the only stepStatus I obtain from the cylinder is 3 / fAlongStepDoItProc.

Is there something that I am missing? Thanks a lot in advance :slight_smile:

Geant4 version Name: geant4-10-07-patch-02 [MT]


  • same behavior with geant4-11-00-beta-01 [MT]
  • setting the bin numbers to a different value (e.g., /score/mesh/nBin 11 99 31) makes it work again like a charm. I think this might be a bug? Coinciding surfaces in parallel worlds should not obscure particles penetrating the surface of a sensitive detector, right?

The problem happens with some conditions including when the volume boundary in the real world and in a parallel world are exactly overlapping. Could you please slightly relocate the scoring mesh to avoid the exact overlap?
We have identified the issue and the fix will be included in the next release (either a patch release for version 10.7 or version 11.0, whichever comes first). If you want, I can send you a patch code to be applied to the latest version (10.7-p02).
Kind regards,

yep, in principle that works. but some boundaries are placed programmatically, hence I am glad that the issue is recognized and fixed already!

that would be great, thanks so much in advance :slight_smile:

Dear @makotoasai
could you please send me / upload the patch(es) for 10.7-p02 (and if you have it anyways, also for 11)?
Thank you