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

XMLLoader can not handle compact filename without the path #1039

Closed
atolosadelgado opened this issue Jan 13, 2023 · 1 comment · Fixed by #1042
Closed

XMLLoader can not handle compact filename without the path #1039

atolosadelgado opened this issue Jan 13, 2023 · 1 comment · Fixed by #1042
Assignees
Labels

Comments

@atolosadelgado
Copy link
Contributor

atolosadelgado commented Jan 13, 2023

Hi,

It seems XMLLoader cannot handle a local file like "compact_file.xml", but only "./compact_file.xml" (Thanks @andresailer for spotting the problem)

If the "./" is missing, it prefix the filename with the wrong path $PWD/file: , which leads to not finding the file.

  • OS version: CC7 (lxplus)
  • Compiler version: gcc (Spack GCC) 11.2.0
  • Package version: 1.22
  • Goal: if no path to compact file provided, it should assume the file is placed in the local directory where the program is being executed. I do not know if this problem affects to other features
    -How to reproduce the error: in lxplus (or any other CC7 with CVMFS, run the following code in order to source the stack and create a G4 mac file.
source /cvmfs/sw.hsf.org/key4hep/setup.sh
echo "/geometry/test/run" >> overlap.mac
echo "exit" >> overlap.mac

Then, if file path is provided, it works as expected:

ddsim --compactFile $FCCDETECTORS/Detector/DetCommon/compact/Box.xml --runType run --macroFile overlap.mac --part.userParticleHandler=''
.....................[a lot of info here].............................
Geant4UIManager  INFO  ++ Executing UI setup:overlap.mac
Running geometry overlaps check...
Checking overlaps for volume Box0_vol_0:0 (G4Box) ... OK! 
Geometry overlaps check completed !

Geant4Kernel     INFO  ++ Terminate Geant4 and delete associated actions.
DDSim            INFO DDSim            INFO  Total Time:   5.46 s (User), 1.43 s (System)

If we create a symbolic link and do not provide file path, it fails with the following output

$ ln -s $FCCDETECTORS/Detector/DetCommon/compact/Box.xml Box.xml
$ ln -s $FCCDETECTORS/Detector/DetCommon/compact/elements.xml elements.xml
$ ln -s $FCCDETECTORS/Detector/DetCommon/compact/materials.xml materials.xml

$ ddsim --compactFile Box.xml --runType run --macroFile overlap.mac --part.userParticleHandler=''
PersistencyIO    INFO  +++ Set Streamer to dd4hep::OpaqueDataBlock
Info in <TGeoManager::TGeoManager>: Geometry default, Detector Geometry created
Info in <TGeoNavigator::BuildCache>: --- Maximum geometry depth set to 100
XMLLoader        INFO  +++ Processing XML file: file:Box.xml
XercesC          FATAL +++ FATAL Error at file "", Line 0 Column: 0 Message:unable to open primary document entity '/afs/cern.ch/user/a/atolosad/file:Box.xml'
Traceback (most recent call last):
  File "/cvmfs/sw.hsf.org/spackages6/dd4hep/1.22/x86_64-centos7-gcc11.2.0-opt/7peyh/bin/ddsim", line 25, in <module>
    RUNNER.run()
  File "/cvmfs/sw.hsf.org/spackages6/dd4hep/1.22/x86_64-centos7-gcc11.2.0-opt/7peyh/lib/python3.9/site-packages/DDSim/DD4hepSimulation.py", line 312, in run
    kernel.loadGeometry(str("file:" + compactFile))
cppyy.gbl.std.runtime_error: void dd4hep::sim::Geant4Kernel::loadGeometry(const string& compact_file) =>
    runtime_error: dd4hep: Failed to parse the XML file file:Box.xml [Invalid XML ROOT handle]
dd4hep: while parsing file:Box.xml
dd4hep: with plugin:DD4hep_XMLLoader

Thank you for your time.

Best,
Alvaro

@MarkusFrankATcernch
Copy link
Contributor

@atolosadelgado @andresailer
This must be ddsim specific. For other applications this seems to work.
e.g. $> geoDisplay -compact SiD.xml
behaves as expected.

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

Successfully merging a pull request may close this issue.

3 participants