Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kill photons as soon they enter into a OpticalTracker #1174

Merged

Conversation

atolosadelgado
Copy link
Contributor

@atolosadelgado atolosadelgado commented Sep 30, 2023

BEGINRELEASENOTES

  • Geant4OpticalTracker: Kill optical photons (instead of all other particles) as soon they enter into a Optical Tracker sensitive detector

ENDRELEASENOTES

Hi,

Please, correct me, but I think the condition to kill the photons when they enter an Optical Tracker is the other way around.

I ran a simulation of optical photon transport with and without changing that condition. The default DD4hep do not kill photons when they enter the Optical Tracker sensitive detector, but that behavior happens when the condition is reversed (as in the suggested change in this PR).

Test: I did some tests with version 1.23 of DD4hep. The geometry is simple: a box (laboratory) made of "optical air", showed as a semitransparent, contains a sensitive detector made of "optical silicon", showed as red. The particle gun fires photons from the right to the left. The refractive index in the laboratory and the sensor is the same. The photons are stopped when they try to jump from the "laboratory" to the "world" (because World has no optical properties)

  1. This plot shows a track of a photon that crosses the sensor, the laboratory and it is only stopped when trying to cross to the world.
    photon_default
  2. This plot shows a track of a photon after changing the condition of killing particle in OpticalTracker SD Action
    photon_after_change
  3. This plot shows a track of a proton, same direction, with default DD4hep
    proton_default
  4. This plot shows a track of a proton, same direction, after changing the condition in OpticalTracker SD Action
    proton_after_change

The following code reproduce the plots:

git clone -b optical_tracker_test https://github.com/atolosadelgado/dd4hep_cube.git
cd dd4hep_cube
cmake -B build -S . -D CMAKE_INSTALL_PREFIX=install
cmake --build build -j 6 -- install
export LD_LIBRARY_PATH=$PWD/install/lib:$LD_LIBRARY_PATH
# Gun = optical photon
python3 test.py --compactFile compact/simple_detector.xml --runType qt --macroFile vis.mac --gun.energy 4*eV --gun.particle opticalphoton
# Gun = proton
python3 test.py --compactFile compact/simple_detector.xml --runType qt --macroFile vis.mac --gun.energy 4*GeV --gun.particle proton

@veprbl
Copy link
Contributor

veprbl commented Oct 2, 2023

cc @wdconinc

@github-actions
Copy link

github-actions bot commented Oct 2, 2023

Test Results

       6 files         6 suites   7h 4m 21s ⏱️
   356 tests    356 ✔️ 0 💤 0
1 058 runs  1 058 ✔️ 0 💤 0

Results for commit 6725f8d.

♻️ This comment has been updated with latest results.

@andresailer
Copy link
Member

@wdconinc : As the original code came from you in #967

Could you review this please?

@wdconinc
Copy link
Contributor

wdconinc commented Oct 2, 2023

I'll try to take a look today, at the latest by the end of the week. (cc @veprbl @c-dilks who may have comments too)

@c-dilks
Copy link
Contributor

c-dilks commented Oct 2, 2023

The RICH tests still pass, so I assume this change is okay for our ePIC dRICH.

@atolosadelgado
Copy link
Contributor Author

the bug is more evident if you remove these lines from the steering file

    # Some detectors are only sensitive to optical photons
    SIM.filter.filters["opticalphotons"] = dict(
        name="ParticleSelectFilter/OpticalPhotonSelector",
        parameter={"particle": "opticalphoton"},
        )
    SIM.filter.mapDetFilter["ACUBE"] = "opticalphotons"

@andresailer
Copy link
Member

@wdconinc Any objection from your side?

@wdconinc
Copy link
Contributor

I haven't had a chance to test this (swamped with a review), but I looked at the code and it seems like the right fix so don't let me hold this up. I'm not completely sure why it seemed to have worked for us in the past, but likely because we had thin detector volumes and the same thing happened as described here: photons are killed when leaving the detector, or are even absorbed in the detector (silicon PM).

@MarkusFrankATcernch MarkusFrankATcernch merged commit 611633c into AIDASoft:master Oct 19, 2023
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants