23.05.2014 Views

Athena Developer Guide

Athena Developer Guide

Athena Developer Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Athena</strong> Chapter 14 Tools and ToolSvc Version/Issue: 2.0.0<br />

Listing 14.11 Extracted code from the AsctExampleAlgorithm<br />

1: #include "GaudiTools/IAssociator.h"<br />

2: // Example of retrieving an associator<br />

3: IAssociator<br />

4: StatusCode sc = toolsvc->retrieveTool("AxPart2MCParticleAsct", m_pAsct);<br />

5: if( sc.isFailure() ) {<br />

6: log retrieveInverse( *itm, mptry );<br />

15: if( sc.isSuccess() ) {...}<br />

16: else {...}<br />

17: }<br />

18: // Example of retrieving direct one-to-many information from an<br />

19: // associator<br />

20: SmartDataPtr candidates(evt,<br />

"/Anal/AxPartCandidates");<br />

21: std::vector pptry;<br />

22: AxPartCandidate* itP = *(candidates->begin());<br />

23: StatusCode sa =<br />

m_pAsct->retrieveDirect(itP, pptry, MCParticle::classID());<br />

24: if( sa.isFailure() ) {...}<br />

25: else {<br />

26: for (std::vector::iterator it = pptry.begin();<br />

pptry.end() != it; it++ ) {<br />

27: MCParticle* imc = dynamic_cast( *it );<br />

28: }<br />

29: }<br />

page 136

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

Saved successfully!

Ooh no, something went wrong!