Gaudi Framework Tutorial, April 2006 3 Job Options and Printing.

Slides:



Advertisements
Similar presentations
Core Java Lecture 4-5. What We Will Cover Today What Are Methods Scope and Life Time of Variables Command Line Arguments Use of static keyword in Java.
Advertisements

INHERITANCE BASICS Reusability is achieved by INHERITANCE
Chapter 7 User-Defined Methods. Chapter Objectives  Understand how methods are used in Java programming  Learn about standard (predefined) methods and.
 2005 Pearson Education, Inc. All rights reserved Introduction.
Gaudi Framework Tutorial, April Accessing Event Data.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
Road Map Introduction to object oriented programming. Classes
Job Options file (HelloWorldOptions.py) Application Configuration options # Full job is a list of algorithms from AthenaCommon.AlgSequence import AlgSequence.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
C# Programming: From Problem Analysis to Program Design1 Creating Your Own Classes C# Programming: From Problem Analysis to Program Design 3rd Edition.
Introducing JavaBeans Lesson 2A / Slide 1 of 30 JDBC and JavaBeans Pre-assessment Questions 1.Which of the given symbols is used as a placeholder for PreparedStatement.
Review of C++ Programming Part II Sheng-Fang Huang.
MIT AITI 2003 Lecture 7 Class and Object - Part I.
Differences between C# and C++ Dr. Catherine Stringfellow Dr. Stewart Carpenter.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Chapter 6 Understanding the Structure of an Application: Procedures, Modules, and Classes.
Chapter 9 Defining New Types. Objectives Explore the use of member functions when creating a struct. Introduce some of the concepts behind object-oriented.
Copyright © 2007, Oracle. All rights reserved. Managing Concurrent Requests.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
Athena and HEC Test Beam Reconstruction Tutorial October 12, 2001 CERN N. Kanaya, M. Marino, S. Rajagopalan, M. Wielers.
CERN Tutorial, September Job Options and Printing.
Job Options and Printing 1 LHCb software tutorial - September 2011.
Defining New Types Lecture 21 Hartmut Kaiser
CIS-165 C++ Programming I CIS-165 C++ Programming I Bergen Community College Prof. Faisal Aljamal.
1 Chapter 8 – Classes and Object: A Deeper Look Outline 1 Introduction 2 Implementing a Time Abstract Data Type with a Class 3 Class Scope 4 Controlling.
Introduction to the HARP Software reconstructed drift chamber triplets (MC data)
9 Associators How to relate objects to each other Create relations Save relations Use relations: Associators.
Use of Gaudi in Reconstruction Weidong Li 23/06/2004.
Introduction to Java Lecture Notes 3. Variables l A variable is a name for a location in memory used to hold a value. In Java data declaration is identical.
Applications Development
Gaudi Framework Tutorial, April Algorithm Tools: what they are, how to write them, how to use them.
Chapter 10 Defining Classes. The Internal Structure of Classes and Objects Object – collection of data and operations, in which the data can be accessed.
1 Chapter 2 C++ Syntax and Semantics, and the Program Development Process.
M.Frank LHCb/CERN Random Numbers in GAUDI ã Requirements ã Interface ã Usage.
Static. 2 Objectives Introduce static keyword –examine syntax –describe common uses.
Chapter 7: Class Inheritance F Superclasses and Subclasses F Keywords: super and this F Overriding methods F The Object Class F Modifiers: protected, final.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
Bookkeeping Tutorial. 2 Bookkeeping content  Contains records of all “jobs” and all “files” that are produced by production jobs  Job:  In fact technically.
More About Data Types & Functions. General Program Structure #include statements for I/O, etc. #include's for class headers – function prototype statements.
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.
 2005 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
Classes, Interfaces and Packages
DaVinciAssociators How to relate physics objects to MC truth.
OOP Basics Classes & Methods (c) IDMS/SQL News
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.
Copyright 2006 Pearson Addison-Wesley, 2008, 2012 Joey Paquet 1 Concordia University Department of Computer Science and Software Engineering SOEN6441 –
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.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 10 Java Fundamentals Objects/ClassesMethods.
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.
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
Chapter 5 Introduction to Defining Classes Fundamentals of Java.
Chapter 1.2 Introduction to C++ Programming
Creating Your Own Classes
“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
Writing Physics Tools Schedule: Timing Topic 20 minutes Lecture
Classes & Objects: Examples
Exploring the Power of EPDM Tasks - Working with and Developing Tasks in EPDM By: Marc Young XLM Solutions
Introduction to Data Structure
Programming Language C Language.
2 Getting Started.
2 Getting Started.
Classes and Objects Systems Programming.
Accessing Event Data Schedule: Timing Topic 20 minutes Lecture
Presentation transcript:

Gaudi Framework Tutorial, April Job Options and Printing

