#! /bin/sh # This is the LHEA perl script: /cvmfs/extras-fp7.egi.eu/extras/heasoft/suzaku/x86_64-unknown-linux-gnu-libc2.19-0/bin/hxdgtigen # 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/suzaku/x86_64-unknown-linux-gnu-libc2.19-0/bin/hxdgtigen." 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/suzaku/x86_64-unknown-linux-gnu-libc2.19-0/bin/hxdgtigen." 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 # HXD gti making tool # This script makes a gti file, which excludes the time when "buffer flash" and "TLM reject" occur. # 2005 Nov 29 Hiromitsu Takahashi # 2006 Jun 27 Hiromitsu Takahashi # ftools release fo version 1.2 process # 2006 Nov 15 Hiromitsu Takahashi # excluding the time when data transfer from AE to DE is saturated. # identifying WPU borad IDs. # 2007 May 21 Hiromitsu Takahashi # "fifo_full" option is added to choose whether the gti includes # the time during the AE-DE transfer saturation or not. # 2008 Jul 29 Yukikatsu Terada, Takao Kitaguchi # bug fixed when the non reset counters carry up # $hxdgtigen_version = "1.5" ; $bufrec_max = 32.0; ### parse arguments ################################################ if(@ARGV) { foreach $i (0 .. $#ARGV) { $ARGV[$i] = "\"".$ARGV[$i]."\""; } $invokestring = join(' ',@ARGV); } $hk_dir = `pquery2 hxdgtigen hk_dir $invokestring`; chop($hk_dir); $hk_file = `pquery2 hxdgtigen hk_file $invokestring`; chop($hk_file); $gti_fname = `pquery2 hxdgtigen gti_fname $invokestring`; chop($gti_fname); $WPU = `pquery2 hxdgtigen WPU $invokestring`; chop($WPU); $fifo_full = `pquery2 hxdgtigen fifo_full $invokestring`; chop($fifo_full); $clobber = `pquery2 hxdgtigen clobber $invokestring`; chop($clobber); $chatter = `pquery2 hxdgtigen chatter $invokestring`; chop($chatter); ######## verbose ####### if($chatter){ printf("hxdgtigen: hxdgtigen version %s \n",$hxdgtigen_version); printf("hxdgtigen: hk dir = %s\n", $hk_dir); printf("hxdgtigen: hk file = %s\n", $hk_file); printf("hxdgtigen: WPU = %s\n", $WPU); printf("hxdgtigen: fifo full = %s\n", $fifo_full); printf("hxdgtigen: output gti = %s\n", $gti_fname); } ####################################################################### # check files if (!-e "$hk_dir/$hk_file"){ printf("hxdgtigen: No hk file!: %s/%s\n", $hk_dir, $hk_file); exit; } system("rm -f temp_gti.list"); foreach $wpu (0, 1, 2, 3) { if (`echo $WPU | grep -c $wpu`==1){ system("rm -f temp${wpu}_tlmrej.fits"); system("maketime prefr=1.0 postfr=0 infile=\"$hk_dir/$hk_file\"+2 outfile=\"temp${wpu}_tlmrej.fits\" expr=\"HXD_W${wpu}EVTLMRJCT\=\=HXD_W${wpu}EVTLMRJCT{-1}\" compact=NO time=TIME"); $bfsh = `fstruct \"$hk_dir/$hk_file\"+2 | grep TLMBFSH | grep W${wpu} | awk '{print \$2}'`; chop($bfsh); if ($chatter){ system("echo \"BFSH colmun name\: WPU\"${wpu}\" \"${bfsh}"); } system("rm -f temp${wpu}_bfsh.fits"); system("maketime prefr=1.0 postfr=0 infile=\"$hk_dir/$hk_file\"+2 outfile=\"temp${wpu}_bfsh.fits\" expr=\"${bfsh}\=\=${bfsh}{-1}\" compact=NO time=TIME"); system("cat >> temp_gti.list <=0 ? (HXD_WEVT${wpu}_BREC_CNT-HXD_WEVT${wpu}_BREC_CNT{-1})/(TIME-TIME{-1})<$bufrec_max : (HXD_WEVT${wpu}_BREC_CNT-HXD_WEVT${wpu}_BREC_CNT{-1}+65535)/(TIME-TIME{-1})<$bufrec_max\" compact=NO time=TIME"); system("cat >> temp_gti.list <