#! /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/add_sis_rmf # 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/add_sis_rmf." 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/add_sis_rmf." 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/contrib/irix/bin/perl # # who wrote this thing? # 2/17/95 Diddled so that Usage message will print if -h flagged LE Brown use Getopt::Std; getopts('h'); if ((! @ARGV )|| (defined $opt_h)) { print "Usage: add_sis_rmf evtfile addrmf_file caldb_dir \n"; print "Reports what percentage of the total counts in evtfile are in each chip \n"; print "If addrmf_file is given, an input file for addrmf is created \n"; print "If caldb_dir is not given, /FTP/caldb/data/asca/sis/cpf/94nov9/ is used \n"; print "Filenames put into addrmf_file are: \n"; print "s?c?g0234p40e1_512v0_8i.rmf \n"; print "SIS # is determined from evtfile \n"; exit; } $file = shift(@ARGV); # verify input file # print "$file \n"; # Find out total number of events $nevt = `( fkeypar $file NAXIS2 ; pget fkeypar value )`; print "Number of events in $file = $nevt"; # Find out which sis $typ = `( fkeypar $file INSTRUME ; pget fkeypar value )`; # print "$typ \n"; $snum = substr($typ,4,1); # Find out how many events are in each chip # Report results print "CCD No. of events % of events \n"; $maggot = "maggot"; system("pset fstatistic outfile=$maggot"); system("pset fstatistic minval=0"); system("pset fstatistic maxval=0"); $ccd0 = `( fstatistic $file+1 ccdid - ; pget fstatistic numb )`; printf "%1d %18d %20.2f \n",0,$ccd0,100*$ccd0/$nevt; system("rm $maggot"); system("pset fstatistic minval=1"); system("pset fstatistic maxval=1"); $ccd1 = `( fstatistic $file+1 ccdid - ; pget fstatistic numb )`; printf "%1d %18d %20.2f \n",1,$ccd1,100*$ccd1/$nevt; system("rm $maggot"); system("pset fstatistic minval=2"); system("pset fstatistic maxval=2"); $ccd2 = `( fstatistic $file+1 ccdid - ; pget fstatistic numb )`; printf "%1d %18d %20.2f \n",2,$ccd2,100*$ccd2/$nevt; system("rm $maggot"); system("pset fstatistic minval=3"); system("pset fstatistic maxval=3"); $ccd3 = `( fstatistic $file+1 ccdid - ; pget fstatistic numb )`; printf "%1d %18d %20.2f \n",3,$ccd3,100*$ccd3/$nevt; system("rm $maggot"); # Create addrmf_file if nec. $rmff = shift(@ARGV); if ($rmff) { $caldb = shift(@ARGV); if (! $caldb) { $caldb = "/FTP/caldb/data/asca/sis/cpf/94nov9/"; } open(OUTFILE,">$rmff"); $rtname = "g0234p40e1_512v0_8i.rmf"; print OUTFILE "${caldb}s${snum}c0${rtname} ",$ccd0/$nevt,"\n"; print OUTFILE "${caldb}s${snum}c1${rtname} ",$ccd1/$nevt,"\n"; print OUTFILE "${caldb}s${snum}c2${rtname} ",$ccd2/$nevt,"\n"; print OUTFILE "${caldb}s${snum}c3${rtname} ",$ccd3/$nevt,"\n"; close(OUTFILE); }