Visualising a detector geometry

In order to implement and validate a detector geometry in DD4hep, it is important to be able to visualise it. This wiki explores the existing options. Lots of thanks to Nikiforos Nikiforou for explaining how everything works.

Geometry description formats

There are various formats used to describe a detector geometry. The info in the compact.xml is not enough to describe the detector - drivers are needed to expand info from the XML and create all the volumes. Mokka or SLIC for example create ways of inputting objects in Geant4 without programming volumes in Geant4.

  • GDML (Geant4, ROOT)
  • LCDD (GeomConverter) - LCDD is GDML augmented by sensitive detector info including cell id specs.
  • HEPREP
  • XML - all of the above are XML formats

Format conversions

How to create the LCDD file:

From GeomConverter - start with GeomConverter's compact.xml (from here, for example), use the java converter to produce the LCDD file:

cd /afs/cern.ch/eng/clic/software/GeomConverter/GeomConverter-2_4/target
Convert by doing
java -jar GeomConverter-2.4-bin.jar -o lcdd <input> <output>

One can then delete by hand all sensitive detector info to be left with a pure GDML file.

From SLIC, use

slic -g clic-sid_cdr.lcdd
for example to load the geometry in memory, then
slic -G clic-sid_cdr.lcdd
to dump the geometry. This allows to see how SLIC loads the geometry, basically debugging SLIC as well. ALERT! Beware of some bugs in SLIC related to assemblies and the order of rotations.

From DD4hep, use

geoConverter -compact2lcdd -input compact.xml -output dd4hep.lcdd
gGeoManager->Export(“clic-crr.gdml”) 
or use Export(“clic-crr.root”) to export in ROOT format.

From Mokka, one can create a GDML file with

/Mokka/Visu/Detector/DumpGDML 
By default this will dump the World volume (whole detector) in World.gdml. If one provides a subdetector as argument, it will dump just the subdetector. See the help function for more info.

ALERT! Beware of bug related to VACUUM material (delete the VACUUM and dummy entries by hand). One can also create a Gear file etc.

Visualisation

To visualise a GDML file in ROOT: open ROOT, then

TGeoManager::Import(“myclic.gdml”);
gGeoManager->GetTopVolume()->Draw(“ogl”); 
where ogl selects the OpenGL engine. All figures from this section were produced like that.

From SLIC, do

source ~/ilc_soft/slic/v03-01-06/init_ilcsoft.sh 
slic -g clic-sid_cdr.lcdd -n
to get a Geant4 prompt, i.e. a Geant4 interface with the geometry loaded; use Geant4 commands like to visualise the geometry:
Idle> /vis/open OGL
Idle> /vis/scene/create 
Idle> /vis/drawVolume
Idle> /vis/viewer/set/viewpointThetaPhi 60 45
Idle> /vis/viewer/set/background white
which, with this geometry, will display something like this:

slic-view.png

From Mokka, one can visualise the DB geometry via Geant4 as above. See this example.

To visualise a HEPREP file use jas3. With the SLIC setup described above, one can see the GUI by doing:

java -jar GeomConverter-2.4-bin.jar
Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng slic-view.png r1 manage 42.8 K 2014-06-24 - 13:57 DanProtopopescu SLIC/Geant4 view of the clic_sid_cdr geometry
Topic revision: r5 - 2014-06-24 - DanProtopopescu
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback