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

The result of innerMaterial and outerMaterial depends on if the other function is called before #1413

Open
1 task done
jmcarcell opened this issue Mar 7, 2025 · 0 comments · May be fixed by #1414
Open
1 task done
Labels

Comments

@jmcarcell
Copy link
Member

jmcarcell commented Mar 7, 2025

Check duplicate issues.

  • Checked for duplicates

Goal

When calling outerMaterial() after innerMaterial() has been called, the result is different for some surfaces than when outerMaterial() is called first. This is happening because the TGeoManager keeps some internal state that changes after innerMaterial() is called, leading to it not being the same when calling outerMaterial(). For CLD_o2_v07, it seems that about 20 surfaces are affected, so it seems it's not a very large effect.

Operating System and Version

AlmaLinux 9

compiler

GCC 14

ROOT Version

6.32.08 and 6.34.04

DD4hep Version

master

Reproducer

source /cvmfs/sw-nightlies.hsf.org/key4hep/setup.sh
python issue.py
python issue.py --call-inner-material

If we now diff the two output files

diff surfaces_good.txt surfaces_bad.txt

We will see that in one file some surfaces are Silicon and in the other Air. For example:

< 1 Silicon
---
> 1 Air

The file issue.py:

import os
import argparse
import dd4hep
import DDRec

argparser = argparse.ArgumentParser()
argparser.add_argument('--call-inner-material', action='store_true', default=False)

det = dd4hep.Detector.getInstance()
det.fromCompact(f'{os.getenv("K4GEO")}/FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v07.xml')

args = argparser.parse_args()

sm = det.extension[DDRec.SurfaceManager]()
multimap = sm.map('world')
d = {}
for k, v in multimap:
    if args.call_inner_material:
        innermat = v.innerMaterial()
    outermat = v.outerMaterial()
    d[k] = outermat.name()

with open(f'surfaces_{"bad" if args.call_inner_material else "good"}.txt', 'w') as f:
    for k, v in d.items():
        f.write(f'{k} {v}\n')

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant