#!/usr/bin/perl -w ###################################################################### # This Perl script will generate a geometry file to use # with IceCube simulations. # Author: Joakim Edsjo, edsjo@physto.se # Date: December 29, 1999 ###################################################################### use Getopt::Std; ######### SETUP and INPUT ########## $ver="1.0, December 29, 1999"; ### Parse input arguments getopts('s:o:v:g:p:h',\%opts); if ($opts{"h"}) { # Help required print< meters. Default: 125 m. -o number Number of OMs on each string. Default: 60 -v number Vertical spacing between OMs (meters). Default: 16 m. -g number Number of grid points in x and y, i.e. a x grid centered around (0,0) will be generated. Default: 9 -p number What pulse shape to use. Default: 5 (square pulse) -h Show this help. Joakim Edsjo, edsjo\@physto.se END die "-- gen-square version $ver --\n"; } if ($opts{'s'}) { $stringspacing=$opts{'s'}; } else { $stringspacing=125; } if ($opts{'o'}) { $omperstring=$opts{'o'}; } else { $omperstring=60; } if ($opts{'v'}) { $verticalspacing=$opts{'v'}; } else { $verticalspacing=16; } if ($opts{'g'}) { $gridpoints=$opts{'g'}; } else { $gridpoints=9; } if ($opts{'p'}) { $pulseshape=$opts{'p'}; } else { $pulseshape=5; } if (@ARGV>0) { # output file given $geofile=shift; } else { # generate output file name $geofile="ice.${gridpoints}_${stringspacing}m.${omperstring}_" . "${verticalspacing}m"; if ($pulseshape == 5) { $geofile .= ".sp.geo"; } else { $geofile .= ".${pulseshape}.geo"; } $geofile =~ s/\s+//g; } print "Welcome to gen-square.pl\n"; print "Will create the geometry file: $geofile\n"; open(GEO,">$geofile") || die "Can't open geometry file $geofile for writing: $!\n"; geo_header(); $zlow=-($omperstring-1)*$verticalspacing/2; $xlow=-($gridpoints-1)*$stringspacing/2; $ylow=-($gridpoints-1)*$stringspacing/2; $omi=0; for ($xi=0; $xi<$gridpoints; $xi++) { for ($yi=0; $yi<$gridpoints; $yi++) { for ($zi=0; $zi<$omperstring; $zi++) { $omi++; $x=$xlow+$xi*$stringspacing; $y=$ylow+$yi*$stringspacing; $z=$zlow+$zi*$verticalspacing; geo_line($omi,$x,$y,$z); } } } ############### SUBROUTINES ############### sub geo_header { # Print geomtry file header to output file. $date=localtime(); print GEO <