#!/usr/bin/sh
# \
exec oagwish "$0" "$@"

set auto_path [linsert $auto_path 0 /usr/local/oag/apps/lib/$env(HOST_ARCH)]
set auto_path [linsert $auto_path 0  /usr/local/oag/lib_patch/$env(HOST_ARCH)]

set CVSRevisionAuthor "\$Revision: 1.618 $ \$Author: soliday $"

APSApplication . -name OAGapps -version $CVSRevisionAuthor \
  -overview {This is a menu of Operations Analysis Group applications.  Send email to borland with any comments or bug reports.\n\
               Try turning on 'Context Help' from the Help menu; turn it off using the same menu.  If you are in the control room, you can use the SUN Help key to toggle context help mode.  When in context help mode, the mouse pointer turns into a question mark; pressing on various objects will usually bring up a short help dialog.}

if {[wm geometry .] == "1x1+0+0"} {
  wm geometry . +33+0
}
set rfGroup "rf nassiri asdops sr borland emery npd soliday  oag cyao horan"
set srGroup "borland emery asdops sr carwar feedback soliday  nassiri oag cyao shang"
set parGroup "borland emery sereno asdops par gbanks soliday leutl nassiri oag laser cyao linac"
set linacGroup "borland emery sereno asdops linac  pasky nda soliday leutl nassiri oag laser lewellen"
set feedbackGroup "feedback afp carwar frl hillmana afp decker blill singh oag csch tfors csch laird"
set psGroup "psgroup hillmana feedback oag tfors asdops sr soliday"
set boosterGroup "borland emery sereno asdops booster milton gbanks soliday nassiri oag cyao psgroup linac shang"
set leutlGroup "leutl borland sereno oag laser lewellen linac"
set rfGunGroup "pasky linac sereno flood"

######## Misc control apps ############
APSMenuFrameMake miscMenu -type label -text "Miscellaneous"

#APSMenuFrameMake miscMenu -type secureExec -text "Current Monitor Offsets" -executable setCMOffsets -contextHelp "Brings up a utility for setting the LTP, PAR, PTB, and BTS current monitor offsets." -allowedSubnets "164.54.2 164.54.3"

APSMenuFrameMake miscMenu -type exec \
  -text "Machine workspace setup" -executable APSMWST -contextHelp \
  "Brings up a utility for setting up MEDM screens for operating different machines."

APSMenuFrameMake miscMenu -type exec \
  -text "ASDOPS workspace setup" -executable  /home/helios/ASDOPS/bin/dws -contextHelp \
  "This is the ASDOPS desktop workspace script and has a new launcher to work with RHEL6 and RHEL7."


APSMenuFrameMake miscMenu -type exec \
  -text "Uniform Notebook Utility" -executable UniformNotebook -contextHelp \
  "Brings up a utility for creating uniform machine studies notebook entries."

APSMenuFrameMake miscMenu -type secureExec \
  -text "Timing resets" -executable timingResets -contextHelp \
  "Brings up a screen for doing various timing resets for pulsed magnets and the P0 counter." 
#  -allowedUsers ""
#  -allowedUsers "$linacGroup $parGroup $boosterGroup $srGroup"

APSMenuFrameMake miscMenu -type exec \
  -text "Safety envelope monitor" -executable safetyEnvMon -contextHelp \
  "Brings up a utility for evaluating beam conditions in light of the safety envelope."

APSMenuFrameMake miscMenu -type exec \
  -text "ADT Filter and Run" -executable ADTFilter -contextHelp \
  "Brings up a utility to prefilter ADT files and then run ADT."

APSMenuFrameMake miscMenu -type exec \
  -text "PV Search" -executable pvsearch -contextHelp \
  "Brings up a utility for searching the PV database for PV names matching a specific pattern."

APSMenuFrameMake miscMenu -type exec \
  -text "PV Monitor" -executable PVmonitor -contextHelp \
  "Brings up a utility for monitoring PV values vs limits supplied by the user."

APSMenuFrameMake miscMenu -type exec \
  -text "CS-Studio phoebus" -executable phoebus-aop -contextHelp \
  "Brings up CSS-Phoebus GUI"

APSMenuFrameMake miscMenu -type exec \
  -text "Process search and destroy" -executable NetProcessControl -contextHelp \
  "Brings up a utility for searching MCR workstations for processes and selectively killing them."

APSMenuFrameMake miscMenu -type exec \
  -text "Password Manager" -executable /usr/local/oag/apps/bin/$env(HOST_ARCH)/passManager -contextHelp \
  "Brings up a utility for storing encripted passwords."

APSMenuFrameMake miscMenu -type exec \
  -text "Demo Script" -executable demoScript -contextHelp \
  "Brings up a script that demonstrates many of the common features of OAG scripts."

APSMenuFrameMake miscMenu -type exec \
  -text "Time Card Checker" -executable CheckPayStub -contextHelp \
  "Script for the operators and ACOs to check the validity of their time cards."

APSMenuFrameMake miscMenu -type exec \
  -text "Manage Operator Quiz Questions" -executable OperatorQuizQuestions.tbc -contextHelp \
  "Script to add/modify/delete questions for the operator quiz."

APSMenuFrameMake miscMenu -type exec \
  -text "Image Capture" -executable OperatorImageCapture -contextHelp \
  "Script to capture beam images."

APSMenuFrameMake miscMenu -type secureExec \
  -text "IOC Rebooter" -executable IOCRebooter -contextHelp \
  "Script to capture beam images."

APSMenuFrameMake miscMenu -type exec \
  -text "FOE Occupancy" -executable FOEoccupancy -contextHelp \
  "Script to calculate the length of time a FOE door is open while zonez A-F are in beam permit mode."

APSMenuFrameMake miscMenu -type exec \
  -text "NOAA Temperature Trends" -executable noaaGUI -contextHelp \
  "Temperature data from the National Oceanic and Atmospheric Administration's Cliemate Reference Network. The raw data is fit using SDDS tools in an attempt to give an unbiased look at temperature trends."

#### miscellaneous menu attic

APSMenuFrameMake miscMenuAttic -type label -text "Attic"

APSMenuFrameMake miscMenuAttic -type exec \
  -text "To-Do List Maintainer" -executable MaintainToDoList -contextHelp \
  "Brings up a utility for maintaining and prioritizing a to-do list.  Get organized! Stop procrastinating! Be happy!"

APSMenuFrameMake miscMenuAttic -type exec \
  -text "Frequency Check" -executable checkFreq -contextHelp \
  "Brings up a screen that allows checking the frequency match between PAR, booster, and SR."

######## Controller apps ############
APSMenuFrameMake controllerMenu -type label -text "Generic Controllers"

APSMenuFrameMake controllerMenu -type exec \
  -text "PV Oscillator" -executable OscillatePVs \
  -contextHelp "Brings up an application that lets you oscillate the values of\
 a number of process variables using a sine wave or triangle wave."

APSMenuFrameMake controllerMenu -type exec \
  -text "PV Ramper" -executable RampPVs \
  -contextHelp "Brings up an application that lets you ramp the values of\
 a number of process variables using a line or exponential function."

APSMenuFrameMake controllerMenu -type exec \
  -text "One variable feedback" -executable maintainReadback \
    -contextHelp "Brings up an application that lets you set up and \
      run a feedback loop with one actuator and one readback."

APSMenuFrameMake controllerMenu -type exec \
    -text "Generic Optimizer" -executable optimizeInterface \
    -contextHelp "Brings up an application for performing simplex optimization on process variables."

APSMenuFrameMake controllerMenu -type exec \
    -text "APSopt Optimizer" -executable "apsopt gui" \
    -contextHelp "Brings up the new ML optimizer interface."

APSMenuFrameMake controllerMenu -type exec \
    -text "badger" -executable "/usr/local/oag/3rdParty/miniconda3.new/envs/badger-env/bin/badger -g" \
    -contextHelp "Brings up the new bager interface."

APSMenuFrameMake controllerMenu -type exec \
  -text "Tcl Knobs" -executable tclKnobs -contextHelp \
  "Sets up Tcl/Tk composite knob interface based on existing SDDS knobconfig\
     files." 

APSMenuFrameMake controllerMenu -type secureExec \
  -text "2D Slider Panel" -executable twoDSlider -contextHelp \
  "Brings up an application for creating and user 2 dimensional slider controls." 

APSMenuFrameMake controllerMenu -type exec \
  -text "TK Probe" -executable tkprobe \
  -contextHelp "Brings up an application to monitor and get\
     information on process variables.  Works differently and has\
     some information that is not available in the Epics Probe."

######## Data Review MENU ############
APSMenuFrameMake loggerReviewMenu -type label -text "Data Logger Review"
APSMenuFrameMake loggerReviewMenu -type exec \
  -text "PV Data Logger review" -executable /home/oxygen/SHANG/oag/apps/src/tcltkapp/oagapp/DataLoggerViewer \
  -contextHelp "Bring up a screen to review PV data logger data." 
APSMenuFrameMake loggerReviewMenu -type exec \
  -text "PV Alarm Logger review" -executable ReviewAlarmLog \
  -contextHelp "Bring up a screen to review alarm logger data." 
APSMenuFrameMake loggerReviewMenu -type exec \
  -text "PV Glitch Logger review" -executable "MonitorDataReview -group Glitch"\
  -contextHelp "Bring up a screen to review glitch data." 
APSMenuFrameMake loggerReviewMenu -type exec \
  -text "PV Log-On-Change Logger review" -executable {PVHistoryTool -configurationFile PVHistoryTool.config.2.sdds} \
  -contextHelp "Brings up the screen for the PV History Tool facility." 
APSMenuFrameMake loggerReviewMenu -type exec \
  -text "Booster Ramp Correction Log review" -executable BRampAutoCorrReview \
  -contextHelp "Bring up a screen to review booster automatic ramp correction data." 
APSMenuFrameMake loggerReviewMenu -type exec \
  -text "Booster Ramp Correction Waveform review" -executable BoosterRampCorrectionReview \
  -contextHelp "Bring up a screen to review booster correction ramps and current waveforms."
APSMenuFrameMake loggerReviewMenu -type exec \
  -text "PEM Error and Activity Log review" -executable "PEMErrorLogReview -log scriptAction" \
  -contextHelp "Bring up a screen to review the error and activity logs for the PEM."

APSMenuFrameMake loggerReviewMenu -type exec \
  -text "PV Alarm Probability Analysis" -executable AlarmProbabilityAnalysis \
  -contextHelp "Bring up a screen to review alarm logger data with computations of alarm probabilities relative to a reference time."
APSMenuFrameMake loggerReviewMenu -type exec \
  -text "Search PV Alarm Loggers" -executable "SearchDataLoggers -type alarm" \
  -contextHelp "Bring up a screen to search alarm log input files for PV names."
APSMenuFrameMake loggerReviewMenu -type exec \
  -text "PV Data Logger Comparison" -executable CompareDataLogs \
  -contextHelp "Bring up a screen to compare values from data logs at two different times."
APSMenuFrameMake loggerReviewMenu -type exec \
  -text "Search PV Data Loggers" -executable SearchDataLoggers \
  -contextHelp "Bring up a screen to search data log input files for PV names or readback names."
APSMenuFrameMake loggerReviewMenu -type exec \
  -text "Injector Beam Time review" -executable InjectorBeamTimeReview \
    -contextHelp "Bring up a screen to compute beam time in various parts of the injector."
APSMenuFrameMake loggerReviewMenu -type exec \
  -text "Check PV Data Loggers" -executable checkDataLoggers \
  -contextHelp "Bring up a screen to check that data loggers are running."

APSMenuFrameMake loggerReviewMenu -type exec \
  -text "Booster Ramp Waveform Glitch data review" -executable "BoosterRampWaveformGlitchReview"\
  -contextHelp "Bring up a screen to review Booster Ramp waveform glitch data." 
APSMenuFrameMake loggerReviewMenu -type exec \
  -text "Vibration Monitoring review" -executable "VibrationMonitorDisplay"\
  -contextHelp "Bring up a screen to review vibration monitoring around the storage ring." 

APSMenuFrameMake loggerReviewMenuAttic -type label -text "Attic"

APSMenuFrameMake loggerReviewMenuAttic -type exec \
  -text "Monitor data review (old)" -executable MonitorDataReview \
  -contextHelp "Bring up a screen to review monitor data." 
APSMenuFrameMake loggerReviewMenuAttic -type exec \
  -text "OPI data review" -executable "MonitorDataReview -group OPI" \
  -contextHelp "Bring up a screen to review load and performance data for OPIs (operator interfaces)."
APSMenuFrameMake loggerReviewMenuAttic -type exec \
  -text "Review PEM Error Log (old)" -executable PEMErrorLogReview \
  -contextHelp "Bring up a screen to review the error logs for the PEM."
APSMenuFrameMake loggerReviewMenuAttic -type exec \
  -text "Review PEM Activity Log (old)" -executable "PEMErrorLogReview -log mpExecAudit" \
  -contextHelp "Bring up a screen to review the activity logs for the PEM."
APSMenuFrameMake loggerReviewMenuAttic -type exec \
  -text "Extended monitor data review" -executable MonitorDataReviewExtended \
  -contextHelp "Bring up a screen to review monitor data.  This version allows reviewing data from multiple loggers." 

#APSMenuFrameMake loggerReviewMenu -type exec -text "Check workstation clocks" -executable clockCheck -contextHelp "Bring up a screen to check the clocks between different workstations."

APSMenuFrameMake routineOperationsMenu -type label -text "Routine Operations" 

APSMenuFrameMake routineOperationsMenu -type secureExec \
  -text "Save/Compare/Restore" -executable SaveCompareRestore \
  -contextHelp "Brings up the screen for the save/compare/restore/review facility." 
  
APSMenuFrameMake routineOperationsMenu -type exec \
  -text "Alarm logger review" -executable ReviewAlarmLog \
  -contextHelp "Bring up a screen to review alarm logger data."

APSMenuFrameMake routineOperationsMenu -type exec \
  -text "Check data loggers" -executable checkDataLoggers \
  -contextHelp "Bring up a screen to check that data loggers are running."
  
APSMenuFrameMake routineOperationsMenu -type exec \
  -text "Data logger viewer (new)" -executable DataLoggerViewer \
  -contextHelp "Bring up a screen to review logged data."
  
APSMenuFrameMake routineOperationsMenu -type secureExec \
  -text "Timing resets" -executable timingResets -contextHelp \
  "Brings up a screen for doing various timing resets for pulsed magnets and the P0 counter."

APSMenuFrameMake routineOperationsMenu -type exec \
  -text "XrayOps Notification Tool" -executable APSStatusOperatorMessageEntry \
  -contextHelp "Updates the APS Status message and send notification to xrayops list."

APSMenuFrameMake routineOperationsMenuLinac -type label -text "Linac"

APSMenuFrameMake routineOperationsMenuLinac -type secureExec \
    -text "Linac PEM" -executable "LINACpem"

APSMenuFrameMake routineOperationsMenuLinac -type secureExec \
  -text "RF gun scope save/restore" -executable "ScopeSaveRestore -scopeID L1:SCOPE1" \
  -contextHelp "Brings up a utility for saving and restoring scope setups and waveforms for L1:SCOPE1"

APSMenuFrameMake routineOperationsMenuLinac -type secureExec \
  -text "Single-Matrix Linac Beam-RF Phase controllaw" -executable {controllaw -controlList "linacBeamRfPhaseGlobal"} \
  -contextHelp "Bring up the controllaw screens for single-matrix linac beam-rf phase feedback using all actuators and detector readbacks."

APSMenuFrameMake routineOperationsMenuLinac -type secureExec \
  -text "Linac controllaw" -executable {controllaw -controlList "linac"} \
  -contextHelp "Bring up the controllaw screens relevant to the linac trajectory controllaw."

APSMenuFrameMake routineOperationsMenuLinac -type exec \
  -text "Linac+RG1 controllaw" -executable {controllaw -controlList "rg1PlusLinac"} \
  -contextHelp "Bring up the controllaw screens relevant to the linac+RG1 trajectory controllaw."

APSMenuFrameMake routineOperationsMenuLinac -type secureExec \
  -text "Linac BPM Feedback Setpoints" -executable "LinacLTPSetpointTransfer -includeLinac 1" \
  -contextHelp "Bring up the utility to set steering setpoints for linac BPMs for use with linac controllaw."
  
APSMenuFrameMake routineOperationsMenuLinac -type secureExec \
  -text "LTP controllaw" -executable {controllaw -controlList "ltp"} \
  -contextHelp "Bring up the controllaw screens relevant to the LTP."

APSMenuFrameMake routineOperationsMenuLinac -type secureExec \
  -text "LTP BPM setpoint config" -executable "LinacLTPSetpointTransfer -includeLTP 1" \
  -contextHelp "Bring up the BPM setpoint transfer screens relevant to the LTP."

APSMenuFrameMake routineOperationsMenuLinac -type exec \
  -text "Acquire Linac waveform" -executable "AcquireLinacWaveforms" \
  -contextHelp ""

APSMenuFrameMake routineOperationsMenuPAR -type label -text "PAR"

APSMenuFrameMake routineOperationsMenuPAR -type secureExec \
  -text "PAR PEM" -executable {PARpem} \
  -contextHelp "Bring up the procedure execution manager for the par/let."

APSMenuFrameMake routineOperationsMenuPAR -type secureExec \
  -text "LTP controllaw" -executable {controllaw -controlList "ltp"} \
  -contextHelp "Bring up the controllaw screens relevant to the LTP."

APSMenuFrameMake routineOperationsMenuPAR -type secureExec \
  -text "LTP BPM setpoint config" -executable "LinacLTPSetpointTransfer -includeLTP 1" \
  -contextHelp "Bring up the BPM setpoint transfer screens relevant to the LTP."

APSMenuFrameMake routineOperationsMenuPAR -type exec \
  -text "PAR Orbit Correction" -executable {controllaw -controlList par} \
  -contextHelp "Bring up an application to correct the PAR orbit"

APSMenuFrameMake routineOperationsMenuPAR -type exec \
    -text "PAR RF12 Tuner Feedforward" -executable \
    "PARRF12TunerFeedforward" -contextHelp \
    "Launches script to par rf12 tuner feedforward"

APSMenuFrameMake routineOperationsMenuPAR -type secureExec \
  -text "PAR Scope Save/Restore (new)" -executable ScopeSaveRestore \
  -contextHelp "Brings up the par save/restore screen for the PAR HP9000 scope with python sockeet."

APSMenuFrameMake routineOperationsMenuPAR -type secureExec \
  -text "PAR Scope Save/Restore" -executable "ScopeSaveRestore -new 0" \
  -contextHelp "Brings up the par save/restore screen for the PAR HP9000 scope."
  

APSMenuFrameMake routineOperationsMenuPAR -type exec \
  -text "PTB controllaw" -executable {controllaw -controlList ptb} \
  -contextHelp "Bring up the controllaw screens relevant to the booster."

APSMenuFrameMake routineOperationsMenuPAR -type exec \
  -text "PTB BPM setpoint config" -executable \
  "LinacLTPSetpointTransfer -includePTB 1 -includeLinac 0 -includeLTP 0" \
  -contextHelp "Bring up a screen to transfer PTB BPM readings to controllaw setpoints"

APSMenuFrameMake  routineOperationsMenuPAR  -type exec \
    -text "PAR kicker timing setup" -executable  PARKickerTimingSetup \
    -contextHelp "Bring up a screen to scan and setup par kicker timing"
if {0} {
APSMenuFrameMake  routineOperationsMenuPAR  -type exec \
    -text "PTB charge Optimizer - x plane" -executable  "optimizeInterface -configuration /home/helios/oagData/par/optimizationFiles/PTBchargeOpt/xplane"  \
    -contextHelp "Bring up a screen to optimize PTB charge with x plane correctors"

APSMenuFrameMake  routineOperationsMenuPAR  -type exec \
    -text "PTB charge Optimization - y plane" -executable  "optimizeInterface -configuration /home/helios/oagData/par/optimizationFiles/PTBchargeOpt/yplane"  \
    -contextHelp "Bring up a screen to optimize PTB charge with x plane correctors"
}

APSMenuFrameMake routineOperationsMenuBooster -type label -text "Booster"

APSMenuFrameMake routineOperationsMenuBooster -type exec \
  -text "BTS BPM setpoint transfer" -executable \
  "LinacLTPSetpointTransfer -includeBTS 1" \
  -contextHelp "Bring up a screen to transfer BTS BPM readings to controllaw setpoints" 

APSMenuFrameMake routineOperationsMenuBooster -type exec \
  -text "Booster PEM"  -executable {BoosterPem} \
  -contextHelp "Bring up the procedure execution manager for the booster."

APSMenuFrameMake routineOperationsMenuBooster -type exec \
  -text "PTB controllaw" -executable {controllaw -controlList ptb} \
  -contextHelp "Bring up the controllaw screens relevant to the booster."

APSMenuFrameMake routineOperationsMenuBooster -type exec \
  -text "PTB BPM setpoint config" -executable \
  "LinacLTPSetpointTransfer -includePTB 1 -includeLinac 0 -includeLTP 0" \
  -contextHelp "Bring up a screen to transfer PTB BPM readings to controllaw setpoints"

APSMenuFrameMake routineOperationsMenuBooster -type exec \
  -text "Booster Automatic Ramp Correction" -executable {BRampControlAutoCorrection} \
  -contextHelp "Interface for booster automatic ramp correction application."

APSMenuFrameMake routineOperationsMenuBooster -type exec \
  -text "Booster controllaw" -executable {controllaw -controlList "booster"} \
  -contextHelp "Bring up the controllaw screens relevant to booster injection."

#APSMenuFrameMake routineOperationsMenuBooster -type exec \
#  -text "Booster Corrector Checkout"  -executable {BoosterCorrectorCheckOut } \
 # -contextHelp "Bring up an application to monitor and test booster correctors."

APSMenuFrameMake routineOperationsMenuBooster -type exec \
  -text "Booster ramp control" -executable BRampControl \
  -contextHelp "Bring up a screen control and diagnose the booster main ramped supplies"
  
APSMenuFrameMake routineOperationsMenuBooster -type exec \
  -text "Booster corrector control" -executable BoosterCorrectorControl \
  -contextHelp "Bring up a screen for booster corrector ramp loading and verifying."

APSMenuFrameMake routineOperationsMenuBooster -type exec \
  -text "Run Booster Energy Save Mode" -executable BRampEnergySave \
  -contextHelp "Bring up the booster energy save application"

APSMenuFrameMake routineOperationsMenuBooster -type exec \
  -text "Run Booster Energy Save Review" -executable RampTestReview \
  -contextHelp "Bring up the booster energy save review application"

APSMenuFrameMake routineOperationsMenuBooster -type exec \
  -text "BTS controllaw" -executable {controllaw -controlList "bts" -debug 1} \
  -contextHelp "Bring up the controllaw screens for BTS trajectory control."

APSMenuFrameMake routineOperationsMenuBooster -type secureExec \
  -text "BTX controllaw" -executable {controllaw -controlList "btx"} \
  -contextHelp "Bring up the controllaw screens for BTX trajectory control."


if {0} {
APSMenuFrameMake  routineOperationsMenuBooster  -type exec \
    -text "BTS charge Optimizer" -executable  "optimizeInterface -configuration /home/helios/oagData/booster/optimizationFiles/BTSchargeOpt"  \
    -contextHelp "Bring up a screen to optimize BTS charge"
}

APSMenuFrameMake routineOperationsMenuSR -type label -text "Storage Ring"

APSMenuFrameMake routineOperationsMenuSR -type secureExec \
  -text "SR PEM"  -executable {SRpem} \
  -contextHelp "Bring up the procedure execution manager for the storage ring."

APSMenuFrameMake routineOperationsMenuSR -type exec \
  -text "BTS controllaw" -executable {controllaw -controlList "bts"} \
  -contextHelp "Bring up the controllaw screens for BTS trajectory control."

APSMenuFrameMake routineOperationsMenuSR -type exec \
  -text "BTS BPM setpoint transfer" -executable {LinacLTPSetpointTransfer -includeBTS 1} \
  -contextHelp "Bring up an application to transfer the BTS trajectory to BPM setpoints"

APSMenuFrameMake routineOperationsMenuSR -type secureExec \
  -text "BTX controllaw" -executable {controllaw -controlList "btx"} \
  -contextHelp "Bring up the controllaw screens for BTX trajectory control."


APSMenuFrameMake routineOperationsMenuSR -type exec \
  -text "Large status display" -executable SRLargeStatusDisplay -contextHelp \
  "Brings up the storage ring large status display, showing time, current, lifetime, and emittance."

APSMenuFrameMake routineOperationsMenuSR -type secureExec \
  -text "Orbit controllaw (expert)" -executable SROrbitControllaw -contextHelp \
  "Brings up a utility (expert version)for using sddscontrollaw to correct the SR orbit."

APSMenuFrameMake routineOperationsMenuSR -type secureExec \
  -text "P5 controllaw" -executable {controllaw -controlList "srrfFreq"} \
  -contextHelp "Bring up the controllaw screens for controlling the dispersion orbit using the rf frequency."

APSMenuFrameMake routineOperationsMenuSR -type secureExec \
  -text "RF phase knobs" -executable SRRFPhaseSliders \
  -contextHelp "Brings up a screen that allows adjusting SR rf station phase in various klystron running modes."

APSMenuFrameMake routineOperationsMenuSR -type secureExec \
  -text "SR BPM Offset Adjustment" -executable SROffsetAdjustment -contextHelp \
  "Brings up a utility to adjust offsets of SR BPMs as a function of current." 

APSMenuFrameMake routineOperationsMenuSR -type exec \
  -text "SR Scope Save/Restore" -executable "ScopeSaveRestore -scopeID S:HP9000 -new 1" \
  -contextHelp "Brings up the save/restore screen for the SR HP54542 scope."

APSMenuFrameMake routineOperationsMenuSR -type secureExec \
  -text "SR Scope Waveform Archiving" -executable "ScopeWaveformHistory -ring SR" \
  -contextHelp "Brings up the screen for the SR HP54542 scope history creation and review utility."

