Re: geant to ROOT

Rene Brun (Rene.Brun@cern.ch)
Thu, 25 Jun 1998 19:05:29 +0200


Jayoung Wu wrote:
>
> Hi rooters,
>
> Is there any documents for converting geant simulation code to ROOT code?
> ^^^^^^^^^^^^^^^^^^^^^
> especially geometry setup for a detector
>
> ---

The program g2root distributed on most systems in $ROOTSYS/bin/g2root
converts a Geant3 geometry file into Root C++ geometry.
Here are the comments in the program header

* Program to convert an existing GEANT geometry/RZ file
* into a ROOT macro (C++ file).
*
* To use this conversion program (in $ROOTSYS/bin),
* g2root geant_rzfile macro_name
*
* for example
* g2root na49.geom na49.C
* will convert the GEANT RZ file na49.geom into a ROOT macro na49.C
*
* To generate the Geometry structure within Root, do:
* Root > .x na49.C
* Root > na49.Draw()
* Root > wh.x3d() (this invokes the 3-d Root viewver)
* Root > TFile gna49("na49.root","NEW") //open a new root file
* Root > na49.Write() //Write the na49 geometry
structure
* Root > gna49.Write() //Write all keys (in this
case only one)

A second program called gh2root
see http://root.cern.ch/root/gh2root.html
generates automatically C++ code corresponding to the Geant3
Zebra structures JSET,JVERTX,JKINE,JHITS and JDIGI.

Rene Brun