1 / 10

First Step on User Commands

First Step on User Commands. Makoto Asai (SLAC) Geant4 Users Workshop @ CERN Nov. 11th, 2002. Contents. Geant4 UI command Built-in commands Macro file Alias Loop commands Information for creating user-defined commands will be given at “More on User Commands” on Wednesday.

truman
Download Presentation

First Step on User Commands

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. First Step on User Commands Makoto Asai (SLAC) Geant4 Users Workshop @ CERN Nov. 11th, 2002

  2. Contents • Geant4 UI command • Built-in commands • Macro file • Alias • Loop commands • Information for creating user-defined commands will be given at “More on User Commands” on Wednesday. First Step On User Commands - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/11/2002)

  3. Geant4 UI command • Geant4 UI command can be issued by • (G)UI interactive command submission • Macro file • Hard-coded implementation • No need for the targeting class pointer • SLOW! Never use this for event-by-event setting or deeper inside the event processing G4UImanager* UI = G4UImanager::GetUIpointer(); UI->ApplyCommand("/run/verbose 1"); • A command consists of • Command directory • Command • Parameter(s) First Step On User Commands - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/11/2002)

  4. Available Commands • You can get a list of available commands including your custom ones by /control/manual [directory] • Plane text format to standard output /control/createHTML [directory] • HTML file(s) • List of built-in commands is also available in section 7.1 of User's Guide For Application Developers. • Some (G)UIs support online help. First Step On User Commands - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/11/2002)

  5. Available commands • The availability of individual commands, the ranges of parameters, the available candidates on individual command parameters vary according to the implementation of your application and may even vary dynamically during the execution of your job. • E.g. available particle types of /gun/particle command depend on which particles you defined in your physics list. • Commands may be available only for limited Geant4 application state(s). • E.g. /run/beamOn is available only for PreInit and Idle states. First Step On User Commands - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/11/2002)

  6. Syntax of parameters • A parameter can be a type of string, boolean, integer or double. • Use double-quotes (” ”) for a string with space(s). • A parameter can be “omittable”. If it is the case, a default value will be taken if you omit the parameter. • Default value is either predefined default value or current value according to its definition • If you want to use the default value for your first parameter while you want to set your second parameter, use “!” as a place holder. /dir/command ! second First Step On User Commands - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/11/2002)

  7. Refusal of command • Command will be refused if • Wrong application state • Wrong type of parameter • Insufficient number of parameters • Parameter out of its range • For ineteger or double type parameter • Parameter out of its candidate list • For string type parameter • Miss-use of alias • Command not found First Step On User Commands - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/11/2002)

  8. Macro file • Macro file is an ASCII file contains UI commands. • All commands must be given with their full-path directories. • Use “#” for comment line. • First “#” to the end of the line will be ignored. • Comment lines will be echoed if /control/verbose is set to 2. • Macro file can be executed by • /control/execute • /control/loop • /control/foreach • You can recursively execute same and/or other macro files. First Step On User Commands - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/11/2002)

  9. Alias • Alias can be defined by /control/alias [name] [value] • Also by /control/loop and /control/foreach commands. • Aliased value is string, even if it consists of numbers. • Alias can be used by other UI command(s), for command name, directory path, parameter(s) or any combination of these. • Use curly brackets “{” and “}” to use an alias. Alias can be interpreted recursively. /control/alias file1 /diskA/run1 /control/alias file2 /diskB/run2 /control/alias run 1 /myCommand/getFile {file{run}}.dat • You can shorten lengthy but frequently used command using alias. First Step On User Commands - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/11/2002)

  10. Repeating macro execution /control/loop [macroFile] [counterName] [initialValue] [finalValue] [stepSize] • Execute a macro file more than once.Loop counter can be used as an aliased variable. /control/foreach [macroFile] [counterName] [valueList] • Execute a macro file more than once.Loop counter can be used as an aliased variable.Values must be separated by a space. First Step On User Commands - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/11/2002)

More Related