Job Options and Printing 1 LHCb software tutorial - September 2011.

Slides:



Advertisements
Similar presentations
Chapter 6 Server-side Programming: Java Servlets
Advertisements

Tutorial 12: Enhancing Excel with Visual Basic for Applications
Classes and Objects: Recap A typical Java program creates many objects which interact with one another by sending messages. Through the objects interactions,
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
1 Lab Session-XII CSIT121 Fall 2000 b Namespaces b Will This Program Compile ? b Master of Deceit b Lab Exercise 12-A b First Taste of Classes b Lab Exercise.
1 Lab Session-XIV CSIT121 Spring 2002 b Namespaces b First Class Travel b Lab Exercise 14 (Demo) b Lab Exercise b Practice Problem.
Classes and Objects  A typical Java program creates many objects which interact with one another by sending messages. Through the objects interactions,
Using the Visual Basic Editor Visual Basic for Applications 1.
Macros Tutorial Week 20. Objectives By the end of this tutorial you should understand how to: Create macros Assign macros to events Associate macros with.
Chapter 12: Advanced Topics: Exception Handling Visual Basic.NET Programming: From Problem Analysis to Program Design.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
ASP.NET Programming with C# and SQL Server First Edition
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
PRINCIPLES OF PROGRAMMING Revision. A Computer  A useful tool for solving a great variety of problems.  To make a computer do anything (i.e. solve.
Automation Testing- QTP Rajesh Charles Batch No: Date: jan
A First Program Using C#
CLEO’s User Centric Data Access System Christopher D. Jones Cornell University.
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Tutorial 11 Using and Writing Visual Basic for Applications Code
WEEK 3 AND 4 USING CLIENT-SIDE SCRIPTS TO ENHANCE WEB APPLICATIONS.
1 JavaScript. 2 What’s wrong with JavaScript? A very powerful language, yet –Often hated –Browser inconsistencies –Misunderstood –Developers find it painful.
Chapter 1: A First Program Using C#. Programming Computer program – A set of instructions that tells a computer what to do – Also called software Software.
Copyright © 2007, Oracle. All rights reserved. Managing Concurrent Requests.
CERN Tutorial, September Job Options and Printing.
Computer Programming 2 Lab(1) I.Fatimah Alzahrani.
Bookkeeping Tutorial. Bookkeeping & Monitoring Tutorial2 Bookkeeping content  Contains records of all “jobs” and all “files” that are created by production.
Practice and Evaluation. Practice Develop a java class called: SumCalculator.java which computes a sum of all integer from 1 to 100 and displays the result.
3. The Nuts and Bolts of C++ Computer Programming 3. The Nuts and Bolts of C++ 1 Learning the C++ language 3. The Nuts and Bolts of C++
Introduction to Exception Handling and Defensive Programming.
Variables and ConstantstMyn1 Variables and Constants PHP stands for: ”PHP: Hypertext Preprocessor”, and it is a server-side programming language. Special.
9 Associators How to relate objects to each other Create relations Save relations Use relations: Associators.
Particle to MC truth association Juan Palacios (Nikhef) LHCb software week June
OOP in Java : © W. Milner 2005 : Slide 1 Java and OOP Part 2 – Classes and objects.
Use of Gaudi in Reconstruction Weidong Li 23/06/2004.
Object Oriented Software Development
Gaudi Framework Tutorial, April Algorithm Tools: what they are, how to write them, how to use them.
Dual-use prototype for analysis tools David Adams BNL October 16, 2013 ASG tools working group.
Gaudi Framework Tutorial, April Job Options and Printing.
9-13/9/03 Atlas Overview WeekPeter Sherwood 1 Atlfast, Artemis and Atlantis What, Where and How.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
JSP BASICS AND ARCHITECTURE. Goals of JSP Simplify Creation of dynamic pages. Separate Dynamic and Static content.
Bookkeeping Tutorial. 2 Bookkeeping content  Contains records of all “jobs” and all “files” that are produced by production jobs  Job:  In fact technically.
Bologna Tutorial, April Job Options and Printing.
Tutorial: Examples (09may00 - ATLAS Software LBNL) May 2000 Prototype Framework Tutorial: Examples Paolo Calafiura, Charles Leggett HCG/NERSC/LBNL.
IS2802 Introduction to Multimedia Applications for Business Lecture 4: JavaScript, Loops, and Conditional Statements Rob Gleasure
Hands-On Microsoft Windows Server 2008 Chapter 5 Configuring Windows Server 2008 Printing.
Proposal for extension of GaudiAlgorithm and GaudiTool classes Vanya Belyaev CERN & ITEP/Moscow.
Gaudi Framework Tutorial, Algorithm Tools: what they are and how to use them.
“Hello World” In Java Mehdi Einali Advanced Programming in Java 1.
Netbeans QuickStart. Creating a project File->New Project –For now you want General->Java Application –Then fill in the project details.
9 Associators How to relate objects to each other Create relations Save relations Use relations: Associators.
Athena StoreGate Tutorial: May 30, Objectives Learn how to access data objects using StoreGate How to record/retrieve by TYPE Optionally using keys.
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
Gaudi Framework Tutorial, April Histograms And N-tuples.
C# Programming: From Problem Analysis to Program Design1 Creating Your Own Classes C# Programming: From Problem Analysis to Program Design 4th Edition.
ASP.NET Programming with C# and SQL Server First Edition
“Algorithm Tools” what they are, how to get them and how to use them
GLAST Gaudi Review T. Burnett H.Kelly 10 Sept 02 Gaudi code review
Testing and Debugging.
Writing Physics Tools Schedule: Timing Topic 20 minutes Lecture
Microsoft Access Illustrated
Tutorial 19 - Microwave Oven Application Building Your Own Classes and Objects Outline Test-Driving the Microwave Oven Application Designing.
CIS16 Application Development Programming with Visual Basic
Classes & Objects: Examples
2 Getting Started.
2 Getting Started.
2 Getting Started.
Presentation transcript:

Job Options and Printing 1 LHCb software tutorial - September 2011

Job Options LHCb software tutorial - September  All applications run the same main program (gaudirun.py)  Job options configure the job:  What to run, in what order, with what data, with which cuts  Provided by the user in a job options configuration file  Job options configuration file is written in python  Can use full power of python syntax  Type checking  Expressions, if-then-else, loops etc.  Early Validation of configuration  Job options file is passed to gaudirun.py as argument(s) gaudirun.py MyOpts.py [someMoreOpts.py]

Configurables LHCb software tutorial - September  Python classes, provided by the framework, used to set the job options of the C++ components  Each C++ component (Algorithm, Tool, Service) has a corresponding python Configurables  To set the properties of a component, must first instantiate the corresponding python Configurable Instance of the Python class Python variable holding the instance  Then use it to set the properties of the C++ component from Configurables import MyFirstAlgorithm myAlg = MyFirstAlgorithm() myAlg.OutputLevel = DEBUG

Running the C++ algorithms LHCb software tutorial - September  Merely instantiating the python configurable does not instantiate the corresponding C++ component  Some special configurables have properties that define sequences of algorithms to be executed  Python instances must be added to these sequences  Execute an instance of the C++ MyFirstAlgorithm, as configured on the previous slide, in the TopAlg sequence of the ApplicationMgr  Execute an instance of the C++ MyFirstAlgorithm, as configured on the previous slide, in the UserAlgorithms sequence of DaVinci ApplicationMgr().TopAlg += [ myAlg ] DaVinci().UserAlgorithms += [ myAlg ]

Named algorithms LHCb software tutorial - September  By default, instance of an algorithm has the same name as the C++ class (and python configurable class)  e.g. “MyFirstAlgorithm”  To run several instances of the same algorithm, give it an an explicit name  Execute two instances of MyFirstAlgorithm, with different values for the MassWindow property; execute “Fred” before “George”  N.B. MassWindow must have been declared as a property in the C++ code myFred = MyFirstAlgorithm( name = “Fred” ) myGeorge = MyFirstAlgorithm( name = “George” ) myFred.MassWindow = 3. * GeV myGeorge.MassWindow = * MeV ApplicationMgr().TopAlg += [ myFred, myGeorge ] myFred = MyFirstAlgorithm( name = “Fred” ) myGeorge = MyFirstAlgorithm( name = “George” ) myFred.MassWindow = 3. * GeV myGeorge.MassWindow = * MeV ApplicationMgr().TopAlg += [ myFred, myGeorge ]

Named Tools LHCb software tutorial - September  Tools always have a name, defined in the C++ code. They are created by a named instance of a C++ component (Algorithm, Tool, Service)  In his case an algorithm of type MyFirstAlgorithm creates a tool of type Knife, with interface ICutlery, called “MeatKnife”  Use the same names in python configuration: MyFirstAlgorithm::initialise() { ICutlery* theTool = tool (“Knife”, “MeatKnife”); MyFirstAlgorithm::initialise() { ICutlery* theTool = tool (“Knife”, “MeatKnife”); theCook = MyFirstAlgorithm( name = “Cook” ) # Create a configurable for a tool named “MeatKnife”, of # type Knife, and associate it to the theCook configurable theCook.addTool( Knife, name =“MeatKnife” ) # Now set a property of the tool theCook.MeatKnife.OutputLevel = DEBUG theCook = MyFirstAlgorithm( name = “Cook” ) # Create a configurable for a tool named “MeatKnife”, of # type Knife, and associate it to the theCook configurable theCook.addTool( Knife, name =“MeatKnife” ) # Now set a property of the tool theCook.MeatKnife.OutputLevel = DEBUG

Declaring properties in the C++ code LHCb software tutorial - September  Add a member variable to hold the property  Declare as a property in the constructor and initialize it with a default value class MyFirstAlgorithm : public GaudiAlgorithm { private: double m_jPsiMassWin; ///< J/Psi mass window cut... }; MyFirstAlgorithm::MyFirstAlgorithm( ) { declareProperty( “MassWindow", ///< Property name used in job options file m_jPsiMassWin = 0.5*Gaudi::Units::GeV, ///< Variable initialized to default “The J/Psi mass window cut” ); ///< Documentation string for Python } MyFirstAlgorithm::MyFirstAlgorithm( ) { declareProperty( “MassWindow", ///< Property name used in job options file m_jPsiMassWin = 0.5*Gaudi::Units::GeV, ///< Variable initialized to default “The J/Psi mass window cut” ); ///< Documentation string for Python } Aside: all member data must always be initialised in the constructor LHCb coding convention for member datadoxygen documentation string

Printing LHCb software tutorial - September  Why not use std::cout, std::cerr,... ?  Yes, it prints, but  Do you always want to print to the log file?  How can you connect std::cout to the message window of an event display?  How can you add a timestamp to the messages?  You may want to switch on/off printing at several levels just for one given algorithm, service etc.

Printing - MsgStream LHCb software tutorial - September  Using the MsgStream class  Usable like std::cout  Allows for different levels of printing  MSG::VERBOSE(=1)  MSG::DEBUG(=2)  MSG::INFO(=3)  MSG::WARNING(=4)  MSG::ERROR(=5)  MSG::FATAL(=6)  MSG::ALWAYS(=7)  Record oriented  Allows to define severity level per object instance

MsgStream - Usage LHCb software tutorial - September  Send to predefined message stream  Print error and return bad status  String formatting  Set print level in options Print everything of INFO level or higher info() << "PDG particle ID of " << m_partName << " is " << m_partID << endmsg; err() << "Cannot retrieve properties for particle " << m_partName << endmsg; return Error(“Cannot retrieve particle properties”); debug() << format("E: %8.3f GeV", energy ) << endmsg; MessageSvc().OutputLevel = ERROR MySvc().OutputLevel = WARNING MyAlgorithm().OutputLevel = INFO

Units LHCb software tutorial - September  We use Geant4/CLHEP system of units  mm, MeV, ns are defined to have value 1.  All other units defined relative to this  In header file “GaudiKernel/SystemOfUnits.h”  In namespace Gaudi::Units  Multiply by units to set value:  Divide by units to print value:  Units can be used also in job options: double m_jPsiMassWin = 0.5 * Gaudi::Units::GeV; import GaudiKernel.SystemOfUnits as Units SomeAlgorithm().MassWindow = 0.3 * Units.GeV import GaudiKernel.SystemOfUnits as Units SomeAlgorithm().MassWindow = 0.3 * Units.GeV info() << “Mass window: ” << m_jPsiMassWin / Gaudi::Units::MeV << “ MeV” << endmsg; info() << “Mass window: ” << m_jPsiMassWin / Gaudi::Units::MeV << “ MeV” << endmsg;

StatusCode LHCb software tutorial - September  Object returned by many methods  Including GaudiAlgorithm::initialize(), GaudiAlgorithm::execute(), etc.  Currently, takes two values:  StatusCode::SUCCESS, StatusCode::FAILURE  Should always be tested  If function returns StatusCode, there must be a reason  Report failures:  If IAlgorithm methods return StatusCode::FAILURE, processing stops  Always return StatusCode::SUCCESS from these methods StatusCode sc = someFunctionCall(); if ( sc.isFailure() ) { Warning(“there is a problem”,sc,0).ignore();} }

Exercise LHCb software tutorial - September  Now read the web page attached to this lesson in the agenda and work through the exercise