char trigConf_tcl_proc[]= "#!/usr/bin/wish\n" "\n" "\n" "set smallfont \"-adobe-times-*-r-*-*-12-*-*-*-*-*-*-*\"\n" "set mediumfont \"-adobe-times-*-r-*-*-14-*-*-*-*-*-*-*\"\n" "set largefont \"-adobe-times-*-r-*-*-16-*-*-*-*-*-*-*\"\n" "set hugefont \"-adobe-times-*-r-*-*-18-*-*-*-*-*-*-*\"\n" "\n" "\n" "\n" "set scaler_channels [list \"OR TRIGGER\" \"LATCHED TRIGGER\" \"LEVEL 1 ACCEPT\" \"LEVEL 2 ACCEPT\" \"LEVEL 3 ACCEPT\"]\n" "lappend scaler_channels \"FAST RESET\" \"CLEAR\" \"LEVEL 2 PASS\" \"LEVEL 2 FAIL\" \"LEVEL 3 PASS\" \"LEVEL 3 FAIL\"\n" "lappend scaler_channels \"LATE FAIL\" \"SYNC SCHEDULED\" \"SYNC FORCED\" \"PROGRAM 1 EVENT\" \"PROGRAM 2 EVENT\"\n" "\n" "proc Initialize {} {\n" "\n" " global smallfont mediumfont largefont hugefont\n" " global t1_enable t2_enable t3_enable t4_enable t5_enable t6_enable\n" " global t7_enable t8_enable t9_enable t10_enable t11_enable t12_enable\n" " global t1_prescale t2_prescale t3_prescale t4_prescale t5_prescale t6_prescale\n" " global t7_prescale t8_prescale t9_prescale t10_prescale t11_prescale t12_prescale\n" " global sync_enable sync_period\n" " global scaler13 scaler14 scaler15 scaler16 scaler17 scaler18\n" " global filename current_time\n" " global trigger_addr roc_code\n" " global busyfrontendenable\n" "\n" "#source trigConf_mlu.tcl\n" "#source trigConf_roc.tcl\n" "\n" " # Menu buttons\n" " frame .mf -borderwidth 3 -relief raised\n" " pack .mf -side top -fill x\n" " menubutton .mf.file -text \"File\" -menu .mf.file.m\n" " menubutton .mf.conf -text \"Configurations\" -menu .mf.conf.m\n" " menubutton .mf.expert -text \"Expert\" -menu .mf.expert.m\n" " menubutton .mf.help -text \"Help\" -state disabled\n" " pack .mf.file .mf.conf .mf.expert -side left\n" " pack .mf.help -side right\n" "\n" " # File Menu\n" " menu .mf.file.m\n" " .mf.file.m add command -label \"Open...\" -command {ReadFromFile [tk_getOpenFile -initialdir \"/usr/local/halld/config\"]}\n" " .mf.file.m add separator\n" " .mf.file.m add command -label \"Save\" -command {SaveToFile $filename}\n" " .mf.file.m add command -label \"Save As...\" -command {SaveToFile [tk_getSaveFile]}\n" " .mf.file.m add separator\n" " .mf.file.m add command -label \"Quit\" -command {destroy .}\n" "\n" " # Configurations Menu\n" " menu .mf.conf.m\n" " .mf.conf.m add command -label \"Default Production\" -command {ConfigProduction} -state disabled\n" " .mf.conf.m add command -label \"Default PS\" -command {ConfigPS} -state disabled\n" " .mf.conf.m add command -label \"Default TAC\" -command {ConfigTAC} -state disabled\n" " .mf.conf.m add command -label \"Default MOR\" -command {} -state disabled\n" " .mf.conf.m add command -label \"Default Calib 1\" -command {} -state disabled\n" "\n" " # MLU Program Menu\n" " menu .mf.expert.m\n" " .mf.expert.m add checkbutton -label \"Show MLU programmer\" -command {ShowHideMLUProgrammer}\n" " .mf.expert.m add checkbutton -label \"Show ROC programmer\" -command {ShowHideROCProgrammer}\n" "\n" " # Middle frame\n" " frame .m\n" " pack .m -side top -fill both\n" "\n" " # Trigger bits\n" " set w .m.trig\n" " frame $w -borderwidth 2 -relief groove\n" " pack $w -side left\n" " label $w.lab -text \"Level 1 Trigger Bits\"\n" " pack $w.lab -side top -fill both\n" " for {set i 1} {[expr $i<=12]} {incr i} {\n" " AddTriggerRow $w $i\n" " }\n" "\n" " # Right side of middle frame\n" " frame .m.right\n" " pack .m.right -side right -fill both\n" "\n" " # SYNC Events\n" " set w .m.right.sync\n" " frame $w -borderwidth 3 -relief groove\n" " pack $w -side top -fill x -ipady 5\n" " label $w.lab -text \"SYNC Events\" -font $smallfont\n" " checkbutton $w.enable -variable sync_enable -text \"enable\" -command {} -font $smallfont\n" " frame $w.period\n" " label $w.period.left_lab -text \"every\" -font $smallfont\n" " menubutton $w.period.mb -text \"--select--\" -textvariable sync_period -menu $w.period.mb.m \\\n" " -relief raised -borderwidth 2 -width 8 -font $smallfont\n" " label $w.period.right_lab -text \"events\" -font $smallfont\n" " pack $w.period.left_lab $w.period.mb $w.period.right_lab -side left\n" " set sync_periods [list 1 10 100 1000 2000 5000 10000 100000]\n" " menu $w.period.mb.m -font $smallfont\n" " foreach period $sync_periods {\n" " $w.period.mb.m add radiobutton -label $period -value $period -variable sync_period -font $smallfont\n" " }\n" " set sync_period 1000\n" " pack $w.lab $w.enable $w.period -side top -fill y\n" "\n" " # Busy Timer\n" " set w .m.right.busy\n" " frame $w -borderwidth 3 -relief groove\n" " pack $w -side top -fill x -ipady 5\n" " label $w.lab -text \"Busy Timer\" -font $smallfont\n" " frame $w.period\n" " menubutton $w.period.mb -text \"--select--\" -textvariable busytimer -menu $w.period.mb.m \\\n" " -relief raised -borderwidth 2 -width 8 -font $smallfont\n" " label $w.period.right_lab -text \"microseconds\" -font $smallfont\n" " pack $w.period.mb $w.period.right_lab -side left\n" " set busy_periods [list 1 5 10 12 15 20 25 50 75 100 500 1000]\n" " menu $w.period.mb.m -font $smallfont\n" " foreach period $busy_periods {\n" " $w.period.mb.m add radiobutton -label $period -value $period -variable busytimer -font $smallfont\n" " }\n" " checkbutton $w.enable -text \"enable\" -variable busytimerenable -font $smallfont\n" " set busy_period 50\n" " set busytimer_enable 0\n" " pack $w.lab $w.period $w.enable -side top -fill y\n" "\n" " # External Busy Enable\n" " set w .m.right.exbusy\n" " frame $w -borderwidth 3 -relief groove\n" " pack $w -side top -fill x -ipady 5\n" " label $w.lab -text \"External Busy (front panel)\" -font $smallfont\n" " checkbutton $w.enable -text \"enable\" -variable busyfrontendenable -font $smallfont\n" " set busyfrontendenable 1\n" " pack $w.lab $w.enable -side top -fill y\n" " \n" " # Scaler Assignments\n" " set w .m.right.scaler\n" " frame $w -borderwidth 2 -relief groove\n" " pack $w -side top -fill both\n" " label $w.lab -text \"TS Scalers\" -font $smallfont\n" " pack $w.lab -side top -fill x -pady 5\n" " for {set i 13} {[expr $i<=18]} {incr i} {\n" " AddScalerRow $w $i\n" " }\n" " \n" " # MLU Programmer frame\n" " frame .b -relief groove -borderwidth 4\n" " # bottom frame is packed and unpacked by ShowHideMLUProgrammer\n" " #pack .b -side top -fill both\n" " MLUProgrammer .b\n" "\n" " # ROC Programmer frame\n" " frame .rocs -relief groove -borderwidth 4\n" " # this frame is packed and unpacked by ShowHideROCProgrammer\n" " ROCProgrammer .rocs\n" "\n" " # Add current filename to very bottom\n" " frame .filename\n" " pack .filename -side bottom -fill x\n" " label .filename.lab -text \"filename : \"\n" " label .filename.fname -textvariable filename -anchor w\n" " pack .filename.lab .filename.fname -side left -fill x\n" " set filename \"\"\n" " label .filename.clock -textvariable current_time -anchor e\n" " pack .filename.clock -side right\n" " UpdateClock\n" "}\n" "\n" "proc AddTriggerRow {win t} {\n" " global t1_enable t2_enable t3_enable t4_enable t5_enable t6_enable\n" " global t7_enable t8_enable t9_enable t10_enable t11_enable t12_enable\n" " global t1_prescale t2_prescale t3_prescale t4_prescale t5_prescale t6_prescale\n" " global t7_prescale t8_prescale t9_prescale t10_prescale t11_prescale t12_prescale\n" "\n" " set w $win.t$t\n" " frame $w -relief groove -borderwidth 2\n" " pack $w -side top -fill x\n" " label $w.lab -text \"T$t:\" -width 4 -anchor e\n" " checkbutton $w.enable -variable t${t}_enable -text \"enable\"\n" " frame $w.psframe\n" " if {[expr $t<=8]} {\n" " set bits [expr $t<=4 ? 24:16]\n" " entry $w.psframe.prescale -textvariable t${t}_prescale -width 8 \n" " label $w.psframe.pslab -text \"prescale ($bits bits)\"\n" " pack $w.psframe.prescale $w.psframe.pslab -side left\n" " }\n" " pack $w.lab $w.enable $w.psframe -side left -fill y -padx 10\n" "}\n" "\n" "proc AddScalerRow {win t} {\n" " global scaler13 scaler14 scaler15 scaler16 scaler17 scaler18\n" " global scaler13_name scaler14_name scaler15_name scaler16_name scaler17_name scaler18_name\n" " global scaler_channels\n" " global smallfont\n" "\n" " set w $win.scaler$t\n" " frame $w -relief groove -borderwidth 2\n" " pack $w -side top -fill x\n" " label $w.lab -text \"scaler $t:\" -width 12 -anchor e -font $smallfont\n" " menubutton $w.mb -text \"--select--\" -textvariable scaler${t}_name -menu $w.mb.m \\\n" " -relief raised -borderwidth 2 -width 18 -font $smallfont\n" " menu $w.mb.m -font $smallfont\n" " set i 0\n" " foreach channel $scaler_channels {\n" " $w.mb.m add radiobutton -label $channel -value $channel -variable scaler${t}_name \\\n" " -command {MapScalers} -font $smallfont\n" " incr i\n" " }\n" "\n" " pack $w.lab $w.mb -side left -fill y -padx 10\n" "}\n" "\n" "# This kludge of a routine is so we can have the scaler menus display a string while\n" "# still having the numeric value set in a global variable. This does this for\n" "# all 6 scalers everytime any one of them is set.\n" "proc MapScalers {} {\n" " global scaler13 scaler14 scaler15 scaler16 scaler17 scaler18\n" " global scaler13_name scaler14_name scaler15_name scaler16_name scaler17_name scaler18_name\n" " global scaler_channels\n" "\n" " for {set i 13} {[expr $i<=18]} {incr i} {\n" " set channel [subst scaler${i}_name]\n" " set scaler [subst scaler$i]\n" " set $scaler [lsearch -exact $scaler_channels [set $channel]]\n" " }\n" "}\n" "\n" "# This routine will set the scaler channel names according\n" "# to what the numerical value is. This is so the scalers can be\n" "# easily set when a new configuration is read in.\n" "proc ReverseMapScalers {} {\n" " global scaler13 scaler14 scaler15 scaler16 scaler17 scaler18\n" " global scaler13_name scaler14_name scaler15_name scaler16_name scaler17_name scaler18_name\n" " global scaler_channels\n" "\n" " for {set i 13} {[expr $i<=18]} {incr i} {\n" " set channel [subst scaler${i}_name]\n" " set scaler [subst scaler$i]\n" " set $channel [lindex $scaler_channels [set $scaler]]\n" " }\n" "}\n" "\n" "proc UpdateClock {} {\n" " global current_time\n" " set current_time [clock format [clock seconds] -format \"%c\"]\n" " after 1000 UpdateClock\n" "}\n" "\n" "\n" "Initialize\n" "\n" "wm title . \"PrimEx Trigger Configurator\"\n" "\n" ;