#! /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/binFactorSelect # 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/binFactorSelect." 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/binFactorSelect." 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! #------------------------------------------------------------------------------- #!/usr/bin/perl use Getopt::Std; use Math::Trig; use HEACORE::HEAINIT; use HEACORE::HEAUTILS; use HEACORE::PIL; getopt(); if (defined $opt_h) { print</dev/null`; if ($result !~ /heraXPA/) { $heraXPA = $pow; } $helpfile = "$helpdir/binFactor.html"; system("cat $helpfile |xpaset $heraXPA helpPage 2>/dev/null"); $startValue="NOT_YET 0"; @return_value = split(/ /, $startValue); $status = &binFactorSelect_binInputFile($infile,$bin,$tmpimgfile,$xcol,$ycol,$timeout); system("xpaset -p $pow binFactorTool -open"); system("xpaset -p $pow binFactorTool -value $bin"); $previousBin = $return_value[1]; while (($return_value[0] eq "NOT_YET") || ($return_value[0] eq "Apply")) { @return_value = split(/ /, `xpaget $pow binFactorTool -wait`); ######################### # Pan Chai - wait command will now returned immediately. Scripts needs to check every # 2 seconds to see if the status has changed. ######################### if ( $return_value[0] eq "Apply" ) { $bin = $return_value[1]; $status = &binFactorSelect_binInputFile($infile,$bin,$tmpimgfile,$xcol,$ycol,$timeout); $previousBin = $return_value[1]; } sleep 2; } system("xpaset -p $pow binFactorTool -close"); if ( $previousBin != $return_value[1] ) { $bin = $return_value[1]; # $status = &binFactorSelect_binInputFile($infile,$bin,$tmpimgfile,$xcol,$ycol,$timeout); } return; } sub binFactorSelect_getpar { if (PILGetString("infile",$infile)) { print "Error to get parameter \"infile\"\n"; exit(-1); } if (PILGetString("bin",$bin)){ print "Error to get parameter \"bin\"\n"; exit(-1); } if (PILGetString("tmpimgfile",$tmpimgfile)){ print "Error to get parameter \"tmpimgfile\"\n"; exit(-1); } if (PILGetReal("timeout",$timeout)){ print "Error to get parameter \"timeout\"\n"; exit(-1); } if (PILGetString("xcol",$xcol)) { print "Error to get parameter \"xcol\"\n"; exit(-1); } if (PILGetString("ycol",$ycol)) { print "Error to get parameter \"ycol\"\n"; exit(-1); } }