Links

Content Skeleton

This Page

Previous topic

Export Usage

Next topic

Export All

EXPORT GEANT4 GEOMETRY INTO VRML, GDML AND DAE

From script usage:

export.sh VGDX DayaBay
export.sh VGDX Lingao
export.sh VGDX Far

GDB=1 export.sh VGDX Far

Promoting from export into opticksdata

Select what to promote:

simon:opticks blyth$ opticksdata-;opticksdata-find-ls
-rw-r--r--  1 blyth  staff  7126305 Jun  7 20:12 /Users/blyth/opticksdata/export/DayaBay_VGDX_20140414-1300/g4_00.dae
-rw-r--r--  1 blyth  staff  8918916 Jun  7 20:12 /Users/blyth/opticksdata/export/Far_VGDX_20140414-1256/g4_00.dae
-rw-r--r--  1 blyth  staff  7126139 Jun  7 20:12 /Users/blyth/opticksdata/export/Lingao_VGDX_20140414-1247/g4_00.dae
-rw-r--r--  1 blyth  staff  78630 Jun  7 20:12 /Users/blyth/opticksdata/export/LXe/g4_00.dae

simon:optickscore blyth$ export-;export-find-ls
-rw-r--r--  1 blyth  staff  7126305 Apr 14  2014 /usr/local/env/geant4/geometry/export/DayaBay_VGDX_20140414-1300/g4_00.dae
-rw-r--r--  1 blyth  staff  8918916 Apr 14  2014 /usr/local/env/geant4/geometry/export/Far_VGDX_20140414-1256/g4_00.dae
-rw-r--r--  1 blyth  staff  7126139 Apr 14  2014 /usr/local/env/geant4/geometry/export/Lingao_VGDX_20140414-1247/g4_00.dae
-rw-r--r--  1 blyth  wheel  78630 May  5  2014 /usr/local/env/geant4/geometry/export/LXe/g4_00.dae

-rw-r--r--  1 blyth  staff  5228932 Oct 14  2014 /usr/local/env/geant4/geometry/export/DayaBay_VGDX_20140414-1300/g4_00.dae.noextra.dae
-rw-r--r--  1 blyth  staff  260565 Mar  5 15:09 /usr/local/env/geant4/geometry/export/dpib/cfg4.dae
-rw-r--r--  1 blyth  staff  210955 Jul 22  2015 /usr/local/env/geant4/geometry/export/juno/nopmt.dae
-rw-r--r--  1 blyth  staff  25782981 Aug 25  2015 /usr/local/env/geant4/geometry/export/juno/t3.dae
-rw-r--r--@ 1 blyth  staff  6406279 May 25  2014 /usr/local/env/geant4/geometry/export/juno/test.dae
-rw-r--r--@ 1 blyth  staff  4200320 Aug 21  2015 /usr/local/env/geant4/geometry/export/juno/test.nometa.dae
-rw-r--r--@ 1 blyth  staff  6430314 May 25  2014 /usr/local/env/geant4/geometry/export/juno/test2.dae
-rw-r--r--  1 blyth  staff  25782981 Jul 21  2015 /usr/local/env/geant4/geometry/export/juno/test3.dae
-rw-r--r--  1 blyth  staff  16262853 Aug 21  2015 /usr/local/env/geant4/geometry/export/juno/test3.nometa.dae

Check the command, then pipe to shell:

simon:optickscore blyth$ export-copy- dae test3
mkdir -p /Users/blyth/opticksdata/export/juno
cp /usr/local/env/geant4/geometry/export/juno/test3.dae /Users/blyth/opticksdata/export/juno/test3.dae

Hmm thats too big for comfort, but proceed anyhow:

simon:opticksdata blyth$ du -h  export/juno/test3.dae
 25M    export/juno/test3.dae

simon:opticksdata blyth$ export-copy-all-  cfg4
cp /usr/local/env/geant4/geometry/export/dpib/cfg4.dae /Users/blyth/opticksdata/export/dpib/cfg4.dae
simon:opticksdata blyth$
simon:opticksdata blyth$ export-copy-all-  cfg4  | sh
simon:ana blyth$ opticksdata-find-du
6.8M    /Users/blyth/opticksdata/export/DayaBay_VGDX_20140414-1300/g4_00.dae
256K    /Users/blyth/opticksdata/export/dpib/cfg4.dae
8.5M    /Users/blyth/opticksdata/export/Far_VGDX_20140414-1256/g4_00.dae
 25M    /Users/blyth/opticksdata/export/juno/test3.dae
