23.05.2014 Views

Athena Developer Guide

Athena Developer Guide

Athena Developer Guide

SHOW MORE
SHOW LESS

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 />

from the data. A user can choose to set either behaviour at run time. The second property contains the<br />

location in the data where the stored navigational information is located. Currently it must be set via the<br />

jobOptions when necessary, as shown in Listing 14.9 for a particular implementation provided in the<br />

Associator example. Two corresponding methods are provided for using the information from these<br />

properties: followLinks() and whichTable().<br />

Inverse Association - Retrieving information in the direction opposite to that of the links in the data is<br />

in general a time consuming operation, that implies checking all the direct associations to access the<br />

inverse relation for a specified object. For this reason Associators should keep a local copy of the<br />

inverse associations after receiving the first request for an event. A few methods are provided to<br />

facilitate the work of Associators in this case. The methods inverseExist() and<br />

setInverseFlag(bool) help in keeping track of the status of the locally kept inverse<br />

information.The method buildInverse() has to be overridden by concrete associators since they<br />

choose in which form to keep the information and should be called by the associator when receiving the<br />

first request during the processing of an event.<br />

Locally kept information - When a new event is processed, the associator needs to reset its status to<br />

the same conditions as those after having been created . In order to be notified of such an incident<br />

happening the Associator base class implements the IListener interface and, in the constructor,<br />

registers itself with the Incident Service (see section 13.9 for details of the Incident Service). The<br />

associator’s flushCache() method is called in the implementation of the IListener interface in<br />

the Associator base class. This method must be overridden by concrete associators wanting to do a<br />

meaningful reset of their initial status.<br />

14.4.1.3 A concrete example<br />

In this section we look at an example implementation of a specific associator. The code is taken from<br />

the LHCb Associator example, but the points illustrated should be clear even without a knowledge<br />

of the LHCb data model.<br />

The AxPart2MCParticleAsct provides association between physics analysis particles<br />

(AxPartCandidate) and the corresponding Monte Carlo particles (MCParticle). The direct<br />

navigational information is stored in the persistent data as short-cuts, and is retrieved in the form of a<br />

SmartRefTable in the Transient Event Store. This choice is specific to<br />

AxPart2MCParticleAsct, any associator can use internally a different navigational mechanism.<br />

The location in the Event Store where the navigational information can be found is set in the job options<br />

via the “DataLocation” property, as shown in Listing 14.9.<br />

Listing 14.9 Example of setting properties for an associator via jobOptions<br />

ToolSvc.AxPart2MCParticleAsct.DataLocation = "/Event/Anal/AxPart2MCParticle";<br />

page 134<br />

In the current LHCb data model only a single MCParticle can be associated to one<br />

AxPartCandidate and vice-versa only one or no AxPartCandidate can be associated to one<br />

MCParticle. For this reason only the i_retrieveDirect and i_retrieveInverse<br />

methods providing one-to-one association are meaningful. Both methods verify that the objects passed<br />

are of the correct type before attempting to retrieve the information, as shown in Listing 14.10. When<br />

no association is found, a StatusCode::FAILURE is returned.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!