Message: Re: Generating a geometry GDML file Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Generating a geometry GDML file 

Forum: Geometry
Re: Question Generating a geometry GDML file (Luis Alejandro Perez Perez)
Re: News Re: Generating a geometry GDML file (Michael H. Kelsey)
Date: 20 Jul, 2015
From: Luis Alejandro Perez Perez <Luis Alejandro Perez Perez>

Dear Michael.

I just tried your suggestion and it seems it doesn't work. I installed 
the XercesC library in my lapton (which uses Ubuntu 14.04 LTS). The 
package is installed in the directory,

/usr/lib/x86_64-linux-gnu/libxerces-c.so

So, when I compile Geant4 I do the following,

- iniside the geant4-XXXX-build directory I do,

cmake -DCMAKE_INSTALL_PREFIX=/path/geant4-XXX-install/ 
-DGEANT4_USE_OPENGL_X11=ON -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_QT=ON 
-DGEANT4_USE_G3TOG4=ON  -DG4MULTITHREADED=ON 
-DGEANT4_BUILD_TLS_MODEL=global-dynamic  -DGEANT4_USE_GDML=ON 
-DXERCESC_INCLUDE_DIR=/usr/lib/x86_64-linux-gnu/ 
-DXERCESC_LIBRARY=/usr/lib/x86_64-linux-gnu/libxerces-c.so /path/geant4-XXX/

- I then do
  >$ make
  >$ make install

The compilation works.

Then, in my application I do the following in the main function (after 
runManager->Initialize()),

  G4String command;
  command = "/control/verbose 0";
  UImanager->ApplyCommand(command);
  command = "/run/verbose 0";
  UImanager->ApplyCommand(command);
  command = "/event/verbose 0";
  UImanager->ApplyCommand(command);
  command = "/tracking/verbose 0";
  UImanager->ApplyCommand(command);

  command = "/vis/disable";
  UImanager->ApplyCommand(command);

   command = "/run/initialize";
   UImanager->ApplyCommand(command);

   //Writing a gdml file with the geometry
   TString TheGDMLCommand = TString("/persistency/gdml/write 
Mygeometry.gdml");
   command = TheGDMLCommand.Data();
   UImanager->ApplyCommand(command);

   TheGDMLCommand = TString("/run/beamOn  10");
   command = TheGDMLCommand.Data();
   UImanager->ApplyCommand(command);

The code seems to be working OK, but I don't get the gdml file at the end.

Do you guys have any suggestions?

Many thanks,

   Alejandro


On 07/17/2015 08:25 PM, Michael H. Kelsey wrote:
> *** Discussion title: Geometry
>
> On Fri, 17 Jul 2015 15:44:53 GMT, Luis Alejandro Perez Perez wrote:
>
>> I am writing an application for simulating beam test setups with silicon detector telescopes. I would
>> already wrote a code for doing this but would like to generate a gdml file with the geometry description
>> to visualize it later with root. Is there a systematic way of doing this in Geant4?
> Yes, it's quite easy to both write and read GDML files with Geant4. You
> will have to the external XercesC library installed on your system (see
> the Geant4 Installation Guide), and set the following CMake flags:
>
>      cmake -DGEANT4_USE_GDML=ON -DXERCESC_INCLUDE_DIR=<whatever> -DXERCESC_LIBRARY=<whatever>/libxerces-c.so <other-cmake-stuff>
>
> (or .dylib on MacOSX). You can use |ccmake| interactively; the XercesC
> stuff is in the Advanced options.
>
> Once your geometry has been built (i.e., after |/run/initialize|), use
> the command
>
>    /persistency/gdml/write <filename>
>
> to dump your geometry to a GDML file.
>
> Note that the geometry file produced this way is not particularly
> friendly to humans. All of the names (of materials, of solids, and of
> volumes) have the hexadecimal pointer from your G4 job appended:
>
>      <isotope N="54" Z="26" name="Fe540xb9b7ef0">
>        <atom unit="g/mole" value="53.9396"/>
>      </isotope>
>
>      <subtraction name="Shield-OuterPoly0xd643bc0">
>        <first ref="Tube10xd643a60"/>
>        <second ref="Tube20xd643b20"/>
>        <position name="Shield-OuterPoly0xd643bc0_pos" unit="mm" x="0" y="0" z="25.4"/>
>      </subtraction>
>
>      <volume name="Shield-InnerLead0xd643160">
>        <materialref ref="G4_Pb0xb9b6970"/>
>        <solidref ref="Shield-InnerLead0xd643010"/>
>      </volume>
>
> I wrote myself a script to process the GDML file and strip out all this
> cruft, but it's kind of annoying.
>
> There is an external library you might want to try. VGM (
> http://ivana.home.cern.ch/ivana/VGM.html ), written by one of our Geant4
> collaborators, Ivan Hrivnacova, provides interconversion between a few
> different geometry formats, including G4, ROOT, and GDML. The GDML
> output from VGM is more human friendly.
>
>    -- Michael Kelsey
>
> -------------------------------------------------------------
> Visit this GEANT4 at hypernews.slac.stanford.edu message (to reply or unsubscribe) at:
> http://hypernews.slac.stanford.edu/HyperNews/geant4/get/geometry/1423/1.html

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: Generating a geometry GDML file   (Ivana Hrivnacova - 12 Aug, 2015)
2 None: Re: Generating a geometry GDML file   (Ivana Hrivnacova - 12 Aug, 2015)
3 None: Re: Generating a geometry GDML file   (Ivana Hrivnacova - 12 Aug, 2015)
1 Question: Re: Generating a geometry GDML file   (Leonardo Ghizoni - 20 Sep, 2015)
(_ Idea: Re: Generating a geometry GDML file   (Leonardo Ghizoni - 22 Sep, 2015)
 Add Message Add Message
to: "Re: Generating a geometry GDML file"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]