#! /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/xsl_xmm_epic_makeresp # 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/xsl_xmm_epic_makeresp." 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/xsl_xmm_epic_makeresp." 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 $version ="1.30"; $date ="2006-05-25"; $author = "kaa"; # This script makes the XMM EMOS rmf and arf. It is run by the xselect # routine xsl_rspsav. Note that we assume that the relevant bad pixel # extensions have been included in the spectrum file. # Check that we were given input filenames if(@ARGV < 1 || @ARGV > 2) { print "\n usage : xsl_xmm_epic_makeresp spectrumfile extended?\n"; exit(0); } # check whether SAS is set-up. if it isn't we will try to use hera $local = "yes"; if($ENV{'SAS_CCF'} !~/\S/) { $local = "no"; print "Local SAS not set up so will try to use Hera... this may take a while\n"; } $infile = $ARGV[0]; $extended = "no"; if(@ARGV == 2 && $ARGV[1] eq "yes") { $extended = "yes"; } $dot = index($infile,"."); $rootname = substr($infile, 0, $dot); $rmffile = $rootname . ".rmf"; $arffile = $rootname . ".arf"; # remove any pre-existing files with these names to avoid hera prompting us # about whether we want to overwrite unlink $arffile; unlink $rmffile; # Need to change the region extension name from REGION to REG00101 $command = "fparkey value=\"REG00101\" fitsfile=$infile\[REGION\] keyword=EXTNAME"; print "\n",$command,"\n\n"; system($command); # run rmfgen to make the rmf $command = "rmfgen format=var rmfset=$rmffile spectrumset=$infile threshold=1.0e-6"; if ( $local eq "no" ) { $command = "fv -runtask " . $command; } print "\n",$command,"\n\n"; system($command); # run arfgen to make the arf if ($extended eq "yes") { $command = "arfgen arfset=$arffile spectrumset=$infile withrmfset=yes rmfset=$rmffile extendedsource=yes modelee=yes withbadpixcorr=yes badpixlocation=$infile modelootcorr=yes useodfatt=no"; } else { $command = "arfgen arfset=$arffile spectrumset=$infile withrmfset=yes rmfset=$rmffile extendedsource=no modelee=yes withbadpixcorr=yes badpixlocation=$infile modelootcorr=yes useodfatt=no"; } if ( $local eq "no" ) { $command = "fv -runtask " . $command; } print "\n",$command,"\n\n"; system($command); # set the RESPFILE and ANCRFILE keywords in the spectrum to point to the # files that have been created $command = "fparkey value=$rmffile fitsfile=$infile\[SPECTRUM\] keyword=RESPFILE"; system($command); $command = "fparkey value=$arffile fitsfile=$infile\[SPECTRUM\] keyword=ANCRFILE"; system($command);