Optical photon visualisation

Dear experts,

I have been fiddling with the DD4hep interfacing of G4 for the simulation of a Cerenkov-based detector. According to the higher-verbosity output and the actual distributions in the scoring plane, it appears that optical photons are indeed produced and propagated in the various media of the geometry. However, none of my attempts to visualise them with the “usual” Qt/X11/OGL utils is succeeding.

At best, I get a few optical photon tracks produced in the radiator displayed, but although they are tracked outside the volume (transiting through a --fortunately-- well-defined optical surface), none of these are actually displayed.

Here is a stripped-down version of my vis.mac (1.1 KB).

Could you please let me know what are --unless steered differently by the user-- the minimal requirements (momentum? energy? particle ID? etc) on an optical photon track to be properly displayed in one of the main visualiser shipped in? And what would be the handles I can use to start displaying them in my workflow?

Thanks a lot in advance!


Geant4 Version: 11.1.1
Operating System: AlmaLinux 9.2
Compiler/Version: gcc 11.3.1
CMake Version: 3.20.2


Hi Laurent

It’s a while since I used trajectory modelling and filtering…

What happens if you turn filtering off - comment out the commands or

/vis/filtering/trajectories/OpticsFilter/active false

?

John

Hi John,
Thanks for the quick reaction! As somewhat expected, turning it off does not change anything on the optical photon side while allows for the full particles content to be displayed (excl. the expected optical photons)

Hi Laurent

Mmm. You say, “According to the higher-verbosity output and the actual distributions in the scoring plane, it appears that optical photons are indeed produced and propagated in the various media of the geometry.” Is there any other way to verify that optical photons are actually being produced? For example

/tracking/verbose 2

What I am saying is, perhaps the vis system is simply representing the situation and the problem lies in the physics setup?

Hi John,

Yes, sorry for not being too specific hereabove. What I meant is, increasing the verbosity to the G4Cerenkov process module to 2, where I get something along:

GenerationInit   INFO  +++ Initializing event 14. Within run:4 event 1.
Gun              INFO  Shoot [13] [40.000 , 40.000] GeV proton pos:(-100.000 0.000 0.000)[mm] dir:( 1.000  0.000  0.000)
Gun              INFO  Particle [0] proton       Mom:40.000 GeV vertex:(-100.000  0.000  0.000)[mm] direction:( 1.000  0.000  0.000)
Gun              INFO  +-> Interaction [0] [40.000 , 40.000] GeV proton pos:(-100.000 0.000 0.000)[mm]
Gun              INFO  +++   +-> ID:  0 proton       status:00000002 PDG:  2212 Vtx:(-1.00e+02,+0.00e+00,+0.00e+00)[mm] time: +0.00e+00 [ns] #Dau:  0 #Par:0      
PrimaryHandler   INFO  +++++ G4PrimaryVertex at (-1.00e+02,+0.00e+00,+0.00e+00) [mm] +0.00e+00 [ns]
ParticleHandler  INFO  +++ Event 0 Begin event action. Access event related information.

 Exiting from G4Cerenkov::DoIt -- NumberOfSecondaries = 3

 Exiting from G4Cerenkov::DoIt -- NumberOfSecondaries = 4

 Exiting from G4Cerenkov::DoIt -- NumberOfSecondaries = 2

 Exiting from G4Cerenkov::DoIt -- NumberOfSecondaries = 2

 Exiting from G4Cerenkov::DoIt -- NumberOfSecondaries = 1

 Exiting from G4Cerenkov::DoIt -- NumberOfSecondaries = 6

 Exiting from G4Cerenkov::DoIt -- NumberOfSecondaries = 2

 Exiting from G4Cerenkov::DoIt -- NumberOfSecondaries = 4

 Exiting from G4Cerenkov::DoIt -- NumberOfSecondaries = 2

 Exiting from G4Cerenkov::DoIt -- NumberOfSecondaries = 4
1 event has been kept for refreshing and/or reviewing.
  "/vis/reviewKeptEvents" to review one by one.
  To see accumulated, "/vis/enable", then "/vis/viewer/flush" or "/vis/viewer/rebuild".

But, using the /tracking/verbose 2 flag (on another event), I can see that the full production/parentage seem correct:

GenerationInit   INFO  +++ Initializing event 3. Within run:2 event 1.
Gun              INFO  Shoot [2] [40.000 , 40.000] GeV proton pos:(-100.000 0.000 0.000)[mm] dir:( 1.000  0.000  0.000)
Gun              INFO  Particle [0] proton       Mom:40.000 GeV vertex:(-100.000  0.000  0.000)[mm] direction:( 1.000  0.000  0.000)
Gun              INFO  +-> Interaction [0] [40.000 , 40.000] GeV proton pos:(-100.000 0.000 0.000)[mm]
Gun              INFO  +++   +-> ID:  0 proton       status:00000002 PDG:  2212 Vtx:(-1.00e+02,+0.00e+00,+0.00e+00)[mm] time: +0.00e+00 [ns] #Dau:  0 #Par:0      
PrimaryHandler   INFO  +++++ G4PrimaryVertex at (-1.00e+02,+0.00e+00,+0.00e+00) [mm] +0.00e+00 [ns]
ParticleHandler  INFO  +++ Event 0 Begin event action. Access event related information.

*********************************************************************************************************
* G4Track Information:   Particle = proton,   Track ID = 1,   Parent ID = 0
*********************************************************************************************************