APSMenuFrameMake routineOperationsMenuSR -type secureExec \
  -text "Tune measurement" -executable "SRMeasureTunes" -contextHelp \
  "Brings up a utility to help with tune measurement with Dimtel."

APSMenuFrameMake routineOperationsMenuSR -type exec \
  -text "SR Corrector Feedforward" -executable "SRCorrectorFeedforward" -contextHelp \
  "Brings up SR corrector feedforward script, which modifies the corrector output."



APSMenuFrameMake routineOperationsMenuSR -type exec \
  -text "Collect SR PFGA Tune Spectra" -executable "collectSRTuneSpectra" \
  -contextHelp "collect SR FPGA tune spectra for diagnosisi purpose."
  

APSMenuFrameMake srDataReviewMenu -type label -text "SR Data Review" 
APSMenuFrameMake srDataReviewMenu -type exec \
  -text "SR orbit review" -executable SROrbitReview \
  -contextHelp "Bring up a screen to review orbit data from the logs of average orbit readbacks.  Also has offsets and setpoints."
APSMenuFrameMake srDataReviewMenu -type exec \
  -text "SR orbit comparisons" -executable SROrbitCompare \
  -contextHelp "Bring up a screen to compare orbit data two different times.  Also has offsets and setpoints."
APSMenuFrameMake srDataReviewMenu -type exec \
  -text "SR Xray bpm review" -executable XrayBPMReview \
  -contextHelp "Bring up a screen to review and compare Xray bpms data from the logs of IDs and BMs."
APSMenuFrameMake srDataReviewMenu -type exec \
  -text "SR Fill-to-Fill Slopes at IDs" -executable SRFillToFillAtIDs 
APSMenuFrameMake srDataReviewMenu -type exec \
  -text "SR corrector review" -executable "SROrbitReview -review SRCorrector" \
  -contextHelp "Bring up a screen to review corrector data from the logs of corrector readbacks. Allows plotting correctors, corrector changes, and implied orbit changes."
APSMenuFrameMake srDataReviewMenu -type exec \
  -text "SR rf Review" -executable SRrfMonitor \
  -contextHelp "Bring up a screen to review and monitor data from storage ring rf systems."
APSMenuFrameMake  srDataReviewMenu -type exec \
  -text "SR Vacuum/Lifetime Trending" -executable SRVacuumTrending \
    -contextHelp "Bring up a screen for plotting SR vacuum, current, and lifetime data."
APSMenuFrameMake  srDataReviewMenu -type exec \
  -text "SR Chamber Temperature Trending" -executable SRChamberTempTrending \
    -contextHelp "Bring up a screen for plotting SR chamber temperatures and current."
APSMenuFrameMake srDataReviewMenu -type exec \
  -text "SR Vacuum Glitch Review" -executable SRVacuumGlitchReview 
APSMenuFrameMake srDataReviewMenu -type exec \
  -text "SR TBT DAQ POMO Review" -executable SrTbtDaqPomoBrowser
APSMenuFrameMake srDataReviewMenu -type exec \
  -text "SR BPM and PS PSD transfer tool" -executable SrDaqPsdTransfer

APSMenuFrameMake srDataReviewMenuAttic -type label -text "Attic"

APSMenuFrameMake srDataReviewMenuAttic -type exec \
  -text "Current and Lifetime History" -executable SRCurrentHistory \
  -contextHelp "Brings up a utility for reviewing storage ring current, lifetime, and mA-hours data."
APSMenuFrameMake srDataReviewMenuAttic -type exec \
  -text "SR rf 38/40 controllaw data review" -executable \
  "SRRFControllawReview -group 3840" -contextHelp \
  "Brings up a utility to review data from the sector 38/40 cavity controllaw."
APSMenuFrameMake srDataReviewMenuAttic -type exec \
  -text "SR rf 36/37 controllaw data review" -executable \
  "SRRFControllawReview -group 3637" -contextHelp \
  "Brings up a utility to review data from the sector 36/37 cavity controllaw."
APSMenuFrameMake srDataReviewMenuAttic -type exec \
  -text "SR MPS Dump Review" -executable mpsDumpReview \
  -contextHelp "Bring up a screen to select and review data from MPS dumps."
APSMenuFrameMake srDataReviewMenuAttic -type exec \
  -text "SR RMS Glitch Review" -executable rmsGlitchReview \
  -contextHelp "Bring up a screen to select and review data from rms orbit glitches."
APSMenuFrameMake  srDataReviewMenuAttic -type exec \
  -text "HLS Data Review" -executable HLSDataReview \
  -contextHelp "Bring up a screen for reviewing hydrostatic level system data."
APSMenuFrameMake  srDataReviewMenuAttic -type exec \
  -text "SR Orbit motion alarm review/editing" -executable SRRMSAlarmEditCause \
    -contextHelp "Bring up a screen for editing and reviewing causes of RMS orbit motion events."
APSMenuFrameMake  srDataReviewMenuAttic -type exec \
  -text "SR Alignment Data review" -executable SRsurveyData \
    -contextHelp "Bring up a screen for reviewing present and past SR magnet alignment data."
APSMenuFrameMake srDataReviewMenuAttic -type exec \
  -text "SR Converter Glitch Review" -executable SRConverterGlitchReview 
APSMenuFrameMake srDataReviewMenuAttic -type exec \
  -text "ID Energy History" -executable IDEnergyHistory
APSMenuFrameMake srDataReviewMenuAttic -type exec \
  -text "Absorber water review" -executable AbsorberWaterReview \
  -contextHelp "Bring up a screen to review and process data from the SR absorber water data logger."
APSMenuFrameMake  srDataReviewMenuAttic -type exec \
  -text "RF frequency Review" -executable RFfrequencyHistory \
  -contextHelp "Bring up a screen for reviewing rf frequency offset history."

APSMenuFrameMake srDataReviewMenuAttic -type secureExec \
  -text "Hydrostatic Level Control" -executable SRHLSControl \
    -contextHelp "Brings up a screen for controlling the hydrostatic level system." 

APSMenuFrameMake srDataReviewMenuAttic -type exec \
  -text "Shutter State Query" -executable ShutterStateReview \
  -contextHelp "Bring up a screen for determining which shutters were open during a specified time."

APSMenuFrameMake srDataReviewMenuAttic -type exec \
  -text "Process water review" -executable ProcessWaterReview \
  -contextHelp "Bring up a screen to review and process data from the process water data logger."

######## SR PV monitor MENU ############

APSMenuFrameMake srPvMonitorMenu -type label -text "SR PV Monitors"
APSMenuFrameMake srPvMonitorMenu -type exec -text "Chamber temperatures" \
  -executable "PVmonitor -fileName /home/helios/SR/PVMonitorConfig/SRChamberTemps.config -group 1" \
  -contextHelp "Brings up a PVmonitor instance for monitoring SR chamber temperatures"

APSMenuFrameMake srPvMonitorMenu -type exec -text "Vacuum pressure" \
  -executable "PVmonitor -fileName /home/helios/SR/PVMonitorConfig/SRVacuumLimits.config -group 1" \
  -contextHelp "Brings up a PVmonitor instance for monitoring SR vacuum"

######## SR MENU Injection ############
APSMenuFrameMake srInjectionMenu \
    -type label \
    -text "SR Injection"

APSMenuFrameMake srInjectionMenu \
    -type exec \
    -text "BTS energy" \
    -executable SRInjectionEnergy \
    -contextHelp "Varies BTS energy for manual injection optimization"

APSMenuFrameMake srInjectionMenu \
    -type exec \
    -text "SR/Booster Phase" \
    -executable SROptimizeInjectionPhase \
    -contextHelp "Automatic optimization of RF phase."

APSMenuFrameMake srInjectionMenu \
    -type exec \
    -text "Optimize Injection" \
    -executable SROptimizeInjection \
    -contextHelp  "Automatic optimization BTS H corrector and Pulsed PS."

APSMenuFrameMake srInjectionMenu \
    -type exec \
    -text "Optimize Coupling" \
    -executable SRCouplingAdjust \
    -contextHelp "Automatic minimization of coupling."

APSMenuFrameMake srInjectionMenu -type exec -text "Bunch pattern creation" -executable SRBunchPattern  \
    -contextHelp "Varies BTS energy for manual injection optimization"

APSMenuFrameMake srInjectionMenu -type exec -text "Fill pattern planner" -executable SRFillPlanner \
  -contextHelp "Application to help plan fill patterns for swap-out."

if 0 {
APSMenuFrameMake srInjectionMenu \
    -type exec \
    -text "Match Closed Bump" \
    -executable SRClosedBump \
    -contextHelp "Automatic optimization of closed bump"

APSMenuFrameMake srInjectionMenu \
    -type exec \
    -text "Match On-axis Injection" \
    -executable SROnAxis \
    -contextHelp "Automatic optimization of on-axis injection"
}

APSMenuFrameMake srInjectionMenu \
    -type exec \
    -text "Optimize S:IS1" \
    -executable SRSeptumScan \
    -contextHelp "Scan S:IS1 to optimize SIS1 setpoint."

####### SR Physics Sector 35 Diagnostics MENU ############
APSMenuFrameMake srPhysicsS35DiagMenu -type label -text "SR Sector 35 Diagnostics"
set s35appsDir /home/helios/PHOTODIA/operations/s35apps

APSMenuFrameMake s35bmPHCMenu -type label -text "S35BMFE pinhole camera"

APSMenuFrameMake s35bmPHCMenu -type exec \
  -text "S35BM-FE Pinhole camera setup" \
  -executable "${s35appsDir}/pinholeCam/s35PinholeCam -Beamline S35BM -PowerUser 0" \
  -contextHelp "Calibrate 35-BM front end pinhole camera (in-tunnel) through slits scans."

APSMenuFrameMake s35bmPHCMenu -type exec \
  -text "S35BM 9M Pinhole camera setup" \
  -executable "${s35appsDir}/pinholeCam/s35bm9mPinholeCam -Beamline S35BM -PowerUser 0" \
  -contextHelp "Connect 35-BM 9M pinhole camera to VID4 for beam size measurements." 

set s35author bxyang
if {[string compare $env(USER) $s35author]==0} {
    APSMenuFrameMake s35bmPHCMenu -type exec \
      -text "* 35BM-FE Pinhole camera calibration" \
      -executable "${s35appsDir}/pinholeCam/s35PinholeCam -Beamline S35BM -PowerUser 2" \
      -contextHelp "Calibrate 35-BM front end pinhole camera (in-tunnel) through slits scans" 
    
    APSMenuFrameMake s35bmPHCMenu -type exec \
      -text "* OLD 35BM Pinhole camera calibration" \
      -executable "${s35appsDir}/pinholeCam/s35bmfePinholeCam -PowerUser 1" \
      -contextHelp "Configure 35-BM front end pinhole camera (in-tunnel)"  
}

######## 35ID monochromator controls ############
APSMenuFrameMake s35idDIAMenu -type label -text "S35ID monochromator"
APSMenuFrameMake s35idDIAMenu -type exec \
  -text "35ID Monochromator scans" \
  -executable "${s35appsDir}/idDiag/s35MonoScan -PowerUser 2" \
  -contextHelp "Scan 35-ID monochromator " 

APSMenuFrameMake s35idDIAMenu -type exec \
  -text "35ID Combined video display setup" \
  -executable "${s35appsDir}/idDiag/idVideoComboSetup -PowerUser 0" \
  -contextHelp "Set up split screen combined display operation." 
  
if {[string compare $env(USER) $s35author]==0} {
 APSMenuFrameMake s35idDIAMenu -type exec \
  -text "* 35ID Combined emittance calculation" \
  -executable "${s35appsDir}/idDiag/idBeamData -PowerUser 0" \
  -contextHelp "Calculate electron beam emittance using both divergence and source size measurements." 
}  

######## 36AM/35BM Bunch Purity Monitor control apps ############
APSMenuFrameMake s35bpdMenu -type label -text "Bunch purity detector"

 APSMenuFrameMake s35bpdMenu -type exec \
  -text "BCG Pattern BCG setup" \
  -executable "${s35appsDir}/bunchPurity/bcgPatternSetup -bcgPVRoot S35BM:0BnchClkGen" \
  -contextHelp "Setting up bunch clock generator pulse patterns."

APSMenuFrameMake s35bpdMenu -type exec \
  -text "S35BM Bunch Purity Monitor setup" \
  -executable "${s35appsDir}/bunchPurity/bpMonStartupBM -PowerUser 1" \
  -contextHelp "Setting up bunch purity monitor for datalogger."

APSMenuFrameMake s35bpdMenu -type exec \
  -text "SR sector 35 bunch purity measurement (brief)" \
  -executable SRBPDSetup \
  -contextHelp "SR sector 35 bunch purity measurement brief application."

APSMenuFrameMake s35bpdMenu -type exec \
  -text "SR sector 35 bunch purity measurement (expert)" \
  -executable "SRBPDSetup -PowerUser 1" \
  -contextHelp "SR sector 35 bunch purity measurement expert application."

if {[string compare $env(USER) $s35author]==0} {
    APSMenuFrameMake s35bpdMenu -type exec \
      -text "* S35BMBL2 Bunch Purity Monitor setup" \
      -executable "${s35appsDir}/bunchPurity/bpMonStartupBMBL2 -PowerUser 1" \
      -contextHelp "Setting up bunch purity monitor for datalogger."
    
    APSMenuFrameMake s35bpdMenu -type exec \
      -text "* S35ID FPGA Bunch purity data archive" \
      -executable "${s35appsDir}/bunchPurity/bpDataArchiveID -PowerUser 0" \
      -contextHelp "Archive bunch purity waveforms"
    
    APSMenuFrameMake s35bpdMenu -type exec \
      -text "* S35BM FPGA Bunch purity data archive" \
      -executable "${s35appsDir}/bunchPurity/bpDataArchiveBM -PowerUser 0" \
      -contextHelp "Archive bunch purity waveforms"
    
    APSMenuFrameMake s35bpdMenu -type exec \
      -text "* FPGA Bunch purity data review" \
      -executable "${s35appsDir}/bunchPurity/bpDataReview -PowerUser 0" \
      -contextHelp "Process archived bunch purity waveforms"
}

######## 3Storage Ring Cherenkov Detector Test apps ############
APSMenuFrameMake s35cherenkovMenu -type label -text "SR Cherenkov detector"

APSMenuFrameMake s35cherenkovMenu -type exec \
  -text "Set up Cherenkov Detectors" \
  -executable "${s35appsDir}/cherenkov/setupCherenkovSR -PowerUser 1" \
  -contextHelp "Measure and set gated integrator baseline offsets."

APSMenuFrameMake s35cherenkovMenu -type exec \
  -text "Process Cherenkov dosimeter data" \
  -executable "${s35appsDir}/cherenkov/cherenkovDosimeterGUI -PowerUser 1" \
  -contextHelp "Process Cherenkov data logger files."

APSMenuFrameMake s35cherenkovMenu -type exec \
  -text "Calibration using kickers/scrapers" \
  -executable "${s35appsDir}/cherenkov/calTools/cherenkovCalScan -PowerUser 1" \
  -contextHelp "Calibration scans / tests for Cherenkov detectors using stored beam."

APSMenuFrameMake s35cherenkovMenu -type exec \
  -text "Stored beam steering experiment" \
  -executable "${s35appsDir}/cherenkov/calTools/cherenkovSteerExp -PowerUser 1" \
  -contextHelp "Stored beam steering experiment for Cherenkov detectors."

APSMenuFrameMake s35cherenkovMenu -type exec \
  -text "One-var scan of detectors" \
  -executable "${s35appsDir}/cherenkov/cherenkovOneVarScan -PowerUser 1" \
  -contextHelp "Scan discriminator, PMT voltage for testing Cherenkov detector electronics. Scan time for monitor"

APSMenuFrameMake s35cherenkovMenu -type exec \
  -text "Review one-var scan data" \
  -executable "${s35appsDir}/cherenkov/viewCherenkovData -PowerUser 1" \
  -contextHelp "Plot data from test scans of Cherenkov electronics discriminator or PMT voltage."

APSMenuFrameMake s35cherenkovMenu -type exec \
  -text "Review PMT data" \
  -executable "${s35appsDir}/cherenkov/viewPMTData -PowerUser 1" \
  -contextHelp "Print PMT calbration data."

APSMenuFrameMake s35cherenkovMenu -type exec \
  -text "Convert Old Cherenkov Data Files" \
  -executable "${s35appsDir}/cherenkov/convertCherenkovData -PowerUser 1" \
  -contextHelp "Convert old data column names to new names consistent with OAG data logger."

APSMenuFrameMake s35cherenkovMenu -type exec \
  -text "Review Cherenkov Scope Trace" \
  -executable "${s35appsDir}/cherenkov/scopeTools/viewScopeData -PowerUser 1" \
  -contextHelp "Plot data from Cherenkov Dector scope traces."

APSMenuFrameMake s35cherenkovMenu -type exec \
  -text "Scope Data Pulse Height Analysis" \
  -executable "${s35appsDir}/cherenkov/scopeTools/scopePHA -PowerUser 1" \
  -contextHelp "Perform pulse-height analysis with Cherenkov Detector scope data."

APSMenuFrameMake s35cherenkovMenu -type exec \
  -text "Scheduled Monitor" \
  -executable "${s35appsDir}/cherenkov/cherenkovMonitor -PowerUser 1" \
  -contextHelp "Scan discriminator or PMT voltage for testing Cherenkov detector electronics."

######## Storage Ring ID Flux Monitor Test apps ############
APSMenuFrameMake s35fluxMonMenu -type label -text "XBPM & Flux Monitor"

APSMenuFrameMake s35fluxMonMenu -type exec \
  -text "35ID Flux Monitor Motors" \
  -executable "${s35appsDir}/fluxMon/fluxMonTest -PowerUser 1" \
  -contextHelp "Test scan flux monitor motors." 

APSMenuFrameMake s35fluxMonMenu -type exec \
  -text "35ID Portable XBPM" \
  -executable "${s35appsDir}/xBPM/xBPMS35Test -PowerUser 1" \
  -contextHelp "Test scan portable detector motors." 

APSMenuFrameMake s35fluxMonMenu -type exec \
  -text "29ID GRIID-XBPM status" \
  -executable "${s35appsDir}/xBPM/xbpmS29Status -PowerUser 1" \
  -contextHelp "Scan 29-ID GRID-XBPM PVs." 

APSMenuFrameMake s35fluxMonMenu -type exec \
  -text "29ID GRIID-XBPM scan" \
  -executable "${s35appsDir}/xBPM/xbpmS29Test -PowerUser 1" \
  -contextHelp "Scan 29-ID GRID-XBPM PVs." 

APSMenuFrameMake s35fluxMonMenu -type exec \
  -text "Plot Flux Monitor data" \
  -executable "/home/helios/PHOTODIA/operations/PDapps/xBPM/plotFluxMonData" \
  -contextHelp "Plot test data of Flux Monitor." 

######## Frame Grabber control apps ############
APSMenuFrameMake s35videoMenu -type label -text "Video camera and digitizers"

APSMenuFrameMake s35videoMenu -type exec \
  -text "Video route" \
  -executable "autoroute" \
  -contextHelp "Use Steve Shoaf's script to switch video sources and destinations." 

APSMenuFrameMake s35videoMenu -type exec \
  -text "Video field monkey" \
  -executable "${s35appsDir}/videoControl/videoFieldMonkey -PowerUser 1" \
  -contextHelp "Use profile asymmetry to decide flipping between two fields." 

APSMenuFrameMake s35videoMenu -type exec \
  -text "Save/view image profiles" \
  -executable "${s35appsDir}/videoControl/saveImageProfiles -PowerUser 1" \
  -contextHelp "Save multiple video image profiles and view them." 

APSMenuFrameMake s35videoMenu -type exec \
  -text "Save/view profiles with LFG etc." \
  -executable "${s35appsDir}/videoControl/saveImageProfilesLFG -PowerUser 1" \
  -contextHelp "Save multiple video image profiles and view them. Digitizer includes LFG" 

APSMenuFrameMake s35videoMenu -type exec \
  -text "Save/view multiple images" \
  -executable "${s35appsDir}/videoControl/saveImages -PowerUser 1" \
  -contextHelp "Save multiple video images and view them." 

APSMenuFrameMake s35videoMenu -type exec \
  -text "Save/view LFG images" \
  -executable "${s35appsDir}/videoControl/saveImagesLFG -PowerUser 1" \
  -contextHelp "Save multiple video images with LFG and view them." 

APSMenuFrameMake s35videoMenu -type exec \
  -text "Sum multiple images" \
  -executable "${s35appsDir}/videoControl/sumImages -PowerUser 1" \
  -contextHelp "Sum multiple video images and save into one file." 

APSMenuFrameMake s35videoMenu -type exec \
  -text "Save S35 standard set of images"  \
  -executable "${s35appsDir}/videoControl/s35ImageCapture " \
  -contextHelp "Save a set of standard images for Sector 35." 

APSMenuFrameMake s35videoMenu -type exec \
  -text "View/analyze multiple images" \
  -executable "${s35appsDir}/videoControl/viewImages -PowerUser 1" \
  -contextHelp "View and analyze sdds video images." 


######## CCD camera control apps ############
if {[string compare $env(USER) $s35author]==0} {
    APSMenuFrameMake s35ccdMenu -type label -text "* CCD cameras"
    
    APSMenuFrameMake s35ccdMenu -type exec \
      -text "35-BM-FE camera controls" \
      -executable "${s35appsDir}/pinholeCam/s35CCDs -Beamline S35BM -PowerUser 1" \
      -contextHelp "Brings up a menu for setting the CCD camera in 35-BM front end (in-tunnel camera)." 

    APSMenuFrameMake s35ccdMenu -type exec \
      -text "35-BM-A CCD camera controls" \
      -executable "${s35appsDir}/pinholeCam/s35CCDs -Beamline S35BMA -PowerUser 1" \
      -contextHelp "Brings up a menu for setting the CCD camera in 35-BM-A line (pinhole camera)." 
  
    APSMenuFrameMake s35ccdMenu -type exec \
      -text "35-BM-B camera controls" \
      -executable "${s35appsDir}/pinholeCam/s35CCDs -Beamline S35BMB -PowerUser 1" \
      -contextHelp "Brings up a menu for setting the CCD camera in 35-BM-B (visible camera)." 
    
    APSMenuFrameMake s35ccdMenu -type exec \
      -text "35-BM-C CCD camera controls" \
      -executable "${s35appsDir}/pinholeCam/s35CCDs -Beamline S35BMC -PowerUser 1" \
      -contextHelp "Brings up a menu for setting the CCD camera in 35-BM-C (pinhole camera)." 
    
    APSMenuFrameMake s35ccdMenu -type exec \
      -text "35-ID-Divergence camera controls" \
      -executable ccd35IDA1 \
      -contextHelp "Brings up a menu for setting the CCD camera in 35-ID-A1 (divergence camera)." 
    
    APSMenuFrameMake s35ccdMenu -type exec \
      -text "35-ID-PH camera controls"  \
      -executable "${s35appsDir}/pinholeCam/s35CCDs -Beamline S35ID -PowerUser 1" \
      -contextHelp "Brings up a menu for setting the CCD camera in 35-ID-A3 (ID pinhole camera)." 

    APSMenuFrameMake s35ccdMenu -type exec \
      -text "36-AM-PH camera controls"  \
      -executable "${s35appsDir}/pinholeCam/s35CCDs -Beamline S35AM -PowerUser 1" \
      -contextHelp "Brings up a menu for setting the CCD camera in 35-ID-A2 (36AM pinhole camera)." 
    
    APSMenuFrameMake s35ccdMenu -type exec \
      -text "old 36-AM-PH camera controls"  \
      -executable "${s35appsDir}/pinholeCam/s36amPinholeCam -PowerUser 1" \
      -contextHelp "Brings up a menu for setting the CCD camera in 35-ID-A2 (36AM pinhole camera)." 
    
    APSMenuFrameMake s35ccdMenu -type exec \
      -text "old 36-BM-FE camera controls"  \
      -executable "${s35appsDir}/pinholeCam/s36bmfePinholeCam -PowerUser 1" \
      -contextHelp "Brings up a menu for setting the CCD camera in 35-BM-FE3 (35BM pinhole camera)." 
    
    APSMenuFrameMake s35ccdMenu -type exec \
      -text "Save standard set of images"  \
      -executable "${s35appsDir}/videoControl/s35ImageCapture " \
      -contextHelp "Save a set of standard images for Sector 35." 
}


######## Gated camera control apps ############
APSMenuFrameMake s35gatedMenu -type label -text "Gated cameras"

APSMenuFrameMake s35gatedMenu -type exec \
  -text "Take SR event movie" \
  -executable "${s35appsDir}/gatedCam/takeMovie -PowerUser 1" \
  -contextHelp "Save multiple gated camera images for SR events." 

APSMenuFrameMake s35gatedMenu -type exec \
  -text "Show SR event movie" \
  -executable "${s35appsDir}/gatedCam/showMovie -PowerUser 1" \
  -contextHelp "Show multiple gated camera images for SR events saved by takeMovie." 

APSMenuFrameMake s35gatedMenu -type exec \
  -text "Capture SR injection movie (old version)" \
  -executable "${s35appsDir}/gatedCam/injectionMovie -PowerUser 1" \
  -contextHelp "Save multiple gated camera images for injection process." 

