G4Replica obscures mother volume sensitivity?

Hi :slight_smile:

I am trying to count hits in a pixelated detection volume, realized with nested G4Replica volumes like so:

 // 1. Mother volume - sensor
    G4Box* sensor = new G4Box( "sensor", (pixelSize * Nx) / 2.0, (pixelSize * Ny) / 2.0, pixelThickness/ 2.0 );
    G4LogicalVolume* sensorLV = new G4LogicalVolume(sensor, Si, sensor->GetName());

    // 2. Replica volume - column
    G4Box* col = new G4Box( "pixelcolumn", pixelSize / 2.0, (Ny*pixelSize) / 2.0, pixelThickness / 2.0);
    G4LogicalVolume* colLV = new G4LogicalVolume(col, Si, col->GetName());
    new G4PVReplica(colLV->GetName(), colLV, sensorLV, kXAxis, Nx, pixelSize);
//     3. Replica volume - row
    G4Box* row = new G4Box( "pixel", pixelSize / 2.0, pixelSize / 2.0, pixelThickness / 2.0);
    l_sensor = new G4LogicalVolume(row, Si, row->GetName());
    new G4PVReplica(l_sensor->GetName(), l_sensor, colLV, kYAxis, Ny, pixelSize);
    new G4PVPlacement( rot1, pos1, sensorLV, sensor->GetName(), fWorldVolume, 0, 0, false);
    new G4PVPlacement( rot2, pos2, sensorLV, sensor->GetName(), fWorldVolume, 0, 1, false);

now I try to score an energy histogram of volumeFlux and the dose deposit for the two volumes with a macro as follows:

/score/create/realWorldLogVol sensor 2
/score/quantity/volumeFlux flux
/score/quantity/doseDeposit dose

/analysis/h1/create sensor1volFlux volFlux_sensor1 180 0 450 keV
/analysis/h1/create sensor2volFlux volFlux_sensor2 180 0 450 keV

/score/fill1D 0 pixel flux 0
/score/fill1D 1 pixel flux 1

and — it does not work as expected: All histogram bins are zero…
It seems that the G4Replica inside the sensor-volume is obscured by the G4Replica structure inside!?

Changing the realWorldLogVol command to use the “pixel” volume instead, things work almost as expected: now the histogram bins are filled with values, and I also get the dose dumped. however: there are as many values as there are pixels per column, all of which except for entry 0 and 1 are again zero.

Alternatively, I used a G4VSensitiveDetector instead of the command based approach: again, using “sensor” as the detection logical volume yields zero hits, I can however generate hits with the “pixel” LV.

Is this behaviour anticipated? I was expecting the structure to behave like a nested structure of LVs (pixel inside pixelcolumn inside sensor), instead it seems the pixels obscure the column and the sensor!? Am I doing something fundamentally wrong?

Thanks a lot in advance!


  • wrapping the mother volume into an additional volume (of the same size as the previous mother volume) can also not be used as a sensitive detector / realWorldLogVol scorer. Changing the size by 1um makes it work.
  • Adapting divisions instead of replica Physical Volumes — Book For Application Developers 10.7 documentation does not work for me, the G4Para constructor does not exist anymore in 10.7.2!?

/score/create/realWorldLogVol command defines a G4MultiFunctionalDetector object to the specifying logical volume. But in general any sensitive detector (including G4MultiFunctionalDetector) does not propagate to the daughter volumes. The primary use-case of /score/create/realWorldLogVol is for a volume that has no daughter. In particular of your case, the volume “sensor” is fully filled by the replicated daughter volumes (“pixelcolumn”), so basically the G4MultiFunctionalDetector assigned to “sensor” will never be invoked.

To address to your use-case, you may

  1. use scoring box. In this case, you do not need replicas to define “pixelcolumn” or “pixel”,
  2. implement ConstractSDandField() method in your detector construction and defile scorers to the logical volume of the lowest geometrical hierarchy (i.e. “pixel”).

Hope this helps,

if the sensor volume is never entered when it is fully filled with its daughters it makes completely sense, also why the additional 1um “trick” works.

indeed, the scoring box can trivially be pixelized, but I was looking for a more customizable option (a larger number of pixelized sensor areas, but also histograms (volume flux spectra) for each complete sensor area). I guess making the box 1um or less larger works for me, just wanted to know why.
thank you for your respense :slight_smile:

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