Makoto Asai (SLAC) Geant4 Users CERN Nov. 13th, 2002

Slides:



Advertisements
Similar presentations
First Step on User Commands Makoto Asai (SLAC) Geant4 Users CERN Nov. 11th, 2002.
Advertisements

Geant4 v9.2p02 User Interface I Makoto Asai (SLAC) Geant4 Tutorial Course.
Constructor. 2 constructor The main use of constructors is to initialize objects. A constructor is a special member function, whose name is same as class.
User Interface I Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.3.
Geant4 v9.2p02 User Interface II Makoto Asai (SLAC) Geant4 Tutorial Course.
Geant4 v9.2p02 Particle Gun Makoto Asai (SLAC) Geant4 Tutorial Course.
Geant4 v9.2p02 Primary Particle Makoto Asai (SLAC) Geant4 Tutorial Course.
 2006 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
Improvement of G4Exception (and an announcement on G4ApplicationState) Makoto Asai (SLAC) on behalf of Architecture team.
Primary particle generation Makoto Asai (SLAC) Geant4 Users CERN Nov. 12 th, 2002.
Geant4 User Interface Overview Geant4 Mini-Tutorial Hebden Bridge 15 September 2007 Joseph Perl, SLAC (mostly stolen from a talk by Makoto Asai)
Makoto Asai (SLAC) Geant4 Users CERN Nov. 15 th, 2002 Customizing Run Management.
Makoto Asai (SLAC) Geant4 Users CERN Nov. 12 th, 2002 Detector Sensitivity.
Geant4 v9.4 Primary Particle Makoto Asai (SLAC) Geant4 Tutorial Course.
Geant4 v9.4 User Interface I Makoto Asai (SLAC) Geant4 Tutorial Course.
Makoto Asai (SLAC) Geant4 Users CERN Nov. 11 th, 2002 Getting Started.
Highlights of latest developments ESA/ESTEC Makoto Asai (SLAC)
Geant4 v9.3p01 Primary Particle Makoto Asai (SLAC) Geant4 Tutorial Course.
 2006 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
User Commands Makoto Asai (SLAC) Geant4 Users SLAC Feb. 19th, 2002.
Introduction to Classes and Objects CS-2303, C-Term Introduction to Classes and Objects CS-2303 System Programming Concepts (Slides include materials.
Makoto Asai (SLAC) Geant4 Users CERN Nov. 13th, 2002 Stack management, Digitization and Pile-up.
User Interface II Makoto Asai (SLAC) Geant4 Tutorial Course Geant4 v8.2p01.
Java Methods By J. W. Rider. Java Methods Modularity Declaring methods –Header, signature, prototype Static Void Local variables –this Return Reentrancy.
Dale Roberts Object Oriented Programming using Java - Class Constructors Dale Roberts, Lecturer Computer Science, IUPUI Department.
CSE 332: C++ templates and generic programming I Motivation for Generic Programming in C++ We’ve looked at procedural programming –Reuse of code by packaging.
(G)UI status and developments Geant4 Workshop at CERN Oct. 02, 2002 Hajime Yoshida.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
OBJECT ORIENTED PROGRAMMING CONCEPTS ISC 560. Object-oriented Concepts  Objects – things names with nouns  Classes – classifications (groups) of similar.
CSC1018F: Object Orientation, Exceptions and File Handling Diving into Python Ch. 5&6 Think Like a Comp. Scientist Ch
C++ Review Classes and Object Oriented Programming Parasol Lab, Texas A&M University.
Object Oriented Programming with C++/ Session 6 / 1 of 44 Multiple Inheritance and Polymorphism Session 6.
Chapter 1 Working with strings. Objectives Understand simple programs using character strings and the string library. Get acquainted with declarations,
17-19 Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan 2007 Geant4 Collaboration.
Copyright © 2012 Pearson Education, Inc. Chapter 13: Introduction to Classes.
Oracle Data Integrator Procedures, Advanced Workflows.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
Introduction to Geant4 User Interface J. Perl1 6 June 2005 Introduction to Geant4 User Interface Joseph Perl Stanford Linear Accelerator Center.
UI command Makoto Asai (SLAC) Geant4 Tutorial CERN May 25-27, 2005 May 2005, Geant4 v7.0p01.
Copyright © 2002 W. A. Tucker1 Chapter 10 Lecture Notes Bill Tucker Austin Community College COSC 1315.
CS-1030 Dr. Mark L. Hornick 1 Basic C++ State the difference between a function/class declaration and a function/class definition. Explain the purpose.
Methods Methods are how we implement actions – actions that objects can do, or actions that can be done to objects. In Alice, we have methods such as move,
Architecture team and Inter-category design/interface Makoto Asai (SLAC) 10/Oct/2002 Geant4 delta-review.
17-19 Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan 2007 Geant4 Collaboration.
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
Classes, Interfaces and Packages
FIT Objectives By the end of this lecture, students should: understand the role of constructors understand how non-default constructors are.
Recap Introduction to Inheritance Inheritance in C++ IS-A Relationship Polymorphism in Inheritance Classes in Inheritance Visibility Rules Constructor.
Defining Data Types in C++ Part 2: classes. Quick review of OOP Object: combination of: –data structures (describe object attributes) –functions (describe.
Classes in C++ By: Mr. Jacobs. Objectives  Explore the implications of permitting programmers to define their own data types and then present C++ mechanism.
Java Programming: Guided Learning with Early Objects Chapter 9 Inheritance and Polymorphism.
Motivation for Generic Programming in C++
Creating and Using Objects, Exceptions, Strings
Andy Wang Object Oriented Programming in C++ COP 3330
Classes (Part 1) Lecture 3
The full set of lecture notes of this Geant4 Course is available at
Delegates and Events 14: Delegates and Events
Object-Oriented Programming & Design Lecture 18 Martin van Bommel
User Interface
Makoto Asai (SLAC) Geant4 Tutorial Course
Makoto Asai (SLAC) Geant4 Tutorial Course
Makoto Asai (SLAC) Geant4 Users CERN Nov. 11th, 2002
Andy Wang Object Oriented Programming in C++ COP 3330
Makoto Asai (SLAC) Geant4 Tutorial Course
Makoto Asai (SLAC) Geant4 Tutorial Course
G4 Workshop 2002 Detector Description Parallel Session
Customizing Run Management
Primary particle Makoto Asai (SLAC Computing Services)
CS148 Introduction to Programming II
Introduction to Classes and Objects
Presentation transcript:

Makoto Asai (SLAC) Geant4 Users Workshop @ CERN Nov. 13th, 2002 More on User Commands Makoto Asai (SLAC) Geant4 Users Workshop @ CERN Nov. 13th, 2002

Contents User-defined command User-defined messenger String stream object G4ExceptionHandler More on User Commands - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/13/2002)

UI command and messenger (G)UI G4UImessenger messenger 2. apply 1. register 4. invoke 3. do it UImanager command Target class parameter More on User Commands - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/13/2002)