if {[string compare $env(USER) $s35author]==0} {

    APSMenuFrameMake s35gatedMenu -type exec \
      -text "*35-BM-B gated camera controls" -executable gatedBMB -contextHelp \
      "Brings up a menu for setting the gated camera in 35-BM-B (visible camera)." 
    
    APSMenuFrameMake s35gatedMenu -type exec \
      -text "*35-BM-C1 gated camera controls" -executable gatedBMC1 -contextHelp \
      "Brings up a menu for setting the gated camera in 35-BM-C1 (pinhole camera)." 
    
    APSMenuFrameMake s35gatedMenu -type exec \
      -text "*35-BM-C2 gated camera controls" -executable gatedBMC2 -contextHelp \
      "Brings up a menu for setting the gated camera in 35-BM-C2 (pinhole camera)." 
    
    APSMenuFrameMake s35gatedMenu -type exec \
      -text "*35-ID-Divergence gated camera controls" -executable gatedIDA1 -contextHelp \
      "Brings up a menu for setting the gated camera in 35-ID-A1 (divergence camera)." 
    
    APSMenuFrameMake s35gatedMenu -type exec \
      -text "*35-ID-PH gated camera controls" -executable gatedIDA3 -contextHelp \
      "Brings up a menu for setting the gated camera in 35-ID-A3 (ID pinhole camera)." 
    
    APSMenuFrameMake s35gatedMenu -type exec \
      -text "*36-AM-PH gated camera controls" -executable gatedIDA2 -contextHelp \
      "Brings up a menu for setting the gated camera in 35-ID-A2 (36AM pinhole camera)." 
    
    APSMenuFrameMake s35gatedMenu -type exec \
      -text "*Monitor SR beam motion" \
      -executable "${s35appsDir}/gatedCam/beamMotionMonitor -PowerUser 1" \
      -contextHelp "Monitor beam motion with gated cameras." 
    
    APSMenuFrameMake s35gatedMenu -type exec \
      -text "*SR beam motion monitor data" \
      -executable "${s35appsDir}/gatedCam/beamMonitorDisplay -PowerUser 1" \
      -contextHelp "Display beam motion monitor data file." 
}

######## Streak camera control apps ############
APSMenuFrameMake s35streakMenu -type label -text "Streak cameras"

APSMenuFrameMake s35streakMenu -type exec \
  -text "35-BM-B streak camera synchroscan operations" \
  -executable "${s35appsDir}/streakControl/srBunchLen -PowerUser 0" \
  -contextHelp "Brings up a menu for setting the streak camera in 35-BM-B (visible camera)." 

if {[string compare $env(USER) $s35author]==0} {
    APSMenuFrameMake s35streakMenu -type exec \
      -text "*35-BM-B streak camera synchroscan tuning" \
      -executable "${s35appsDir}/streakControl/srBunchLen -PowerUser 1" \
      -contextHelp "Brings up a menu for phase scan for the streak camera in 35-BM-B (visible camera)." 

    APSMenuFrameMake s35streakMenu -type exec \
      -text "*35-BM-B streak dual sweep operation" \
      -executable "${s35appsDir}/streakControl/dualSweepSynchro -PowerUser 1" \
      -contextHelp "Brings up a menu for dual sweep operation of the streak camera in 35-BM-B (visible camera)." 
}

######## Pinhole camera calibration apps ############
APSMenuFrameMake s35calMenu -type label -text "Pinhole slits calbration"

APSMenuFrameMake s35calMenu -type exec \
  -text "35BM-FE Pinhole camera calibration" \
  -executable "${s35appsDir}/pinholeCam/s35PinholeCam -Beamline S35FE -PowerUser 2" \
  -contextHelp "Calibrate 35-BM front end pinhole camera (in-tunnel) through slits scans" 
  
APSMenuFrameMake s35calMenu -type exec \
  -text "35BM 9m Pinhole camera calibration" \
  -executable "${s35appsDir}/pinholeCam/s35PinholeCam -Beamline S35BM -PowerUser 2" \
  -contextHelp "Calibrate 35-BM front end pinhole camera (in-tunnel) through slits scans" 
  
APSMenuFrameMake s35calMenu -type exec \
  -text "35-BM-A Pinhole camera calibration" \
  -executable "${s35appsDir}/pinholeCam/s35PinholeCam -Beamline S35BMA -PowerUser 2" \
  -contextHelp "Calibrate 35-BM-A pinhole camera through slits scans" 
  
APSMenuFrameMake s35calMenu -type exec \
  -text "35-BM-C Pinhole camera calibration" \
  -executable "${s35appsDir}/pinholeCam/s35PinholeCam -Beamline S35BMC -PowerUser 2" \
  -contextHelp "Calibrate 35-BM-C pinhole camera through slits scans" 
  
APSMenuFrameMake s35calMenu -type exec \
  -text "35-ID-A Pinhole camera calibration" \
  -executable "${s35appsDir}/pinholeCam/s35PinholeCam -Beamline S35ID -PowerUser 2" \
  -contextHelp "Calibrate 35-ID-A pinhole camera through slits scans" 
  
APSMenuFrameMake s35calMenu -type exec \
  -text "36-AM Pinhole camera calibration" \
  -executable "${s35appsDir}/pinholeCam/s35PinholeCam -Beamline S35AM -PowerUser 2" \
  -contextHelp "Calibrate 36-AM pinhole camera through slits scans" 
  
APSMenuFrameMake s35calMenu -type exec \
  -text "OLD 35BM-FE Pinhole camera calibration" \
  -executable "${s35appsDir}/pinholeCam/s35bmfePinholeCam -PowerUser 2" \
  -contextHelp "Calibrate 35-BM front end pinhole camera (in-tunnel) through slits scans" 
  
APSMenuFrameMake s35calMenu -type exec \
  -text "OLD 36-AM Pinhole camera calibration" \
  -executable "${s35appsDir}/pinholeCam/s36amPinholeCam -PowerUser 2" \
  -contextHelp "Calibrate 36-AM pinhole camera through slits scans" 
  

######## PV SETUP: Stepper motor indexer/driver, Digital IO, Video, and Timing  ############
APSMenuFrameMake s35setupMenu -type label -text "Sector 35 PV setup"

APSMenuFrameMake s35setupMenu -type exec \
  -text "Print Sector35 Setup Instructions" \
  -executable "${s35appsDir}/Setup/s35SetupInstruction " \
  -contextHelp "Print Sector 35 start up instructions"

APSMenuFrameMake s35setupMenu -type exec \
  -text "Sector35 Stepper Motor Driver Setup/Initialization" \
  -executable "${s35appsDir}/Setup/s35MotorSetup.tcl -PowerUser 1" \
  -contextHelp "Configure Sector 35 stepper motor drivers and initialize the motor limits for user operations" 

APSMenuFrameMake s35setupMenu -type exec \
  -text "Sector35 Video Setup/Initialization" \
  -executable "${s35appsDir}/Setup/s35VideoSetup -PowerUser 1" \
  -contextHelp "Configure Sector 35 video mux and digitizer for user operations" 
 
APSMenuFrameMake s35setupMenu -type exec \
  -text "Sector35 Timing Setup" \
  -executable "${s35appsDir}/Setup/s35TimingSetup -PowerUser 0" \
  -contextHelp "Configure Sector 35 Timing circuits for user operations" 
 
APSMenuFrameMake s35setupMenu -type exec \
  -text "Sector35 Monitor File Maker" \
  -executable "${s35appsDir}/inputFileMaker/monFileMaker" \
  -contextHelp "Automatic generation of monitor files for Sector 35 video digitizer." 
 

######## Logbook Review ############
APSMenuFrameMake s35logMenu -type label -text "Sector 35 Logbook Review"

APSMenuFrameMake logMenu -type exec \
  -text "35-BM-4MPH logbook Review" \
  -executable "${s35appsDir}/configLog/viewConfigLog \
	  -inputDir /home/helios/BXYANG/DeviceInfo/SR/Sector35/35BM/35BMFE/Pinhole_Camera/bm4mLogFiles -loadNow 1" \
  -contextHelp "Review 35-BM-4M Pinhole logbook entries." 

APSMenuFrameMake s35logMenu -type exec \
  -text "35-BM-FE logbook Review" \
  -executable "${s35appsDir}/configLog/viewConfigLog \
	  -inputDir /home/helios/PHOTODIA/DeviceInfo/SR/Sector35/35BM/35BMFE/Pinhole_Camera/bmfeLogFiles -loadNow 1" \
  -contextHelp "Review 35-BM-FE logbook entries." 
 
APSMenuFrameMake s35logMenu -type exec \
  -text "35-BM-A line logbook Review" \
  -executable "${s35appsDir}/configLog/viewConfigLog \
	  -inputDir /home/helios/PHOTODIA/DeviceInfo/SR/Sector35/35BM/35BMA/bmaLineLog -loadNow 1" \
  -contextHelp "Review 35-BM-A line logbook entries." 
 
APSMenuFrameMake s35logMenu -type exec \
  -text "35-BM-B logbook Review" \
  -executable "${s35appsDir}/configLog/viewConfigLog \
	  -inputDir /home/helios/PHOTODIA/DeviceInfo/SR/Sector35/35BM/35BMB/bmbLogFiles -loadNow 1" \
  -contextHelp "Review 35-BM-B logbook entries." 
 
APSMenuFrameMake s35logMenu -type exec \
  -text "35-BM-C line logbook Review" \
  -executable "${s35appsDir}/configLog/viewConfigLog \
	  -inputDir /home/helios/PHOTODIA/DeviceInfo/SR/Sector35/35BM/35BMC/bmcLineLog -loadNow 1" \
  -contextHelp "Review 35-BM-C line logbook entries." 
 
APSMenuFrameMake s35logMenu -type exec \
  -text "35-ID-FE logbook Review" \
  -executable "${s35appsDir}/configLog/viewConfigLog \
	  -inputDir /home/helios/PHOTODIA/DeviceInfo/SR/Sector35/35ID/35IDFE/idfeLogFiles -loadNow 1" \
  -contextHelp "Review 35-ID-FE logbook entries." 
 
APSMenuFrameMake s35logMenu -type exec \
  -text "35-ID-A logbook Review" \
  -executable "${s35appsDir}/configLog/viewConfigLog \
	  -inputDir /home/helios/PHOTODIA/DeviceInfo/SR/Sector35/35ID/35IDA/idaLogFiles -loadNow 1" \
  -contextHelp "Review 35-ID-A logbook entries." 
 
APSMenuFrameMake s35logMenu -type exec \
  -text "36-AM logbook Review" \
  -executable "${s35appsDir}/configLog/viewConfigLog \
	  -inputDir /home/helios/PHOTODIA/DeviceInfo/SR/Sector35/36AM/amLogFiles -loadNow 1" \
  -contextHelp "Review 36-AM logbook entries." 
 
APSMenuFrameMake s35logMenu -type exec \
  -text "36-AM Bunch purity monitor logbooks" \
  -executable "${s35appsDir}/configLog/viewConfigLog \
	  -inputDir /home/helios/PHOTODIA/DeviceInfo/SR/Sector35/36AM/BunchPurity/bpLogFiles -loadNow 1" \
  -contextHelp "Review 36-AM bunch purity monitor logbook entries." 
 
APSMenuFrameMake s35logMenu -type exec \
  -text "S35 video logbook Review" \
  -executable "${s35appsDir}/configLog/viewConfigLog \
	  -inputDir /home/helios/PHOTODIA/DeviceInfo/SR/Sector35/Video/videoLogFiles -loadNow 1" \
  -contextHelp "Review Sector 35 video logbook entries." 
 

######## Test apps ############
APSMenuFrameMake s35testMenu -type label -text "Test scripts"

APSMenuFrameMake s35testMenu -type exec \
  -text "35-BM-B streak dual sweep test" \
  -executable "${s35appsDir}/streakControl/dualSweepSynchroTest -PowerUser 0" \
  -contextHelp "Brings up a menu for dual sweep operation of the streak camera in 35-BM-B (visible camera)." 

APSMenuFrameMake s35testMenu -type exec \
  -text "Injector Photon Monitor applications" \
  -executable "/home/helios/PHOTODIA/operations/injectorApps/injectorApps" \
  -contextHelp "Start injector photon monitor applications menu." 

APSMenuFrameMake s35testMenu -type exec \
  -text "Test S35 Lab Stepper Motors" \
  -executable "${s35appsDir}/s35Lab/stepperTest -PowerUser 1" \
  -contextHelp "Run a routine test of the stepper motor / driver combination." 

APSMenuFrameMake s35testMenu -type exec \
  -text "Test Cherenkov Detectors" \
  -executable "${s35appsDir}/cherenkov/cherenkovTest -PowerUser 1" \
  -contextHelp "Test Cherenkov Detector response by scanning PMT voltage and discriminator levels." 

if {[string compare $env(USER) $s35author]==0} {
  APSMenuFrameMake s35testMenu -type exec \
  -text "*LCLS applications" \
  -executable "/home/helios/PHOTODIA/operations/lclsApps/lclsApps -PowerUser 1" \
  -contextHelp "LCLS erlated calculations." 

  APSMenuFrameMake s35testMenu -type exec \
  -text "*test camera controls" \
  -executable "${s35appsDir}/test/Test" \
  -contextHelp "Brings up a menu for tcl scripts being tested..." 

  APSMenuFrameMake s35testMenu -type exec \
    -text "Streak camera timing compensation" \
    -executable "/home/helios/PHOTODIA/operations/injectorApps/PAR/streakControl/streakInDelay -strkLocation 35BMB -frameGrabber S:VID4 " \
    -contextHelp "Set DG535 to compensate for streak camera internal delays." 

}


######## Developing apps ############
if {[string compare $env(USER) $s35author]==0} {
    APSMenuFrameMake s35bxytestMenu -type label -text "Developing scripts (bxy)"
    
    APSMenuFrameMake s35bxytestMenu -type exec \
      -text "Monitor SR beam motion" \
  -executable "${s35appsDir}/gatedCam/beamMotionMonitor -PowerUser 1" \
      -contextHelp "Monitor beam motion with gated cameras." 
    
    APSMenuFrameMake s35bxytestMenu -type exec \
      -text "SR beam motion monitor data display" \
      -executable "${s35appsDir}/gatedCam/beamMonitorDisplay -PowerUser 1" \
      -contextHelp "Display beam motion monitor data file." 
}

######## Tested apps in other menus ############

######## SR MENU ############
APSMenuFrameMake srMenu -type label -text "Storage Ring"
APSMenuFrameMake srMenu -type exec \
  -text "Swap-out Permissive" -executable swapOutPermissiveLauncher -contextHelp \
    "Brings up the GUI for launching and monitoring the swap-out permissive."

APSMenuFrameMake  srMenu -type exec \
    -text "SR Injection Efficiency Optimizer" -executable "optimizer -optimizeList srInjEff"  \
  -contextHelp "Brings up a GUI for SR injection efficiency optimization."

APSMenuFrameMake  srMenu -type exec \
    -text "SR Injection Efficiency Optimizer (expert)" -executable "optimizer -optimizeList srInjEff -expert 1"  \
    -contextHelp "Brings up a GUI for SR injection efficiency optimization (expert version)."


APSMenuFrameMake srMenu -type exec \
  -text "Large status display" -executable SRLargeStatusDisplay -contextHelp \
  "Brings up the storage ring large status display, showing time, current, lifetime, and emittance."

APSMenuFrameMake srMenu -type secureExec \
  -text "SR slow kickout and fill" -executable SRFillAndKickOut  -contextHelp \
  "Brings up a GUI for configuring slow kickout and filling"

APSMenuFrameMake srMenu -type exec \
  -text "Fill History" -executable SRFillHistory \
  -contextHelp "Brings up an application for reviewing, modifying, and analyzing fill history data." 

APSMenuFrameMake srMenu -type exec \
  -text "BTS controllaw" -executable {controllaw -controlList "bts" -debug 1} \
  -contextHelp "Bring up the controllaw screens for BTS trajectory control." 

APSMenuFrameMake srMenu -type exec \
  -text "BTS BPM setpoint transfer" -executable \
  "LinacLTPSetpointTransfer -includeBTS 1" \
  -contextHelp "Bring up a screen to transfer BTS BPM readings to controllaw setpoints" 

APSMenuFrameMake srMenu -type secureExec \
  -text "SR pem"  -executable {SRpem} \
  -contextHelp "Bring up the procedure execution manager for the storage ring." 

APSMenuFrameMake srMenu -type secureExec \
  -text "Tune measurement" -executable "SRMeasureTunes" -contextHelp \
  "Brings up a utility to help with tune measurement with Dimtel" 

APSMenuFrameMake srMenu -type secureExec \
  -text "Tune from trajectory response" -executable "SRtrajectoryResponse"\
  -contextHelp \
  "Brings up a utility to estimate the tune by using trajectory reponse data. Needs first-turn trajectory setup." 

APSMenuFrameMake srMenu -type exec \
  -text "SR Scope Save/Restore" -executable "ScopeSaveRestore -scopeID S:HP9000 -new 1" \
  -contextHelp "Brings up the save/restore screen for the SR HP9000 scope." 

APSMenuFrameMake srMenu -type secureExec \
  -text "SR Scope Waveform Archiving" -executable "ScopeWaveformHistory -ring SR" \
  -contextHelp "Brings up the screen for the SR HP54542 scope history creation and review utility." 
#  -allowedUsers "$srGroup $psGroup juw stein"

APSMenuFrameMake srMenu -type exec \
  -text "Fill predictor" -executable SRFillPredictor \
    -contextHelp "Brings up a screen for predicting how long a fill will last until a certain current is reached." 

APSMenuFrameMake srMenu -type exec \
  -text "Radiation monitor watchdog" -executable "PVmonitor -fileName /home/helios/oagData/PVMonitorFiles/sr/radMonitors.config -group 1" \
    -contextHelp "Brings up a screen to monitor radiation monitors and disable pulsed magnets when radiation levels approach a trip."

APSMenuFrameMake srMenu -type exec \
  -text "ID gap/motor watchdog" -executable "PVmonitor -fileName /home/helios/oagData/PVMonitorFiles/sr/IDWatchdog.config -group 1" \
    -contextHelp "Brings up a screen to monitor ID gaps and motors for errors."

APSMenuFrameMake srMenu -type secureExec \
  -text "Change default SR lattice" -executable "SRSetDefaultLattice" \
  -contextHelp "Brings up a screen to change the default lattice for oagData sr directories. Only oag account is allowed to run this application." 
#  -allowedUsers "oag borland emery cyao sajaev sr"

APSMenuFrameMake srMenu -type secureExec \
  -text "Update dependent files" -executable "SRUpdateDependentFiles" \
  -contextHelp "Brings up a screen that runs scripts to update files dependent on the hardware configuration of the storage ring. Only oag account is allowed to run this application." 
#  -allowedUsers "oag"

APSMenuFrameMake srMenu -type exec \
  -text "Scan bucket purity" -executable "ScanBucketPurity" \
  -contextHelp "Brings up a screen that scan each bucket bunch purity in 24 bucket pattern." 

APSMenuFrameMake srMenu -type exec \
  -text "Tune measurement (FPGA)" -executable "SRTuneFPGA" \
  -contextHelp "Brings up a screen that measures SR tune with FPGA." 

APSMenuFrameMake srMenu -type exec \
    -text "Transverse Feedback Control" -executable TransverseFeedbackControl \
    -contextHelp "Brings up a screen for Transverse feedback control."

APSMenuFrameMake srMenu -type exec \
    -text "P0 Feedback Control" -executable P0FeedbackControl \
    -contextHelp "Brings up a screen for P0 feedback control."

APSMenuFrameMake srMenu -type exec \
    -text "SCU Operational Statistics" -executable SCUOperationalStatistics \
    -contextHelp "Program to calculate SCU operation time and downtime.."

APSMenuFrameMake srMenu -type exec \
    -text "Scan SCU Aperture" -executable ScanSCUAperture \
    -contextHelp "Program to scan and plot the SCU apertures."
#### SR Attic menu
APSMenuFrameMake srMenuAttic -type label -text "Attic"

APSMenuFrameMake srMenuAttic -type secureExec \
  -text "SR emittance ratio controllaw" -executable {controllaw -controlList "srEmittanceRatio"} \
  -contextHelp "Bring up the controllaw screens for SR emittance ratio control. Should not be run when SR vertical emittance controllaw is running." 

APSMenuFrameMake srMenuAttic -type secureExec \
  -text "SR vertical emittance controllaw" -executable {controllaw -controlList "srYEmittance"} \
  -contextHelp "Bring up the controllaw screens for SR vertical emittance control. Should not be run when SR emittance ratio controllaw is running." 
#  -allowedUsers "$srGroup"

APSMenuFrameMake srMenuAttic -type secureExec \
  -text "Vertical Sweep" -executable SRVertSweep -contextHelp \
  "Brings up a utility to initiate chamber scrubbing using two vertical correctors." 
#  -allowedUsers "$srGroup"

APSMenuFrameMake srMenuAttic -type secureExec \
  -text "SR/BTS Injection" -executable SRpulsed -contextHelp \
  "Brings up a screen to control SR pulsed magnets and BTS/BTX switching." 
#  -allowedUsers "$srGroup $boosterGroup"

APSMenuFrameMake srMenuAttic -type secureExec \
  -text "Bunch Train" -executable SRBunchTrain -contextHelp \
  "Brings up the storage ring bunch train injection utility." 

### SR BPLD menu
APSMenuFrameMake srBPLDMenu -type label -text "Storage Ring BPLD" 

APSMenuFrameMake srBPLDMenu -type exec \
    -text "SR ID BPLD Config and Limits"  -executable "SRIDBPLDConfigAndLimits" 

APSMenuFrameMake srBPLDMenu -type exec \
    -text "SR BM BPLD Config and Limits"  -executable "SRBMBPLDConfigAndLimits" 

APSMenuFrameMake srBPLDMenu -type exec \
    -text "SR ID BPLD x Position Display"  -executable "SRIDBPLDPositionDisplay -plane x" 

APSMenuFrameMake srBPLDMenu -type exec \
    -text "SR ID BPLD y Position Display"  -executable "SRIDBPLDPositionDisplay -plane y" 

APSMenuFrameMake srBPLDMenu -type exec \
    -text "SR ID BPLD Validation"  -executable SRIDBPLDValidationNew
APSMenuFrameMake srBPLDMenu -type exec \
    -text "SR BM BPLD Validation"  -executable SRBMBPLDValidationNew

APSMenuFrameMake srBPLDMenu -type exec \
    -text "SR Local MPS External Input Validation"  -executable "SRLocalMPSExtInputValidation" 

APSMenuFrameMake srBPLDMenu -type exec \
    -text "SR LB+ Synthetic Data Setup"  -executable "LiberaSyntheticDataSetup" 

APSMenuFrameMake srBPLDMenu -type exec \
    -text "SR BPLD SaveCompareRestore (Offsets and Limits Loading)"  -executable "SaveCompareRestore -system SRBPLD"

APSMenuFrameMake srBPLDMenu -type exec \
    -text "SR Traveling Orbit Wave"  -executable "TravelingOrbitWave" 

APSMenuFrameMake srBPLDMenuLab -type label -text "Lab"

APSMenuFrameMake srBPLDMenuLab -type exec \
   -text "Lab SR ID BPLD Config and Limits"  -executable "SRIDBPLDConfigAndLimits -lab 1" 
APSMenuFrameMake srBPLDMenuLab -type exec \
   -text "Lab SR BM BPLD Config and Limits"  -executable "SRBMBPLDConfigAndLimits -lab 1" 
APSMenuFrameMake srBPLDMenuLab -type exec \
    -text "Lab SR ID BPLD x Position Display"  -executable "SRIDBPLDPositionDisplay -plane x -lab 1" 
APSMenuFrameMake srBPLDMenuLab -type exec \
    -text "Lab SR ID BPLD y Position Display"  -executable "SRIDBPLDPositionDisplay -plane y -lab 1"
APSMenuFrameMake srBPLDMenuLab -type exec \
    -text "Lab SR BPLD Arming Test"  -executable "SRBPLDArmingTest -lab 1"
APSMenuFrameMake srBPLDMenuLab -type exec \
    -text "Lab SR ID BPLD Validation"  -executable "SRIDBPLDValidation -lab 1" 
APSMenuFrameMake srBPLDMenuLab -type exec \
    -text "Lab SR BM BPLD Validation"  -executable "SRBMBPLDValidation -lab 1" 
APSMenuFrameMake srBPLDMenuLab -type exec \
    -text "Lab SR Local MPS External Input Validation"  -executable "SRLocalMPSExtInputValidation -lab 1" 
APSMenuFrameMake srBPLDMenuLab -type exec \
    -text "Lab SR LB+ Synthetic Data Setup"  -executable "LiberaSyntheticDataSetup -lab 1" 

APSMenuFrameMake srBPLDMenuLab -type exec \
    -text "Lab SR BPLD SaveCompareRestore (Offsets and Limits Loading)"  -executable "SaveCompareRestore -lab 1 -system SRBPLD" 

APSMenuFrameMake srBPLDMenuTest -type label -text "Test and Check out"

APSMenuFrameMake srBPLDMenuTest -type exec \
   -text "SR ID BPLD Config and Limits"  -executable "SRIDBPLDConfigAndLimits" 
APSMenuFrameMake srBPLDMenuTest -type exec \
   -text "SR BM BPLD Config and Limits"  -executable "SRBMBPLDConfigAndLimits" 
APSMenuFrameMake srBPLDMenuTest -type exec \
    -text "SR ID BPLD x Position Display"  -executable "SRIDBPLDPositionDisplay -plane x" 
APSMenuFrameMake srBPLDMenuTest -type exec \
    -text "SR ID BPLD y Position Display"  -executable "SRIDBPLDPositionDisplay -plane y"
APSMenuFrameMake srBPLDMenuTest -type exec \
    -text "SR BPLD Arming Test"  -executable "SRBPLDArmingTest"
APSMenuFrameMake srBPLDMenuTest -type exec \
    -text "SR ID BPLD Validation"  -executable "SRIDBPLDValidation" 
APSMenuFrameMake srBPLDMenuTest -type exec \
    -text "SR BM BPLD Validation"  -executable "SRBMBPLDValidation" 
APSMenuFrameMake srBPLDMenuTest -type exec \
    -text "SR Local MPS External Input Validation"  -executable "SRLocalMPSExtInputValidation" 
APSMenuFrameMake srBPLDMenuTest -type exec \
    -text "SR LB+ Synthetic Data Setup"  -executable "LiberaSyntheticDataSetup" 

APSMenuFrameMake srBPLDMenuTest -type exec \
    -text "SR BPLD SaveCompareRestore (Offsets and Limits Loading)"  -executable "SaveCompareRestore -system SRBPLD" 

### SR knobs menu
APSMenuFrameMake srKnobsMenu -type label -text "Storage Ring Knobs" 

