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.
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
@atolosadelgado @andresailer
This must be ddsim specific. For other applications this seems to work.
e.g. $> geoDisplay -compact SiD.xml
behaves as expected.
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.Then, if file path is provided, it works as expected:
If we create a symbolic link and do not provide file path, it fails with the following output
Thank you for your time.
Best, Alvaro