Can't get secondaries to register boundary crossings in parallel world

_Geant4 Version:_10.7.4 OR 11.2.2, happens in both
_Operating System:_Ubuntu 22.04
_Compiler/Version:_gcc 11.4.0
_CMake Version:_3.22.1

I am modeling particle propagation in Earth’s atmosphere. The physical world is made up of horizontal slabs of air of gradually decreasing density as you go upwards. I have a parallel world made up of concentric spherical shells surrounding a point in the atmosphere where a bunch of high-energy gamma-rays initiate. I would like to create an output record every time a particle crosses a boundary of one of these shells. The problem is that only the primary gamma-rays are creating output records properly when they cross these boundaries. Secondary particles (like electrons) can be caught crossing the boundaries in the physical world just fine (so I’m creating plenty of secondaries). In other words: the parallel world is registering OK because primary gammas cross it; secondary particles are getting created and moving around OK because I can see them crossing the physical world boundaries; but secondary particles aren’t getting caught crossing the parallel world boundaries. Oddly, when I do the test in myDetectorSD, I get just a few of the secondaries correctly crossing the parallel world boundaries, not exactly none. But when I look for such crossings in mySteppingAction, I get exactly none. Note that each concentric spherical shell in the parallel world crosses several of the horizontal air layers in the physical world. Setting up in main.cc:

physics->RegisterPhysics(new G4ParallelWorldPhysics(paraWorldName,true));
runManager->SetUserInitialization(physics);

Registering the concentric shells of the parallel world as SDs in myDetectorConstruction:

            G4String sdName = "scoringShell" + std::to_string(i + 1);
            myDetectorSD* sd = new myDetectorSD(sdName, "sphereCollection");
            SDman->AddNewDetector(sd);
            SetSensitiveDetector(logicShell, sd);

Trying to get the crossings recorded in myDetectorSD.cc:

G4bool myDetectorSD::ProcessHits(G4Step* step, G4TouchableHistory*)
{
    G4StepPoint* pre = step->GetPreStepPoint();
    G4StepPoint* post = step->GetPostStepPoint();

    //    if (pre->GetStepStatus() != fGeomBoundary && post->GetStepStatus() != fGeomBoundary)
    //  return false;

    auto preVol = pre->GetTouchableHandle()->GetVolume();
    auto postVol = post->GetTouchableHandle()->GetVolume();

    if (preVol == postVol) return false;
    // If it gets beyond this point, I should get output.

As I said, this doesn’t give me zero boundary crossings of secondaries in the parallel world regions, but it just gives me a small fraction of what I should get. If I use the “fGeomboundary” code that’s commented out, I get even an order of magnitude fewer than that, but still not zero.

I know this is odd and complicated and if I’m just trying to do something that can’t be done, I’ll abandon my parallel world. But I think I can’t make a bunch of spherical shells in the physical world that overlap with the slabs, since they intersect many of them. I would have known how to handle the overlaps correctly in GEANT3, but I think this is forbidden (?) in GEANT4.

Any advice welcome, including “give it up”.

Consider changing from

if (preVol == postVol) return false;

To checking explicitly that a transportation step is being performed.

G4String procName = step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName();

Also, if you set the tracking verbose to be high and simulate a small number of particles (maybe dummy electrons and other changed particles generated via the GPS near a boundary) you can directly compare the output from that to what your sensitive detector is telling you.

Thank you! But after a great deal of struggle I realized last night that my virtual world shells were being set up with their radii in mm instead of km, which is why I got so few secondary crossings – gammas don’t make a lot of secondaries in just a few mm of air. Sigh, my apologies…

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.