APSMenuFrameMake srKnobsMenu -type exec \
    -text "SR Harmonic Orbit Knobs" -executable \
    "pvgroupKnobs -knobFile /home/helios/oagData/sr/knobs/orbit/lattices/default/orbit.cokn" \
    -contextHelp "Brings up knob screen for SR orbit harmonics." 
#   -allowedUsers "$srGroup"

APSMenuFrameMake srKnobsMenu -type exec \
    -text "SR Tune Knobs" -executable \
    "tclKnobs -fileName /home/helios/oagData/sr/knobs/tune/lattices/default/tune.cokn -windowName SRTuneKnobs" \
    -contextHelp "Brings up knob screen for SR tunes."

APSMenuFrameMake srKnobsMenu -type exec \
    -text "SR Chromaticity Knobs" -executable \
    "tclKnobs -fileName /home/helios/oagData/sr/knobs/chrom/lattices/default/chrom.cokn -windowName SRChromaticityKnobs" \
    -contextHelp "Brings up knob screen for SR chromaticities." 

APSMenuFrameMake srKnobsMenu -type exec \
    -text "SR Kicker Knobs" -executable \
    "tclKnobs -fileName /home/helios/oagData/sr/knobs/kickerSeptum/kicker.cokn" \
    -contextHelp "Brings up knobs for kicker adjustment."

APSMenuFrameMake srKnobsMenu -type exec \
    -text "S40 V Collimator Knobs" -executable \
    "tclKnobs -fileName /home/helios/oagData/sr/knobs/localBumps/lattices/default/S40VColBumps.cokn" \
    -contextHelp "Brings up knobs for vertical bumps in S40A:M1 swap-out dump and S40B:M1 vertical collimator"

# Usually there are many cokn files available. 
# The first one of the list will be selected.
APSMenuFrameMake srKnobsMenu -type exec \
    -text "ID Bump Knobs" -executable \
    {tclKnobs -fileName /home/helios/oagData/sr/knobs/IDbump/lattices/default/ID01.cokn} \
    -contextHelp "Brings up knob screen for SR ID bumps."
#  -allowedUsers "$srGroup"

APSMenuFrameMake srKnobsMenu -type exec \
    -text "BM Angle Bump Knobs" -executable \
    {tclKnobs -fileName /home/helios/oagData/sr/knobs/BMbump/lattices/default/BM35.cokn} \
    -contextHelp "Brings up knob screen for SR BM angle bumps. Default is BM35"

APSMenuFrameMake srKnobsMenu -type exec \
    -text "Local Bump Knobs" -executable \
    {tclKnobs -fileName /home/helios/oagData/sr/knobs/localBumps/lattices/default/S01-x-LocalBumps.cokn} \
    -contextHelp "Brings up knob screen for SR local bumps."

APSMenuFrameMake srKnobsMenu -type exec \
    -text "SR Skew Knobs" -executable \
    "tclKnobs -fileName /home/helios/oagData/sr/knobs/skew/lattices/default/skew.cokn" \
    -contextHelp "Brings up knob screen for SR skew quads." 

APSMenuFrameMake srKnobsMenu -type secureExec \
    -text "BTS Trajectory Knob" -executable \
    "tclKnobs -fileName /home/helios/oagData/sr/optimizeScripts/injection/BTS:CH2.cokn" \
    -contextHelp "Brings up a knob screen for 2 BTS H-correctors grouped to make a parallel displacement at the S:IS1 septum." 

APSMenuFrameMake srKnobsMenu -type exec \
    -text "ID downstream loss scenario knobs" -executable \
    "pvgroupKnobs -knobFile /home/helios/oagData/sr/knobs/lossScenarios/IDStraightsDownstreamLossScenarios.cokn" \
    -contextHelp "Brings up a knob screen for loss scenarios at downstream end of ID straights"

APSMenuFrameMake srKnobsMenu -type exec \
    -text "ID upstream loss scenario knobs" -executable \
    "pvgroupKnobs -knobFile /home/helios/oagData/sr/knobs/lossScenarios/IDStraightsUpstreamLossScenarios.cokn" \
    -contextHelp "Brings up a knob screen for loss scenarios at upstream end of ID straights"

APSMenuFrameMake srKnobsMenu -type exec \
    -text "Other loss scenario knobs" -executable \
    "pvgroupKnobs -knobFile /home/helios/oagData/sr/knobs/lossScenarios/LossScenarios.cokn" \
    -contextHelp "Brings up a knob screen for loss scenarios at non-ID locations"

### sr knobs menu attic

APSMenuFrameMake srKnobsMenuAttic -type label -text "Attic"

APSMenuFrameMake srKnobsMenuAttic -type secureExec \
    -text "SR Quad Harmonic Knobs" -executable \
    "tclKnobs -fileName /home/helios/oagData/sr/knobFiles/misc/quadHarmonics.cokn" \
    -contextHelp "Brings up knob screen for SR quadrupole harmonics." 

APSMenuFrameMake srKnobsMenuAttic -type secureExec \
    -text "SR BPM Timing Knobs" -executable \
    "tclKnobs -fileName /home/helios/oagData/sr/knobFiles/misc/sectorP0DL.cokn" \
    -contextHelp "Brings up knob screen for SR BPM timing." 

### SR physics SR Optics
APSMenuFrameMake srPhysicsOpticsMenu \
    -type label \
    -text "SR Optics" 

APSMenuFrameMake srPhysicsOpticsMenu \
    -type exec \
    -executable SRorbitResponse \
    -text "Orbit Response Measurement" \
    -contextHelp "Brings up a screen for making measurements of orbit response to corrector tweeks in the storage ring."

APSMenuFrameMake srPhysicsOpticsMenu \
    -type exec \
    -executable SROpticsCorrection \
    -text "Twiss functions correction" \
    -contextHelp "Brings up a screen for calculating Twiss functions correction."

APSMenuFrameMake srPhysicsOpticsMenu \
    -type exec -executable SRBetaMeasurement \
    -text "Beta Function Measurement" \
    -contextHelp "Brings up a screen for making measurements of beta functions in the storage ring."

APSMenuFrameMake srPhysicsOpticsMenu \
    -type exec -executable SRLightSourceBeta \
    -text "Beta Function Interpolator" \
    -contextHelp "Brings up an application that interpolates the beta functions at light sources and S2 S3 sextupoles using data processed from the quadrupole beta function measurement."

APSMenuFrameMake srPhysicsOpticsMenu \
    -type exec -executable SRFamilyBetaMeasurement \
    -text "Family Beta Function Measurement" \
    -contextHelp "Brings up a screen for making measurements of beta functions in the storage ring for quadrupole families."

APSMenuFrameMake srPhysicsOpticsMenu \
    -type exec -executable SRdispersionCorrection \
    -text "Horizontal Dispersion Correction" \
    -contextHelp "Brings up a screen for correcting the horizontal dispersion using quadrupole settings."

APSMenuFrameMake srPhysicsOpticsMenu \
    -type exec \
    -executable SRvertDispersionCorrection \
    -text "Vertical Dispersion Correction" \
    -contextHelp "Brings up a screen for correcting the vertical dispersion using skew quadrupole settings."

APSMenuFrameMake srPhysicsOpticsMenu \
    -type exec \
    -executable SRbetaCorrection \
    -text "Beta Function Correction" \
    -contextHelp "Brings up a screen for correcting the beta function measured at quadrupoles using quadrupoles as correctors."

APSMenuFrameMake srPhysicsOpticsMenu \
    -type exec \
    -executable SRSextupoleBeamOffset \
    -text "Sextupole beam offset" \
    -contextHelp "Brings up a screen for measuring the position of the beam in a sextupole.  Uses HP VSA for tune measurement."

APSMenuFrameMake srPhysicsOpticsMenu \
    -type exec \
    -executable "APSULatticeAndSetpoints -startArea SR -startFunction setpoints" \
    -text "Generate setpoints" \
    -contextHelp "Brings up an application that creates snapshot and standardization files from an elegant parameter file."

APSMenuFrameMake srPhysicsOpticsMenu \
    -type exec \
    -executable "APSULatticeAndSetpoints -startArea SR -startFunction lattice" \
    -text "Generate lattice values" \
    -contextHelp "Brings up an application that converts an SCR file to a file of values suitable for loading in elegant."

APSMenuFrameMake srPhysicsOpticsMenu \
    -type exec \
    -executable SRMakeStandardizeFile \
    -text "Make Standardization File" \
    -contextHelp "Brings up a application that converts an SCR file to a standardization file. Also allows the installation of the standardization file as a default."

APSMenuFrameMake srPhysicsOpticsMenu \
    -type secureExec \
    -executable SRCouplingAdjust \
    -text "Coupling Minimization" \
    -contextHelp "Brings up an application to minimize the coupling in the SR by minimizing hte vertical beam size of 35BM pinhole image."

APSMenuFrameMake srPhysicsMenuAttic -type label -text "Attic"

APSMenuFrameMake srPhysicsMenuAttic -type exec -executable SRSextupoles \
    -text "Chromaticity adjustment" \
    -contextHelp "Brings up a screen for making adjustments to chromaticity or just sextupoles families."

APSMenuFrameMake srPhysicsMenuAttic -type exec -executable SRCheckChromSextupoles \
    -text "Individual Sextupole Chromaticity" \
    -contextHelp "Brings up a screen for measuring the chromaticity due to individual sextupoles.  Useful for checking the strength and polarity of the sextupoles."

APSMenuFrameMake srPhysicsMenuAttic -type secureExec -executable SREnergyApFreqScan \
  -text "Energy Aperture from Frequency Scan" \
  -contextHelp "Brings up a screen for measuring the energy aperture from a scan of the rf frequency." 

APSMenuFrameMake srPhysicsMenuAttic -type exec -executable SREmittanceCalc \
    -text "Emittance calculation" \
    -contextHelp "Brings up a screen for computing the SR emittance from 35BM beam sizes."

APSMenuFrameMake srPhysicsMenuAttic -type secureExec \
  -text "ID Gap Scan with orbit and tune data" -executable UndulatorGapScan \
  -contextHelp "Brings up a screen for performing gap scan measurements and data review." 

### SR MPS menu
APSMenuFrameMake srMPSMenu -type label -text "Storage Ring MPS"

### SR physics menu
APSMenuFrameMake srPhysicsMenu -type label -text "Storage Ring Physics"

APSMenuFrameMake srPhysicsMenuCerenkov -type label -text "Cerenkov detector"
APSMenuFrameMake srPhysicsMenuCerenkov -type secureExec -executable setupCherenkovSR \
    -text "Cerenkov detector setup" \
    -contextHelp "Brings up an application to setup cerenkov detector." 

APSMenuFrameMake srPhysicsMenuCerenkov -type secureExec -executable SRCerenkovTimingScan \
    -text "Cerenkov detector timing scan" \
    -contextHelp "Brings up an application to scan the cerenkov timing PVs in order to set the timing of detectors to the injected beam." 

APSMenuFrameMake srPhysicsMenu -type secureExec \
  -text "ID Gap Scan for feedforward data" -executable SRCollectGapFFData \
  -contextHelp "Brings up a screen for performing gap scan measurements and data review." 
#  -allowedUsers "$srGroup"

#APSMenuFrameMake srPhysicsMenu -type secureExec \
#  -text "ID Gap Scan for Blade Offset/Rate ..." -executable SRFitGapScan \
#  -contextHelp "Brings up a screen for performing gap scan measurements and data review." 
APSMenuFrameMake  srPhysicsMenu -type exec \
    -text "SR Injection Efficiency Optimizer" -executable "optimizer -optimizeList srInjEff"  \
  -contextHelp "Brings up a GUI for SR injection efficiency optimization."

APSMenuFrameMake  srPhysicsMenu -type exec \
    -text "SR Injection Efficiency Optimizer (expert)" -executable "optimizer -optimizeList srInjEff -expert 1"  \
    -contextHelp "Brings up a GUI for SR injection efficiency optimization (expert version)."

APSMenuFrameMake srPhysicsMenu -type secureExec \
  -text "Aperture Scan" -executable SRApertureScan \
  -contextHelp "Brings up a screen for performing aperture scan measurements." 
#  -allowedUsers "$srGroup"

APSMenuFrameMake srPhysicsMenu -type secureExec -executable SREnergyApVoltScan \
  -text "Energy Aperture from Voltage Scan" \
  -contextHelp "Brings up a screen for measuring the energy aperture from a scan of the rf voltage setpoints."
#  -allowedUsers sr

APSMenuFrameMake srPhysicsMenu -type secureExec -executable SRDynamicAperture \
    -text "SR Dynamic Aperture" \
    -contextHelp "Brings up a screen for scanning a kicker strength while collecting bpm histories. Horizontal dynamic aperture may be deduced." 
#  -allowedUsers "$srGroup"

APSMenuFrameMake srPhysicsMenu -type exec -executable SRLongitudinalSpectrum \
    -text "Longitudinal Beam Spectrum" \
    -contextHelp "Brings up a screen for taking longitudinal beam motion spectrum data from the HP VSA."

APSMenuFrameMake srPhysicsMenu -type exec -text "Longitudinal Parameter Calculations" -executable \
  "longitCalcsAPS -twiss /home/helios/oagData/sr/lattices/default/aps.twi -voltage 4.0 -harmonic 1296 -superPeriods 1" \
  -contextHelp "Brings up a GUI for computing longitudinal parameters of the beam."

APSMenuFrameMake srPhysicsMenu -type exec -executable SRDispChromMeasWithDimtel \
    -text "Chromaticity/dispersion Measurement" \
    -contextHelp "Brings up a screen for making measurements of chromaticity and dispersion in the storage ring."

APSMenuFrameMake srPhysicsMenu -type exec -executable TakeSRLifetimeData \
    -text "Lifetime data collection" \
    -contextHelp "Brings up a screen for collecting various data related to lifetime measurements."

APSMenuFrameMake srPhysicsMenu -type exec -executable SRAcquireADC750 \
    -text "Acquire ADC750 data" \
    -contextHelp "Brings up a screen for acquiring data from the adc750 fast digitizer."

APSMenuFrameMake srPhysicsMenu -type exec -executable SRscanCurrent \
    -text "Scan single bunch current" \
    -contextHelp "Brings up a screen for acquiring a diverse set of data as the single bunch current is changed."

APSMenuFrameMake srPhysicsMenu -type exec -executable SRInjectionImageCapture \
    -text "Capture SR injection pulse images" \
    -contextHelp "Brings up an application that captures a sequence of images from the SR video system and plays a movie."

APSMenuFrameMake srPhysicsMenu -type secureExec -executable CPUWaveformAdjust \
    -text "CPU AC Mode Correction" \
    -contextHelp "Brings up an application to iterate the waveform correction
to the CPU operated in the AC mode."

APSMenuFrameMake srPhysicsMenu -type secureExec -executable IDmeasureLocalImpedance \
    -text "ID Local Impedance" \
    -contextHelp "Brings up an application to measure the ID local impedance."

APSMenuFrameMake srPhysicsMenu -type secureExec -executable SRS35BunchLength \
  -text "Bunch length measurement" \
  -contextHelp "Brings up an application to measure the bunch length in sector 35." 

APSMenuFrameMake srPhysicsMenu -type exec -executable SRTunesVsCurrentScan \
    -text "SR Tunes vs. Current Scan" \
    -contextHelp "brings up an application to scrapes down current using scraper, measures tunes using VSA."

APSMenuFrameMake srPhysicsMenu -type exec -executable ApplyS37ScraperBump \
    -text "SR S37 Scraper Bump" \
    -contextHelp "brings up an application to apply SR S37 Scraper Bump."

####### Storage Ring Power Supplies MENU ########

APSMenuFrameMake srPSMenu -type label -text "Storage Ring Power Supplies"

APSMenuFrameMake srPSMenu -type secureExec \
  -text "SR DC Power Supply Control" -executable SR-DCPS -contextHelp \
  "Brings up a utility for controlling storage-ring DC power supply
 convertors." 
#  -allowedUsers "$srGroup $psGroup jfm"

APSMenuFrameMake srPSMenu -type exec \
  -text "BTS DC Power Supply Control" -executable BTS-DCPS -contextHelp \
  "Brings up a utility for controlling BTS DC power supply
 convertors." 

APSMenuFrameMake srPSMenu -type secureExec \
  -text "Raw Power Supply Control" -executable SR-RPS -contextHelp \
  "Brings up a utility for controlling storage-ring raw power supplies." 
#  -allowedUsers "$srGroup $psGroup jfm"

APSMenuFrameMake srPSMenu -type exec -text "PS readback check" -executable SRPSCheckOperation \
  -contextHelp "Brings up a utility to check operation of SR power supplies by comparing the setpoint and external DCCT"

APSMenuFrameMake srPSMenu -type secureExec \
  -text "Global Dynamic Corrector Checkout" -executable SRFBTestGlobalCorrectors \
  -contextHelp \
"Brings up a utility for checkout of the global correctors for the SR real-time feedback."
# -allowedUsers "$srGroup $feedbackGroup $psGroup" 

APSMenuFrameMake srPSMenu -type secureExec \
  -text "Low-level Dynamic Corrector Checkout" -executable SRFBTestDynamicCorrectors \
  -contextHelp \
"Brings up a utility for checkout of all dynamic correctors for the SR real-time feedback."
#   -allowedUsers "$srGroup $feedbackGroup $psGroup" 

APSMenuFrameMake srPSMenu -type secureExec \
  -text "SR Corrector Punch Down" -executable "SRCorrectorPunchDown -buttonOrientation horizontal" \
  -contextHelp \
  "Brings up a utility to punch down selected SR correctors."
#  -allowedUsers "$srGroup $feedbackGroup $psGroup" 

APSMenuFrameMake srPSMenu -type secureExec \
  -text "SR Corrector Vector Delta" -executable "SRApplyCorrectorDelta" \
  -contextHelp \
  "Brings up a utility to apply corrector delta one by one."

APSMenuFrameMake srPSMenu -type exec \
    -text "Histogram Quad and Sext Data" -executable SRQuadSextHistograms \
    -contextHelp \
    "Bring up a utility to histogram current, voltage, and temperatures for quadrupoles and sextupoles."

APSMenuFrameMake srPSMenu -type secureExec \
  -text "SR H Corr. Status Management" -executable "ManageSRDeviceStatus -system hcorrectors"\
  -contextHelp "Brings up a utility for reviewing and changing the status of SR horizontal correctors."
# -allowedUsers "$srGroup $feedbackGroup" 

APSMenuFrameMake srPSMenu -type secureExec \
  -text "SR V Corr. Status Management" -executable "ManageSRDeviceStatus -system vcorrectors"\
  -contextHelp "Brings up a utility for reviewing and changing the status of SR vertical correctors."
# -allowedUsers "$srGroup $feedbackGroup" 

APSMenuFrameMake srPSMenu -type secureExec \
  -text "SR bad corrector punch down" -executable "badCorrectorPunchDown" \
  -contextHelp "for punching down bad correctors."

APSMenuFrameMake srPSMenu -type secureExec \
  -text "SR CH1 corrector punch down" -executable "CH1CorrectorPunchDown" \
  -contextHelp "for punching down CH1 correctors."

#### SR PS attic 
APSMenuFrameMake srPSMenuAttic -type label -text "Attic"

APSMenuFrameMake srPSMenuAttic -type exec \
    -text "Analyze Conditioning Configuration" -executable SRAnalyzeConditioningConfig \
    -contextHelp \
    "Bring up a utility to analyze conditioning configuration in the IOCs for different PS families."

APSMenuFrameMake srPSMenuAttic -type exec \
  -text "DAC to CurrentAO comparison" -executable SRDACMonitor \
  -contextHelp \
  "Bring up a utility to monitor SR power supplies for deviation of DACs from setpoints."

APSMenuFrameMake srPSMenuAttic -type secureExec \
  -text "SR Power Supply Calibration" -executable "APSCalibrateDCPS -system sr" \
  -contextHelp \
  "Brings up a utility to calibrate DC PS converters, in the sense of making the CurrentAI's match the CurrentAO's.  Also allows review of archived calibration data. This utility works on the converters installed in the storage ring."

APSMenuFrameMake srPSMenuAttic -type secureExec \
  -text "PSTS Converter Calibration (normal)" -executable "APSCalibrateDCPS -system psts -option normal" \
  -contextHelp \
  "Brings up a utility to calibrate DC PS converters, in the sense of making the CurrentAI's match the CurrentAO's.  Also allows review of archived calibration data. This utility works on the power supply converter test stand in the EAA."
#   -allowedUsers "srGroup $psGroup" 

APSMenuFrameMake srPSMenuAttic -type secureExec \
  -text "PSTS Converter Calibration (four corrs)" -executable "APSCalibrateDCPS -system psts -option fourcorr" \
  -contextHelp \
  "Brings up a utility to calibrate DC PS converters, in the sense of making the CurrentAI's match the CurrentAO's.  Also allows review of archived calibration data. This utility works on the power supply converter test stand in the EAA and assumes slots 2 & 6 are set up to be correctors."
#   -allowedUsers "srGroup $psGroup" 

APSMenuFrameMake srPSMenuAttic -type command \
  -text "Unselected Dac On" -command {exec carestore -sddsin /usr/local/oag/apps/src/appconfig/SRDac/USDacOn.sdds}  -contextHelp \
  "Turns on the corrector unselected dac readback."

APSMenuFrameMake srPSMenuAttic -type command \
  -text "Unselected Dac Off" -command {exec carestore -sddsin /usr/local/oag/apps/src/appconfig/SRDac/USDacOff.sdds}  -contextHelp \
  "Turns off the corrector unselected dac readback."

APSMenuFrameMake srPSMenuAttic -type exec \
  -text "Thick septum feedback" -executable \
  "maintainReadback -configFile /home/helios/oagData/maintainReadbackFiles/S:IS1.config"

APSMenuFrameMake srPSMenuAttic -type secureExec \
  -text "Power Supply Statistics" -executable SRPSStats \
  -contextHelp \
  "Brings up a utility to collect and review statistics for DC power supply convertors." 
#  -allowedUsers "$srGroup $psGroup jfm"

### SR steering menu
APSMenuFrameMake srSteeringMenu -type label -text "Storage Ring Steering"

APSMenuFrameMake srSteeringMenu -type secureExec -text "APS-U Steering Server" \
  -executable APSUSteeringServer \
    -contextHelp "brings up the utiltiy for the server of SR steering knobs."

APSMenuFrameMake srSteeringMenu -type secureExec -text "SR Beamline Steering Server" \
  -executable APSUBeamlineSteeringServer \
    -contextHelp "brings up the utiltiy for SR beamline steering server."

#APSMenuFrameMake srSteeringMenu -type secureExec \
#    -text "SR ID Optimization (new)" -executable SRIDIntensityOptimization \
#    -contextHelp \
#    "Brings up a utility for optimizing the ID intensity with new steering method." 


APSMenuFrameMake srSteeringMenu -type secureExec \
  -text "SR ID Steering" -executable "APSUBeamlineSteering -steeringType ID" -contextHelp \
  "Brings up the new utility for steering the orbit at the P0 or P1 bpms in any ID straight section." 
#  -allowedUsers "$srGroup"


APSMenuFrameMake srSteeringMenu -type secureExec \
  -text "SR BM Steering" -executable "APSUBeamlineSteering -steeringType BM" -contextHelp \
  "Brings up the new utility for steering the orbit at the BM source bpms." 
#  -allowedUsers "$srGroup"

#APSMenuFrameMake srSteeringMenu -type secureExec \
#  -text "SR CU bpm Steering" -executable "APSUBeamlineSteering -steeringType CU" -contextHelp \
#  "Brings up the new utility for steering the orbit at the CU source bpms." 
#  -allowedUsers "$srGroup"

APSMenuFrameMake srSteeringMenu -type exec \
  -text "SR restore steering correctors from SCR" -executable "SRRestoreCorrectorFromSCR" -contextHelp \
  "Brings up the new utility for restoring ID steering correctors from SCR" 

#APSMenuFrameMake srSteeringMenu -type secureExec \
#  -text "SR All Sectors Steering" -executable "SRSteerAllSectors" -contextHelp \
#  "Brings up a utility for all ID/BM steering." 

APSMenuFrameMake srSteeringMenu -type exec \
  -text "SR Steering Activity Review" -executable SRSteeringActivityReview \
  -contextHelp "Brings up a utility for reviewing when steering was done on different beamlines." 

APSMenuFrameMake srSteeringMenu -type secureExec \
  -text "SR orbit controllaw (brief)" \
  -executable "SROrbitControllaw -brief 1" -contextHelp \
  "Brings up a utility (simplified version) for using sddscontrollaw to correct the SR orbit." 
#  -allowedUsers "$srGroup"

APSMenuFrameMake srSteeringMenu -type secureExec \
  -text "SR orbit controllaw (expert)" -executable SROrbitControllaw -contextHelp \
  "Brings up a utility (expert version)for using sddscontrollaw to correct the SR orbit." 
#  -allowedUsers "$srGroup csch"

APSMenuFrameMake srSteeringMenu -type secureExec \
  -text "MOFB controllaw" -executable SRMofbControllaw -contextHelp \
  "Brings up a utility for using MOFB sddscontrollaw to correct the SR orbit."

APSMenuFrameMake srSteeringMenu -type exec \
  -text "SR orbit controllaw stats review" -executable SROrbitControllawStats -contextHelp \
  "Brings up a utility for reviewing statistics from orbit controllaw." 
  
APSMenuFrameMake srSteeringMenu -type secureExec \
  -executable {SRHVOrbitCorrectionConfig -applicationList DCOrbitCorrection} \
  -text "SR Orbit Correction Configuration" -contextHelp \
  "Brings up a utility for configuring SR orbit correction with sddscontrollaw. Use with SR orbit controllaw (expert) for orbit correction setup." 
#  -allowedUsers "$srGroup esl tfors csch"

APSMenuFrameMake srSteeringMenu -type exec \
  -executable {SRConfigCompare} \
  -text "SR Configuration Compare" -contextHelp \
  "Brings up a utility for comparing two OC or RTFB configurations" 

APSMenuFrameMake srSteeringMenu -type exec -executable SRCorrectionDefaultConfigHistory \
  -text "SR Default Configuration History" -contextHelp \
  "Brings up a utility that prints out the history of default orbit correction configurations."