3-2 Gaudi Framework Tutorial, April 2006 Objectives After completing this lesson, you should be able to: Know how to implement job options in an algorithm. Know basic job options. Know how to print. After completing this lesson, you should be able to: Know how to implement job options in an algorithm. Know basic job options. Know how to print.

3-3 Gaudi Framework Tutorial, April 2006 Job Options Job is steered by “cards” fileJob is steered by “cards” file Options are not directly accessedOptions are not directly accessed Access through IJobOptionsSvc interfaceAccess through IJobOptionsSvc interface – Details hidden from users by the framework Job is steered by “cards” fileJob is steered by “cards” file Options are not directly accessedOptions are not directly accessed Access through IJobOptionsSvc interfaceAccess through IJobOptionsSvc interface – Details hidden from users by the framework

3-4 Gaudi Framework Tutorial, April 2006 Job Options: Data Types Primitives – bool, char, short, int, long, long long, float, double, std::string –And unsigned char, short, int, long, long long Arrays of primitives – std::vector, std::vector...Primitives – bool, char, short, int, long, long long, float, double, std::string –And unsigned char, short, int, long, long long Arrays of primitives – std::vector, std::vector...

3-5 Gaudi Framework Tutorial, April 2006 Declare the property in the Constructor, and initialize it with a default value DecayTreeAlgorithm:: DecayTreeAlgorithm( ) { declareProperty( Declare the property in the Constructor, and initialize it with a default value DecayTreeAlgorithm:: DecayTreeAlgorithm( ) { declareProperty( "DecayParticle", m_partName = "B0"); } Declare property variable as data member class DecayTreeAlgorithm : public GaudiAlgorithm { private: std::string m_partName;... }; Using Job Options LHCb convention

3-6 Gaudi Framework Tutorial, April 2006 Set options in job options file – File path is first argument of executable../$CMTDEB/Main.exe../options/jobOptions.opts – C++ like syntax – Example B0_Decays.DecayParticle = “B0”; D0_Decays.DecayParticle = “D0”; Set options in job options file – File path is first argument of executable../$CMTDEB/Main.exe../options/jobOptions.opts – C++ like syntax – Example B0_Decays.DecayParticle = “B0”; D0_Decays.DecayParticle = “D0”; – Object name (Instance not class) Set Job Options – Property name – Property value

3-7 Gaudi Framework Tutorial, April 2006 Job Options: Conventions Many algorithms need many options – Options go along with code –New code release may need different options –Must be configurable with cmt – Need for conventions Many algorithms need many options – Options go along with code –New code release may need different options –Must be configurable with cmt – Need for conventions

3-8 Gaudi Framework Tutorial, April 2006 ApplicationMgr.DLLs += { “STAlgorithms" }; ApplicationMgr.TopAlg += { "MCSTDepositCreator/MCITDepositCreator" }; #include "$STALGORITHMSROOT/options/itDigi.opts“ ApplicationMgr.DLLs += { “STAlgorithms" }; ApplicationMgr.TopAlg += { "MCSTDepositCreator/MCITDepositCreator" }; #include "$STALGORITHMSROOT/options/itDigi.opts“ LHCb conventions LHCb applications organize sequencing of algorithms, then take specific options from corresponding algorithms package MCITDepositCreator.tofVector = {25.9, 28.3, 30.5}; ToolSvc.STSignalToNoiseToolIT.conversionToADC = ; MCITDepositCreator.tofVector = {25.9, 28.3, 30.5}; ToolSvc.STSignalToNoiseToolIT.conversionToADC = ; Default values for the options should be hard-coded. Included options files modify these defaults.

3-9 Gaudi Framework Tutorial, April 2006 ApplicationMgr.EvtMax ApplicationMgr.DLLs ApplicationMgr.TopAlg ApplicationMgr.EvtMax ApplicationMgr.DLLs ApplicationMgr.TopAlg Job Options You Must Know Maximal number of events to execute Component libraries to be loaded Top level algorithms: “Type/Name” “DecayTreeAlgorithm/B0_Decays” This also defines the execution schedule

3-10 Gaudi Framework Tutorial, April 2006 Job options printout Contents of job options files is printed out when Gaudi starts. - Control printing during processing: Contents of job options files is printed out when Gaudi starts. - Control printing during processing: #pragma print off // Do not print options defined after this #pragma print on // Switch back on #printOptions - Print a single sorted list of all modified options:

3-11 Gaudi Framework Tutorial, April 2006 Printing 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? – You may want to switch on/off printing at several levels just for one given algorithm, service etc. 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? – You may want to switch on/off printing at several levels just for one given algorithm, service etc.

3-12 Gaudi Framework Tutorial, April 2006 Printing - MsgStream Using the MsgStream class 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 Using the MsgStream class 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

3-13 Gaudi Framework Tutorial, April 2006 MsgStream - Usage Print error and return bad status return Error("Cannot retrieve particle properties"); Print error and return bad status return Error("Cannot retrieve particle properties"); Set printlevel in job options MessageSvc.OutputLevel = 5; // MSG::ERROR MySvc.OutputLevel = 4; // MSG::WARNING MyAlgorithm.OutputLevel = 3; // MSG::INFO Set printlevel in job options MessageSvc.OutputLevel = 5; // MSG::ERROR MySvc.OutputLevel = 4; // MSG::WARNING MyAlgorithm.OutputLevel = 3; // MSG::INFO Send to predefined message stream info() << "PDG particle ID of " << m_partName << " is " << m_partID << endmsg; err() << "Cannot retrieve properties for particle " << m_partName << endmsg; Send to predefined message stream info() << "PDG particle ID of " << m_partName << " is " << m_partID << endmsg; err() << "Cannot retrieve properties for particle " << m_partName << endmsg; Formatting with format( “string”, vars ) debug() << format("E: %8.3f GeV", energy ) << endmsg;

3-14 Gaudi Framework Tutorial, April 2006 Hands On: DecayTreeAlgorithm Introduce a property – std::string called “DecayParticle” – long called “DecayDepth” Print value in DecayTreeAlgorithm using – accessors to MsgStream class – several severity levels Add algorithm instance to top alg list – Name: B0_Decays Introduce a property – std::string called “DecayParticle” – long called “DecayDepth” Print value in DecayTreeAlgorithm using – accessors to MsgStream class – several severity levels Add algorithm instance to top alg list – Name: B0_Decays

3-15 Gaudi Framework Tutorial, April 2006 Hands On: If you have time left... Extend for printout of D 0 decays Re-use the existing implementation Re-use the existing implementation Play with printing directives: #pragma print off #pragma print on #printOptions Extend for printout of D 0 decays Re-use the existing implementation Re-use the existing implementation Play with printing directives: #pragma print off #pragma print on #printOptions

3-16 Gaudi Framework Tutorial, April 2006 Hands On: DecayTreeAlgorithm.h class DecayTreeAlgorithm : public GaudiAlgorithm { private: /// Name of the particle to be analysed std::string m_partName; /// Integer property to set the depth of printout long m_depth;... }; class DecayTreeAlgorithm : public GaudiAlgorithm { private: /// Name of the particle to be analysed std::string m_partName; /// Integer property to set the depth of printout long m_depth;... };

3-17 Gaudi Framework Tutorial, April 2006 Hands On: DecayTreeAlgorithm.cpp StatusCode DecayTreeAlgorithm::initialize(){ debug() << “Decay Particle:” << m_partName << “Number of daughter generations in printout:” << m_depth << endmsg; } DecayTreeAlgorithm::DecayTreeAlgorithm( const std::string& name, ISvcLocator* pSvcLocator) :GaudiAlgorithm(name, pSvcLocator) { declareProperty( "DecayParticle",m_partName = "B0” ); declareProperty( "DecayDepth",m_depth = 2 ); }

3-18 Gaudi Framework Tutorial, April 2006 Hands On: B0DecayTree.opts // Add B0 decay algorithm to list of top level algorithms ApplicationMgr.TopAlg += {"DecayTreeAlgorithm/B0_Decays"}; // Setup of B0 decay algorithm B0_Decays.DecayParticle = "B0"; B0_Decays.DecayDepth = 3; // Add B0 decay algorithm to list of top level algorithms ApplicationMgr.TopAlg += {"DecayTreeAlgorithm/B0_Decays"}; // Setup of B0 decay algorithm B0_Decays.DecayParticle = "B0"; B0_Decays.DecayDepth = 3;

3-19 Gaudi Framework Tutorial, April 2006 Hands On: add D0 decays // Add B0 decay algorithm to list of top level algorithms ApplicationMgr.TopAlg += {"DecayTreeAlgorithm/B0_Decays"}; // Setup of B0 decay algorithm B0_Decays.DecayParticle = "B0"; B0_Decays.DecayDepth = 3; // Add B0 decay algorithm to list of top level algorithms ApplicationMgr.TopAlg += {"DecayTreeAlgorithm/B0_Decays"}; // Setup of B0 decay algorithm B0_Decays.DecayParticle = "B0"; B0_Decays.DecayDepth = 3; // Add D0 decay algorithm to list of top level algorithms ApplicationMgr.TopAlg += {"DecayTreeAlgorithm/D0_Decays"}; // Setup of D0 decay algorithm D0_Decays.DecayParticle = “D0"; // Add D0 decay algorithm to list of top level algorithms ApplicationMgr.TopAlg += {"DecayTreeAlgorithm/D0_Decays"}; // Setup of D0 decay algorithm D0_Decays.DecayParticle = “D0";