| 1 | #!/usr/local/bin/perl -w
|
|---|
| 2 | #############################################################
|
|---|
| 3 | # JOBS-MC.daemon v. 0.01
|
|---|
| 4 | # Copyright (c) J C Gonzalez, 1998 - All rights reserved
|
|---|
| 5 | #------------------------------------------------------------
|
|---|
| 6 | # Perl script for running automatically the MC generation
|
|---|
| 7 | # program.
|
|---|
| 8 | #############################################################
|
|---|
| 9 | #
|
|---|
| 10 |
|
|---|
| 11 | use strict;
|
|---|
| 12 | use vars qw(
|
|---|
| 13 | $VERSION $PROGRAM $SYSDIR $COPYRIGHT $USER $EXECCOR
|
|---|
| 14 | $uptime $DISK $MOTHERDIR $NICE $TOP $TEL
|
|---|
| 15 | $MINN $SITE
|
|---|
| 16 | $Spectral_Index
|
|---|
| 17 | @energies @energies2
|
|---|
| 18 | @nshowers
|
|---|
| 19 | @primaries
|
|---|
| 20 | @Theta
|
|---|
| 21 | @Phi
|
|---|
| 22 | $Energy1 $Energy2
|
|---|
| 23 | $Primary
|
|---|
| 24 | $Set
|
|---|
| 25 | $MACH_CRITICAL
|
|---|
| 26 | $MACH_BAD
|
|---|
| 27 | $MACH_GOOD
|
|---|
| 28 | $MACH_VERYGOOD
|
|---|
| 29 | $MAXDISK $MAXTAPE
|
|---|
| 30 | $verbose
|
|---|
| 31 | $debug
|
|---|
| 32 | $minfree
|
|---|
| 33 | $cpu
|
|---|
| 34 | $cpumsg
|
|---|
| 35 | $icpu
|
|---|
| 36 | );
|
|---|
| 37 | use Carp;
|
|---|
| 38 |
|
|---|
| 39 | require 5.001;
|
|---|
| 40 |
|
|---|
| 41 | $TEL = 'MAGIC';
|
|---|
| 42 |
|
|---|
| 43 | $PROGRAM = "$TEL-MC.DAEMON";
|
|---|
| 44 | $COPYRIGHT = 'Copyright (c) J C Gonzalez, 1998 - All rights reserved';
|
|---|
| 45 | $VERSION = '0.01';
|
|---|
| 46 | $USER = '#USERADD#';
|
|---|
| 47 | $DISK = '#DATADISK#';
|
|---|
| 48 | $SYSDIR = '#ADMDISK#';
|
|---|
| 49 | $MOTHERDIR = '#PATHEXE#';
|
|---|
| 50 | $EXECCOR = '#NAMEEXE#';
|
|---|
| 51 | $NICE = '#NICE#';
|
|---|
| 52 | $SITE = '#SITE#';
|
|---|
| 53 | $TOP = '/usr/local/bin/top';
|
|---|
| 54 |
|
|---|
| 55 | # parameters
|
|---|
| 56 |
|
|---|
| 57 | # Note: each CORSIKA run launched from this script will generate
|
|---|
| 58 | # [nshowers] showers in the energy bin [energies:energies2],
|
|---|
| 59 | # with a **differential** spectral index [Spectral_Index].
|
|---|
| 60 | # The range in angles are given in @Theta and @Phi
|
|---|
| 61 |
|
|---|
| 62 | $Spectral_Index = -1.5; # spectral index ( **differential** )
|
|---|
| 63 | @energies = qw ( 30 ); # lower limits in energy bins
|
|---|
| 64 | @energies2 = qw ( 30000 ); # corresponding upper limits
|
|---|
| 65 | @nshowers = qw ( 1000 ); # number of showers to generate
|
|---|
| 66 | @primaries = ( 1 ); # primaries (GEANT codes)
|
|---|
| 67 | @Theta = qw ( 5. 25. ); # Theta range
|
|---|
| 68 | @Phi = qw ( 0. 360. ); # Phi range
|
|---|
| 69 |
|
|---|
| 70 | $MINN = {}; # minimum number of showers for energy
|
|---|
| 71 |
|
|---|
| 72 | # currently we use the MACH factor to see how loaded is
|
|---|
| 73 | # the machine. It goes from 0 to 1, 0 is dead, 1 is free
|
|---|
| 74 |
|
|---|
| 75 | $MACH_CRITICAL = 0.0; # critical
|
|---|
| 76 | $MACH_BAD = 0.2; # bad
|
|---|
| 77 | $MACH_GOOD = 0.4; # good
|
|---|
| 78 | $MACH_VERYGOOD = 0.9; # verygood
|
|---|
| 79 |
|
|---|
| 80 | # maximum disk and tape space allowed
|
|---|
| 81 | $MAXDISK = (10 * 1024 * 1024); # max. disk
|
|---|
| 82 | $MAXTAPE = (6 * 1024 * 1024); # max. space
|
|---|
| 83 |
|
|---|
| 84 | # some flags (some of them not yet used)
|
|---|
| 85 | $verbose = 1; # verbose output flag
|
|---|
| 86 | $debug = 0; # debugging flag
|
|---|
| 87 | $minfree = 1; # minimum number of free jobs
|
|---|
| 88 | $uptime = 0;
|
|---|
| 89 | $cpumsg = '';
|
|---|
| 90 |
|
|---|
| 91 | ###
|
|---|
| 92 | # subroutines
|
|---|
| 93 | ###
|
|---|
| 94 |
|
|---|
| 95 | # presentation
|
|---|
| 96 | sub hello {
|
|---|
| 97 | print <<"_eom_" if ( $verbose );
|
|---|
| 98 | ============================================================
|
|---|
| 99 | $PROGRAM version $VERSION
|
|---|
| 100 | $COPYRIGHT
|
|---|
| 101 | ============================================================
|
|---|
| 102 |
|
|---|
| 103 | _eom_
|
|---|
| 104 | }
|
|---|
| 105 |
|
|---|
| 106 | # initialize
|
|---|
| 107 | sub init {
|
|---|
| 108 | my (@line,$df,$e,$p,$msg,$l);
|
|---|
| 109 |
|
|---|
| 110 | for ($l=0; $l<=$#energies; $l++) {
|
|---|
| 111 | $$MINN{$energies[$l]} = $nshowers[$l];
|
|---|
| 112 | }
|
|---|
| 113 |
|
|---|
| 114 | $msg = "";
|
|---|
| 115 | if (! -f "$SYSDIR/last-primary") {
|
|---|
| 116 | system("echo $#primaries > $SYSDIR/last-primary");
|
|---|
| 117 | $msg .= "\n\t\tlast-primary file initialized.";
|
|---|
| 118 | }
|
|---|
| 119 | if (! -f "$SYSDIR/last-energy") {
|
|---|
| 120 | system("echo $#energies > $SYSDIR/last-energy");
|
|---|
| 121 | $msg .= "\n\t\tlast-energy file initialized.";
|
|---|
| 122 | }
|
|---|
| 123 | if (! -f "$SYSDIR/disk-space") {
|
|---|
| 124 | system("echo $MAXDISK > $SYSDIR/disk-space") == 0
|
|---|
| 125 | or croak "Cannot write $SYSDIR/disk-space";
|
|---|
| 126 | $msg .= "\n\t\tdisk-space file initialized.";
|
|---|
| 127 | }
|
|---|
| 128 | if (! -f "$SYSDIR/tape-space") {
|
|---|
| 129 | system("echo $MAXTAPE > $SYSDIR/tape-space") == 0
|
|---|
| 130 | or croak "Cannot write $SYSDIR/tape-space";
|
|---|
| 131 | $msg .= "\n\t\ttape-space file initialized.";
|
|---|
| 132 | $msg .= "\n\t\tA new tape for disk $DISK is required.";
|
|---|
| 133 | }
|
|---|
| 134 | if (! -f "$SYSDIR/last-sets") {
|
|---|
| 135 | open(FILESETS,"> $SYSDIR/last-sets")
|
|---|
| 136 | or croak "Cannot open file $SYSDIR/last-sets";
|
|---|
| 137 | foreach $p (@primaries) {
|
|---|
| 138 | foreach $e (@energies) {
|
|---|
| 139 | $l = $p . "-" . $e . " 0\n";
|
|---|
| 140 | print FILESETS $l;
|
|---|
| 141 | }
|
|---|
| 142 | }
|
|---|
| 143 | close(FILESETS);
|
|---|
| 144 | $msg .= "\n\t\tlast-sets file initialized.";
|
|---|
| 145 | }
|
|---|
| 146 | send_mail("System Initialization Procedure:" . $msg, 0)
|
|---|
| 147 | if ($msg ne "");
|
|---|
| 148 | }
|
|---|
| 149 |
|
|---|
| 150 | # clear the system
|
|---|
| 151 | sub sys_clear {
|
|---|
| 152 | exit system('yes | rm -r ' .
|
|---|
| 153 | $SYSDIR . '/last-* ' .
|
|---|
| 154 | $SYSDIR . '/*space ' .
|
|---|
| 155 | $SYSDIR . '/to-save ');
|
|---|
| 156 | }
|
|---|
| 157 |
|
|---|
| 158 | # get options for the program
|
|---|
| 159 | sub get_options {
|
|---|
| 160 | my ($op);
|
|---|
| 161 | foreach $op ( @ARGV ) {
|
|---|
| 162 | shift;
|
|---|
| 163 | last if ($op =~ /^--$/);
|
|---|
| 164 | if ($op =~ /^-q/) { $verbose = 0 }
|
|---|
| 165 | if ($op =~ /^-D/) { $debug = 1 }
|
|---|
| 166 | if ($op =~ /^-u/) { $uptime = 1 }
|
|---|
| 167 | if ($op =~ /^-n(.*)/) { $NICE = $1 }
|
|---|
| 168 | if ($op =~ /^-t(.*):(.*)/) { @Theta = ( $1, $2, );}
|
|---|
| 169 | if ($op =~ /^-p(.*):(.*)/) { @Phi = ( $1, $2, );}
|
|---|
| 170 | if ($op =~ /^-c/) { &sys_clear }
|
|---|
| 171 | }
|
|---|
| 172 | 1;
|
|---|
| 173 | }
|
|---|
| 174 |
|
|---|
| 175 | # get machine load
|
|---|
| 176 | sub read_cpu_load {
|
|---|
| 177 | my ($line, @upline, $users, @mach);
|
|---|
| 178 |
|
|---|
| 179 | $line = `uptime -m`;
|
|---|
| 180 | @mach = split (
|
|---|
| 181 | /^.* factor: ([0-9\.]*), ([0-9\.]*), ([0-9\.]*)$/,
|
|---|
| 182 | $line);
|
|---|
| 183 | return $mach[1];
|
|---|
| 184 | }
|
|---|
| 185 |
|
|---|
| 186 | # check the cpu load
|
|---|
| 187 | sub check_cpu_load {
|
|---|
| 188 | my ($cpu, $msg, $running, $l);
|
|---|
| 189 |
|
|---|
| 190 | $cpu = read_cpu_load;
|
|---|
| 191 |
|
|---|
| 192 | if ( $cpu < $MACH_CRITICAL ) {
|
|---|
| 193 | $cpumsg = "CPU is critically overloaded: MACH = $cpu";
|
|---|
| 194 | $icpu = 0;
|
|---|
| 195 | } elsif ( $cpu < $MACH_BAD ) {
|
|---|
| 196 | $cpumsg = "CPU load is too high: MACH = $cpu";
|
|---|
| 197 | $icpu = 1;
|
|---|
| 198 | } elsif ( $cpu < $MACH_GOOD ) {
|
|---|
| 199 | $cpumsg = "CPU load is not good enough: MACH = $cpu";
|
|---|
| 200 | $icpu = 2;
|
|---|
| 201 | } elsif ( $cpu < $MACH_VERYGOOD ) {
|
|---|
| 202 | $cpumsg = "CPU load is very good: MACH = $cpu";
|
|---|
| 203 | $icpu = 3;
|
|---|
| 204 | } else {
|
|---|
| 205 | $cpumsg = "CPU load is excellent!: MACH = $cpu";
|
|---|
| 206 | $icpu = 4;
|
|---|
| 207 | }
|
|---|
| 208 |
|
|---|
| 209 | open(C520RUNNING, "ps x|")
|
|---|
| 210 | or die "Cannot execute ps x: $!";
|
|---|
| 211 | $running = 0;
|
|---|
| 212 | while ( $l = <C520RUNNING> ) {
|
|---|
| 213 | if ( $l =~ /c520/ ) {
|
|---|
| 214 | $running++;
|
|---|
| 215 | }
|
|---|
| 216 | }
|
|---|
| 217 | close(C520RUNNING);
|
|---|
| 218 |
|
|---|
| 219 | if ( $running > 0 ) {
|
|---|
| 220 | $cpumsg .= "\nCORSIKA still running $running time(s):\n$l";
|
|---|
| 221 | $icpu = 0;
|
|---|
| 222 | }
|
|---|
| 223 |
|
|---|
| 224 | $icpu;
|
|---|
| 225 | }
|
|---|
| 226 |
|
|---|
| 227 | # get primary to be used
|
|---|
| 228 | sub get_primary {
|
|---|
| 229 | my ($prim);
|
|---|
| 230 |
|
|---|
| 231 | $prim = `cat $SYSDIR/last-primary`
|
|---|
| 232 | or croak "Cannot read data file $SYSDIR/last-primary";
|
|---|
| 233 |
|
|---|
| 234 | $prim = ($prim == $#primaries ) ? 0 : $prim+1;
|
|---|
| 235 |
|
|---|
| 236 | system("echo $prim > $SYSDIR/last-primary") == 0
|
|---|
| 237 | or croak "Cannot write data file $SYSDIR/last-primary";
|
|---|
| 238 |
|
|---|
| 239 | $primaries[$prim];
|
|---|
| 240 | }
|
|---|
| 241 |
|
|---|
| 242 | # get primary to be used
|
|---|
| 243 | sub get_energy {
|
|---|
| 244 | my ($prim) = @_;
|
|---|
| 245 | my ($ener);
|
|---|
| 246 |
|
|---|
| 247 | $ener = `cat $SYSDIR/last-energy`
|
|---|
| 248 | or croak "Cannot read data file $SYSDIR/last-energy";
|
|---|
| 249 |
|
|---|
| 250 | if ($prim == $primaries[0]) {
|
|---|
| 251 | $ener = ($ener == $#energies ) ? 0 : $ener+1;
|
|---|
| 252 | system("echo $ener > $SYSDIR/last-energy") == 0
|
|---|
| 253 | or croak "Cannot write data file $SYSDIR/last-energy";
|
|---|
| 254 | }
|
|---|
| 255 |
|
|---|
| 256 | return ( $energies[$ener], $energies2[$ener],);
|
|---|
| 257 | }
|
|---|
| 258 |
|
|---|
| 259 | # get set (run) number for this run
|
|---|
| 260 | sub get_set {
|
|---|
| 261 | my ($energy, $primary) = @_;
|
|---|
| 262 | my (@line, $lastset, $l);
|
|---|
| 263 |
|
|---|
| 264 | open(FILESETS,"< $SYSDIR/last-sets")
|
|---|
| 265 | or croak "Cannot open file $SYSDIR/last-sets";
|
|---|
| 266 | open(FILESETS2,"> $SYSDIR/last-sets.bak")
|
|---|
| 267 | or croak "Cannot open file $SYSDIR/last-sets.bak";
|
|---|
| 268 | while ($l = <FILESETS>) {
|
|---|
| 269 | if ($l =~ /^($primary-$energy) /) {
|
|---|
| 270 | chomp $l;
|
|---|
| 271 | @line = split ' ', $l;
|
|---|
| 272 | $lastset = $line[1];
|
|---|
| 273 | $lastset++;
|
|---|
| 274 | $l = "$primary-$energy $lastset\n";
|
|---|
| 275 | }
|
|---|
| 276 | print FILESETS2 $l;
|
|---|
| 277 | }
|
|---|
| 278 | close(FILESETS2);
|
|---|
| 279 | close(FILESETS);
|
|---|
| 280 | system("mv $SYSDIR/last-sets.bak $SYSDIR/last-sets") == 0
|
|---|
| 281 | or croak "Cannot modify file $SYSDIR/last-sets";
|
|---|
| 282 |
|
|---|
| 283 | $lastset;
|
|---|
| 284 | }
|
|---|
| 285 |
|
|---|
| 286 | # send an e-mail
|
|---|
| 287 | sub send_mail {
|
|---|
| 288 | my ($msg,$err)=@_;
|
|---|
| 289 | my ($date,$fullmsg,$time);
|
|---|
| 290 |
|
|---|
| 291 | $date = scalar localtime;
|
|---|
| 292 | $time = time;
|
|---|
| 293 |
|
|---|
| 294 | $fullmsg = "Subject: $PROGRAM $VERSION - log\n";
|
|---|
| 295 | $fullmsg .= "=" x 60 . "\n";
|
|---|
| 296 | $fullmsg .= "$PROGRAM version $VERSION\n";
|
|---|
| 297 | $fullmsg .= "$COPYRIGHT\n";
|
|---|
| 298 | $fullmsg .= "=" x 60 . "\n\n";
|
|---|
| 299 | $fullmsg .= " User: $USER\n";
|
|---|
| 300 | $fullmsg .= " Date: $date ($time)\n\n";
|
|---|
| 301 | $fullmsg .= " Msg: $msg\n\n";
|
|---|
| 302 | open(MSGFILE, "> $SYSDIR/last-msg")
|
|---|
| 303 | or croak "Cannot write data file $SYSDIR/last-msg";
|
|---|
| 304 | print MSGFILE $fullmsg;
|
|---|
| 305 | close(MSGFILE);
|
|---|
| 306 | open(OVERLOAD, ">> $SYSDIR/last-logs")
|
|---|
| 307 | or croak "Cannot write data file $SYSDIR/last-logs";
|
|---|
| 308 | if ($err < 1) {
|
|---|
| 309 | system("mail $USER < $SYSDIR/last-msg") == 0
|
|---|
| 310 | or croak "Cannot send e-mail file $SYSDIR/last-msg";
|
|---|
| 311 | print OVERLOAD "+$date : $cpumsg\n";
|
|---|
| 312 | } else {
|
|---|
| 313 | print OVERLOAD " $date : $cpumsg\n";
|
|---|
| 314 | }
|
|---|
| 315 | close(OVERLOAD);
|
|---|
| 316 | }
|
|---|
| 317 |
|
|---|
| 318 | # construct the job file
|
|---|
| 319 | sub make_job {
|
|---|
| 320 | my ($job,$nrun,$date,$dir,$fulldir,$nshow);
|
|---|
| 321 | my ($seed1,$seed2,$seed3);
|
|---|
| 322 |
|
|---|
| 323 | $Primary = get_primary();
|
|---|
| 324 | ($Energy1,$Energy2) = get_energy($Primary);
|
|---|
| 325 | $Set = get_set($Energy1, $Primary);
|
|---|
| 326 | $nshow = $$MINN{$Energy1};
|
|---|
| 327 | $dir = "mc$TEL-$Primary-$Energy1:$Energy2-$Set";
|
|---|
| 328 | $fulldir = "$DISK/$dir";
|
|---|
| 329 | $job = "job.cmds";
|
|---|
| 330 |
|
|---|
| 331 | # change seed for random numbers
|
|---|
| 332 | srand ( time() ^ ($$ + ($$ << 15)) );
|
|---|
| 333 | $seed1 = int(rand 100000) + 1;
|
|---|
| 334 | $seed2 = int(rand 100000) + 1;
|
|---|
| 335 | $seed3 = int(rand 100000) + 1;
|
|---|
| 336 |
|
|---|
| 337 | ### make job commands file
|
|---|
| 338 |
|
|---|
| 339 | open(JOBFILE,"> $SYSDIR/$job")
|
|---|
| 340 | or croak "Cannot write job file $SYSDIR/job";
|
|---|
| 341 | $date = scalar localtime;
|
|---|
| 342 |
|
|---|
| 343 | print JOBFILE <<"_eoj_";
|
|---|
| 344 | #!/bin/sh
|
|---|
| 345 | #############################################################
|
|---|
| 346 | # JOBS script
|
|---|
| 347 | # Automaticaly generated by $PROGRAM v. $VERSION
|
|---|
| 348 | #
|
|---|
| 349 | # $COPYRIGHT
|
|---|
| 350 | # $date
|
|---|
| 351 | #############################################################
|
|---|
| 352 | #
|
|---|
| 353 |
|
|---|
| 354 | # begin
|
|---|
| 355 |
|
|---|
| 356 | # initialize variables
|
|---|
| 357 |
|
|---|
| 358 | MAIN_DIR="$MOTHERDIR"
|
|---|
| 359 | TARGET_DIR="$fulldir"
|
|---|
| 360 | DATA_FILES="ATM75 ATM80 ATM84 ATM85 ATM86 ATM87 ATM88 ATM89 ATM90"
|
|---|
| 361 | DATA_FILES="\$DATA_FILES EGSDAT2 NUCNUCCS VENUSDAT"
|
|---|
| 362 | PROG="$EXECCOR"
|
|---|
| 363 | INPUT="input"
|
|---|
| 364 | OUTPUT="output"
|
|---|
| 365 | ERROR="error"
|
|---|
| 366 |
|
|---|
| 367 | # create target directory
|
|---|
| 368 | mkdir \$TARGET_DIR || \
|
|---|
| 369 | { echo "Cannot create directory \$TARGET_DIR"; exit 1; }
|
|---|
| 370 | cd \$TARGET_DIR || \
|
|---|
| 371 | { echo "Cannot move to directory \$TARGET_DIR"; exit 1; }
|
|---|
| 372 |
|
|---|
| 373 | # make symbolic links
|
|---|
| 374 | for i in \$DATA_FILES; do
|
|---|
| 375 | ln -s \$MAIN_DIR/\$i \$TARGET_DIR/. || \
|
|---|
| 376 | { echo "Cannot create symbolic link"; exit 1; }
|
|---|
| 377 | done
|
|---|
| 378 |
|
|---|
| 379 | # copy this file to the target directory
|
|---|
| 380 | cp $SYSDIR/$job $SYSDIR/\$INPUT \$TARGET_DIR/.
|
|---|
| 381 |
|
|---|
| 382 | # before it starts
|
|---|
| 383 | datebef=`date`
|
|---|
| 384 | timebef=`times`
|
|---|
| 385 |
|
|---|
| 386 | #------------------------------------------------------------
|
|---|
| 387 | # execute CORSIKA
|
|---|
| 388 | nice -n $NICE \$MAIN_DIR/\$PROG < \$INPUT 1> \$OUTPUT 2> \$ERROR
|
|---|
| 389 | # \$MAIN_DIR/\$PROG < \$INPUT 1> \$OUTPUT 2> \$ERROR
|
|---|
| 390 | #------------------------------------------------------------
|
|---|
| 391 |
|
|---|
| 392 | # after it finishes
|
|---|
| 393 | dateaft=`date`
|
|---|
| 394 | timeaft=`times`
|
|---|
| 395 | dspace=`du -sk \$TARGET_DIR | cut -f 1`
|
|---|
| 396 |
|
|---|
| 397 | # now update information in the system
|
|---|
| 398 | odspace=`cat "$SYSDIR/disk-space"`
|
|---|
| 399 | otspace=`cat "$SYSDIR/tape-space"`
|
|---|
| 400 | ndspace=`expr "\$odspace" - "\$dspace"`
|
|---|
| 401 | ntspace=`expr "\$otspace" - "\$dspace"`
|
|---|
| 402 | echo \$ndspace > $SYSDIR/disk-space
|
|---|
| 403 | echo \$ntspace > $SYSDIR/tape-space
|
|---|
| 404 |
|
|---|
| 405 | # save the directory name in the table to be saved to tape
|
|---|
| 406 | echo \$TARGET_DIR \$dspace >> $SYSDIR/to-save
|
|---|
| 407 |
|
|---|
| 408 | # build report
|
|---|
| 409 |
|
|---|
| 410 | cat << EOM > $SYSDIR/last-mail
|
|---|
| 411 | Subject: $PROGRAM v $VERSION - END OF JOB
|
|---|
| 412 | ============================================================
|
|---|
| 413 | $PROGRAM version $VERSION
|
|---|
| 414 | $COPYRIGHT
|
|---|
| 415 | ============================================================
|
|---|
| 416 |
|
|---|
| 417 | User: $USER
|
|---|
| 418 | Date: \$dateaft
|
|---|
| 419 |
|
|---|
| 420 | Msg: The job has finished
|
|---|
| 421 | Follows statistics of the job:
|
|---|
| 422 |
|
|---|
| 423 | Running with nice: $NICE
|
|---|
| 424 | CPU load: $cpumsg
|
|---|
| 425 | Command line was: "\$MAIN_DIR/\$PROG < \$INPUT"
|
|---|
| 426 | Target directory: \$TARGET_DIR
|
|---|
| 427 | Used disk space: \$dspace
|
|---|
| 428 | Start date(time): \$datebef ( \$timebef )
|
|---|
| 429 | End date(time): \$dateaft ( \$timeaft )
|
|---|
| 430 | Disk space avail.: \$ndspace
|
|---|
| 431 | Tape space avail.: \$ntspace
|
|---|
| 432 |
|
|---|
| 433 | EOM
|
|---|
| 434 |
|
|---|
| 435 | echo '-- List of directories to save --------' >> $SYSDIR/last-mail
|
|---|
| 436 | cat $SYSDIR/to-save >> $SYSDIR/last-mail
|
|---|
| 437 | echo '-- EOF --------------------------------' >> $SYSDIR/last-mail
|
|---|
| 438 |
|
|---|
| 439 | echo '' >> $SYSDIR/last-mail
|
|---|
| 440 |
|
|---|
| 441 | echo '-- Input file used --------------------' >> $SYSDIR/last-mail
|
|---|
| 442 | cat \$INPUT >> $SYSDIR/last-mail
|
|---|
| 443 | echo '-- EOF --------------------------------' >> $SYSDIR/last-mail
|
|---|
| 444 |
|
|---|
| 445 | echo '' >> $SYSDIR/last-mail
|
|---|
| 446 |
|
|---|
| 447 | echo '-- Job file used ----------------------' >> $SYSDIR/last-mail
|
|---|
| 448 | cat job.cmds >> $SYSDIR/last-mail
|
|---|
| 449 | echo '-- EOF --------------------------------' >> $SYSDIR/last-mail
|
|---|
| 450 |
|
|---|
| 451 | # send the report
|
|---|
| 452 |
|
|---|
| 453 | mail $USER < $SYSDIR/last-mail
|
|---|
| 454 |
|
|---|
| 455 | # bye
|
|---|
| 456 |
|
|---|
| 457 | exit 0
|
|---|
| 458 |
|
|---|
| 459 | _eoj_
|
|---|
| 460 |
|
|---|
| 461 | close(JOBFILE);
|
|---|
| 462 | chmod(0755, "$SYSDIR/job.cmds"); # make it executable
|
|---|
| 463 |
|
|---|
| 464 | ### make input file
|
|---|
| 465 |
|
|---|
| 466 | open(INFILE, "> $SYSDIR/input")
|
|---|
| 467 | or croak "Cannot write input file $SYSDIR/input";
|
|---|
| 468 | print INFILE <<"_eoj_";
|
|---|
| 469 | RUNNR $Set number of run
|
|---|
| 470 | EVTNR 1 number of first shower event
|
|---|
| 471 | NSHOW $nshow number of showers to generate
|
|---|
| 472 | PRMPAR $Primary particle type of prim. particle
|
|---|
| 473 | ESLOPE $Spectral_Index slope of primary energy spectrum
|
|---|
| 474 | ERANGE $Energy1 $Energy2 energy range of primary particle
|
|---|
| 475 | THETAP $Theta[0] $Theta[1] range of zenith angle (degree)
|
|---|
| 476 | PHIP $Phi[0] $Phi[1] range of azimuth angle (degree)
|
|---|
| 477 | SEED $seed1 $SITE 0 seed for 1. random number sequence
|
|---|
| 478 | SEED $seed2 $SITE 0 seed for 2. random number sequence
|
|---|
| 479 | SEED $seed3 $SITE 0 seed for 3. random number sequence
|
|---|
| 480 | OBSLEV 2200.E2 observation level (in cm)
|
|---|
| 481 | ELMFLG F F em. interaction flags (NKG,EGS)
|
|---|
| 482 | RADNKG 200.E2 outer radius for NKG lat.dens.determ.
|
|---|
| 483 | ARRANG 0. rotation of array to north
|
|---|
| 484 | FIXHEI 0. 0 first interaction height & target
|
|---|
| 485 | FIXCHI 0. starting altitude (g/cm**2)
|
|---|
| 486 | MAGNET 20.0 42.8 magnetic field centr. europe
|
|---|
| 487 | HADFLG 0 0 0 0 0 0 flags for hadr. interaction
|
|---|
| 488 | GHEISH T use gheisha for low energy hadrons
|
|---|
| 489 | VENUS T use venus for high energy hadrons
|
|---|
| 490 | VENSIG T use VENUS hadronic cross sections
|
|---|
| 491 | ECUTS 0.3 0.3 0.02 0.02 e.cuts: had, mu, elec y fot
|
|---|
| 492 | MUADDI F additional info for muons
|
|---|
| 493 | MUMULT T muon multiple scattering angle
|
|---|
| 494 | LONGI T 10. T longit.distr. & step size & fit
|
|---|
| 495 | MAXPRT 0 max. number of printed events
|
|---|
| 496 | ECTMAP 1.E4 cut on gamma factor for printout
|
|---|
| 497 | STEPFC 10.0 mult. scattering step length fact.
|
|---|
| 498 | DEBUG F 6 F 1000000 debug flag and log.unit for out
|
|---|
| 499 | VENDBG 0 venus debug option
|
|---|
| 500 | DIRECT ./
|
|---|
| 501 | CWAVLG 290. 600. Cherenkov wavelength band
|
|---|
| 502 | CSCAT 1 0. 35000. scatter Cherenkov events
|
|---|
| 503 | CERSIZ 1. bunch size Cherenkov photons
|
|---|
| 504 | CERFIL T Cherenkov output to extra file
|
|---|
| 505 | CERTEL 1
|
|---|
| 506 | 0. 0. 0. 0. 0. 1800. 1700. Location and size of each CT
|
|---|
| 507 | EXIT terminates input
|
|---|
| 508 | _eoj_
|
|---|
| 509 | close(INFILE);
|
|---|
| 510 | }
|
|---|
| 511 |
|
|---|
| 512 | sub bye {
|
|---|
| 513 | print "\nbye.\n\n";
|
|---|
| 514 | }
|
|---|
| 515 |
|
|---|
| 516 |
|
|---|
| 517 |
|
|---|
| 518 | ###
|
|---|
| 519 | # main procedure
|
|---|
| 520 | ###
|
|---|
| 521 |
|
|---|
| 522 | # get command line options
|
|---|
| 523 | init;
|
|---|
| 524 |
|
|---|
| 525 | # get command line options
|
|---|
| 526 | get_options;
|
|---|
| 527 |
|
|---|
| 528 | # say hello
|
|---|
| 529 | hello;
|
|---|
| 530 |
|
|---|
| 531 |
|
|---|
| 532 |
|
|---|
| 533 |
|
|---|