APSMenuFrameMake srSteeringMenu -type exec -executable SRConfigChangeHistory \
  -text "SR Configuration Change History" -contextHelp \
  "Brings up a utility that prints out the change history of selected default orbit correction configurations."

APSMenuFrameMake srSteeringMenu -type secureExec \
  -text "SR RF frequency controllaw" -executable {controllaw -controlList "srrfFreq"} \
  -contextHelp "Bring up the controllaw screens for controlling the dispersion orbit (say from earth tides) using the rf frequnecy. The configuration of bpm can be modified in SRHVOrbitCorrectionConfig under the tab rfFrequency" 

APSMenuFrameMake srSteeringMenu -type exec -executable "SRXrayBPMPositionDisplay -bpm BM" \
  -text "SR BM XRay BPM Display" -contextHelp \
  "Brings up a display of the BM Xray BPM with an indication of trouble spots."

APSMenuFrameMake srSteeringMenu -type exec -executable "SRXrayBPMPositionDisplay -bpm ID" \
  -text "SR ID XRay BPM Display" -contextHelp \
  "Brings up a display of the ID Xray BPM with an indication of trouble spots."

APSMenuFrameMake srSteeringMenu -type command \
  -text "Toggle SR Steering Indication" -command {APSSRChangeSteeringIndicator -toggle 1} \
  -contextHelp "Toggles the indicated state of storage ring orbit correction."

APSMenuFrameMake srSteeringMenu -type secureExec \
  -text "SR BPM Offset Adjustment" -executable SROffsetAdjustment -contextHelp \
  "Brings up a utility to adjust offsets of SR BPMs as a function of current." 
#  -allowedUsers "$srGroup"

proc LaunchSROrbitADT {suffix} {
    set dataDir /home/helios/oagData/sr/orbitControllaw/lattices/default
    set tmpFile /tmp/[APSTmpString]
    exec cp $dataDir/h.default/config $tmpFile.h.config
    exec cp $dataDir/v.default/config $tmpFile.v.config
    if [catch {exec makesadtfile -x -suffix $suffix -o $tmpFile \
                 $tmpFile.h.config $tmpFile.v.config } result] {
        APSAlertBox [APSUniqueName .] -errorMessage "$result"
        return
    }
    exec adt -f $tmpFile -a /home/helios/oagData/ADTFiles/srBpm &
}

APSMenuFrameMake srSteeringMenu -type secureExec \
  -text "Restore Steering Positions" -executable SRRestoreSteering -contextHelp \
  "Brings up a utility for restoring the steering positions at light source points from a SCR file."

APSMenuFrameMake srSteeringMenu -type secureExec \
  -text "SR ID Steering P0/P1 swap" -executable SRIDdirectoryLinks \
  -contextHelp \
  "Brings up a utility for changi
ng the bpms pairs used for ID steering." 
#  -allowedUsers "$srGroup"

### SR Steering Attic 
APSMenuFrameMake srSteeringMenuAttic -type label -text "Attic"

APSMenuFrameMake srSteeringMenuAttic -type exec \
  -text "SR Datapool Corrector Statistics" -executable DPCorrectorWaveformStats \
  -contextHelp \
  "Brings up a utility for datapool corrector waveform statistics." 

APSMenuFrameMake srSteeringMenuAttic -type secureExec \
    -text "SR datapool options editor" \
    -executable DPControllawOption \
    -contextHelp "Bring up a utility for changing the DP orbit controllaw option without restarting the orbit controllaw."

APSMenuFrameMake srSteeringMenuAttic -type secureExec \
    -text "SR datapool raw command editor" \
    -executable DatapoolCommandEditor \
    -contextHelp "Bring up a utility for editing the actual sddscontrollaw command in the datapool ioc."

APSMenuFrameMake srSteeringMenuAttic -type command \
  -text "SR Orbit BPM ADT (mswAve:x)" -command {LaunchSROrbitADT ""}\
  -contextHelp "Brings up Array Display Tool for SR rf BPMs used in orbit correction, and x-ray bpms."

APSMenuFrameMake srSteeringMenuAttic -type command \
  -text "SR Orbit BPM ADT (mswAve:x:ErrorCC)" -command {LaunchSROrbitADT :ErrorCC}\
  -contextHelp "Brings up Array Display Tool for SR rf BPMs (:ErrorCC's) used in orbit correction, and x-ray bpms."

APSMenuFrameMake srSteeringMenuAttic -type secureExec \
  -text "Beam wiggler" -executable wiggleSrBeam -contextHelp \
  "Brings up a utility for wiggling the beam orbit using a corrector." 

APSMenuFrameMake srSteeringMenuAttic -type secureExec \
  -text "SR ID P0/P1 bpm Steering (origin)" -executable "SRIDSteering.old" -contextHelp \
  "Brings up a utility for steering the orbit at the P0 or P1 bpms in any ID straight section." 
#  -allowedUsers "$srGroup"


APSMenuFrameMake srSteeringMenuAttic -type secureExec \
    -text "SR ID Optimization (origin)" -executable SRIDIntensityOptimization.old \
    -contextHelp \
    "Brings up a utility for optimizing the ID intensity." 
#  -allowedUsers "$srGroup"

APSMenuFrameMake srSteeringMenuAttic -type secureExec \
  -text "SR BM bpm Steering (origin)" -executable "SRBMSteering.old" -contextHelp \
  "Brings up a utility for steering the orbit at the BM source bpms." 
#  -allowedUsers "$srGroup"


APSMenuFrameMake srSteeringMenuAttic -type secureExec \
  -text "SR CU bpm Steering (origin)" -executable "SRCUSteering.old" -contextHelp \
  "Brings up a utility for steering the orbit at the CU source bpms." 
#  -allowedUsers "$srGroup"


######## SR BPM MENU ############
APSMenuFrameMake srBPMMenu -type label -text "Storage Ring BPMs"

APSMenuFrameMake srBPMMenu -type secureExec \
  -text "BPM Self Test" -executable SRBPMSelfTest -contextHelp \
  "Brings up a utility for performing self-test checkouts on the storage ring BPMs." 

APSMenuFrameMake srBPMMenu -type secureExec \
  -text "BPM Configuration" -executable SRbpmConfig -contextHelp \
  "Brings up a utility for changing settings of BPMs, such as timing, SCDU, and beam history settings." 

APSMenuFrameMake srBPMMenu -type secureExec \
  -text "BPM Offset Measurement" -executable SRBPMOffset -contextHelp \
  "Brings up a utility for measuring the offsets of some storage ring BPMs." 

APSMenuFrameMake srBPMMenu -type secureExec \
  -text "SR BPM Status Management" -executable "ManageSRDeviceStatus -system bpms"\
  -contextHelp "Brings up a utility for reviewing and changing the status of SR BPMs."
#  -allowedUsers "$srGroup $feedbackGroup erwin" \

APSMenuFrameMake srBPMMenu -type secureExec \
  -text "SR BPM Gain Adjustment" -executable "SRAdjustBPMGains"\
  -contextHelp "Brings up a utility for adjusting SR BPM gains."
#  -allowedUsers "$srGroup $feedbackGroup erwin" \

APSMenuFrameMake srBPMMenu -type exec \
  -text "Mechanical Motion Offset Correction" \
  -executable "MMSCorrection" \
  -contextHelp "brings up a utility for mechanical motion correction of S27/S28 P0 and grid bpms offsets."

APSMenuFrameMake srBPMMenu -type exec \
  -text "SR Xray BPM P1 Steering" \
  -executable "SRXrayP1SquareMatrixSteering" \
  -contextHelp "brings up a utility for SR xray bpm P1 steering."

APSMenuFrameMake srBPMMenu -type exec \
  -text "SR Xray BPM Sanity Check" \
  -executable "SRXrayBPMSanityCheck" \
    -contextHelp "brings up a utility for SR xray bpm sanity check."

APSMenuFrameMake srBPMMenu -type exec \
    -text "XBPM Setup" -executable APSUXbpmSetup \
    -contextHelp "brings up a utility for setup XBPM."

APSMenuFrameMake srBPMMenu -type exec \
  -text "Beam motion in bands review" -executable SrBeamMotionBandPlots

APSMenuFrameMake srBPMMenuAttic -type label -text "Attic"

APSMenuFrameMake srBPMMenuAttic -type exec \
  -text "SR BPM RMS Weekly History" \
  -executable "srBeamStabilityHistory" \
  -contextHelp "brings up a utility for calculate the average sector BPM RMS values."

APSMenuFrameMake srBPMMenuAttic -type exec \
  -text "SR FPGA bpm self test" \
  -executable "FPGABpmSelfTest" \
  -contextHelp "Brings up a utility for testing FPGA bpms."

APSMenuFrameMake srBPMMenuAttic -type exec \
  -text "SR FPGA bpm turn history" \
  -executable "FPGABpmTurnHistory" \
  -contextHelp "Brings up a utility for collecting FPGA bpm turn history."

APSMenuFrameMake srBPMMenuAttic -type exec \
  -text "SR BPM waveform generator" \
  -executable "FPGABpmWaveformConfig" \
  -contextHelp "Brings up a utility for collecting FPGA bpm turn history."

APSMenuFrameMake srBPMMenuAttic -type exec \
  -text "SR FPGA MIA data acquisition" \
  -executable "collectFPGAdata" \
  -contextHelp "Brings up a utility for collecting FPGA bpm data collection for MIA application."

APSMenuFrameMake srBPMMenuAttic -type exec \
  -text "SR FPGA adc delay scan" \
  -executable "FPGAadcDelayScan" \
  -contextHelp "Brings up a utility for scanning FPGA bpm adc delays."

APSMenuFrameMake srBPMMenuAttic -type secureExec \
  -text "SR BPM Statistics" -executable SRBpmStats \
  -contextHelp "Brings up a utility for checking the readbacks of the storage ring bpms by collecting \
statistics of EPICS readbacks."

APSMenuFrameMake srBPMMenuAttic -type exec \
  -text "BPM Beam Motion Archiving" -executable \
  "SRAcquireSlowHistory -applicationMode archival -runControl 1" -contextHelp \
  "Brings up a utility for acquiring data from storage ring BPM slow history buffers. The data is analyzed to give RMS beam motion.  The data is archived and may be reviewed at a later date."

APSMenuFrameMake srBPMMenuAttic -type exec \
  -text "BPM Expert Slow History Data Acquisition" -executable \
    "SRAcquireSlowHistory -runControl 1" -contextHelp \
    "Brings up a utility for acquiring data from storage ring BPM slow history buffers." 

APSMenuFrameMake srBPMMenuAttic -type exec \
  -text "Slow Beam Motion Monitoring" -executable SRMeasureSlowMotion -contextHelp \
  "Brings up a utility for acquiring slow (~1Hz) data from the SR msAve BPMs.  Provides plots and source analysis."

APSMenuFrameMake srBPMMenuAttic -type secureExec \
  -text "BPM Address Check" -executable SRBPMCheckout -contextHelp \
  "Brings up a utility for checking the local bus addresses of the storage ring BPMs." 

APSMenuFrameMake srBPMMenuAttic -type secureExec \
  -text "BPM Intensity Effects Measurement" -executable SRBPMIntensityDependence \
  -contextHelp "Brings up a utility to collect data on BPM response to beam intensity variation." 

APSMenuFrameMake srBPMMenuAttic -type secureExec \
  -text "BPM Intensity Effects Comparison" -executable SRBPMIntensityDependenceCompare \
  -contextHelp "Brings up a utility to compare BPM intensity effects measurement data." 

APSMenuFrameMake srBPMMenuAttic -type secureExec \
  -text "BPM Timing Scan" -executable SRBPMTimingScan \
  -contextHelp "Brings up a utility to perform BPM timing scans and data analysis." 
 
APSMenuFrameMake srBPMMenuAttic -type secureExec \
  -text "BPM New Timing Scan" -executable SRBPMNewTimingScan \
  -contextHelp "Brings up a utility to perform BPM timing scans and data analysis for the sectors that have the new timing system." 
 

########### SR BPM FPGA Menu ###################
#APSMenuFrameMake srBPMFPGAMenu -type label -text "Storage Ring FPGA BPM Waveform Viewer"
#APSMenuFrameMake srBPMFPGAMenu1 -type label -text "Sector 1-10"
#APSMenuFrameMake srBPMFPGAMenu11 -type label -text "Sector 11-20"
#APSMenuFrameMake srBPMFPGAMenu21 -type label -text "Sector 21-30"
#APSMenuFrameMake srBPMFPGAMenu31 -type label -text "Sector 31-40"

#APSMenuFrameMake srBPMFPGAMenu1 -type exec \
#    -text "S1A" \
#    -executable "MpBPMWaveformViewer -PVprefix S1A" \
#    -contextHelp "Bring up the S1A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu1 -type exec \
#    -text "S1B" \
#    -executable "MpBPMWaveformViewer -PVprefix S1B" \
#    -contextHelp "Bring up the S1B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu1 -type exec \
#    -text "S2A" \
#    -executable "MpBPMWaveformViewer -PVprefix S2A" \
#    -contextHelp "Bring up the S2A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu1 -type exec \
#    -text "S2B" \
#    -executable "MpBPMWaveformViewer -PVprefix S2B" \
#    -contextHelp "Bring up the S2B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu1 -type exec \
#    -text "S3A" \
#    -executable "MpBPMWaveformViewer -PVprefix S3A" \
#    -contextHelp "Bring up the S3A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu1 -type exec \
#    -text "S3B" \
#    -executable "MpBPMWaveformViewer -PVprefix S3B" \
#    -contextHelp "Bring up the S3B BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu1 -type exec \
#    -text "S4A" \
#    -executable "MpBPMWaveformViewer -PVprefix S4A" \
#    -contextHelp "Bring up the S4A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu1 -type exec \
#    -text "S4B" \
#    -executable "MpBPMWaveformViewer -PVprefix S4B" \
#    -contextHelp "Bring up the S4B BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu1 -type exec \
#    -text "S5A" \
#    -executable "MpBPMWaveformViewer -PVprefix S5A" \
#    -contextHelp "Bring up the S5A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu1 -type exec \
#    -text "S5B" \
#    -executable "MpBPMWaveformViewer -PVprefix S5B" \
#    -contextHelp "Bring up the S5B BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu1 -type exec \
#    -text "S6A" \
#    -executable "MpBPMWaveformViewer -PVprefix S6A" \
#    -contextHelp "Bring up the S6A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu1 -type exec \
#    -text "S6B" \
#    -executable "MpBPMWaveformViewer -PVprefix S6B" \
#    -contextHelp "Bring up the S6B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu1 -type exec \
#    -text "S7A" \
#    -executable "MpBPMWaveformViewer -PVprefix S7A" \
#    -contextHelp "Bring up the S7A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu1 -type exec \
#    -text "S7B" \
#    -executable "MpBPMWaveformViewer -PVprefix S7B" \
#    -contextHelp "Bring up the S7B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu1 -type exec \
#    -text "S8A" \
#    -executable "MpBPMWaveformViewer -PVprefix S8A" \
#    -contextHelp "Bring up the S8A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu1 -type exec \
#    -text "S8B" \
#    -executable "MpBPMWaveformViewer -PVprefix S8B" \
#    -contextHelp "Bring up the S8B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu1 -type exec \
#    -text "S9A" \
#    -executable "MpBPMWaveformViewer -PVprefix S9A" \
#    -contextHelp "Bring up the S9A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu1 -type exec \
#    -text "S9B" \
#    -executable "MpBPMWaveformViewer -PVprefix S9B" \
#    -contextHelp "Bring up the S9B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu1 -type exec \
#    -text "S10A" \
#    -executable "MpBPMWaveformViewer -PVprefix S10A" \
#    -contextHelp "Bring up the S10A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu1 -type exec \
#    -text "S10B" \
#    -executable "MpBPMWaveformViewer -PVprefix S10B" \
#    -contextHelp "Bring up the S10B BPMs waveform viewer."


#APSMenuFrameMake srBPMFPGAMenu11 -type exec \
#    -text "S11A" \
#    -executable "MpBPMWaveformViewer -PVprefix S11A" \
#    -contextHelp "Bring up the S11A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu11 -type exec \
#    -text "S11B" \
#    -executable "MpBPMWaveformViewer -PVprefix S11B" \
#    -contextHelp "Bring up the S11B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu11 -type exec \
#    -text "S12A" \
#    -executable "MpBPMWaveformViewer -PVprefix S12A" \
#    -contextHelp "Bring up the S12A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu11 -type exec \
#    -text "S12B" \
#    -executable "MpBPMWaveformViewer -PVprefix S12B" \
#    -contextHelp "Bring up the S12B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu11 -type exec \
#    -text "S13A" \
#    -executable "MpBPMWaveformViewer -PVprefix S13A" \
#    -contextHelp "Bring up the S13A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu11 -type exec \
#    -text "S13B" \
#    -executable "MpBPMWaveformViewer -PVprefix S13B" \
#    -contextHelp "Bring up the S13B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu11 -type exec \
#    -text "S14A" \
#    -executable "MpBPMWaveformViewer -PVprefix S14A" \
#    -contextHelp "Bring up the S14A BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu11 -type exec \
#    -text "S14B" \
#    -executable "MpBPMWaveformViewer -PVprefix S14B" \
#    -contextHelp "Bring up the S14B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu11 -type exec \
#    -text "S15A" \
#    -executable "MpBPMWaveformViewer -PVprefix S15A" \
#    -contextHelp "Bring up the S15A BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu11 -type exec \
#    -text "S15B" \
#    -executable "MpBPMWaveformViewer -PVprefix S15B" \
#    -contextHelp "Bring up the S15B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu11 -type exec \
#    -text "S16A" \
#    -executable "MpBPMWaveformViewer -PVprefix S16A" \
#    -contextHelp "Bring up the S16A BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu11 -type exec \
#    -text "S16B" \
#    -executable "MpBPMWaveformViewer -PVprefix S16B" \
#    -contextHelp "Bring up the S16B BPMs waveform viewer."


#APSMenuFrameMake srBPMFPGAMenu11 -type exec \
#    -text "S17A" \
#    -executable "MpBPMWaveformViewer -PVprefix S17A" \
#    -contextHelp "Bring up the S17A BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu11 -type exec \
#    -text "S17B" \
#    -executable "MpBPMWaveformViewer -PVprefix S17B" \
#    -contextHelp "Bring up the S17B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu11 -type exec \
#    -text "S18A" \
#    -executable "MpBPMWaveformViewer -PVprefix S18A" \
#    -contextHelp "Bring up the S18A BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu11 -type exec \
#    -text "S18B" \
#    -executable "MpBPMWaveformViewer -PVprefix S18B" \
#    -contextHelp "Bring up the S18B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu11 -type exec \
#    -text "S19A" \
#    -executable "MpBPMWaveformViewer -PVprefix S19A" \
#    -contextHelp "Bring up the S19A BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu11 -type exec \
#    -text "S19B" \
#    -executable "MpBPMWaveformViewer -PVprefix S19B" \
#    -contextHelp "Bring up the S19B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu11 -type exec \
#    -text "S20A" \
#    -executable "MpBPMWaveformViewer -PVprefix S20A" \
#    -contextHelp "Bring up the S20A BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu11 -type exec \
#    -text "S20B" \
#    -executable "MpBPMWaveformViewer -PVprefix S20B" \
#    -contextHelp "Bring up the S20B BPMs waveform viewer."


#APSMenuFrameMake srBPMFPGAMenu21 -type exec \
#    -text "S21A" \
#    -executable "MpBPMWaveformViewer -PVprefix S21A" \
#    -contextHelp "Bring up the S21A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu21 -type exec \
#    -text "S21B" \
#    -executable "MpBPMWaveformViewer -PVprefix S21B" \
#    -contextHelp "Bring up the S21B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu21 -type exec \
#    -text "S22A" \
#    -executable "MpBPMWaveformViewer -PVprefix S22A" \
#    -contextHelp "Bring up the S22A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu21 -type exec \
#    -text "S22B" \
#    -executable "MpBPMWaveformViewer -PVprefix S22B" \
#    -contextHelp "Bring up the S22B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu21 -type exec \
#    -text "S23A" \
#    -executable "MpBPMWaveformViewer -PVprefix S23A" \
#    -contextHelp "Bring up the S23A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu21 -type exec \
#    -text "S23B" \
#    -executable "MpBPMWaveformViewer -PVprefix S23B" \
#    -contextHelp "Bring up the S23B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu21 -type exec \
#    -text "S24A" \
#    -executable "MpBPMWaveformViewer -PVprefix S24A" \
#    -contextHelp "Bring up the S24A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu21 -type exec \
#    -text "S24B" \
#    -executable "MpBPMWaveformViewer -PVprefix S24B" \
#    -contextHelp "Bring up the S24B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu21 -type exec \
#    -text "S25A" \
#    -executable "MpBPMWaveformViewer -PVprefix S25A" \
#    -contextHelp "Bring up the S25A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu21 -type exec \
#    -text "S25B" \
#    -executable "MpBPMWaveformViewer -PVprefix S25B" \
#    -contextHelp "Bring up the S25B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu21 -type exec \
#    -text "S26A" \
#    -executable "MpBPMWaveformViewer -PVprefix S26A" \
#    -contextHelp "Bring up the S26A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu21 -type exec \
#    -text "S26B" \
#    -executable "MpBPMWaveformViewer -PVprefix S26B" \
#    -contextHelp "Bring up the S26B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu21 -type exec \
#    -text "S27A" \
#    -executable "MpBPMWaveformViewer -PVprefix S27A" \
#    -contextHelp "Bring up the S27A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu21 -type exec \
#    -text "S27B" \
#    -executable "MpBPMWaveformViewer -PVprefix S27B" \
#    -contextHelp "Bring up the S27B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu21 -type exec \
#    -text "S28A" \
#    -executable "MpBPMWaveformViewer -PVprefix S28A" \
#    -contextHelp "Bring up the S28A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu21 -type exec \
#    -text "S28B" \
#    -executable "MpBPMWaveformViewer -PVprefix S28B" \
#    -contextHelp "Bring up the S28B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu21 -type exec \
#    -text "S29A" \
#    -executable "MpBPMWaveformViewer -PVprefix S29A" \
#    -contextHelp "Bring up the S29A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu21 -type exec \
#    -text "S29B" \
#    -executable "MpBPMWaveformViewer -PVprefix S29B" \
#    -contextHelp "Bring up the S29B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu21 -type exec \
#    -text "S30A" \
#    -executable "MpBPMWaveformViewer -PVprefix S30A" \
#    -contextHelp "Bring up the S30A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu21 -type exec \
#    -text "S30B" \
#    -executable "MpBPMWaveformViewer -PVprefix S30B" \
#    -contextHelp "Bring up the S30B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu31 -type exec \
#    -text "S31A" \
#    -executable "MpBPMWaveformViewer -PVprefix S31A" \
#    -contextHelp "Bring up the S31A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu31 -type exec \
#    -text "S31B" \
#    -executable "MpBPMWaveformViewer -PVprefix S31B" \
#    -contextHelp "Bring up the S31B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu31 -type exec \
#    -text "S32A" \
#    -executable "MpBPMWaveformViewer -PVprefix S32A" \
#    -contextHelp "Bring up the S32A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu31 -type exec \
#    -text "S32B" \
#    -executable "MpBPMWaveformViewer -PVprefix S32B" \
#    -contextHelp "Bring up the S32B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu31 -type exec \
#    -text "S33A" \
#    -executable "MpBPMWaveformViewer -PVprefix S33A" \
#    -contextHelp "Bring up the S33A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu31 -type exec \
#    -text "S33B" \
#    -executable "MpBPMWaveformViewer -PVprefix S33B" \
#    -contextHelp "Bring up the S33B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu31 -type exec \
#    -text "S34A" \
#    -executable "MpBPMWaveformViewer -PVprefix S34A" \
#    -contextHelp "Bring up the S34A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu31 -type exec \
#    -text "S34B" \
#    -executable "MpBPMWaveformViewer -PVprefix S34B" \
#    -contextHelp "Bring up the S34B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu31 -type exec \
#    -text "S35A" \
#    -executable "MpBPMWaveformViewer -PVprefix S35A" \
#    -contextHelp "Bring up the S35A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu31 -type exec \
#    -text "S35B" \
#    -executable "MpBPMWaveformViewer -PVprefix S35B" \
#    -contextHelp "Bring up the S35B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu31 -type exec \
#    -text "S36A" \
#    -executable "MpBPMWaveformViewer -PVprefix S36A" \
#    -contextHelp "Bring up the S36A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu31 -type exec \
#    -text "S36B" \
#    -executable "MpBPMWaveformViewer -PVprefix S36B" \
#    -contextHelp "Bring up the S36B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu31 -type exec \
#    -text "S37A" \
#    -executable "MpBPMWaveformViewer -PVprefix S37A" \
#    -contextHelp "Bring up the S37A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu31 -type exec \
#    -text "S37B" \
#    -executable "MpBPMWaveformViewer -PVprefix S37B" \
#    -contextHelp "Bring up the S37B BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu31 -type exec \
#    -text "S38A" \
#    -executable "MpBPMWaveformViewer -PVprefix S38A" \
#    -contextHelp "Bring up the S38A BPMs waveform viewer."

#APSMenuFrameMake srBPMFPGAMenu31 -type exec \
#    -text "S38B" \
#    -executable "MpBPMWaveformViewer -PVprefix S38B" \
#    -contextHelp "Bring up the S38B BPMs waveform viewer."


#APSMenuFrameMake srBPMFPGAMenu31 -type exec \
#    -text "S39A" \
#    -executable "MpBPMWaveformViewer -PVprefix S39A" \
#    -contextHelp "Bring up the S39A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu31 -type exec \
#    -text "S39B" \
#    -executable "MpBPMWaveformViewer -PVprefix S39B" \
#    -contextHelp "Bring up the S39B BPMs waveform viewer."