User command To define user commands, you need to make your own concrete messenger class implementation class G4ParticleGun; class G4UIcmdWithADoubleAndUnit; #include "G4UImessenger.hh" class G4ParticleGunMessenger: public G4UImessenger { public: G4ParticleGunMessenger(G4ParticleGun * fPtclGun); ~G4ParticleGunMessenger(); void SetNewValue(G4UIcommand * command,G4String newValues); G4String GetCurrentValue(G4UIcommand * command); private: G4ParticleGun * fParticleGun; G4UIcmdWithADoubleAndUnit * energyCmd; }; More on User Commands - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/13/2002)

Messenger class Constructor Instantiate command objects, set guidance, parameter information, etc., and register commands to UImanager. Destructor Delete commands (automatically unregistered). SetNewValue method Convert parameter string to values Invoke appropriate method of the target class object GetCurrentValue method Get current values from the target class object Convert them to string and return the string More on User Commands - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/13/2002)

Command classes G4UIcommand Base class, Still usable for complicated command G4UIdirectory Definition of (sub-)directory G4UIcmdWith3Vector, G4UIcmdWith3VectorAndUnit, G4UIcmdWithADouble, G4UIcmdWithADoubleAndUnit, G4UIcmdWithAString, G4UIcmdWithABool, G4UIcmdWithAnInteger, G4UIcmdWithoutParameter Each class has its adequate conversion methods between a string and values. Application state(s), for which a command is valid, can be set. More on User Commands - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/13/2002)

Parameter Each parameter must have its unique name (within a command) If a parameter is set as “omittable”, default value must be given, or “current value as default” flag must be set. Range(s) of parameter(s) can be given by C++ syntax. E.g. “x>=0. && y>= 0. && x > y” Candidate list is a string consists of candidates separated by spaces. directionCmd = new G4UIcmdWith3Vector("/gun/direction",this); directionCmd->Set_guidance("Set momentum direction."); directionCmd ->Set_guidance("Direction needs not to be a unit vector."); directionCmd->SetParameterName("Px","Py","Pz",true,true); directionCmd->SetRange("Px != 0 || Py != 0 || Pz != 0"); See section 7.2 of User's Guide For Application Developers for more detail and full example code. More on User Commands - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/13/2002)

String stream objects G4cout and G4cerr are objects of ostream and they have G4strstreambuf buffer objects. Strings are sent to G4UIsession concrete class for handling appropriate to a (G)UI. G4UIsession is the base class of all (G)UIs or interfaces to GUIs. This base class has methods ReceiveG4cout and ReceiveG4cerr to receive strings. To connect Geant4 to an external framework, the user must implement an interface concrete class derived from G4UIsession, so that the external framework can receive G4cout/G4cerr strings. More on User Commands - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/13/2002)

G4ExceptionHandler Geant4 provides G4VExceptionHandler base class, which is “notified” once G4Exception occurs. Geant4 provides G4ExceptionHandler concrete class for the “default” behavior of core dump. Once the user implements and instantiates his/her own concrete class, it automatically overwrites the default behavior. We are planning to enrich error messages and also to provide more flexible severities of exceptions. At least for exceptions which are most likely user oriented. More on User Commands - M.Asai (SLAC) - Geant4 Users Workshop @ CERN (Nov/13/2002)