
define character*256 file
let file 'pro%arg[1]'

msetup input data all ! none|ontrack|all
msetup input mjdinter no ! yes|no
read 'file' /file /subs 1
variable imbf
variable subs
variable imbdata

g\clear
g\set mark 4 1 0.06 45
g\set plot landscape
g\set char 0.4

define double mymjd /like subs%backdata%table%mjd
let mymjd (subs%backdata%table%mjd-subs%backdata%table%mjd[1])*86400.d0
define real xmin xmid xmax ymin ymid ymax
let xmin 3
let xmax 28
let xmid (xmin+xmax)/2
let ymin 2
let ymax 19.5
let ymid (ymin+ymax)/2
define integer ipart

let ipart 1
g\set box_loc xmin xmid ymin ymid
g\limits /var mymjd IMBDATA%imbf%val[ipart,1,]
g\box
g\points mymjd IMBDATA%imbf%val[ipart,1,]
g\draw text 1 -1 "Backend part #"'ipart'" ("'imbf%back%table%band[ipart]'")" 9 /box 7
g\label "Time [sec]" /X
g\label "Counts" /Y

let ipart 2
g\set box_loc xmid xmax ymin ymid
g\limits /var mymjd IMBDATA%imbf%val[ipart,1,]
g\box p n
g\axis YR /LABEL O ONLY
g\points mymjd IMBDATA%imbf%val[ipart,1,]
g\draw text 1 -1 "Backend part #"'ipart'" ("'imbf%back%table%band[ipart]'")" 9 /box 7
g\label "Time [sec]" /X

let ipart 3
g\set box_loc xmin xmid ymid ymax
g\limits /var mymjd IMBDATA%imbf%val[ipart,1,]
g\box n o
g\points mymjd IMBDATA%imbf%val[ipart,1,]
g\draw text 1 -1 "Backend part #"'ipart'" ("'imbf%back%table%band[ipart]'")" 9 /box 7
g\label "Counts" /Y

let ipart 4
g\set box_loc xmid xmax ymid ymax
g\limits /var mymjd IMBDATA%imbf%val[ipart,1,]
g\box n n
g\axis YR /LABEL O ONLY
g\points mymjd IMBDATA%imbf%val[ipart,1,]
g\draw text 1 -1 "Backend part #"'ipart'" ("'imbf%back%table%band[ipart]'")" 9 /box 7

g\set box_loc 4 28 2.5 19.5
g\draw text 0 0.7 'file' 5 /box 8