|Message: Re: Generating a geometry GDML file||Not Logged In (login)|
Click on the Forum title, e.g. on the "Forums by Category" page, to read a sequence of postings to the Forum and its threads all in one page. If you are only interested in one thread or the thread following a specific posting, click the thread or the posting, which takes you to a smaller page, which contains only the part you are interested in and may be easier to navigate.
Messages are "chained" if there are only replies at the first level, i.e. 1/1.html, 1/1/1.html etc. In case of "chained" messages the message number is replaced by the icon and there is no indentation.
Inline: Display the subject line only or also the text of the posting(s); for the choice "All" the "Outline" choices are switched off.
|1||0||1||no text / full text of posting|
|2||1||All||text for level 1 only / text for All postings|
Outline: Choose the depth of the posting thread, successive toggle controls provide increasing detail.
|1||2||1||2 levels / 1 level (original posting)|
|2||3||2||3 levels / 2 levels|
|3||3||All||3 levels / all levels (all postings)|
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:||Outline Depth:||Add message:|