5 Algorithm Tools Overview Gaudi Framework Tutorial 2001

  • Slides: 19
Download presentation
5 Algorithm Tools: Overview Gaudi Framework Tutorial, 2001

5 Algorithm Tools: Overview Gaudi Framework Tutorial, 2001

Lesson Goals Introduce the concept of Algorithm Tool • Separation of roles: Algorithm &

Lesson Goals Introduce the concept of Algorithm Tool • Separation of roles: Algorithm & Data • Understanding the differences between Services, Algorithms and Tools Design Issues • Use cases • Some examples 1 -2 Gaudi Framework Tutorial, 2001

Algorithms Data T 1 Data T 2, T 3 Transient Event Data Store Algorithm

Algorithms Data T 1 Data T 2, T 3 Transient Event Data Store Algorithm A Data T 2 Algorithm B Data T 4 Data T 3, T 4 Data T 5 Algorithm C Data T 5 1 -3 Gaudi Framework Tutorial, 2001 Apparent dataflow Real dataflow

Algorithm Interface IAlgorithm • initialize() • execute() Algorithm • finalize() IProperty Concrete Algorithm 1

Algorithm Interface IAlgorithm • initialize() • execute() Algorithm • finalize() IProperty Concrete Algorithm 1 -4 • set. Property() • get. Property() Gaudi Framework Tutorial, 2001

Algorithm Scheduling Simple and explicit scheduling • List of Algorithms – Primarily given by

Algorithm Scheduling Simple and explicit scheduling • List of Algorithms – Primarily given by the property Application. Mgr. top. Algorithms are executed only once per event • Several instances of the same algorithm class are possible 1 -5 Gaudi Framework Tutorial, 2001

Algorithm Hierarchies An Algorithm can have Sub-Algorithms • Parent Algorithm is responsible for Main

Algorithm Hierarchies An Algorithm can have Sub-Algorithms • Parent Algorithm is responsible for Main Algorithm – Creation – Execution • Framework does initialization and finalization 1 -6 Gaudi Framework Tutorial, 2001 Sub Algorithm 2

Sequences of Algorithms • Avoid re-calling same algorithm on same event • Different instances

Sequences of Algorithms • Avoid re-calling same algorithm on same event • Different instances of the same algorithm possible Event filtering • Avoid passing all the events through all the processing chain 1 -7 Gaudi Framework Tutorial, 2001 Event Input/Output Algorithm Filter Decision Single Instances

Algorithm life-cycle Algorithms are created by a factory static const Alg. Factory<Hello. World> Factory;

Algorithm life-cycle Algorithms are created by a factory static const Alg. Factory<Hello. World> Factory; const IAlg. Factory& Hello. World. Factory = Factory; Run-type configuration • List of algorithms and their properties Application. Mgr. top. Alg = {‘Hello. World’}; Hello. World. Output. Level = 4; 1 -8 Gaudi Framework Tutorial, 2001

Services Are used by Algorithms to help them to perform their work Are setup

Services Are used by Algorithms to help them to 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” 1 -9 Gaudi Framework Tutorial, 2001

The Problem Sometimes in an Algorithm it is necessary to execute the same operation

The Problem 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 Needed to introduce a new concept 1 -10 Gaudi Framework Tutorial, 2001

Algorithm Tools The concept of Algorithms Tools, being a sort of simple algorithms callable

Algorithm Tools The concept of Algorithms Tools, being a sort of simple algorithms callable many times and with arguments, was introduced in Gaudi • Examples – Vertexing – Track transport – Association to truth – Selection of particles based on a p. ID CL 1 -11 Gaudi Framework Tutorial, 2001

Requirements § An Algorithm requires a Tool on a per need base § The

Requirements § An Algorithm requires a Tool on a per need base § The Tool. Svc 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 Job. Options § An Algorithm can use a Tool “as-it-is”, in this case the Tool. Svc will provide a “common” Tool (shared-Tool) § An Algorithm should be able to use a Tool without worrying about the implementation § The Tool. Svc keeps track of the Tools instantiated and if a tool exists it does not re-create it § An Algorithm can tell the Tool. Svc if it will not need a tool anymore § The Tool. Svc 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 … ) 1 -12 Gaudi Framework Tutorial, 2001

Tool. Svc The Tool. Svc is the service that manages Algorithm Tools (private or

Tool. Svc The Tool. Svc is the service that manages Algorithm Tools (private or shared) • Algorithms ask the Tool. Svc for a give Tool by name • Manages the life-cycle of Tools • Keeps track of existing Tools can be configured using the Job. Options as Algorithms or Services 1 -13 Gaudi Framework Tutorial, 2001

Design IService ITool. Svc IAlg. Tool IProperty Alg. Tool. Svc ITool. Factory <T> Concrete

Design IService ITool. Svc IAlg. Tool IProperty Alg. Tool. Svc ITool. Factory <T> Concrete Algorithm ISub. Tool Concrete Tool 1 Concrete Tool 2 Sub. Tool 1 -14 Gaudi Framework Tutorial, 2001

Tools Interfaces ITool. Svc • retrieve. Tool(type, name, tool, parent, create. If) • retrieve.

Tools Interfaces ITool. Svc • retrieve. Tool(type, name, tool, parent, create. If) • retrieve. Tool(type, tool, parent, create. If) Tool. Svc IAlg. Tool • name(), type(), parent() Your. Tool IYour. Tool 1 -15 • Interface for your tool Gaudi Framework Tutorial, 2001

Alg. Tools life-cycle Alg. Tools are created by a factory static const Tool. Factory<Vertex.

Alg. Tools life-cycle Alg. Tools are created by a factory static const Tool. Factory<Vertex. Smearer> Factory; const IAlg. Factory& Vertex. Smearer. Factory = Factory; Run-type configuration • Convention to name Alg. Tools Rec. Primary. Vertex. Smearer. Output. Level = 3; Rec. Primary. Vertex. Smearer. dx. Vtx = 0. 009; Rec. Primary. Vertex. Smearer. dy. Vtx = 0. 009; Rec. Primary. Vertex. Smearer. dz. Vtx = 0. 038; 1 -16 Gaudi Framework Tutorial, 2001

Algorithm Tools Types Tool Taxonomy • Similar tools could implement the same interface •

Algorithm Tools Types Tool Taxonomy • Similar tools could implement the same interface • Different implementations This could offer a way to evolve and improve Tools 1 -17 Gaudi Framework Tutorial, 2001

Example: Associator One possible tool category is an Associator for relating reconstruction objects to

Example: Associator One possible tool category is an Associator for relating reconstruction objects to the “MC” information • The interface can be very generic – Input: Contained. Object – Output: list of Contained. Object • The actual navigation in the Event Model and association criteria could be very specific 1 -18 Gaudi Framework Tutorial, 2001

Summary Alg. Tools have been introduced to overcome some limitations of Algorithms and with

Summary Alg. Tools have been introduced to overcome some limitations of Algorithms and with the desire of re-use Very similar to Algorithms for configuration and life-cycle Lesson 6: Algorithm Tools in Practice 1 -19 Gaudi Framework Tutorial, 2001