6.8M    /Users/blyth/opticksdata/export/Lingao_VGDX_20140414-1247/g4_00.dae
 80K    /Users/blyth/opticksdata/export/LXe/g4_00.dae

Rationalize IDPATH_DPIB_PMT

simon:env blyth$ find . -name '*.*' -type f -exec grep -H IDPATH_DPIB_PMT {} \;
Binary file ./_build/doctrees/graphics/ggeoview/geometry_review.doctree matches
./graphics/ggeoview/geometry_review.rst:    48 export IDPATH_DPIB_PMT=/usr/local/env/geant4/geometry/export/dpib/cfg4.6f627a3ec05405cbcfff6bd479fbdd37.dae
./graphics/ggeoview/geometry_review.rst:     146                  pmtpath=$IDPATH_DPIB_PMT/GMergedMesh/0
./graphics/ggeoview/ggv.bash:                 pmtpath=$IDPATH_DPIB_PMT/GMergedMesh/0
./numerics/npy/analytic_cf_triangulated.py:    #base = os.path.expandvars("$IDPATH_DPIB_PMT/GMergedMesh/0")
./numerics/npy/mesh.py:    DPIB_PMT = os.path.expandvars("$IDPATH_DPIB_PMT");
Binary file ./optix/ggeo/.GGeoTestConfig.cc.swp matches
./optix/ggeo/GGeoTestConfig.cc:    "pmtpath=$IDPATH_DPIB_PMT/GMergedMesh/0_"
simon:env blyth$

issue : not producing exports on G5

Seems to run but no files:

[blyth@ntugrid5 ~]$ export.sh VGDX DayaBay
=== dyb-- : defining dyb function
=== dyb-- : invoking "dyb dybgaudi"
#CMT> The tag ntu_tarurl is not used in any tag expression. Please check spelling
=== dyb-- : invoking "dyb dybdbi"
#CMT> The tag ntu_tarurl is not used in any tag expression. Please check spelling
G4DAE_EXPORT_LOG=/home/blyth/local/env/geant4/geometry/export/DayaBay_VGDX_20160519-1934/export.log
G4DAE_EXPORT_SITE=DayaBay
G4DAE_EXPORT_DIR=/home/blyth/local/env/geant4/geometry/export/DayaBay_VGDX_20160519-1934
G4DAE_EXPORT_SEQUENCE=VGDX

On D GDML symbols in libG4persistency.dylib:

simon:lib blyth$ nm libG4persistency.dylib | grep GDML | c++filt

Huh on G5 no such lib, need DYBX perhaps:

blyth@ntugrid5 Linux-g++]$ l libG4pers*
ls: cannot access libG4pers*: No such file or directory
[blyth@ntugrid5 Linux-g++]$ pwd
/home/blyth/local/env/dyb/external/build/LCG/geant4.9.2.p01/lib/Linux-g++

Relation of export-name to GCache idp dir

GCache dir is beneath the export-name dir as it represents, via the digest in the name, the geometry volume selection used to create the cache.

delta:cu blyth$ export-;export-name dyb
/usr/local/env/geant4/geometry/export/DayaBay_VGDX_20140414-1300/g4_00.dae
delta:cu blyth$ idp
delta:g4_00.96ff965744a2f6b78c24e33c80d3a4cd.dae blyth$
delta:g4_00.96ff965744a2f6b78c24e33c80d3a4cd.dae blyth$ pwd
/usr/local/env/geant4/geometry/export/DayaBay_VGDX_20140414-1300/g4_00.96ff965744a2f6b78c24e33c80d3a4cd.dae

How the export works

Critical part of nuwa.py module export_all.py hooks up the export G4 RunAction:

69     # --- WRL + GDML + DAE geometry export ---------------------------------
70     from GaussTools.GaussToolsConf import GiGaRunActionExport, GiGaRunActionCommand, GiGaRunActionSequence
71     export = GiGaRunActionExport("GiGa.GiGaRunActionExport")
72
73     giga.RunAction = export
74     giga.VisManager = "GiGaVisManager/GiGaVis"
75
76     import DetSim
77     DetSim.Configure(physlist=DetSim.physics_list_basic,site=site)
delta:env blyth$ find . -name 'GiGaRunActionExport.*'
./geant4/geometry/GaussTools/src/Components/GiGaRunActionExport.cpp
./geant4/geometry/GaussTools/src/Components/GiGaRunActionExport.h
530 void GiGaRunActionExport::WriteDAE(G4VPhysicalVolume* wpv, const G4String& path, G4bool recreatePoly  )
531 {
532 #ifdef EXPORT_G4DAE
533    if(path.length() == 0 || wpv == 0){
534        std::cout << "GiGaRunActionExport::WriteDAE invalid path OR NULL PV  " << path << std::endl ;
535        return ;
536    }
537    std::cout << "GiGaRunActionExport::WriteDAE to " << path << " recreatePoly " << recreatePoly << std::endl ;
538    G4DAEParser parser ;
539    G4bool refs = true ;
540    G4int nodeIndex = -1 ;   // so World is volume 0
541    parser.Write(path, wpv, refs, recreatePoly, nodeIndex );
542 #else
543    std::cout << "GiGaRunActionExport::WriteDAE BUT this installation  not compiled with -DEXPORT_G4DAE " << std::endl ;
544 #endif
545 }

