#!/usr/bin/perl -w #------------------------------------------------------------ # Simple script to chop out sub-processes which have a small # impact on the cross section, in the grid pack. # This is meant to be run after the gridpack warming up run # and before packing it up. # # The script should be run from the main directory of madevent # and sits in the bin directory. # # This is still version 0, where no classes can be defined. # However, the result is a script, chop_procs sitting in # SubProcesses, that can be edited by hand. # # Author: Fabio Maltoni # Date: 10/4/08 # Version: 0.1 # # HISTORY # # 0.2 Fix bug in writing subproc.mg # # 0.1 Added the possibility to list SubProc IDs # # 0.0 Original # #------------------------------------------------------------ #------------------------------------------------------------ # Auxiliary Ordering function #------------------------------------------------------------ sub OrderInc { $all{$a} <=> $all{$b}; }; #------------------------------------------------------------ # Input the chopping value. Example : 0.01 = 1% #------------------------------------------------------------ print "input chopping off value (e.g., 0.01=1% ):\n"; $cutoff_lim=; #------------------------------------------------------------ # Input the SubProcesses ids on which the script should run #------------------------------------------------------------ print "Input SubProcesses ids to process (space separated):\n"; @id_list=split('\s+',); #------------------------------------------------------------ # Parse the form, look for known variables #------------------------------------------------------------ chdir("SubProcesses"); open(SCRIPT,">chop_procs") or die "Could not write chop_procs \n"; foreach $id (@id_list) { print "\n\nNow processing SubProcesses with ID = $id\n"; my @all_Pdirs = ; my $xsec = 0; my $perc = 0; %all = (); %below = (); foreach $arg (@all_Pdirs) { chdir("$arg"); open(RES," below cutoff\n";} else { print "$integ[$i+1] : $all{$key} $key => above cutoff\n";} $i =$i + 1; }; # # Now I move the corresponding procs out of the way # print "The following SubProcess will be tagged to be removed:\n"; foreach $key (keys(%below)){ print "$key "; print SCRIPT "mv $key XXX$key \# $below{$key}\n"; # system("mv $key XXX$key "); }; # print SCRIPT "ls -d P$id* >subproc.mg\n"; # system("ls -d P* >subproc.mg"); } print SCRIPT "ls -d P* >subproc.mg"; close(SCRIPT); system("chmod +x chop_procs");