#APSMenuFrameMake srBPMFPGAMenu31 -type exec \
#    -text "S40A" \
#    -executable "MpBPMWaveformViewer -PVprefix S40A" \
#    -contextHelp "Bring up the S40A BPMs waveform viewer."
#APSMenuFrameMake srBPMFPGAMenu31 -type exec \
#    -text "S40B" \
#    -executable "MpBPMWaveformViewer -PVprefix S40B" \
#    -contextHelp "Bring up the S40B BPMs waveform viewer."


if {0} {
######## SR Feedback MENU ############
APSMenuFrameMake srFDBKMenu -type label -text "Storage Ring RT Feedback"

APSMenuFrameMake srFDBKMenu -type secureExec \
  -text "SRFB Main Control" -executable SRFBControl -contextHelp \
  "Brings up the main SRFB tcl control screen" 

APSMenuFrameMake srFDBKMenu -type secureExec \
  -text "Correction Configuration" \
  -executable {SRHVOrbitCorrectionConfig  -applicationList RTFeedback} \
  -contextHelp "Brings up a utility for defining the correctors and BPMs \
   in use and for generating correction matrices for the real-time orbit feedback system."

APSMenuFrameMake srFDBKMenu -type secureExec \
  -text "Global Orbit Motion Archiving" -executable SRFBOrbitMotion \
  -contextHelp "Brings up a utility for measuring orbit motion up to 767 Hz using the DSPscope of the orbit feedback system."

APSMenuFrameMake srFDBKMenu -type secureExec \
  -text "DSPscope Data for Sectors" -executable SRFBDspScopeEasy \
  -contextHelp "Brings up a utility for collecting data from DSPscope at chosen sector pairs and with a chosen frequency range."

APSMenuFrameMake srFDBKMenu -type secureExec \
  -text "DSPscope Save/Restore (Expert)" -executable SRFBDspScope \
  -contextHelp "Brings up a utility for saving and restoring DSPscope configurations and \
for collecting data from the DSPscope."

APSMenuFrameMake srFDBKMenu -type exec \
  -text "Septum FF Compensation Check" -executable SRFBCollectSeptumFFData \
  -contextHelp "Brings up a utility for collecting the septum FF compensation data from the DSPscope."

APSMenuFrameMake srFDBKMenu -type secureExec \
  -text "Response Matrix Measurement" -executable SRFBMeasureResponseMatrix \
  -contextHelp "Brings up a utility for measuring the response matrices for the \
real-time orbit feedback system. The measurements are performed using AC drive."

APSMenuFrameMake srFDBKMenu -type secureExec \
  -text "Corrector Drive & Error Statistics" -executable SRFBCorrectorStats \
  -contextHelp "Brings up a utility for measuring the global orbit feedback drive \
    and error statistics computed by the real-time feedback system."

APSMenuFrameMake srFDBKMenu -type secureExec \
  -text "Corrector Statistics Glitch Viewer" -executable SRFBStatsGlitchViewer \
  -contextHelp "Brings up a utility for plotting corrector statistics glitch logs, \
    and for triggering the glitch logger."

APSMenuFrameMake srFDBKMenu -type secureExec \
  -text "P0 BPM Offset Measurement" -executable SRFBMeasureBPMOffset \
  -contextHelp "Brings up a utility for measuring the offsets in the P0 bpms using \
AC-lockin and the non-linear coupling between x & y planes."

APSMenuFrameMake srFDBKMenu -type secureExec \
  -text "BPM Gain Measurement" -executable SRFBBpmGain \
  -contextHelp "Brings up a utility for measuring bpm gains using the \
real-time orbit feedback system. The measurements are performed using AC drive."

APSMenuFrameMake srFDBKMenu -type secureExec \
  -text "AC Corrector Drive Utility" -executable SRFBCorrACDrive \
  -contextHelp "Brings up a utility to configure the orbit feedback system for driving \
correctors with AC."

APSMenuFrameMake srFDBKMenu -type exec \
  -text "SR Feedback System Fault Diagnosis" \
  -executable SROrbitFeedbackDiag \
  -contextHelp "brings up a utility to diagnosis the SR feedback system fault."
}

######## SR rf MENU ############
APSMenuFrameMake srRfMenu -type label -text "Storage Ring RF"

APSMenuFrameMake srRfMenu -type secureExec \
  -text "RF controllaw (voltage setpoints)" \
  -executable {controllaw -controlList "srrfErr"} \
  -contextHelp "Bring up the controllaw screens for gap voltage control using voltage errors and setpoints." 
#  -allowedUsers "$srGroup"

APSMenuFrameMake srRfMenu -type secureExec \
  -text "RF controllaw mode change" -executable SRSetRFControllawMode \
  -contextHelp "Bring up an application to read and change the rf mode for controllaw." 
#  -allowedUsers $srGroup

APSMenuFrameMake srRfMenu -type secureExec \
  -text "RF phase knobs" -executable SRRFPhaseSliders \
  -contextHelp "Brings up a screen that allows adjusting SR rf station phase in various klystron running modes." 
#  -allowedUsers "$srGroup"

APSMenuFrameMake srRfMenu -type secureExec \
  -text "ID energy loss to rf voltage feedfoward" -executable SRIDLossToRfVoltageFF \
  -contextHelp "Brings up a screen that allows performing feedforward on the rf voltage setpoints based on the energy loss in IDs." 

APSMenuFrameMake srRfMenu -type secureExec \
  -text "RF Save/Compare/Restore" -executable {SaveCompareRestore -singleAccel SRF} \
  -contextHelp "Bring up the save/compare/restore utility for the SR rf." 
#  -allowedUsers "$rfGroup $srGroup "

APSMenuFrameMake srRfMenu -type exec \
  -text "RF Conditioning Scheduler" -executable {RFConditioningScheduler} \
  -contextHelp "Creates schedule of beam injection for RF conditioning with beam given user-entered parameters. Assumes that the beam will be injected in a uniform pattern. The schedule is created to increase the HOM heating in the cavities linearly with time." 

APSMenuFrameMake srRfMenu -type secureExec \
  -text "Controllaw search" -executable \
  "NetProcessControl -title sddscontrollawSearch -programName sddscontrollaw -matchItems rf" \
  -contextHelp "Brings up a utility to search for and optionally kill instances of sddscontrollaw running on control system workstations." 
#  -allowedUsers "$srGroup"

APSMenuFrameMake srRfMenu -type exec \
  -text "38/40 Controllaw data review" -executable \
  "SRRFControllawReview -group 3840" -contextHelp \
  "Brings up a utility to review data from the sector 38/40 cavity controllaw."

APSMenuFrameMake srRfMenu -type exec \
  -text "36/37 Controllaw data review" -executable \
  "SRRFControllawReview -group 3637" -contextHelp \
  "Brings up a utility to review data from the sector 36/37 cavity controllaw."

APSMenuFrameMake srRfMenu -type exec \
  -text "Gap Voltage from probe power" -executable SRGapVoltagePP \
  -contextHelp "Brings up a utility for computing storage ring gap voltage from probe power." 

proc launchDualLimiters {script} {
    exec $script 1 &
    exec $script 2 &
}

#APSMenuFrameMake srRfMenu -type command \
# -text "rf Probe Power Limiter" -command \
#  {launchDualLimiters SRrfLimitProbePower} -contextHelp \
#  "Brings up a utility for limiting storage ring cavity probe power." 
#  -allowedUsers "$srGroup"

#APSMenuFrameMake srRfMenu -type command \
#  -text "rf Collector Power Limiter" -command \
#  {launchDualLimiters SRrfLimitCollPower} -contextHelp \
#  "Brings up a utility for limiting storage ring klystron collector power." 
#  -allowedUsers "$srGroup"

APSMenuFrameMake srRfMenu -type secureExec \
  -text "rf Probe Calibration" -executable SRrfProbeCal -contextHelp \
  "Bring up a screen to compute and set loss factors for the probe power readings on the storage ring rf systems." 
#  -allowedUsers "$srGroup"

APSMenuFrameMake srRfMenu -type exec \
  -text "rf Monitoring" -executable SRrfMonitor -contextHelp \
  "Brings up a utility for logging and plotting storage ring RF data."

APSMenuFrameMake srRfMenu -type exec \
  -text "rf Time Review" -executable SRrfPowerTimeReview -contextHelp \
  "Brings up a utility for computing hours of power-time in the SR rf cavities."

APSMenuFrameMake srRfMenu -type exec \
  -text "rf Temperature Alh" -executable SRrfTempAlh -contextHelp \
  "Brings up a screen for configuring and running the alarm handler for the SR rf system temperatures."

APSMenuFrameMake srRfMenu -type exec \
  -text "Detune SR cavities" -executable DetuneSRCavs -contextHelp \
  "Brings up a screen for detune SR cavities."

APSMenuFrameMake srRfMenu -type exec \
  -text "TDS 3054 RF Scope Tool" -executable tds3054scopetool -contextHelp \
  "Brings up a utility to view scope data from MPS dumps."

APSMenuFrameMake srRfMenu -type exec \
  -text "Collect HOM spectrum" -executable CollectRFSpectrum -contextHelp \
  "Brings up a utility to collect RF cavity HOM spectrum."

######## PAR MENU ############
APSMenuFrameMake parMenu -type label -text "PAR"

APSMenuFrameMake parMenu -type exec -text "PAR Injection Efficiency Optimizer" \
    -executable "optimizer -optimizeList parInjEff" \
    -contextHelp "Bring up a screen to optimize par injection efficiency"

APSMenuFrameMake parMenu -type exec -text "PAR Injection Efficiency Optimizer (expert)" \
    -executable "optimizer -optimizeList parInjEff -expert 1" \
    -contextHelp "Bring up a screen to optimize par injection efficiency (expert version)"


APSMenuFrameMake parMenu -type secureExec \
  -text "PAR Store/Scrub" -executable PARScrub -contextHelp \
  "Bring up a screen to allow storing beam in the PAR and to allow vacuum scrubbing in PAR." 

#APSMenuFrameMake parMenu -type secureExec \
#  -text "PAR RF1 Limiter" -executable RF1Limit -contextHelp \
#  "Brings up an interface for enforcing voltage and reflected power limits on the PAR fundamental RF system." 

APSMenuFrameMake parMenu -type exec \
  -text "PAR Orbit Correction" -executable {controllaw -controlList par} \
  -contextHelp "Bring up an application to correct the PAR orbit" 

APSMenuFrameMake parMenu -type secureExec \
  -text "PAR BPM setpoint config" -executable "LinacLTPSetpointTransfer -includePAR 1" 

APSMenuFrameMake parMenu -type exec \
    -text "PTB emittance measurement" -executable "measureLinacEmittance  -system PTB"

APSMenuFrameMake parMenu -type exec \
    -text "LTP emittance measurement" -executable "measureLinacEmittance -system LTP"

APSMenuFrameMake parMenu -type secureExec \
  -text "LTP controllaw" -executable {controllaw -controlList "ltp"} \
  -contextHelp "Bring up the controllaw screens relevant to the par." 

APSMenuFrameMake parMenu -type secureExec \
  -text "LTP BPM setpoint config" -executable "LinacLTPSetpointTransfer -includeLTP 1" 

APSMenuFrameMake parMenu -type secureExec \
  -text "LTP BPM utility" -executable "LinacBPMUtil -beamline LTP"

APSMenuFrameMake parMenu -type secureExec \
  -text "PAR BPM Charge Calibration" -executable \
  PARBPMChargeCalibration -contextHelp \
  "Launches script to par bpm charge calibration"

APSMenuFrameMake parMenu -type secureExec \
  -text "PAR pem" -executable {PARpem} \
  -contextHelp "Bring up the procedure execution manager for the par/let." 

APSMenuFrameMake parMenu -type secureExec \
  -text "PAR Scope Save/Restore" -executable ScopeSaveRestore \
  -contextHelp "Brings up the par save/restore screen for the PAR HP9000 scope."


APSMenuFrameMake parMenu -type secureExec \
  -text "PAR Scope Waveform History" -executable "ScopeWaveformHistory -ring PAR" \
  -contextHelp "Brings up the screen for the PAR HP54542 scope history creation and review utility." 

APSMenuFrameMake parMenu -type exec \
  -text "Tune measurement" -executable "PARTuneMeasurementVSA" -contextHelp \
  "Brings up a utility to help with tune measurement." 

APSMenuFrameMake parMenu -type secureExec \
  -text "RF phase knobs" -executable \
  "tclKnobs -fileName /home/helios/oagData/par/knobs/rfPhasePV.cokn" \
  -contextHelp "Launches knob tool for PAR rf phase control." 

APSMenuFrameMake parMenu -type secureExec \
  -text "Kicker timing knobs" -executable \
  "tclKnobs -fileName /home/helios/oagData/par/knobs/PKtimingPV.cokn" \
  -contextHelp "Launches knob tool for PAR kicker timing adjustment." 

APSMenuFrameMake parMenu -type secureExec \
    -text "PAR Efficiency Optimizer" -executable \
    "optimizeParEfficiency" -contextHelp \
    "Launches script to allow optimizing the PAR efficiency"

APSMenuFrameMake parMenu -type exec \
    -text "PAR PS Rate Div Set And Log" -executable \
    "psRateDivSetAndLog -system par" -contextHelp \
    "Launches script to change the PS rate dividers"

APSMenuFrameMake parMenu -type exec \
    -text "PAR RF12 Tuner Feedforward" -executable \
    "PARRF12TunerFeedforward" -contextHelp \
    "Launches script to par rf12 tuner feedforward"

APSMenuFrameMake parMenu -type exec \
    -text "PAR ESP feedforward" -executable \
    "ExperimentDesigner -configuration /home/helios/oagData/par/experimentDesignerConfig/ptbEspFFConfig -applicationName \"PAR ESP feedforward\""  \
    -contextHelp \
    "Launches ExperimentDesigner for PAR extraction septum feedforward"
APSMenuFrameMake parMenu -type exec \
    -text "PAR rf condition" -executable \
    "ExperimentDesigner -configuration /home/helios/oagData/par/experimentDesignerConfig/parTopupCondConfig -applicationName \"PAR rf condition\""  \
    -contextHelp \
    "Launches ExperimentDesigner for PAR rf condition"

APSMenuFrameMake parMenu -type exec \
    -text "PAR Bunch cleaning" -executable \
     "PARBunchCleaning"  \
    -contextHelp "launch bunch cleaning application"

APSMenuFrameMake parMenu -type exec \
    -text "PAR Bunch Duration Monitor" -executable \
     "PARBunchDurationMonitor"  \
    -contextHelp "launch bunch bunch duration measurement application"

APSMenuFrameMake parMenu -type exec \
    -text "PAR Bunch Length Streak Camera" -executable \
     "PARBunchLengthMeas"  \
    -contextHelp "launch bunch bunch length measurement application"

APSMenuFrameMake parMenu -type exec \
    -text "PAR RF12 Phase Amplitude Measurement" -executable \
     "RF12PhaseAmplitudeMeas"  \
    -contextHelp "launch par RF12 phase amplitude measurement application"

APSMenuFrameMake parMenu -type exec \
    -text "PAR Loss Factor Computation" -executable \
     "computePARLossFactor"  \
    -contextHelp "launch par loss factor computation application"

#APSMenuFrameMake parMenu -type secureExec \
#  -text "Efficiency monitor" -executable \
#  "PAREfficiency" \
#  -contextHelp "Launches application for monitoring PAR efficiency." 
##  -allowedUsers "$parGroup"
#
#APSMenuFrameMake parMenu -type secureExec \
#  -text "RF1 Voltage Feedback" -executable \
#  "maintainReadback -configFile /home/helios/oagData/par/quickFeedbacks/parGap.maintainReadback" 
##  -allowedUsers "borland asdops"

######## Linac MENU ############
APSMenuFrameMake linacOpsMenu -type label -text "Linac Routine Operations"

APSMenuFrameMake linacOpsMenu -type secureExec \
  -text "Linac BPM Feedback Setpoints" -executable "LinacLTPSetpointTransfer -includeLinac 1" \
  -contextHelp "Bring up the utility to set steering setpoints for linac BPMs for use with linac controllaw." 
#  -allowedUsers "$linacGroup"

APSMenuFrameMake linacOpsMenu -type secureExec \
  -text "Linac controllaw" -executable {controllaw -controlList "linac"} \
  -contextHelp "Bring up the controllaw screens relevant to the linac trajectory controllaw."
#  -allowedUsers "$linacGroup"

APSMenuFrameMake linacOpsMenu -type exec \
  -text "Linac+RG1 controllaw" -executable {controllaw -controlList "rg1PlusLinac"} \
  -contextHelp "Bring up the controllaw screens relevant to the linac+RG1 trajectory controllaw."


APSMenuFrameMake linacOpsMenu -type secureExec \
  -text "Linac Phase Controllaw Feedback Setpoints" \
  -executable "LinacLTPSetpointTransfer -includeLinacPhase 1" \
  -contextHelp "Bring up the utility to set linac phase controllaw setpoints for linac phase detectors."
#  -allowedUsers "$linacGroup"

# APSMenuFrameMake linacOpsMenu -type secureExec \
#  -text "Linac Beam-RF Phase controllaw" -executable {controllaw -controlList "linacBeamRfPhaseGlobal"} \
#  -contextHelp "Bring up the controllaw screens for linac beam-rf phase feedback using all phase actuators and phase detector readbacks
#                controlled by a single controllaw matrix."
#  -allowedUsers "$linacGroup"

APSMenuFrameMake linacOpsMenu -type secureExec \
  -text "Individual Linac Beam-RF Phase controllaw" -executable {controllaw -controlList "linacBeamRfPhaseIndividual"} \
  -contextHelp "Bring up the controllaw screens for individual linac beam-rf phase feedback using single phase actuator and detector readbacks."
#  -allowedUsers "$linacGroup"

APSMenuFrameMake linacOpsMenu -type secureExec \
  -text "Single-Matrix Linac Beam-RF Phase controllaw" -executable {controllaw -controlList "linacBeamRfPhaseGlobal"} \
  -contextHelp "Bring up the controllaw screens for single-matrix linac beam-rf phase feedback using all actuators and detector readbacks."
#  -allowedUsers "$linacGroup"

APSMenuFrameMake linacOpsMenu -type secureExec \
  -text "LEUTL BPM Feedback Setpoints" -executable \
  "LinacLTPSetpointTransfer -includeLEUTL 1" \
  -contextHelp "Bring up the utility to set steering setpoints for LEUTL BPMs." 
#  -allowedUsers "$linacGroup"

APSMenuFrameMake linacOpsMenu -type secureExec \
  -text "RF gun scope save/restore" -executable "ScopeSaveRestore -scopeID L1:SCOPE1" \
  -contextHelp "Brings up a utility for saving and restoring scope setups and waveforms for L1:SCOPE1" 
#  -allowedUsers "$linacGroup leutl stein"

APSMenuFrameMake linacOpsMenu -type exec \
  -text "RF gun current stabilizer" -executable "fixedCurrent" \
  -contextHelp "Brings up a script that stabilizes the beam current emitted by the thermionic-cathode rf guns." 
#  -allowedUsers "$linacGroup leutl"

APSMenuFrameMake linacOpsMenu -type exec \
  -text "RF gun tune up" -executable "LinacRFGunTuneUp" \
  -contextHelp "Brings up a script that tunes up rf guns." 
#  -allowedUsers "$linacGroup leutl"


APSMenuFrameMake linacOpsMenu -type exec \
    -text "Linac power controllaws" -executable "medm -x -attach /usr/local/iocapps/adlsys/linac/linac_IOC_Controllaws.adl" \
    -contextHelp "Brings up a screen that allows starting and controling controllaw processes for the linac power." 

APSMenuFrameMake linacOpsMenu -type secureExec \
  -text "Linac rf setpoint transfer and rate control" -executable \
  "LinacLTPSetpointTransfer -includeLinacRf 1 -includeRateButtons 1" \
  -contextHelp "Bring up the utility to set feedback setpoints for linac rf." 
#  -allowedUsers "$parGroup"

APSMenuFrameMake linacOpsMenu -type secureExec \
    -text "Linac pem" -executable "LINACpem" 
#    -allowedUsers "$linacGroup leutl"

APSMenuFrameMake linacOpsMenu -type secureExec \
    -text "Set Klystron Saturated Power" -executable \
    "SetLinacKlystronSatPwr" 
#    -allowedUsers "$linacGroup leutl"

APSMenuFrameMake linacOpsMenu -type secureExec \
    -text "Manage L3:AM1 Analyzing Magnet" -executable \
    "ManageLinacAnalyzingMagnets" 
#    -allowedUsers "$linacGroup leutl"

APSMenuFrameMake linacOpsMenu -type exec \
    -text "Linac PS Rate Div Set And Log" -executable \
    "psRateDivSetAndLog -system linac" -contextHelp \
    "Launches script to change the PS rate dividers"

APSMenuFrameMake linacOpsMenu -type exec \
    -text "Injector Power Supply Resistance Check" -executable \
    "PSResistanceCalc" -contextHelp \
    "Launches script to check the injector power supply resistance"
### linac ops menu attic

APSMenuFrameMake linacOpsMenu -type exec \
  -text "Acquire Linac waveform" -executable "AcquireLinacWaveforms" \
  -contextHelp ""

APSMenuFrameMake linacOpsMenu -type exec \
  -text "Linac RF recovery activity review" -executable "LinacRFRecoveryActivityReview" \
  -contextHelp "review linac RF recovery activities logged by logDaemon."

APSMenuFrameMake linacOpsMenuAttic -type label -text "Attic"

APSMenuFrameMake linacOpsMenuAttic -type secureExec \
  -text "RF gun interlock" -executable "rfGunInterlock" \
  -contextHelp "Brings up a script that monitors various rf gun related parameters.  The script will command other scripts to halt and sound an alert if a problem is seen." 
#  -allowedUsers "$linacGroup leutl"

APSMenuFrameMake linacOpsMenuAttic -type secureExec \
    -text "Linac power controllaws (old)" -executable "controllaw -controlList linacRfPower" \
    -contextHelp "Brings up a script that allows starting and controling controllaw processes for the linac power." 
#    -allowedUsers "$linacGroup leutl"

APSMenuFrameMake linacOpsMenuAttic -type secureExec \
    -text "Linac phase controllaws (old)" -executable "controllaw -controlList linacRfPhase" \
    -contextHelp "Brings up a script that allows starting and controling controllaw processes for the linac phase." 
#    -allowedUsers "$linacGroup leutl"


######## linac "physics" menu #######
APSMenuFrameMake linacPhyMenu -type label -text "Linac Physics Menu"

#APSMenuFrameMake linacPhyMenu -type exec \
#  -text "Linac L3 Charge Optimization" -executable optimizeLinacL3Charge \
    # -contextHelp "Bring up a screen to optimize linac L3:CM1 charge."
APSMenuFrameMake linacPhyMenu -type exec \
    -text "Linac RG1/RG2 Optimization" -executable {optimizer -optimizeList linac} \
    -contextHelp "Bring up the optimizer screens for linac RG1/RG2 optimization."

APSMenuFrameMake linacPhyMenu -type exec \
    -text "Linac RG1/RG2 Optimization (expert)" -executable {optimizer -optimizeList linac -expert 1} \
    -contextHelp "Bring up the optimizer screens for linac RG1/RG2 optimization (expert version)."

APSMenuFrameMake linacPhyMenu -type secureExec \
  -text "Linac diagnostic configuration" -executable APSLinacDiagConfig \
  -contextHelp "Bring up a screen to configure timing and averaging for linac BPMs and current monitors." 
#  -allowedUsers "$linacGroup"

APSMenuFrameMake linacPhyMenu -type secureExec \
  -text "Leutl controllaw" -executable {controllaw -controlList "leutl"} \
  -contextHelp "Bring up the controllaw screens relevant to the linac when used for leutl." 
#  -allowedUsers "$linacGroup"

APSMenuFrameMake linacPhyMenu -type secureExec \
  -text "Bypass line controllaw" -executable {controllaw -controlList "bypass"} \
  -contextHelp "Bring up the controllaw screens relevant to the linac when used for leutl." 
#  -allowedUsers "$linacGroup"

APSMenuFrameMake linacPhyMenu -type secureExec \
    -text "Linac emittance measurement" -executable "measureLinacEmittance \
    -system Linac" 

APSMenuFrameMake linacPhyMenu -type secureExec \
    -text "PB 3-screen emittance measurement" -executable "threeScreenEmitMeas -system PARByPassUsingYAG" 
#    -allowedUsers "borland leutl  lumpkin linac asdops"

APSMenuFrameMake linacPhyMenu -type secureExec \
    -text "BC Low Res 3-screen emittance measurement" -executable "threeScreenEmitMeas -system BCUsingYAGLowRes" 
#    -allowedUsers "borland leutl  lumpkin linac asdops"

#below is the same as above
APSMenuFrameMake linacPhyMenu -type secureExec \
   -text "BC High Res 3-screen emittance measurement" -executable "threeScreenEmitMeas -system BCUsingYAGHighRes" 
#    -allowedUsers "borland leutl  lumpkin linac asdops"

APSMenuFrameMake linacPhyMenu -type exec \
   -text "Interleaving BC Low Res 3-screen emittance measurement" -executable "threeScreenEmitMeas -system InterBCLowRes"

APSMenuFrameMake linacPhyMenu -type secureExec \
    -text "Lattice setup tool..." -executable "LinacLatticeSetup"
#        -allowedUsers "$linacGroup leutl"

APSMenuFrameMake linacPhyMenu -type exec \
  -text "Lattice conversion to elegant..." -executable GenerateLinacElegantParameters

APSMenuFrameMake linacPhyMenu -type secureExec \
    -text "Compute BPM Setpoints to Center Beam In Quads" -executable "ComputeBPMSetpointsForQuadCentering" 
#    -allowedUsers "$linacGroup"

APSMenuFrameMake linacPhyMenu -type exec \
    -text "Analyze Synchronous Linac Data" -executable \
    "LinacSynchDataAnalysis" 

APSMenuFrameMake linacPhyMenu -type exec \
    -text "Acquire Linac Beam Images" -executable \
    "documentBeamImages -system LEUTL"

APSMenuFrameMake linacPhyMenu -type secureExec \
    -text "CTR/CDR Alpha Magnet/Scraper Scans" -executable \
    "CTRAlphaScraperScan" 