Explore Id Mapping export

export.sh MX DayaBay

Notable Exports

To make exports easily accessible from multiple machines, they are stored on cms02 webserver. Grab the g4_00.dae from the export directory on N with:

[root@cms02 downloads]# export-pull Lingao_VGDX_20140414-1247

Belle7 down, so custom copy

cmd="scp N:$(NODE_TAG=N EXPORT_EXT=gdml export-name dyb) $(EXPORT_EXT=gdml export-name dyb)"
echo $cmd
   scp N:/data1/env/local/env/geant4/geometry/export/DayaBay_VGDX_20140414-1300/g4_00.gdml /usr/local/env/geant4/geometry/export/DayaBay_VGDX_20140414-1300/g4_00.gdml
eval $cmd

Getting Exports

Browse available exports at

Grab with:

export-
export-get

Getting CerenkovStep/ScintillationStep files

delta:~ blyth$ export-cerenkov-get
mkdir -p /usr/local/env/cerenkov && scp G5:/home/blyth/local/env/cerenkov/1.npy /usr/local/env/cerenkov/1.npy

delta:~ blyth$ export-cerenkov-get | sh
1.npy                                                                                               100%  747KB 746.9KB/s   00:01

Administrator: Placing Exports

Formerly kept in cms02 apache htdocs:

[blyth@cms02 env]$ ll /data/env/system/apache/httpd-2.0.64/htdocs/env/geant4/geometry/export/
total 40
drwxr-xr-x  2 blyth blyth 4096 Apr 14 12:51 Lingao_VGDX_20140414-1247
drwxr-xr-x  2 blyth blyth 4096 Apr 14 12:59 Far_VGDX_20140414-1256
drwxr-xr-x  2 blyth blyth 4096 Apr 14 13:04 DayaBay_VGDX_20140414-1300

[blyth@cms02 export]$ du -hs *
6.9M    DayaBay_VGDX_20140414-1300
8.6M    Far_VGDX_20140414-1256
6.9M    Lingao_VGDX_20140414-1247
  1. env-htdocs-rsync assuming creation into htdocs. Export machinery predates that.
  2. new approach, need to push to bitbucket from /Users/blyth/simoncblyth.bitbucket.org/env/geant4/geometry/export/ in order to appear http://simoncblyth.bitbucket.org/env/geant4/geometry/
    • hmm, bitbucket does not provide automatic directories,
      • generate some html OR base on RST and include in notes ?
delta:geometry blyth$ pwd
/Users/blyth/simoncblyth.bitbucket.org/env/geant4/geometry
delta:geometry blyth$ l
total 0
drwxr-xr-x  4 blyth  staff  136 Apr 27 11:57 collada

For now, just manually grab:

delta:export blyth$ scp -r N:/data1/env/local/env/geant4/geometry/export/DayaBay_MX_20140916-2050 .

Export Environment Setup

Following nuwa integration changes need to use DYBX installation “geant4_with_dae” for this otherwise the export runs without error but no exports happen, as preprocessor not enabled in the compile of standard installation

ACTION CONTROLLED BY ENVVARS

G4DAE_EXPORT_SEQUENCE
envvar is set based on the script argument controls the formats and their order of export

Meaning of the G4DAE_EXPORT_SEQUENCE control characters:

V
VRML WriteVis, same as “IF”
I
VRML InitVis
F
VRML FlushVis
D
Write DAE, without poly recreation : unless not existing already
A
Write DAE, with forced poly recreation
G
Write GDML
C
Clean SolidStore
X
Abrupt Exit

FUNCTIONS

export-cf
parses WRL and DAE files writing SQLite DB with geom, point and face tables. Connects the DB into an sqlite3 session.

MALLOC DEBUGGING

MALLOC_CHECK_=1
Propagated to libc M_CHECK_ACTION, 1 means deatailed error message but continue
LIBC_FATAL_STDERR_=1
Rather than /dev/tty to allow redirection, to allow correlation of the corruption with stdout