Closed armin-ilg closed 1 year ago
To make sure the baseline works as expected, what do you get for the beampipe of https://github.com/key4hep/k4geo/tree/master/FCCee/compact/FCCee_o2_v02 ?
Hi André
For my vertex detector and beampipe it works fine, I just also checked for the CLD version you linked: beampipe_depth.pdf (don't know what "beam" is, but the rest looks okay) beampipe_x0.pdf (looks meaningful) beampipe+vertex_x0.pdf (looks meaningful)
Cheers, Armin
Concerning the material budget with ddsim: You have a problem there which is noit dd4hep related:
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:FCCee_IDEA_o1_v01.xml
XercesC FATAL +++ FATAL Error at file "", Line 0 Column: 0 Message:unable to open primary document entity '/afs/cern.ch/user/a/afehr/lcgeo/FCCee/compact/IDEA/IDEA_o1_v01/file:FCCee_IDEA_o1_v01.xml'
Traceback (most recent call last):
File "/cvmfs/sw.hsf.org/spackages7/dd4hep/1.23/x86_64-centos7-gcc11.2.0-opt/q4qtg/bin/ddsim", line 25, in <module>
RUNNER.run()
File "/cvmfs/sw.hsf.org/spackages7/dd4hep/1.23/x86_64-centos7-gcc11.2.0-opt/q4qtg/lib/python3.10/site-packages/DDSim/DD4hepSimulation.py", line 311, 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:FCCee_IDEA_o1_v01.xml [Invalid XML ROOT handle]
dd4hep: while parsing file:FCCee_IDEA_o1_v01.xml
dd4hep: with plugin:DD4hep_XMLLoader
*** Break *** segmentation violation
We cannot really support problems embedded inside lcgeo, Gaudi etc. It would take way off more time to accommodate to all frameworks than to actually solve the underlying problems.
Is there no way to strip down the problem to only use dd4hep, ROOT and Geant4? This would greatly help to debug this problem.
Concerning the material budget with ddsim: You have a problem there which is noit dd4hep related:
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:FCCee_IDEA_o1_v01.xml XercesC FATAL +++ FATAL Error at file "", Line 0 Column: 0 Message:unable to open primary document entity '/afs/cern.ch/user/a/afehr/lcgeo/FCCee/compact/IDEA/IDEA_o1_v01/file:FCCee_IDEA_o1_v01.xml' Traceback (most recent call last): File "/cvmfs/sw.hsf.org/spackages7/dd4hep/1.23/x86_64-centos7-gcc11.2.0-opt/q4qtg/bin/ddsim", line 25, in <module> RUNNER.run() File "/cvmfs/sw.hsf.org/spackages7/dd4hep/1.23/x86_64-centos7-gcc11.2.0-opt/q4qtg/lib/python3.10/site-packages/DDSim/DD4hepSimulation.py", line 311, 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:FCCee_IDEA_o1_v01.xml [Invalid XML ROOT handle] dd4hep: while parsing file:FCCee_IDEA_o1_v01.xml dd4hep: with plugin:DD4hep_XMLLoader *** Break *** segmentation violation
Ah sorry, yep, I forgot to add the ./ in front of the xml file name, but still it doesn't work for me (seg fault), here's the updated log from
ddsim --compactFile ./FCCee_IDEA_o1_v01.xml --runType shell
ddsim_material_budget_updated.log
We cannot really support problems embedded inside lcgeo, Gaudi etc. It would take way off more time to accommodate to all frameworks than to actually solve the underlying problems.
Is there no way to strip down the problem to only use dd4hep, ROOT and Geant4? This would greatly help to debug this problem.
For the ddsim material check I understand, but for the other way of estimating the material budget (cd FCCee/compact/IDEA/IDEA_o1_v01/, sh scripts/check_material_budget.sh), I'm using material_scan.py which is running the DD4hep geometry service under the hood and not much more, how should I further simplify that?
Thank you, Armin
-- Which is the xml file you use to feed the material scans? -- I simply have a problem to reproduce all the problems for debugging. If there are external (unresolved) dependencies then debugging is virtually impossible and any answer can only be speculation. Thank you for understanding.
-- Which is the xml file you use to feed the material scans? -- I simply have a problem to reproduce all the problems for debugging. If there are external (unresolved) dependencies then debugging is virtually impossible and any answer can only be speculation. Thank you for understanding.
The xml file I use is FCCee_IDEA_o1_v01.xml, which then includes Vertex_IDEA_o1_v01.xml.
-- I simply have a problem to reproduce all the problems for debugging. If there are external (unresolved) dependencies then debugging is virtually impossible and any answer can only be speculation.
I think for reproducing the error, you could put the STL shape into any working file of a detector (e.g FCCee_o2_v02.xml, removing the other detector parts) with
<detectors>
<detector id="0" name="Shape_STL" type="DD4hep_SingleShape" vis="CarbonFiberVis">
<material name="CarbonFiber"/>
<box x="10*cm" y="10*cm" z="22*cm" vis="VXDVis"/>
<shape type="CAD_Shape" ref="Assieme_supporti_carbonio.stl" unit="cm">
<position x="104.3837*cm" y="-1.7417*cm" z="-33.7602*cm"/>
</shape>
<position x="0*cm" y="0*cm" z="0*cm"/>
<rotation phi="0*rad" theta="-pi/2*rad" psi="0*rad"/>
</detector>
</detectors>
using the Assieme_supporti_carbonio.stl
STL file from here.
This should work in any DD4hep installation, without further dependencies if I understand correctly.
Thank you for your time, Armin
Hi @armin-ilg
Can you just set /tracking/verbose 1
and then shoot a geantino at different angles (in the geant4 shell via ddsim for example), and see what that reports? That is kind of what (some of) the material scan features do as well, maybe that makes something obvious.
/tracking/verbose 1
Hi @andresailer
Ok, I did the following:
ddsim --compactFile ./FCCee_IDEA_o1_v01.xml --enableG4Gun --runType shell
Idle> /gun/particle geantino
Idle> /tracking/verbose 1
Idle> /gun/number 10
Idle> /run/beamOn
The output again is a *** Break *** segmentation violation
. You can find the complete log here:
ddsim_geantino_DDCAD.log
When commenting out the DDCAD part, it runs without issue. I also again tried using the STL example file (IR_assy_all_colour.stl) instead of my STL file, with the same segmentation violation error coming out.
Thank you for your time, Armin
Thanks for trying this out!
Does the simulation always fail with the CAD geometry or does it only fail for geantinos or for /tracking/verbose
> 0?
If I summarize: The CAD simulation fails here:
#9 0x00007f8f39aabb29 in vecgeom::cxx::HybridManager2::GetABBoxes_v (numberOfNodes=<optimized out>, size=<optimized out>, structure=..., this=<optimized out>) at /cvmfs/sw.hsf.org/spackages7/vecgeom/1.2.1/x86_64-centos7-gcc11.2.0-opt/4fr2x/include/VecGeom/management/HybridManager2.h:102
#10 vecgeom::cxx::HybridNavigator<false>::GetHitCandidates_v (this=this
entry=0x7f8f39c071f0 <vecgeom::cxx::HybridNavigator<false>::Instance()::instance>, accstructure=..., point=..., dir=..., maxstep=4.73747262e+30, hitlist=hitlist
entry=0x7ffdcdd126e0) at /cvmfs/sw.hsf.org/spackages7/vecgeom/1.2.1/x86_64-centos7-gcc11.2.0-opt/4fr2x/include/VecGeom/navigation/HybridNavigator2.h:122
#11 0x00007f8f39aabf5c in vecgeom::cxx::HybridNavigator<false>::BVHSortedIntersectionsLooper<vecgeom::cxx::HybridManager2::HybridBoxAccelerationStructure, vecgeom::cxx::TessellatedImplementation::DistanceToSolid<double, false>(vecgeom::cxx::TessellatedStruct<3ul, double> const&, vecgeom::cxx::Vector3D<double> const&, vecgeom::cxx::Vector3D<double> const&, double const&, double&, int&, double&, int&)::{lambda(std::pair<int, double>)#1}&>(vecgeom::cxx::HybridManager2::HybridBoxAccelerationStructure const&, vecgeom::cxx::Vector3D<double> const&, vecgeom::cxx::Vector3D<double> const&, double, vecgeom::cxx::TessellatedImplementation::DistanceToSolid<double, false>(vecgeom::cxx::TessellatedStruct<3ul, double> const&, vecgeom::cxx::Vector3D<double> const&, vecgeom::cxx::Vector3D<double> const&, double const&, double&, int&, double&, int&)::{lambda(std::pair<int, double>)#1}&) const (userhook=<synthetic pointer>..., maxstep=<optimized out>, localdir=..., localpoint=..., accstructure=..., this=0x7f8f39c071f0 <vecgeom::cxx::HybridNavigator<false>::Instance()::instance>) at /cvmfs/sw.hsf.org/spackages7/vecgeom/1.2.1/x86_64-centos7-gcc11.2.0-opt/4fr2x/include/VecGeom/navigation/HybridNavigator2.h:179
#12 vecgeom::cxx::TessellatedImplementation::DistanceToSolid<double, false> (tessellated=..., point=..., direction=..., stepMax=
0x7ffdcdd60948: 1.7976931348623157e+308, distance=
0x7ffdcdd60938: 1.7976931348623157e+308, isurf=
0x7ffdcdd60930: -1, distother=
0x7ffdcdd60940: 1.7976931348623157e+308, isurfother=
0x7ffdcdd60934: -1) at /cvmfs/sw.hsf.org/spackages7/vecgeom/1.2.1/x86_64-centos7-gcc11.2.0-opt/4fr2x/include/VecGeom/volumes/kernel/TessellatedImplementation.h:255
#13 0x00007f8f39b4e904 in vecgeom::cxx::TessellatedImplementation::Inside<double, int> (inside=<synthetic pointer>: 3, point=..., tessellated=...) at /cvmfs/sw.hsf.org/spackages7/vecgeom/1.2.1/x86_64-centos7-gcc11.2.0-opt/4fr2x/include/VecGeom/volumes/kernel/TessellatedImplementation.h:80
#14 vecgeom::cxx::CommonUnplacedVolumeImplHelper<vecgeom::cxx::TessellatedImplementation, vecgeom::cxx::VUnplacedVolume>::Inside (p=..., this=<optimized out>) at /cvmfs/sw.hsf.org/spackages7/vecgeom/1.2.1/x86_64-centos7-gcc11.2.0-opt/4fr2x/include/VecGeom/volumes/UnplacedVolumeImplHelper.h:145
#15 G4UAdapter<vecgeom::cxx::UnplacedTessellated>::Inside (this=0x103a3660, p=...) at /tmp/gitlab-runner/spack-stage/spack-stage-geant4-11.1.1-jlctn2ni5o7xwzvcby5ckdrhox2s4pol/spack-src/source/geometry/management/include/G4UAdapter.hh:314
#16 0x00007f8f3997dd73 in G4AuxiliaryNavServices::CheckPointOnSurface (locatedOnEdge=false, sampleTransform=..., globalDirection=0x177ec3d0, localPoint=..., sampleSolid=0x103a3660) at /tmp/gitlab-runner/spack-stage/spack-stage-geant4-11.1.1-jlctn2ni5o7xwzvcby5ckdrhox2s4pol/spack-src/source/geometry/navigation/include/G4AuxiliaryNavServices.icc:41
But it is not understood why.... This will be a very difficult one to sort out. I will have to consult Andrei how to get at this in detail.
Thanks for trying this out!
Does the simulation always fail with the CAD geometry or does it only fail for geantinos or for
/tracking/verbose
> 0?
It fails in the same way with /tracking/verbose 0
, and also when I shoot mu- instead of geantino.
I tried to reproduce the results of Armin with his file: Assieme supporti carbonio_1.stl.zip Please see the results here: https://github.com/AIDASoft/DD4hep/pull/1139
@armin-ilg Armin, I do not exactly know what you are doing wrong, but something is very fishy in your setup. Please study merge request 1139
I did all stuff like material scan, overlap checks etc. using your STL file without problems. Though I have to say the coordinate system of your STL is quite weird and I first had to move the entire setup somewhere close to the origin.
I do not see any problems.
@armin-ilg Armin, I do not exactly know what you are doing wrong, but something is very fishy in your setup. Please study merge request 1139
I did all stuff like material scan, overlap checks etc. using your STL file without problems. Though I have to say the coordinate system of your STL is quite weird and I first had to move the entire setup somewhere close to the origin.
I do not see any problems.
Thank you very much for your help @MarkusFrankATcernch and @andresailer. It is indeed an issue of my local setup. I must have done something wrong in the installation of my local k4geo repo. It works for me as well now by installing k4geo with
source /cvmfs/sw-nightlies.hsf.org/key4hep/releases/2023-06-29/x86_64-centos7-gcc12.2.0-opt/key4hep-stack/2023-06-29-c6wpxe/setup.sh
# Central dd4hep
source $DD4hep_DIR/bin/thisdd4hep.sh
cmake -DBoost_NO_BOOST_CMAKE=ON ..
make -j4 install
source ../bin/thislcgeo.sh
export PYTHONPATH=${LCIO}/src/python:${ROOTSYS}/lib:$PYTHONPATH
Overlap checks work now. Material budget scans using g4MaterialScan are meaningful as well, though using the material budget estimation from FCCSW is still producing wrong results, I'll open an issue there.
Thank you very much for your support, Armin
OS version: lxplus, key4hep stack of 2023-04-08
Reproduced by: Using my local k4Geo/lcgeo version , installing as follows
and then running material budget check with
Input: Files in
FCCee/compact/IDEA/IDEA_o1_v01/
of my local k4Geo/lcgeo installation, and this STL file: Assieme supporti carbonio_1.stl.zipOutput: full build build.log and log check_material_budget.log
Goal: I'm trying to import shapes via DDCAD and check for overlaps with the rest of the detector (see also #1121) and to measure the material budget (this report). The material budget distribution however doesn't make sense at all. The material depth is absurdely large (see depth.pdf) and dominates all other detector components. This results in a very large material budgetr as welli (x0.pdf). What is strange is that also at eta=0 there is a non-zero material length, although there should clearly be nothing there: The stl shape should be positioned correctly however (seen in teveDisplay).
I also tried to check the material budget with ddsim:
which however results in a seg fault (ddsim_material_budget.log).
I also tried to use the example STL file from examples/DDCAD/models/STL/IR_assy_all_colour.stl instead of my shape, and also the material budget check in ddsim doesn't run and the material depth is absurdely large (1800 cm, see depth_IR.pdf).
Am I doing something wrong? I tried putting the DDCAD import inside of a box using
DD4hep_SingleShape
and tried using CAD_Assembly, CAD_MultiVolume and CAD_Shape, but to no avail.Thank you for your help!