Geometry validation
Once the desired geometry is implemented in DD4hep, one need a way to compare it with the existing descriptions from Mokka or GeomConverter. This wiki describes several options for doing this. Lots of thanks to Andrei Gheață and Nikiforos Nikiforou for demonstrating how everything works.
Visual validation
First step is of course visual validation.To compare by eye an existing geometry with the newly implemented geometry in DD4hep, one should use the visualisation tools described in the
VisuDet wiki.
Checking overlaps
Let's say we start with the
examples/CLICSiD
geometry and we remove everything except the ECal Barrel and EndCap components.
Running
./geoDisplay compact/ECal.xml
as described
here, we load this geometry in memory and display it using the TGeo class from ROOT:
To check overlaps or extrusions, from ROOT prompt run
root [0] gGeoManager->CheckOverlaps(0.01);
where the precision is given in
cm
. This will report any overlaps/extrusions:
...
Info in <TGeoNodeMatrix::CheckOverlaps>: Number of illegal overlaps/extrusions : 31
To visualise the overlaps/extrusions, navigate in the ROOT
TBrowser
to
world →
Illegal overlaps and you will be able to see something like this:
The offending subvolumes are highlighted in red. One can use:
gGeoManager->cd(“/path/to/volume/”); // to check only a subvolume
gGeoManager->GetPath(); // to see path
gGeoManager->getCurrentNode()->CheckOverlaps(0.01);
gGeoManager->PrintOverlaps();
Shooting particles with Geant4/SLIC
One can shoot particles using
SLIC MC, and save output to a slcio file, then use
anajob
or
dumpevent
to compare hit positions.
To do this, setup
ilcsoft
to get access to
SLIC and the LCIO libraries (for later processing of slcio files). Then create a file, e.g.
particleGun.mac
, containing something like this:
/run/initialize
/generator/select gps
/gps/pos/type Point
/gps/pos/centre 0. 0. 0.
/gps/ang/type iso
/gps/ang/mintheta 90 deg
/gps/ang/maxtheta 90 deg
/gps/ang/minphi 10 deg
/gps/ang/maxphi 10 deg
/gps/ene/type Mono
/gps/ene/mono 99.8944 GeV
/gps/ene/gradient 0
/gps/ene/intercept 1
/gps/particle mu-
/random/seed 123456789
/run/beamOn 1
Run
SLIC, loading the geometry and running this macro:
slic -g geometry.lcdd -m particleGun.mac
This will create a file named
outfile.slcio
. Now run:
anajob outfile.slcio
to see hit counts, or
dumpevent outfile.slcio 1
or use
dumpHits.py
(
attached, modify at will) to print various hit parameters.
Stress tests
If you don't have that already, then
install your own version of ROOT, so that you can customise it. Then go to
$ROOTSYS/test
and edit
stressGeometry.cxx
to add a custom entry, in my case a
diff
shows these changes:
[protopop@ppelx ECal]$ diff $ROOTSYS/test/stressGeometry.cxx.orig $ROOTSYS/test/stressGeometry.cxx
78c78
< const Int_t NG = 33;
---
> const Int_t NG = 34;
82a83
> "clicd",
116a118
> 1, //clicd - added by protopop@cern.ch
150a153
> 0.4, //clicd
184a188
> {750,750,1000}, // clicd
then recompile
make stressGeometry
and run
stressGeometry clicd
This will generate a reference file called
clicd_ref_1.root
and put it in
$ROOTSYS/test/files
.