Step#    X(mm)    Y(mm)    Z(mm) KinE(MeV)  dE(MeV) StepLeng TrackLeng  NextVolume ProcName
    0     -100        0        0  3.91e+04        0        0         0        RP_0 initStep
    1      -10        0        0  3.91e+04 1.27e-09       90        90 Quartz_vol_0 Transportation
    2    -3.12        0        0  3.91e+04     2.07     6.88      96.9 Quartz_vol_0 hIoni
    :----- List of 2ndaries - #SpawnInStep=  1(Rest= 0,Along= 0,Post= 1), #SpawnTotal=  1 ---------------
    :     -3.12         0         0      1.24                 e-
    :----------------------------------------------------------------- EndOf2ndaries Info ---------------
    3       10 -0.000483 0.000566  3.91e+04     4.26     13.1       110        RP_0 Transportation
    4      250 -0.00799  0.00501  3.91e+04 3.38e-09      240       350 ScoringPlaneWall_2 Transportation

 Exiting from G4Cerenkov::DoIt -- NumberOfSecondaries = 3
    5      250 -0.00799  0.00501  3.91e+04  0.00474     0.02       350        RP_0 Transportation
    :----- List of 2ndaries - #SpawnInStep=  3(Rest= 0,Along= 0,Post= 3), #SpawnTotal=  4 ---------------
    :       250  -0.00799   0.00501  1.83e-06      opticalphoton
    :       250  -0.00799   0.00501  5.31e-06      opticalphoton
    :       250  -0.00799   0.00501  4.88e-06      opticalphoton
    :----------------------------------------------------------------- EndOf2ndaries Info ---------------

*********************************************************************************************************
* G4Track Information:   Particle = opticalphoton,   Track ID = 5,   Parent ID = 1
*********************************************************************************************************

Step#    X(mm)    Y(mm)    Z(mm) KinE(MeV)  dE(MeV) StepLeng TrackLeng  NextVolume ProcName
    0      250 -0.00799  0.00501  4.88e-06        0        0         0 ScoringPlaneWall_2 initStep
    1      250 -0.00891  0.00569  4.88e-06 4.88e-06  0.00142   0.00142        RP_0 Transportation

*********************************************************************************************************
* G4Track Information:   Particle = opticalphoton,   Track ID = 4,   Parent ID = 1
*********************************************************************************************************

Step#    X(mm)    Y(mm)    Z(mm) KinE(MeV)  dE(MeV) StepLeng TrackLeng  NextVolume ProcName
    0      250 -0.00799  0.00501  5.31e-06        0        0         0 ScoringPlaneWall_2 initStep
    1      250   -0.018 -0.00722  5.31e-06 5.31e-06   0.0195    0.0195        RP_0 Transportation

*********************************************************************************************************
* G4Track Information:   Particle = opticalphoton,   Track ID = 3,   Parent ID = 1
*********************************************************************************************************

Step#    X(mm)    Y(mm)    Z(mm) KinE(MeV)  dE(MeV) StepLeng TrackLeng  NextVolume ProcName
    0      250 -0.00799  0.00501  1.83e-06        0        0         0 ScoringPlaneWall_2 initStep
    1      250 -0.00827  0.00513  1.83e-06 1.83e-06 0.000374  0.000374        RP_0 Transportation

where this ScoringPlaneWall is the sensitive part (tracking detector, in the convention of DD4hep).

Mmm. So rather few optical photons produced. From what I know of the Cerenkov process, I’d expect many, perhaps hundreds or thousands per proton. But I’m not an expert here.

Are you still saying, optical photons are produced but not displayed?

Yes, true. There might be something fishy with the optical properties of the medium (high-n though). However, the point is that they are indeed created, propagated, and even detected in the scoring plane, but not displayed.

So, it is really a matter of visualisation.

OK. I’m at a loss at the moment. The vis system just does as it is told, so to speak. But if it is a vis issue, I’d like to know about it and fix it.

I’m afraid I don’t have time to try your example just now - maybe in a few days time.

Maybe, meanwhile, someone else can help? Anyone?

I notice the optical photons don’t go very far - a few micrometres - then no more. What happens?

Hi,

Optical photons may be killed by several reasons, I can think about 3 at the moment

  1. they reach a media without refractive index
  2. they are absorbed (watch out with too small absorption lengths)
  3. the photons are killed because the user wants that feature. That order may be placed in the step function or as the sensitive detector action (it can be useful to avoid useless tracking inside an optical sensor for example)

The case 1 and 2 are handled by Geant4 according to the input information, you may want to crosscheck it.

I have never used scoring with optical photons… so I have no idea if it is causing the killing of photons, maybe there is an unexpected bug there :slight_smile:

Best,
Alvaro

Hi John, Alvaro,

Many thanks for both your answers. Indeed this tracking debugging is useful there, more than the track parentage info. As suggested by the two of you, something was clearly fishy in my surfaces and material optical properties, although strictly following the selection chart in Use of logical border surfaces with reflectivity and transmittance - #2 by dsawkey, setting an arbitrary long absorption length or unphysical r-index, I saw no difference.

I then started investigating the materials definitions, and figured out that the name of my radiator material matched perfectly with one of the materials already defined in DD4hep’s standard materials definitions, without the optical properties… So indeed everything was being killed at the first optical surface interface.

I am therefore now able to properly visualise the optical photon tracks in my workflow. This thread can be safely closed.

Many thanks again!

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