#    -allowedUsers "$linacGroup leutl lumpkin"

APSMenuFrameMake linacPhyMenu -type secureExec \
    -text "Power supply utility..." -executable "LinacPSUtil -beamline linac" 
#    -allowedUsers "$linacGroup leutl"

APSMenuFrameMake linacPhyMenu -type secureExec \
    -text "RF waveform utility..." -executable "LinacRFWFUtil" 

APSMenuFrameMake linacPhyMenu -type secureExec \
    -text "BPM utility..." -executable "LinacBPMUtil" 
#    -allowedUsers "$linacGroup leutl"

APSMenuFrameMake linacPhyMenu -type secureExec \
    -text "L5 bunch length measurement..." -executable "MeasureBunchLength" 
#    -allowedUsers "$linacGroup leutl"

APSMenuFrameMake linacPhyMenu -type secureExec \
    -text "Post-L2 dispersion measurement..." -executable "MeasureLinacDispersion" 
APSMenuFrameMake linacPhyMenu -type secureExec \
    -text "BC residual dispersion meas with flags..." -executable \
    CorrectLinacDispersionAtFlags

APSMenuFrameMake linacPhyMenu -type secureExec \
  -text "Linac Trajectory Squisher" -executable "squishLinacTraj" \
  -contextHelp "Brings up a utility to reduce the linac trajectory using the squishPVs program" 
#  -allowedUsers "leutl $linacGroup borland"

APSMenuFrameMake linacPhyMenu -type exec \
  -text "Linac Data Review" -executable "ReviewLinacDataLogs" \
  -contextHelp "Brings up a utility to review linac diagnostics, power supplies, and other data logs." \

#The related config files are out of date. I don't think this is used anyways.
#APSMenuFrameMake linacPhyMenu -type exec -text "Linac PS Conditioning Check" -executable "LinacPSConditioningTest" -contextHelp "Brings up a utility to test the linac Power Supply conditiong."


APSMenuFrameMake linacPhyMenu -type exec \
    -text "Injector PS Resistance Check" -executable "PSResistanceCalc -expert 1" \
    -contextHelp "Brings up a utility to check the power supply resistance and save time reference." 

APSMenuFrameMake linacPhyMenu -type exec \
    -text "SLED Gain Estimate" -executable "sledGainEstimate" \
    -contextHelp "Brings up a utility to estimate the gain from a SLED cavity."

APSMenuFrameMake linacPhyMenu -type exec \
    -text "Bunch pattern modulation" -executable "modulateLinacBunchPattern" \
    -contextHelp "Brings up a utility to allow modulation of the linac bunch pattern."

APSMenuFrameMake linacPhyMenu -type exec \
    -text "Linac Interleaving Light" -executable "LinacInterleavingLight" \
    -contextHelp "brings up a utility to interleaving beam bewtween PAR and Booster bypass."
### Linac Physics menu attic

APSMenuFrameMake linacPhyMenuAttic -type label -text "Attic"

APSMenuFrameMake linacPhyMenuAttic -type secureExec \
    -text "Linac convert lattice to PS setpoints... (old version)" -executable "GenerateLinacQuadSetpoints" 
#    -allowedUsers "$linacGroup leutl"

APSMenuFrameMake linacPhyMenuAttic -type secureExec \
    -text "2D sliders for linac HV steering..." -executable "twoDSlider -fileName /home/helios/oagData/linac/2DSliderFiles/steering.2DSliders" 
#    -allowedUsers "$linacGroup leutl"

APSMenuFrameMake linacPhyMenuAttic -type secureExec \
    -text "2D sliders for undulator steering..." -executable "twoDSlider -fileName /home/helios/oagData/linac/2DSliderFiles/UndHallSteering.2DSliders" 
#    -allowedUsers "$linacGroup leutl"

APSMenuFrameMake linacPhyMenuAttic -type exec \
    -text "VLD Data Analysis..." \
    -executable "ProcessVLDData" 

APSMenuFrameMake linacPhyMenuAttic -type exec \
    -text "VLD Data Info..." \
    -executable "idGroupVLDInfo"



######## Injector Test Stand menu #######
APSMenuFrameMake ITSMenu -type label -text "Injector Test Stand Menu"

APSMenuFrameMake ITSMenu -type secureExec \
    -text "Injector Test Stand pem" -executable "LTSpem" 

APSMenuFrameMake ITSMenu -type exec \
  -text "ITS Lattice Setup" -executable ITSLatticeSetup

APSMenuFrameMake ITSMenu -type exec \
  -text "Agilent Scope Control" -executable ScopeControl

APSMenuFrameMake ITSMenu -type exec \
    -text "Acquire ITS Waveform" -executable AcquireITSWaveforms

APSMenuFrameMake ITSMenu -type exec \
    -text "ITS alarm handler" -executable "alh  -m 2000 -l /home/helios/ASDOPS/op/alh /net/helios/iocapps/opsys/asdops/alh/ITS.alhConfig"

APSMenuFrameMake ITSMenu -type exec \
  -text "ITS current stabilizer" -executable "fixedCurrent -gunChoice ITS" \
  -contextHelp "Brings up a script that stabilizes the beam current emitted by the ITS." 

APSMenuFrameMake ITSMenu -type exec \
  -text "ITS Gun Conditioning Data" -executable "AcquireITSPCGunConditioningData" \
  -contextHelp "Brings up a script that collects ITS Gun conditioning data."

APSMenuFrameMake ITSMenu -type exec \
  -text "ITS PC Gun Phase Scan" -executable "ITSPCGunPhaseScanAndSet" \
  -contextHelp "Brings up a script that scan and ITS PC gun phase."

APSMenuFrameMake ITSMenu -type exec \
  -text "ITS Quan Scan Emit Meas" -executable "measureLinacEmittance -system ITS" \
  -contextHelp "Brings up a script that scan ITS quad and measure ITS emittance."


APSMenuFrameMake ITSMenu -type exec \
  -text "ITS QE Measurement" -executable "ITSQEMeasurement" \
  -contextHelp "Brings up a script that measures ITS QE."

######## Injection BPM MENU #####
APSMenuFrameMake InjMenu -type label -text "Injection BPM Menu"

APSMenuFrameMake InjMenu -type exec \
    -text "Linac BPM Self Test" -executable "LinacBPMSelfTest -system linac"

APSMenuFrameMake InjMenu -type exec \
    -text "LTP BPM Self Test" -executable "LinacBPMSelfTest -system LTP"

APSMenuFrameMake InjMenu -type exec \
    -text "PTB BPM Self Test" -executable "LinacBPMSelfTest -system PTB"

APSMenuFrameMake InjMenu -type exec \
    -text "Booster Bypass BPM Self Test" -executable "LinacBPMSelfTest -system BB"

APSMenuFrameMake InjMenu -type exec \
    -text "BTS BPM Self Test" -executable "LinacBPMSelfTest -system BTS"

######## PC Gun menu #######
APSMenuFrameMake PCGMenu -type label -text "PC Gun"

APSMenuFrameMake PCGMenu -type secureExec \
  -text "PC Gun PEM" -executable {PG1pem} \
  -contextHelp "Bring up the procedure execution manager for the PC Gun."

APSMenuFrameMake PCGMenu -type exec \
  -text "PC Gun Interleaving" -executable {LinacInterleavingControl} \
  -contextHelp "Bring up the procedure execution for PC gun interleaving control."


APSMenuFrameMake PCGMenu -type exec \
  -text "ITS PC Gun Conditioning Data" \
  -executable "AcquireITSPCGunConditioningData" \
  -contextHelp "Brings up a script that collects ITS Gun conditioning data."

APSMenuFrameMake PCGMenu -type exec \
  -text "ITS PC Gun Phase Scan" \
  -executable "ITSPCGunPhaseScanAndSet" \
  -contextHelp "Brings up a script that scan and ITS PC gun phase."

APSMenuFrameMake PCGMenu -type secureExec \
  -text "PC Gun Phase Scan" \
  -executable PCGunPhaseScanAndSet 

APSMenuFrameMake PCGMenu -type secureExec \
  -text "PC Gun Charge Measurement" \
  -executable measurePCGunCharge

APSMenuFrameMake PCGMenu -type secureExec \
  -text "Single Matrix Linac Using PCGun Beam-RF Phase Controllaw" \
  -executable {controllaw -controlList "linacPCGBeamRfPhaseGlobal"} \
  -contextHelp "Bring up the controllaw screens relevant to the linac using PCGun beam-rf phase controllaw."

APSMenuFrameMake PCGMenu -type secureExec \
  -text "Linac Using PCGun Controllaw" \
  -executable {controllaw -controlList "linacPCG"} \
  -contextHelp "Bring up the controllaw screens relevant to the linac using PCGun trajectory controllaw."

######## rf gun MENU ############
APSMenuFrameMake rfGunMenu -type label -text "RF Gun"

APSMenuFrameMake rfGunMenu -type secureExec \
  -text "RF gun scope save/restore" -executable "ScopeSaveRestore -scopeID L1:SCOPE1" \
  -contextHelp "Brings up a utility for saving and restoring scope setups and waveforms for L1:SCOPE1" 
#  -allowedUsers "$linacGroup leutl stein"

APSMenuFrameMake rfGunMenu -type secureExec \
  -text "RF gun interlock" -executable "rfGunInterlock" \
  -contextHelp "Brings up a script that monitors various rf gun related parameters.  The script will command other scripts to halt and sound an alert if a problem is seen." 
#  -allowedUsers "$linacGroup leutl"

APSMenuFrameMake rfGunMenu -type secureExec \
  -text "Bake In Cathode" -executable "BakeInCathode" \
  -contextHelp "Brings up a script that will allow you to bring the cathode heater power up very high in order to bake in the cathode." 
#  -allowedUsers "$linacGroup leutl"

APSMenuFrameMake rfGunMenu -type secureExec \
  -text "PC Gun Phase Scan" -executable PCGunPhaseScanAndSet 
#  -allowedUsers "$linacGroup leutl"

APSMenuFrameMake rfGunMenu -type secureExec \
  -text "PC Gun Charge Measurement" -executable measurePCGunCharge

APSMenuFrameMake rfGunMenu -type secureExec \
    -text "Kicker Leakage Monitor" \
    -executable MeasureRGKickerLeakage

APSMenuFrameMake rfGunMenu -type secureExec \
    -text "Drive Limits Setpoint Tool" \
    -contextHelp "A tool used to set the high and low drive limits for RF Gun validation" \
    -executable setLinacRFGMagnetDrive 
#    -allowedUsers "$rfGunGroup"

APSMenuFrameMake rfGunMenu -type secureExec \
  -text "Single Matrix Linac Using PCGun Beam-RF Phase Controllaw" -executable {controllaw -controlList "linacPCGBeamRfPhaseGlobal"} \
  -contextHelp "Bring up the controllaw screens relevant to the linac using PCGun beam-rf phase controllaw."

APSMenuFrameMake rfGunMenu -type secureExec \
  -text "Linac Using PCGun Controllaw" -executable {controllaw -controlList "linacPCG"} \
  -contextHelp "Bring up the controllaw screens relevant to the linac using PCGun trajectory controllaw."

### rf gun menu attic

APSMenuFrameMake rfGunMenuAttic -type label -text "Attic"

APSMenuFrameMake rfGunMenuAttic -type secureExec \
    -text "2D sliders for RG BL steering and quads..." -executable "twoDSlider -fileName /home/helios/oagData/linac/2DSliderFiles/RGBL.2DSliders" 
#    -allowedUsers "$linacGroup leutl"

APSMenuFrameMake rfGunMenuAttic -type secureExec \
    -text "2D sliders for RG2 steering and quads..." -executable "twoDSlider -fileName /home/helios/oagData/linac/2DSliderFiles/RG2.2DSliders" 
#    -allowedUsers "$linacGroup leutl"


######## LEA MENU ############
APSMenuFrameMake leaMenu -type label -text "LEA"

APSMenuFrameMake leaMenu -type secureExec \
    -text "LEA PEM" -executable "LEApem"

APSMenuFrameMake leaMenu -type exec \
  -text "BBBM PV monitor" -executable "PVmonitor -fileName /home/helios/ASDOPS/PVMonitorConfig/BBBM.config -group 1" \
    -contextHelp "Brings up a screen to monitor the magnet power supplies used to transport the beam to the LEA."

######## Booster MENU ############
APSMenuFrameMake boosterMenu -type label -text "Booster"

APSMenuFrameMake boosterMenuRamp -type label -text "Booster Ramp"
APSMenuFrameMake boosterMenuRamp -type exec \
  -text "Booster ramp control" -executable BRampControl \
  -contextHelp "Bring up a screen control and diagnose the booster main ramped supplies" 

APSMenuFrameMake boosterMenuRamp -type exec \
  -text "BM Ramp Monitor and Stop" -executable BMRampMonAndStop \
  -contextHelp "Bring up a screen to minitor and stop BM ramp when it is out of range." 

APSMenuFrameMake boosterMenuRamp -type exec \
   -text "Booster PS FFT analysis" -executable BMagFFTMonitor \
  -contextHelp "Bring up a screen to allow collecting power supply ramp data and displaying the frequency content." 

APSMenuFrameMake boosterMenuRamp -type exec \
   -text "Booster Ramp Current FFT analysis" -executable BoosterRampCurrentFFT \
  -contextHelp "Bring up a screen to allow collecting power supply ramp current data and displaying the frequency content."

APSMenuFrameMake boosterMenuRamp -type exec \
  -text "Booster Ramp Optimization" -executable optimizeBoosterRamps \
  -contextHelp "Bring up a screen to booster ramp dI/I rms through varying the zero setpoint and timeshift."


APSMenuFrameMake boosterMenuRamp -type exec \
  -text "Booster Automatic Ramp Correction" -executable {BRampControlAutoCorrection} \
  -contextHelp "Interface for booster automatic ramp correction application." 

APSMenuFrameMake boosterMenuRamp -type exec \
  -text "Booster Test Ramps" -executable {BoosterTestRamps} \
  -contextHelp "Used to move from the installed ramp to a test ramp in a given number of steps." 

APSMenuFrameMake boosterMenuCorrector -type label -text "Booster Corrector Control"
APSMenuFrameMake boosterMenuCorrector -type exec \
  -text "Booster corrector control" -executable BoosterCorrectorControl \
  -contextHelp "Bring up a screen for booster corrector ramp loading and verifying."


APSMenuFrameMake boosterMenuCorrector -type exec \
  -text "Booster 4 corrector bump scan" -executable Booster4CorrectorBumpScan \
  -contextHelp "Bring up a screen for booster 4 corrector bump scan."

APSMenuFrameMake boosterMenuCorrector -type exec \
  -text "Booster Bump Generator"  -executable {BoosterBumpGenerator} \
  -contextHelp "Bring up an application to generate bumps for the Booster orbit." 

APSMenuFrameMake boosterMenuDiag -type label -text "Booster Diagnostic"
APSMenuFrameMake boosterMenuDiag -type exec \
  -text "BTS BPM setpoint transfer" -executable \
  "LinacLTPSetpointTransfer -includeBTS 1" \
  -contextHelp "Bring up a screen to transfer BTS BPM readings to controllaw setpoints" 

APSMenuFrameMake boosterMenuDiag -type exec \
  -text "Booster Single Turn BPM setpoint config" -executable \
  "LinacLTPSetpointTransfer -includeBoosterSingleTurn 1" \
  -contextHelp "Bring up a screen to transfer booster single turn BPM readings to controllaw setpoints" 

APSMenuFrameMake boosterMenuDiag -type exec \
    -text "Booster Chromaticiy Measurement and Correction" -executable BoosterChromCorrection \
    -contextHelp "Bring up a screen to measure the booster chromaticy and correct the booster chromaticity with changing SF/SD ramps."


APSMenuFrameMake boosterMenuDiag -type exec \
    -text "BTS Dispersion Measurement" -executable BTSDispMeasurement \
    -contextHelp "Bring up a screen to measure the BTS dispersion using the extraction time only. This is a dispersion with initial conditions of zero at the booster kicker, which is not the same that the matched dispersion. This is good enough for checking optics."

APSMenuFrameMake boosterMenuDiag -type exec \
  -text "PTB BPM setpoint config" -executable \
  "LinacLTPSetpointTransfer -includePTB 1 -includeLinac 0 -includeLTP 0" \
  -contextHelp "Bring up a screen to transfer PTB BPM readings to controllaw setpoints" 
#  -allowedUsers "$boosterGroup $parGroup"

APSMenuFrameMake boosterMenuDiag -type exec \
  -text "Booster Orbit to Setpoints" -executable BooClosedOrbitToMSSetpoints \
  -contextHelp "Bring up an application to transfer averaged booster orbits to the MS steering setpoints."
#  -allowedUsers "$boosterGroup"

APSMenuFrameMake boosterMenuDiag -type exec \
  -text "Booster longitudinal response measurement" -executable {boosterLongRespMeas} \
  -contextHelp "Script to measure the booster longitudinal response using a bpm and
                actuators startramptime and rf phase." 

APSMenuFrameMake boosterMenuDiag -type exec \
   -text "Booster chromaticiy measurement" -executable {BoosterChromMeasurement} \
  -contextHelp "Script to measure the booster chromaticity." 

APSMenuFrameMake boosterMenuDiag -type exec \
   -text "Booster dispersion measurement" -executable {BoosterDispMeasurement} \
  -contextHelp "Script to measure the booster dispersion." 

APSMenuFrameMake boosterMenuDiag -type exec \
  -text "Booster Tune Measurement" -executable {BoosterTuneFPGA} \
  -contextHelp "Interface for booster tune measurement application." 

APSMenuFrameMake boosterMenuDiag -type exec \
  -text "Booster Integer Tune Measurement" -executable {MeasureBoosterIntegerTune} \
  -contextHelp "Interface for booster integer tune measurement application." 

APSMenuFrameMake boosterMenuDiag -type exec \
    -text "BTS emittance measurement" -executable "measureLinacEmittance \
    -system BTS" 

APSMenuFrameMake boosterMenuDiag -type exec \
    -text "Booster FPGA BPM turn history" -executable "BoosterFPGABpmTurnHistory" 

APSMenuFrameMake boosterMenuDiag -type exec \
    -text "BTS efficiency optimization" -executable "optimizeBTSEfficiency" 

APSMenuFrameMake boosterMenuRF -type label -text "Booster RF"
APSMenuFrameMake boosterMenuRF -type exec \
   -text "Booster Cavity Detuning Measurement" -executable "BoosterCavityDetuningMeasurement" \
   -contextHelp "booster cavity detuning measurement for APS upgrade project."



APSMenuFrameMake boosterMenuControllaw -type label -text "Booster Controllaw"

APSMenuFrameMake boosterMenuControllaw -type exec \
  -text "PTB controllaw" -executable {controllaw -controlList ptb} \
  -contextHelp "Bring up the controllaw screens relevant to the booster." 
#  -allowedUsers "$boosterGroup $parGroup"

APSMenuFrameMake boosterMenuControllaw -type exec \
  -text "BTX controllaw" -executable {controllaw -controlList btx} \
  -contextHelp "Bring up the controllaw screens for BTX trajactory." 


APSMenuFrameMake boosterMenuControllaw -type exec \
  -text "Booster controllaw" -executable {controllaw -controlList "booster"} \
  -contextHelp "Bring up the controllaw screens relevant to booster injection." 


APSMenuFrameMake boosterMenuControllaw -type exec \
    -text "BTS orbit centering" -executable "BTSOrbitCentering" \
    -contextHelp "scan BTS quads to minimize the orbit and find the quads offset."


APSMenuFrameMake boosterMenuSCR -type label -text "Booster SCR"
APSMenuFrameMake boosterMenuSCR -type exec \
  -text "Booster Save/Compare/Restore" -executable {SaveCompareRestore -singleAccel Booster} \
  -contextHelp "Bring up the save/compare/restore utility for the Booster." 
#  -allowedUsers "$boosterGroup"

APSMenuFrameMake boosterMenuSCR -type exec \
  -text "Booster rf Save/Compare/Restore" -executable {SaveCompareRestore -singleAccel BRF} \
  -contextHelp "Bring up the save/compare/restore utility for the Booster rf." 
#  -allowedUsers "$boosterGroup $rfGroup"

APSMenuFrameMake boosterMenu -type secureExec \
  -text "Booster pem"  -executable {BoosterPem} \
  -contextHelp "Bring up the procedure execution manager for the booster." 
#  -allowedUsers "$boosterGroup"

APSMenuFrameMake boosterMenu -type exec \
  -text "Booster single turn bpm setpoint config"  -executable {BoosterSingleTurnBPMSetpointConfig} \
  -contextHelp "Bring up the booster single turn bpm setpoint transfer app." 

APSMenuFrameMake boosterMenuSteering -type label -text "Booster Orbit Correction And Steering"
APSMenuFrameMake boosterMenuSteering -type exec \
  -text "Booster Orbit Correction"  -executable {BoosterHVOrbitCorrection } \
  -contextHelp "Bring up an application to do Booster orbit correction." 
#  -allowedUsers "$boosterGroup"

APSMenuFrameMake boosterMenuSteering -type exec \
  -text "Booster Orbit Correction Configuration"  -executable {BoosterHVOrbitCorrectionConfig } \
  -contextHelp "Bring up an application to create booster orbit correction configuration." 
#  -allowedUsers "$boosterGroup"

APSMenuFrameMake boosterMenuSteering -type exec \
  -text "Booster Orbit Steering"  -executable {BoosterOrbitSteering } \
  -contextHelp "Bring up an application to create booster orbit steering." 

APSMenuFrameMake boosterMenuSteering -type exec \
  -text "Booster 3 Corrector Response Measurement"  -executable {Booster3CorrectorResponse } \
  -contextHelp "Bring up an application to create booster orbit steering." 

APSMenuFrameMake boosterMenuLatticeSetup -type label -text "PTB/BTS Lattice Setup"
APSMenuFrameMake boosterMenuLatticeSetup -type exec \
    -text "BTS Lattice Setup" -executable "APSULatticeAndSetpoints -startArea BTS -startFunction setpoints" \
    -contextHelp "Bring up a screen to set up the BTS from a simulation lattice file."

APSMenuFrameMake boosterMenuLatticeSetup -type exec \
    -text "PTB Lattice Setup" -executable "LinacLatticeSetup -PTB 1" \
    -contextHelp "Bring up a screen to set up the PTB from a simulation lattice file."

###boosterFPGA menu
APSMenuFrameMake boosterMenuFPGA -type label -text "Booster FPGA BPM Waveform Viewer"
APSMenuFrameMake boosterMenuFPGA -type exec \
    -text "B1C0" -executable "MpBPMWaveformViewer -PVprefix B1C0"
APSMenuFrameMake boosterMenuFPGA -type exec \
    -text "B1C2" -executable "MpBPMWaveformViewer -PVprefix B1C2"
APSMenuFrameMake boosterMenuFPGA -type exec \
    -text "B1C4" -executable "MpBPMWaveformViewer -PVprefix B1C4"
APSMenuFrameMake boosterMenuFPGA -type exec \
    -text "B1C6" -executable "MpBPMWaveformViewer -PVprefix B1C6"
APSMenuFrameMake boosterMenuFPGA -type exec \
    -text "B1C8" -executable "MpBPMWaveformViewer -PVprefix B1C8"
APSMenuFrameMake boosterMenuFPGA -type label -text "Booster FPGA BPM Waveform Viewer"
APSMenuFrameMake boosterMenuFPGA -type exec \
    -text "B2C0" -executable "MpBPMWaveformViewer -PVprefix B2C0"
APSMenuFrameMake boosterMenuFPGA -type exec \
    -text "B2C2" -executable "MpBPMWaveformViewer -PVprefix B2C2"
APSMenuFrameMake boosterMenuFPGA -type exec \
    -text "B2C4" -executable "MpBPMWaveformViewer -PVprefix B2C4"
APSMenuFrameMake boosterMenuFPGA -type exec \
    -text "B2C6" -executable "MpBPMWaveformViewer -PVprefix B2C6"
APSMenuFrameMake boosterMenuFPGA -type exec \
    -text "B2C8" -executable "MpBPMWaveformViewer -PVprefix B2C8"
APSMenuFrameMake boosterMenuFPGA -type label -text "Booster FPGA BPM Waveform Viewer"
APSMenuFrameMake boosterMenuFPGA -type exec \
    -text "B3C0" -executable "MpBPMWaveformViewer -PVprefix B3C0"
APSMenuFrameMake boosterMenuFPGA -type exec \
    -text "B3C2" -executable "MpBPMWaveformViewer -PVprefix B3C2"
APSMenuFrameMake boosterMenuFPGA -type exec \
    -text "B3C4" -executable "MpBPMWaveformViewer -PVprefix B3C4"
APSMenuFrameMake boosterMenuFPGA -type exec \
    -text "B3C6" -executable "MpBPMWaveformViewer -PVprefix B3C6"
APSMenuFrameMake boosterMenuFPGA -type exec \
    -text "B3C8" -executable "MpBPMWaveformViewer -PVprefix B3C8"
APSMenuFrameMake boosterMenuFPGA -type exec \
    -text "B4C0" -executable "MpBPMWaveformViewer -PVprefix B4C0"
APSMenuFrameMake boosterMenuFPGA -type exec \
    -text "B4C2" -executable "MpBPMWaveformViewer -PVprefix B4C2"
APSMenuFrameMake boosterMenuFPGA -type exec \
    -text "B4C4" -executable "MpBPMWaveformViewer -PVprefix B4C4"
APSMenuFrameMake boosterMenuFPGA -type exec \
    -text "B4C6" -executable "MpBPMWaveformViewer -PVprefix B4C6"
APSMenuFrameMake boosterMenuFPGA -type exec \
    -text "B4C8" -executable "MpBPMWaveformViewer -PVprefix B4C8"

######## booster attic menu ##################
APSMenuFrameMake boosterMenuAttic -type label -text "Attic"
APSMenuFrameMake boosterMenuAttic -type exec \
  -text "BTS setup/control" -executable BTSControl \
  -contextHelp "Bring up a screen to set up and control the BTS magnets" 
#  -allowedUsers "$boosterGroup sr"

