“Algorithm Tools” what they are, how to get them and how to use them

Slides:



Advertisements
Similar presentations
Python Objects and Classes
Advertisements

Inheritance Java permits you to use your user defined classes to create programs using inheritance.
15 March, 2000LHCb Computing1 Software Review Panel LHCb Answers to Architecture, Data Model and Program Infrastructure Pere Mato for the LHCb Collaboration.
Programming Paradigms Imperative programming Functional programming Logic programming Event-driven programming Object-oriented programming A programming.
Review of C++ Programming Part II Sheng-Fang Huang.
Framework for Online Alignment 4th LHCb Computing Workshop 6 November 2014 Beat Jost / Cern.
Object Based Programming. Summary Slide  Instantiating An Object  Encapsulation  Inheritance  Polymorphism –Overriding Methods –Overloading vs. Overriding.
Peter van Gemmeren (ANL): ANL Analysis Jamboree The ATLAS Data Model.
 2006 Pearson Education, Inc. All rights reserved Classes: A Deeper Look.
Chapter 9 Defining New Types. Objectives Explore the use of member functions when creating a struct. Introduce some of the concepts behind object-oriented.
The New TrigDecision Nicolas Berger, Till Eifert, Ricardo Gonçalo Physics Analysis Tools session ATLAS Software Workshop – Munich, March 2007.
CERN Tutorial, September Job Options and Printing.
Job Options and Printing 1 LHCb software tutorial - September 2011.
OOP IN PHP `Object Oriented Programming in any language is the use of objects to represent functional parts of an application and real life entities. For.
Event Data History David Adams BNL Atlas Software Week December 2001.
Introduction to Gaudi LHCb software tutorial - September
9 Associators How to relate objects to each other Create relations Save relations Use relations: Associators.
OOP: Encapsulation,Abstraction & Polymorphism. What is Encapsulation Described as a protective barrier that prevents the code and data being randomly.
Use of Gaudi in Reconstruction Weidong Li 23/06/2004.
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.
N ATIONAL E NERGY R ESEARCH S CIENTIFIC C OMPUTING C ENTER Charles Leggett Interval of Validity Service IOVSvc ATLAS Software Week May Architecture.
CPSC 252 The Big Three Page 1 The “Big Three” Every class that has data members pointing to dynamically allocated memory must implement these three methods:
CHEP /21/03 Detector Description Framework in LHCb Sébastien Ponce CERN.
SEEM Java – Basic Introduction, Classes and Objects.
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.
CERN Tutorial, February Introduction to Gaudi.
DaVinciAssociators How to relate physics objects to MC truth.
1 C# - Inheritance and Polymorphism. 2 1.Inheritance 2.Implementing Inheritance in C# 3.Constructor calls in Inheritance 4.Protected Access Modifier 5.The.
INFSO-RI Enabling Grids for E-sciencE Using of GANGA interface for Athena applications A. Zalite / PNPI.
Muon Persistency Persistent Analysis Objects Muon Persistency Norbert Neumeister µ-PRS meeting February 10, 2004.
Gaudi Framework Tutorial, Algorithm Tools: what they are and how to use them.
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.
Elements of LCG Architecture Application Architecture Blueprint RTAG 8 th June 2002 P. Mato / CERN.
N ATIONAL E NERGY R ESEARCH S CIENTIFIC C OMPUTING C ENTER Charles Leggett Transient Conditions/Detector Store using StoreGate ATLAS Software Workshop.
Memory Management.
Root I/O and the Gaudi Framework
Creating and Using Objects, Exceptions, Strings
OOP: Encapsulation &Abstraction
Andy Wang Object Oriented Programming in C++ COP 3330
University of Central Florida COP 3330 Object Oriented Programming
2.7 Inheritance Types of inheritance
Programming with ANSI C ++
GLAST Gaudi Review T. Burnett H.Kelly 10 Sept 02 Gaudi code review
Writing Physics Tools Schedule: Timing Topic 20 minutes Lecture
Singleton Pattern Command Pattern
Review: Two Programming Paradigms
Introduction to Gaudi LHCb software tutorial - December 2010.
Winter 2018 CMPE212 9/21/2018 CMPE212 – Stuff…
Lecture 23 Polymorphism Richard Gesick.
Introduction to Classes
Corresponds with Chapter 7
SW Architecture SG meeting 22 July 1999 P. Mato, CERN
Java Programming Language
Fall 2018 CISC124 12/3/2018 CISC124 or talk to your grader with questions about assignment grading. Fall 2018 CISC124 - Prof. McLeod Prof. Alan McLeod.
Classes and Objects.
Fundaments of Game Design
9-10 Classes: A Deeper Look.
2 Getting Started.
CIS 199 Final Review.
2 Getting Started.
CMPE212 – Reminders Quiz 1 marking done. Assignment 2 due next Friday.
The Calorimeter Detector Description
CMPE212 – Reminders Assignment 2 due next Friday.
9-10 Classes: A Deeper Look.
Classes and Objects Systems Programming.
Presentation transcript:

“Algorithm Tools” what they are, how to get them and how to use them G.Corti 5th Software Week 6 July 2000

Algorithms and Services Algorithms (and sub-Algorithms) are initialized and finalized by the framework are executed once per event ( sub-algorithms depending on the parent algorithm ) have the lifetime of a job request/store/share data in Transient Event Store Services are used by the algorithms to help perform their work are setup and initialized at the beginning of a job by the framework and used by many algorithms as often as necessary they do not have a “state” Software Week, 6 July 2000 G.Corti

Idea of Tools and ToolSvc Simpler algorithms? Sometimes in an Algorithm it is necessary to execute the same operation more than once per event, only for some events, on specific non identifiable data objects, producing new objects that will be put in the Event Store later Vertexing Track transport Association to truth Selection of particles based on a pID CL Some Algorithms want to do similar operations but with a slightly different configuration, some will use a “standard configuration” Idea of Tools and ToolSvc Software Week, 6 July 2000 G.Corti

“Requirements” An Algorithm requires a Tool on a per need base The ToolSvc checks if the requested type of Tool is available and returns an instance of the requested type after configuring it An Algorithm can have a private instance of a Tool that can be configured according to its need via JobOptions An Algorithm can use a Tool “as-it-is”, in this case the ToolSvc will provide a “common” Tool (shared-Tool) An Algorithm should be able to use a Sub-Tool without worrying about the implementation The ToolSvc keeps track of the Tools instantiated and if a tool exists it does not re-create it An Algorithm can tell the ToolSvc if it will not need a tool anymore The ToolSvc will decide which tools instances can be deleted (always done at finalization of the Service) Not only Algorithms would want to use Tools ( also Services … ) Software Week, 6 July 2000 G.Corti

Tools and ToolSvc diagram IToolSvc IService ToolSvc ToolFactory < T > AlgTool IProperty ConcreteTool1 ConcreteTool2 SubTool ISubTool IAlgTool ConcreteAlgorithm IToolFactory Software Week, 6 July 2000 G.Corti

IAlgTool The IAlgTool interface is implemented by the AlgTool base class name( ) std::string the identifying full name of an AlgTool instance concatenation of the parent name, a dot, and a tool dependent part ToolsAnalysisAlgorithm.ImpactPar tool dependent part automatically set to type or user specified type( ) the type (concrete class) of an AlgTool parent ( ) const IInterface* the parent of a concrete AlgTool can be an algorithm or a service Software Week, 6 July 2000 G.Corti

IToolSvc The IToolSvc interface is the specific interface implemented by the ToolSvc retrieveTool (const std::string& type, T*& tool, const IInterface* parent=0, bool createIf=true ) StatusCode retrieve specified tool sub-type with tool dependent part of the name automatically assigned type, is the AlgTool type tool, returned as type requested by the user parent, by default no parent createIf, flag requesting creation or not if not existing, by default created retrieveTool (const std::string& type, const std::string& name, T*& tool, const IInterface* parent=0, bool createIf=true ) as above but with tool dependent part of the name specified by the requester as name Software Week, 6 July 2000 G.Corti

Some remarks An AlgTool does not have an initialize/finalize method The AlgTool base class has an accessor to the ServiceLocator and to the MessageService the tool sets them at creation by getting them from the parent specific services can be retrieved by derived tools if necessary “Common Tool” or “Private Tool” Common tools “belong” to the ToolSvc (when parent is not specified) the full identifying name is for example ToolSvc.ImpactPar If a common tool is requested the first request will trigger its creation Private tool really belong to the parent but the parent does not need to keep them Software Week, 6 July 2000 G.Corti

...remarks (cont.) ToolSvc will “hold” a tool. At finalization it will clean up all the tools. Example of how to use tools and some concrete implementations of tools in GaudiExamples/ToolsAnalysis of next Gaudi release There could be GaudiTools, specific applications tools (ex. Physics analysis tools, user tools) Software Week, 6 July 2000 G.Corti

How to retrieve a tool Get the ToolSvc ( as any other service ) IToolSvc* toolsvc = 0; sc = serviceLocator()->getService( "ToolSvc", IID_IToolSvc, (IInterface*&)( toolsvc )); at the moment ToolSvc is an ExternalService need to request it in the JobOptions it is not available in the Algorithm service accessor methods Retrieve a tool ImpactPar* impPar sc = toolsvc->retrieveTool("ImpactPar", impPar, this ) if( sc.isFailure() ) { log << MSG::FATAL << ”Unable to create tool" << endreq; return sc; } the algorithm decides when and if to keep it or not Software Week, 6 July 2000 G.Corti

How to write a concrete tool Instantiate a static factory in the implementation file static ToolFactory<VertexSmearer> s_factory; const IToolFactory& VertexSmearerFactory = s_factory; Inherit from AlgTool base class Could have an additional level of inheritance with additional interfaces Declare in constructor specific properties and get services necessary to the implementation VertexSmearer::VertexSmearer(const std::string& type, const std::string& name, const IInterface* parent) : AlgTool( type, name, parent ) { m_randSvc = 0; if( serviceLocator() ) { StatusCode sc = serviceLocator()->getService( "RndmGenSvc", IID_IRndmGenSvc, (IInterface*&) (m_randSvc) ); } declareProperty("dxVtx", m_dxVtx = 9 * micrometer); Implement necessary functionality Software Week, 6 July 2000 G.Corti

Configure a tool via the jobOptions A concrete tool can be configured using the jobOptions Same convention as for everything else: IdentifyingNameOfTool.NameOfProperty AlgTool base class has the OutputLevel Property If not specified in the JobOptions the OutputLevel of the parent will be taken RecPrimaryVertex.VertexSmearer.OutputLevel = 3; RecPrimaryVertex.VertexSmearer.dxVtx = 0.009; RecPrimaryVertex.VertexSmearer.dyVtx = 0.009; RecPrimaryVertex.VertexSmearer.dzVtx = 0.038; Software Week, 6 July 2000 G.Corti

First version of the ToolSvc and AlgTool is available in GaudiSys v5 Concrete tools can be implemented and used More bookkeeping in the future Additional inheritance level with more interfaces for general tools to be developed Software Week, 6 July 2000 G.Corti