Athena Developer Guide
Athena Developer Guide
Athena Developer Guide
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Athena</strong> Chapter 14 Tools and ToolSvc Version/Issue: 2.0.0<br />
algorithm whereas the initialize() and finalize() methods are invoked automatically by the<br />
framework while initializing the parent algorithm. The properties of a sub-algorithm are automatically<br />
set by the framework but the parent algorithm can change them during execution. Sharing of data<br />
between nested algorithms is done via the Transient Event Store.<br />
Both Services and Algorithms are created during the initialization stage of a job and live until the jobs<br />
ends.<br />
Sometimes an encapsulated piece of code needs to be executed only for specific events, in which case it<br />
is desirable to create it only when necessary. On other occasions the same piece of code needs to be<br />
executed many times per event. Moreover it can be necessary to execute a sub-algorithm on specific<br />
contained objects that are selected by the parent algorithm or have the sub-algorithm produce new<br />
contained objects that may or may not be put in the Transient Store. Finally different algorithms may<br />
wish to configure the same piece of code slightly differently or share it as-is with other algorithms.<br />
To provide this kind of functionality we have introduced a category of processing objects that<br />
encapsulate these “light” algorithms. We have called this category Tools.<br />
Some examples of possible tools are single track fitters, association to Monte Carlo truth information,<br />
vertexing between particles, smearing of Monte Carlo quantities.<br />
14.2.1 “Private” and “Shared” Tools<br />
Algorithms can share instances of Tools with other Algorithms if the configuration of the tool<br />
is suitable. In some cases however an Algorithm will need to customize a tool in a specific way in<br />
order to use it. This is possible by requesting the ToolSvc to provide a “private” instance of a tool.<br />
If an Algorithm passes a pointer to itself when it asks the ToolSvc to provide it with a tool, it is<br />
declaring itself as the parent and a “private” instance is supplied. Private instances can be configured<br />
according to the needs of each particular Algorithm via jobOptions.<br />
As mentioned above many Algorithms can use a tool as-is, in which case only one instance of a<br />
Tool is created, configured and passed by the ToolSvc to the different algorithms. This is called a<br />
“shared” instance. The parent of “shared” tools is the ToolSvc.<br />
14.2.2 The Tool classes<br />
14.2.2.1 The AlgTool base class<br />
page 124<br />
The main responsibilities of the AlgTool base class (see Listing 14.1) are the identification of the<br />
tools instances, the initialisation of certain internal pointers when the tool is created and the<br />
management of the tools properties. The AlgTool base class also offers some facilities to help in the<br />
implementation of derived tools.