APSMenuFrameMake boosterMenuAttic -type exec \
  -text "Booster Chromaticity/dispersion measurement" -executable {BoosterDispChromMeas} \
  -contextHelp "Script to measure the booster tunes, chromaticity and dispersion." 
 # -allowedUsers "$boosterGroup"


APSMenuFrameMake boosterMenuAttic -type exec \
   -text "Booster Orbit Control Panel"  -executable {bcorrfull} \
  -contextHelp "Bring up a large control panel related to Booster orbit correction." 
#  -allowedUsers "$boosterGroup"

APSMenuFrameMake boosterMenuAttic -type exec \
  -text "Booster BPM Config"  -executable {BoosterBPMConfig} \
  -contextHelp "Bring up a large control panel related to Booster orbit correction." 

APSMenuFrameMake boosterMenuAttic -type exec \
  -text "Booster corrector optimizer" -executable \
    "optimizeBoosterCorrectors" 

APSMenuFrameMake boosterMenuAttic -type exec \
  -text "Booster BPM Self Test" -executable "SRBPMSelfTest -system Booster" 

APSMenuFrameMake boosterMenuAttic -type secureExec \
  -text "Booster Direct Injection BPM Feedback Setpoints" -executable \
  "LinacLTPSetpointTransfer -includeBoosterDirInj 1" \
  -contextHelp "Bring up the utility to set steering setpoints for Booster direct injection BPMs."

APSMenuFrameMake boosterMenuAttic -type exec \
  -text "Booster Timing"  -executable {btiming} \
  -contextHelp "Bring up an application to view and change Booster timing parameters." 
#  -allowedUsers "$boosterGroup"


######## Save/Compare/Restore MENU ############
APSMenuFrameMake scrMenu -type label -text "Save/Compare/Restore"

APSMenuFrameMake scrMenu -type secureExec \
  -text "PAR Scope Save/Restore" -executable "ScopeSaveRestore -new 0" \
  -contextHelp "Brings up the save/restore screen for the PAR HP9000 scope." 

APSMenuFrameMake scrMenu -type secureExec \
  -text "PAR Scope Save/Restore (new)" -executable "ScopeSaveRestore -new 1" \
  -contextHelp "Brings up the save/restore screen for the PAR HP9000 scope with python socket." 

#  -allowedUsers "$parGroup stein"

APSMenuFrameMake scrMenu -type secureExec \
  -text "Save/Compare/Restore" -executable  SaveCompareRestore \
  -contextHelp "Brings up the screen for the save/compare/restore/review facility." 
#  -allowedUsers "$linacGroup $parGroup $boosterGroup $srGroup $psGroup $leutlGroup bxyang photodia $rfGroup"

APSMenuFrameMake scrMenu -type exec \
  -text "Save/Compare/Restore PV Search" -executable "SearchDataLoggers -type request" \
  -contextHelp "Brings up a screen to allow searching the SCR request files for process variables." 
   
APSMenuFrameMake scrMenu -type exec \
  -text "View SCR History"  -executable ViewSCRHistory \
  -contextHelp "Brings up the screen for the snapshot history review facility." 

APSMenuFrameMake scrMenu -type exec \
  -text "SCR Activity Review" -executable SCRActivityReview \
  -contextHelp "Brings up the screen for the save/compare/restore activity review utility."

APSMenuFrameMake scrMenu -type secureExec \
  -text "Transfer Snapshots" \
  -executable TransferSCRSnapshots \
  -contextHelp "move snapshots between regular snapshot directory and attic directory."

APSMenuFrameMake scrMenu -type exec \
  -text "SCR Request File Editor" -executable EditRequestFile \
  -contextHelp "Brings up an application to edit SCR request files.  You may only edit files in your own area, not the system files.  New files must be installed by other means."

APSMenuFrameMake scrMenu -type exec \
  -text "PV History Tool" -executable {PVHistoryTool -configurationFile PVHistoryTool.config.1.sdds} \
  -contextHelp "Brings up the screen for the PV History Tool facility." 

APSMenuFrameMake scrMenuAttic -type label -text "Attic"

APSMenuFrameMake scrMenuAttic -type secureExec \
  -text "Snapshot Sequence Recorder" -executable SnapshotSequenceRecorder \
  -contextHelp "Brings up the screen for the snapshot sequence recorder." 

APSMenuFrameMake scrMenuAttic -type secureExec \
  -text "Snapshot Sequence Comparison" -executable SnapshotSequenceComparison \
  -contextHelp "Brings up the screen for snapshot sequence comparison, a companion to the snapshot sequence recorder." 

APSMenuFrameMake scrMenuAttic -type secureExec \
  -text "Snapshot Sequence Restore" -executable SnapshotSequenceRestore \
  -contextHelp "Brings up the screen for snapshot sequence restore, a companion to the snapshot sequence recorder." 

APSMenuFrameMake scrMenuAttic -type exec \
  -text "Save/Compare/Review" -executable {SaveCompareRestore -safetyMode 1} \
  -contextHelp "Brings up the screen for the save/compare/review facility." 


######## SDDS utilities MENU ############

APSMenuFrameMake sddsMenu -type label -text "SDDS utilities"

APSMenuFrameMake sddsMenu -type exec \
  -text "Quick Monitor" -executable quickMonitor \
  -contextHelp "Brings up the quickMonitor screen, which permits doing simple EPICS data logging."

APSMenuFrameMake sddsMenu -type exec \
  -text "Quick Waveform Monitor" -executable quickWaveformMonitor \
  -contextHelp "Brings up an application that allows logging waveforms and scalar values."

APSMenuFrameMake sddsMenu -type exec \
  -text "Experiment Designer" -executable ExperimentDesigner -contextHelp \
  "Brings up an interface for designing experiments."

APSMenuFrameMake sddsMenu -type exec \
  -text "Quick Experiment" -executable quickExperiment \
  -contextHelp "Brings up the quickExperiment screen, which permits doing simple EPICS experiments." 

APSMenuFrameMake sddsMenu -type exec \
  -text "Quick Data Manip" -executable quickSDDSDataManip -contextHelp \
  "Brings up a quick and easy interface to sddsxref, sddscombine, sddsconvert etc. data manipulation tools."

APSMenuFrameMake sddsMenu -type exec \
  -text "Quick DSP" -executable quickSDDSDSP -contextHelp \
  "Brings up a quick and easy interface to sddsfft, sddsnaff, and others digital signal processing."

APSMenuFrameMake sddsMenu -type exec \
  -text "Quick feedforward" -executable quickSDDSFeedforward -contextHelp \
  "Brings up a quick and easy interface to sddsfeedforward."

APSMenuFrameMake sddsMenu -type exec \
  -text "Quick Fitting" -executable quickSDDSFit -contextHelp \
  "Brings up a quick and easy interface to sddspfit, sddsexpfit, and sddsgfit, for fitting data from SDDS files."

APSMenuFrameMake sddsMenu -type exec \
  -text "Quick Logging" -executable quickSDDSLogger -contextHelp \
  "Brings up a quick and easy interface to sddslogger."

APSMenuFrameMake sddsMenu -type exec \
  -text "Quick Math" -executable quickSDDSMath -contextHelp \
  "Brings up a quick and easy interface to SDDS tools for smoothing, peakfinding, integration, differentiation, normalizing, and equation evaluation."


APSMenuFrameMake sddsMenu -type exec \
  -text "Quick sddsplot" -executable quickSDDSplot -contextHelp \
  "Brings up a quick and easy interface to sddsplot for plotting data from SDDS files."

APSMenuFrameMake sddsMenu -type exec \
  -text "Quick Statistics" -executable quickSDDSStatistics -contextHelp \
  "Brings up a quick and easy interface to SDDS tools for histogramming, correlation analysis, outlier removal, and statistics."
APSMenuFrameMake sddsMenu -type exec \
  -text "Quick Logger Correlate" -executable sddsLoggerCorrelator -contextHelp \
  "Brings up a quick and easy interface to sddslogger for checking correlation coefficients of logged data."

APSMenuFrameMake sddsMenu -type exec \
  -text "Edit SDDS file" -executable sddsedit -contextHelp \
  "Brings up a utility for editing an SDDS file."

APSMenuFrameMake sddsMenu -type exec \
  -text "Export SDDS data" -executable sddsExportData -contextHelp \
  "Brings up a utility for exporting data from an SDDS file to other formats, such as spreadsheet data or text."

APSMenuFrameMake sddsMenu -type exec \
  -text "Convert text file" -executable txt2Tabbed -contextHelp \
  "Brings up a utility for converting an arbitrarily delimited file to a tab delimited file."

APSMenuFrameMake sddsMenu -type exec \
  -text "Quick Controllaw" -executable quickSDDSControllaw -contextHelp \
  "This tool provides general purpose control of a beamline using a previously computed or measured response matrix"

APSMenuFrameMake sddsMenu -type exec \
  -text "Compute Inverse Response Matrix" -executable  InvRespMatrix  -contextHelp \
  "This tool provides general purpose script for computing a response matrix from a subset of correctors and bpms from a previously measured response matrix."
APSMenuFrameMake sddsMenu -type exec \
  -text "Quick Response Matrix Measurement" -executable  quickResponseMeasurement  -contextHelp \
  "This tool provides general purpose script for measuring response matrix from a subset of correctors and bpms inputed by user."

APSMenuFrameMake sddsMenu -type exec \
  -text "SDDS 3D Plotter" -executable jsdds3dplot -contextHelp \
  "Brings up a Java application that allows 3D plotting."

APSMenuFrameMake sddsMenu -type exec \
  -text "SDDS Image Reviewer" -executable ImageReviewer -contextHelp \
  "Brings up a utility for reviewing SDDS image files, including making profiles."

APSMenuFrameMake sddsMenu -type exec \
  -text "Edit sddsplot Line Types" -executable sddsplotLineEditor -contextHelp \
  "Brings up a tool to customize and save line types for sddsplot."

APSMenuFrameMake sddsMenu -type exec \
  -text "Arbitrary Waveform Editor" -executable ArbitraryWaveformEditor -contextHelp \
  "Brings up a tool edit waveforms using mathematical functions."
#### SDDS utilities attic

APSMenuFrameMake sddsMenuAttic -type label -text "Attic"

APSMenuFrameMake sddsMenuAttic -type exec \
  -text "Custom Monitor" -executable UserCustomMonitor \
  -contextHelp "Brings up the custom monitor screen, which permits monitoring PVs, evaluating equations from PV values, and logging the results into an SDDS file."

######## Developers MENU ############

APSMenuFrameMake devMenu -type label -text "Software development"

APSMenuFrameMake devMenu -type exec \
  -text "OAG Tcl/Tk help" -executable apsHelp \
  -contextHelp "Brings up the help and code viewer for the OAG Tcl/Tk\
     procedure library."

APSMenuFrameMake devMenu -type exec \
  -text "OAG SDDS Epics help" -executable apsSDDSEpicsHelp \
  -contextHelp "Brings up the help and usage viewer for both the\
     SDDS tools and the SDDS compliant Epics tools."

APSMenuFrameMake devMenu -type exec \
  -text "OAG Version Control" -executable oagVersionControl \
  -contextHelp "Brings up the OAG Version Control tool."

APSMenuFrameMake devMenu -type exec \
  -text "Find In CVS" -executable "findInCVS -gui" \
  -contextHelp "Brings up a tool to search for files in CVS."

APSMenuFrameMake devMenu -type secureExec \
    -text "Security Control" -executable "manageAppSecurity" \
    -contextHelp "Brings up application security management tool."

APSMenuFrameMake devMenu -type exec \
  -text "FACL Management" -executable FACL_Management -contextHelp \
  "Brings up a utility for reseting the file access rights for the OAG files."

APSMenuFrameMake devMenu -type exec \
  -text "IOC SDDS Epics Task Setup" -executable IOC_SDDS_EpicsTaskSetup -contextHelp \
  "Brings up a utility for reseting or modifiying the options for sddscontrollaw and sddsfeedforward running in the IOCs."

APSMenuFrameMake devMenu -type exec \
  -text "Download Software Tree" -executable getSoftwareTree -contextHelp \
  "Brings up a utility for automating the setup of the EPICS/Extensions software tree."

### developers menu attic

APSMenuFrameMake devMenuAttic -type label -text "Attic"

APSMenuFrameMake devMenuAttic -type exec \
  -text "SDDS Rapid Deployment" -executable jsddsRapidDeployment \
  -contextHelp "Brings up the SDDS Rapid Deployment tool."

APSMenuFrameMake devMenuAttic -type secureExec \
  -text "applicationBrowse" -executable applicationBrowse -contextHelp \
  "Browse control system applications. Allows you to change the current official version of an application, or set up a test version of an application in your account. Various filters allow you to browse all applications, or only those which have newer versions than the current official version. Certain operations are not allowed, depending on whether you have sufficient permission. See Gary Gunderson or Claude Saunders to acquire permission." 
#  -allowedUsers "$linacGroup $parGroup $boosterGroup $srGroup"

APSMenuFrameMake devMenuAttic -type exec \
  -text "X Color Matcher" -executable xDatabaseColorMatcher \
  -contextHelp "Brings up an application to generate colors and\
     find the nearest match in the X database."

APSMenuFrameMake devMenuAttic -type exec \
  -text "Color Map Information" -executable colorinfo \
  -contextHelp "Brings up an application to display the color\
     map, find color nanmes, look at the database colors, and\
     more.  (Some features may not work on some machines.)"


################ physics menu ##########

APSMenuFrameMake physicsMenu -type label -text "Physics"

APSMenuFrameMake physicsMenu -type exec \
  -text "Synchrotron Motion Demo" -executable tsm \
  -contextHelp "Brings up an application for exploring the physics of\
     synchrotron motion and beam loading."

APSMenuFrameMake physicsMenu -type exec \
  -text "Beam Lifetime Calcs" -executable "beamLifetimeCalc -latticeFile $OAGGlobal(SRLatticesDirectory)/default/sector1.twi" \
  -contextHelp "Brings up an application for computing gas scattering and Touschek lifetimes for electron storage rings."

################ power supply menu ##########

APSMenuFrameMake psMenu -type label -text "Power Supply"

APSMenuFrameMake psMenu -type secureExec \
    -text "PSGapps" -executable /usr/local/psg/bin_patch/solaris/PSGapps \
    -contextHelp ""
#    -allowedUsers "$psGroup csch" \

APSMenuFrameMake psMenu -type secureExec \
    -text "PSG pem" -executable PSGpem \
    -contextHelp ""
#    -allowedUsers "$psGroup" \

APSMenuFrameMake psMenu -type secureExec \
    -text "PS Analog Check" -executable OAGAnalogCheck \
    -contextHelp ""
#    -allowedUsers "$psGroup" \

APSMenuFrameMake psMenu -type secureExec \
    -text "PS LSB Check" -executable OAGLSBCheck \
    -contextHelp ""
#    -allowedUsers "$psGroup" \

APSMenuFrameMake psMenu -type secureExec \
    -text "PS MSB Check" -executable OAGMSBCheck \
    -contextHelp ""
#    -allowedUsers "$psGroup" \

APSMenuFrameMake psMenu -type secureExec \
    -text "PS GTest" -executable OAGGTest \
    -contextHelp ""
#    -allowedUsers "$psGroup" 

APSMenuFrameMake psMenu -type secureExec \
    -text "PS SR DAC Check" -executable OAGSRDACCheck \
    -contextHelp ""

APSMenuFrameMake psMenu -type secureExec \
    -text "Linac PS Utility..." -executable "LinacPSUtil -beamline linac" \
    -contextHelp ""

APSMenuFrameMake psMenu -type secureExec \
    -text "Leutl PS Utility..." -executable "LinacPSUtil -beamline leutl" \
    -contextHelp ""

APSMenuFrameMake psMenu -type secureExec \
    -text "PAR PS Utility..." -executable "LinacPSUtil -beamline par" \
    -contextHelp ""

APSMenuFrameMake psMenu -type secureExec \
    -text "BTS PS Utility..." -executable "LinacPSUtil -beamline booster" \
    -contextHelp ""

APSMenuFrameMake psMenu -type secureExec \
    -text "Interleaving PS Utility..." -executable "LinacPSUtil -beamline interleaving" \
    -contextHelp ""

APSMenuFrameMake psMenu -type exec \
    -text "Conditioning PS Worksheet..." -executable "ConditionPSWorksheet" \
    -contextHelp ""

################
################ APSU menu ##########

APSMenuFrameMake apsuMenu -type label -text "APSU"
APSMenuFrameMake apsuMenu -type exec \
    -text "Setup DAQ IOCs..." -executable "SetupDaqIOC" 

####### LocalMPS Test Menu###
APSMenuFrameMake localMPSMenu -type label -text "Local MPS Test"
for {set i 1} {$i<40} {incr i 2} {
    APSMenuFrameMake localMPSMenu -type exec \
	-text "LocalMPS-Testing-Sector [format %02d $i]" -executable "SRBPLDValidationMBALab  -doubleSector $i"
}

#APSMenuFrameMake localMPSMenu -type exec \
\#    -text "LocalMPS-Testing-Sector 03" -executable "SRBPLDValidationMBALab  -doubleSector 3"


#APSMenuFrameMake localMPSMenu -type exec \
 \#   -text "LocalMPS-Testing-Sector 05" -executable "SRBPLDValidationMBALab  -doubleSector 5"

#APSMenuFrameMake localMPSMenu -type exec \
 \#   -text "LocalMPS-Testing-Sector 07" -executable "SRBPLDValidationMBALab  -doubleSector 7"

#APSMenuFrameMake localMPSMenu -type exec \
 \#   -text "LocalMPS-Testing-Sector 11" -executable "SRBPLDValidationMBALab  -doubleSector 11"



####


################ MAIN MENU ##################
APSMenuFrameMake menuList -type label -text "OAGapps"

#APSMenuFrameMake routineOperationsMenu -type menu -menuList $routineOperationsMenu
APSMenuFrameMake routineOperationsMenu -type menu -menuList $routineOperationsMenuLinac
APSMenuFrameMake routineOperationsMenu -type menu -menuList $routineOperationsMenuPAR
APSMenuFrameMake routineOperationsMenu -type menu -menuList $routineOperationsMenuBooster
APSMenuFrameMake routineOperationsMenu -type menu -menuList $routineOperationsMenuSR
APSMenuFrameMake menuList -type menu -menuList $routineOperationsMenu
 
APSMenuFrameMake miscMenu -type menu -menuList $miscMenuAttic
APSMenuFrameMake menuList -type menu -menuList $miscMenu

APSMenuFrameMake menuList -type menu -menuList $controllerMenu

APSMenuFrameMake loggerReviewMenu -type menu -menuList $loggerReviewMenuAttic
APSMenuFrameMake menuList -type menu -menuList $loggerReviewMenu

APSMenuFrameMake srDataReviewMenu -type menu -menuList $srDataReviewMenuAttic
APSMenuFrameMake menuList -type menu -menuList $srDataReviewMenu

APSMenuFrameMake srMenu -type menu -menuList $srPvMonitorMenu
APSMenuFrameMake srMenu -type menu -menuList $srInjectionMenu
APSMenuFrameMake srMenu -type menu -menuList $srMenuAttic
APSMenuFrameMake menuList -type menu -menuList $srMenu

APSMenuFrameMake srBPLDMenu -type menu -menuList $srBPLDMenuLab

APSMenuFrameMake srBPLDMenu -type menu -menuList $srBPLDMenuTest
APSMenuFrameMake menuList -type menu -menuList $srBPLDMenu

APSMenuFrameMake srKnobsMenu -type menu -menuList $srKnobsMenuAttic
APSMenuFrameMake menuList -type menu -menuList $srKnobsMenu

APSMenuFrameMake srPhysicsS35DiagMenu -type menu -menuList $s35bmPHCMenu
APSMenuFrameMake srPhysicsS35DiagMenu -type menu -menuList $s35idDIAMenu
APSMenuFrameMake srPhysicsS35DiagMenu -type menu -menuList $s35bpdMenu
APSMenuFrameMake srPhysicsS35DiagMenu -type menu -menuList $s35cherenkovMenu
APSMenuFrameMake srPhysicsS35DiagMenu -type menu -menuList $s35fluxMonMenu
APSMenuFrameMake srPhysicsS35DiagMenu -type menu -menuList $s35videoMenu
if {[string compare $env(USER) $s35author]==0} {
    APSMenuFrameMake srPhysicsS35DiagMenu -type menu -menuList $s35ccdMenu
}
APSMenuFrameMake srPhysicsS35DiagMenu -type menu -menuList $s35gatedMenu
APSMenuFrameMake srPhysicsS35DiagMenu -type menu -menuList $s35streakMenu
APSMenuFrameMake srPhysicsS35DiagMenu -type menu -menuList $s35calMenu
APSMenuFrameMake srPhysicsS35DiagMenu -type menu -menuList $s35setupMenu
APSMenuFrameMake srPhysicsS35DiagMenu -type menu -menuList $s35logMenu
APSMenuFrameMake srPhysicsS35DiagMenu -type menu -menuList $s35testMenu
if {[string compare $env(USER) $s35author]==0} {
    APSMenuFrameMake srPhysicsS35DiagMenu -type menu -menuList $s35bxytestMenu
}

APSMenuFrameMake srPhysicsMenu -type menu -menuList $srPhysicsMenuCerenkov
APSMenuFrameMake srPhysicsMenu -type menu -menuList $srPhysicsOpticsMenu
APSMenuFrameMake srPhysicsMenu -type menu -menuList $srPhysicsS35DiagMenu
APSMenuFrameMake srPhysicsMenu -type menu -menuList $srPhysicsMenuAttic
APSMenuFrameMake menuList -type menu -menuList $srPhysicsMenu


APSMenuFrameMake srPSMenu -type menu -menuList $srPSMenuAttic
APSMenuFrameMake menuList -type menu -menuList $srPSMenu

APSMenuFrameMake srSteeringMenu -type menu -menuList $srSteeringMenuAttic
APSMenuFrameMake menuList -type menu -menuList $srSteeringMenu

#APSMenuFrameMake srBPMMenu -type menu -menuList $srBPMFPGAMenu
#APSMenuFrameMake srBPMFPGAMenu -type menu -menuList $srBPMFPGAMenu1
#APSMenuFrameMake srBPMFPGAMenu -type menu -menuList $srBPMFPGAMenu11
#APSMenuFrameMake srBPMFPGAMenu -type menu -menuList $srBPMFPGAMenu21
#APSMenuFrameMake srBPMFPGAMenu -type menu -menuList $srBPMFPGAMenu31
#APSMenuFrameMake menuList -type menu -menuList $srBPMFPGAMenu

APSMenuFrameMake srBPMMenu -type menu -menuList $srBPMMenuAttic
APSMenuFrameMake menuList -type menu -menuList $srBPMMenu


#APSMenuFrameMake menuList -type menu -menuList $srFDBKMenu

APSMenuFrameMake menuList -type menu -menuList $srRfMenu

APSMenuFrameMake menuList -type menu -menuList $parMenu
APSMenuFrameMake boosterMenu -type menu -menuList $boosterMenuRamp
APSMenuFrameMake boosterMenu -type menu -menuList $boosterMenuCorrector
APSMenuFrameMake boosterMenu -type menu -menuList $boosterMenuDiag
APSMenuFrameMake boosterMenu -type menu -menuList $boosterMenuControllaw
APSMenuFrameMake boosterMenu -type menu -menuList $boosterMenuSteering
APSMenuFrameMake boosterMenu -type menu -menuList $boosterMenuSCR
APSMenuFrameMake boosterMenu -type menu -menuList $boosterMenuRF
APSMenuFrameMake boosterMenu -type menu -menuList $boosterMenuLatticeSetup
APSMenuFrameMake boosterMenu -type menu -menuList $boosterMenuFPGA
APSMenuFrameMake boosterMenu -type menu -menuList $boosterMenuAttic
APSMenuFrameMake menuList -type menu -menuList $boosterMenu

APSMenuFrameMake linacOpsMenu -type menu -menuList $linacOpsMenuAttic
APSMenuFrameMake menuList -type menu -menuList $linacOpsMenu

APSMenuFrameMake linacPhyMenu -type menu -menuList $linacPhyMenuAttic
APSMenuFrameMake menuList -type menu -menuList $linacPhyMenu

APSMenuFrameMake menuList -type menu -menuList $ITSMenu

APSMenuFrameMake menuList -type menu -menuList $InjMenu

APSMenuFrameMake menuList -type menu -menuList $PCGMenu


APSMenuFrameMake rfGunMenu -type menu -menuList $rfGunMenuAttic
APSMenuFrameMake menuList -type menu -menuList $rfGunMenu

APSMenuFrameMake menuList -type menu -menuList $leaMenu

APSMenuFrameMake scrMenu -type menu -menuList $scrMenuAttic
APSMenuFrameMake menuList -type menu -menuList $scrMenu

APSMenuFrameMake sddsMenu -type menu -menuList $sddsMenuAttic
APSMenuFrameMake menuList -type menu -menuList $sddsMenu

APSMenuFrameMake devMenu -type menu -menuList $devMenuAttic
APSMenuFrameMake menuList -type menu -menuList $devMenu

APSMenuFrameMake menuList -type menu -menuList $physicsMenu

APSMenuFrameMake menuList -type menu -menuList $psMenu

APSMenuFrameMake menuList -type menu -menuList $apsuMenu

APSMenuFrameMake menuList -type menu -menuList $localMPSMenu


if {$argc == 2 && [lindex $argv 0] == "-subMenu"} {
    set subMenu [lindex $argv 1]
    set menuList [APSMenuFrameFindSubMenu $subMenu $menuList]
    wm title . $subMenu
}

APSMenuFrame .mf -parent .userFrame -menuList $menuList
.menu.file.menu delete 2
.menu.file.menu add command -label "Quit" -command {
    APSMenuFrameClose .userFrame.mf
    exit
}
set apsMenuFrame(autoCascade) 0
.menu.file.menu insert 1 separator
.menu.file.menu  insert 1 check -label "Auto Cascade" \
    -variable apsMenuFrame(autoCascade)



# Local Variables:
# mode: tcl
# End:
