source: trunk/source/geometry/solids/test/SurfaceChecker/testall.pl@ 1354

Last change on this file since 1354 was 1350, checked in by garnier, 15 years ago

update to last version 4.9.4

  • Property svn:executable set to *
File size: 2.4 KB
RevLine 
[1350]1#!/usr/bin/perl -w
2
3# Author: Oliver Link
4#
5# Mon May 23 18:02:09 CEST 2005
6#
7# Script to test systematically solids with SurfaceChecker
8# For every solid a hbook file will be generated in folder hbk
9# eg. for 500 events , G4Box: hbk/run_Box_500.hbk
10# Attention: already existing hbk files will be replaced
11
12use strict ;
13
14# list of solids for testing
15my @solids = qw/Tet Trap Torus Box Sphere Tube Orb Cons TwistedTubs TwistedBox
16 TwistedTrd TwistedTrap Ellipsoid EllipticalCone EllipticalTube Hype Shell
17 HalfSphere HollowSphere Shell/ ;
18
19#@solids = ("EllipticalCone" ) ; # in case if you want to process just one solid...
20
21my $nevents = 100000 ; # sets the number of events
22
23# --------------------------------------------------------------------------
24
25
26my $macro ; # the name of the macro file. Will be deleted at the end.
27my $data ; # output file of SurfaceChecker. Will be deleted at the end.
28my $hbk ; # resulting hbook file.
29
30
31foreach my $solid ( @solids ) {
32
33 $macro = "run_$solid" . ".mac" ;
34 $data = "data/run_$solid" . "_$nevents" . ".data" ;
35 $hbk = "hbk/run_$solid" . "_$nevents" . ".hbk" ;
36
37 $data =~ tr/A-Z/a-z/ ; # paw dosn't like capital letters for files
38 $hbk =~ tr/A-Z/a-z/ ;
39
40 print "process solid $solid: $macro --> $data\n" ;
41
42# prepare the macro file for the G4 application
43
44 open(FH,">$macro") || die "cannot open file $macro:$!\n" ;
45
46 print FH "/run/initialize\n" ;
47 print FH "/mydet/SelectDetector $solid\n" ;
48 print FH "/gun/particle geantino\n" ;
49 print FH "/run/beamOn $nevents\n" ;
50
51 close(FH) || die "cannot close file $macro:$!\n" ;
52
53# run SurfaceChecker application and redirect output to data file
54
55 system("SurfaceChecker $macro > $data") && die "cannot execute SurfaceChecker for macro $macro to file $data:$!\n" ;
56
57# Convert data to hbook file. Attention: already existing hbk files will be deleted
58 if ( -e $hbk ) {
59 print " >>>> Attention: file $hbk exists already. It will be replaced by a new version...\n" ;
60 unlink($hbk) || die "cannot delete file $hbk:$!\n" ;
61 }
62 system("extract.pl > /dev/null") && die "cannot execute extract.pl:$!\n" ;
63
64# delete temporary macro/data files. Uncomment the lines if you want to keep the files.
65
66 unlink($macro) || die "cannot delete file $macro:$!\n" ;
67 unlink($data) || die "cannot delete file $data:$!\n" ;
68
69}
70
71system(" paw -w 0 -b solid > /dev/null") && die "cannot execute paw macro solid:$!\n" ;
Note: See TracBrowser for help on using the repository browser.