#! /bin/sh # This is the LHEA perl script: /cvmfs/extras-fp7.egi.eu/extras/heasoft/ftools/x86_64-unknown-linux-gnu-libc2.19-0/bin/asmchannel # The purpose of this special block is to make this script work with # the user's local perl, regardless of where that perl is installed. # The variable LHEAPERL is set by the initialization script to # point to the local perl installation. #------------------------------------------------------------------------------- eval ' if [ "x$LHEAPERL" = x ]; then echo "Please run standard LHEA initialization before attempting to run /cvmfs/extras-fp7.egi.eu/extras/heasoft/ftools/x86_64-unknown-linux-gnu-libc2.19-0/bin/asmchannel." exit 3 elif [ "$LHEAPERL" = noperl ]; then echo "During LHEA initialization, no acceptable version of Perl was found." echo "Cannot execute script /cvmfs/extras-fp7.egi.eu/extras/heasoft/ftools/x86_64-unknown-linux-gnu-libc2.19-0/bin/asmchannel." exit 3 elif [ `$LHEAPERL -v < /dev/null 2> /dev/null | grep -ic "perl"` -eq 0 ]; then echo "LHEAPERL variable does not point to a usable perl." exit 3 else # Force Perl into 32-bit mode (to match the binaries) if necessary: if [ "x$HD_BUILD_ARCH_32_BIT" = xyes ]; then if [ `$LHEAPERL -V 2> /dev/null | grep -ic "USE_64_BIT"` -ne 0 ]; then VERSIONER_PERL_PREFER_32_BIT=yes export VERSIONER_PERL_PREFER_32_BIT fi fi exec $LHEAPERL -x $0 ${1+"$@"} fi ' if(0); # Do not delete anything above this comment from an installed LHEA script! #------------------------------------------------------------------------------- #!/usr1/local/bin/perl5 # asmchannel # J. Lochner # v 1.0, Dec 6, 1996 # Perl script to separate an asm .col file into separate .lc # files for the different channels. Script assumes 3 channels # with boundaries 410-1188, 1189-1860, 1861-4750. # If input file name is .col, output file names are of # the form _ch1.lc, etc. require "utils.pl"; use Getopt::Std; # # Output the help if -h specified # getopts('ch'); if (defined $opt_h) { print <.col results in output files with names of the form _ch1.lc, _ch2.lc, and _ch3.lc. USAGE asmchannel -h (print help) [prints this help page] -c (clobber) [overwrite existing output file with same name? [ (default: NO)] EOHELP1 exit; } print "ASMCHANNEL V1.0 \n"; print "\n"; print "Input name of ASM color file: \n"; chop($color=); print "\n"; # clobber option: # Default is to not clobber files unless # explicitly asked for via the -c switch. if(defined $opt_c) { $clobber="yes"; print "enabling clobber\n"; } else { $clobber="no"; } # Loop through the three channels #@minchan = (410,1189,1861); these corresponded to old channels boundries #changed on day 2195 #now will have lower and upper bounds for channels (l=lower, u=upper) @bounds = (0,1000,1001,1850,1851,3500); $l = 0; $u = 1; $i = 0; while ($i <= 2) { $chanlc = &outfile($color, $i+1); #old expression # $expr = 'MINCHAN.eq.'.$minchan[$i]; #new expression after channel boundries changed $expr = 'MINCHAN.gt.'.$bounds[$l].'.AND.MINCHAN.lt.'.$bounds[$u]; print "writing ",$chanlc,"\n"; @result = &runcom('fselect '.$color.' '.$chanlc.' '.$expr.' clobber="'.$clobber.'"'); $l+=2; $u+=2; $i++; } print "\n"; print "all done\n"; sub outfile { local($infile,$i) = @_; local($s1,$sfile,$outfile); $s1 = index($infile,'.'); $sfile = substr($infile,0,$s1); $outfile = $sfile."_ch".$i.".lc"; }