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 5 Writing algorithms Version/Issue: 2.0.0<br />

the Counter1 instance will report seeing 50% of the events, while the Counter2 instance will<br />

report seeing 10%.<br />

Note the same instance of the HelloWorld class appears in both sequences. It will be executed in<br />

Sequence1 if Prescaler1 passes the event. It will be executed in Sequence2 if Prescaler2<br />

passes the event only if Prescaler1 failed it.<br />

Listing 5.3a Example job options using Sequencers demonstrating filtering<br />

1: ApplicationMgr.DLLs += { "GaudiAlg" };<br />

2: ApplicationMgr.TopAlg = { "Sequencer/TopSequence" };<br />

3:<br />

4: // Setup the next level sequencers and their members<br />

5: TopSequence.Members = {"Sequencer/Sequence1", "Sequencer/Sequence2"};<br />

6: TopSequence.StopOverride = true;<br />

7: Sequence1.Members = {"Prescaler/Prescaler1", "HelloWorld",<br />

"EventCounter/Counter1"};<br />

8: Sequence2.Members = {"Prescaler/Prescaler2", "HelloWorld",<br />

"EventCounter/Counter2"};<br />

9:<br />

10: Prescaler1.PercentPass = 50.;<br />

11: Prescaler2.PercentPass = 10.;<br />

Listing 5.3b Example Python script using Sequencers demonstrating filtering<br />

1: theApp.DLLs = [ "GaudiAlg" ]<br />

2: theApp.TopAlg = [ "Sequencer/TopSequence" ]<br />

3: TopSequence = Algorithm( "TopSequence" )<br />

4:<br />

5: # Setup the next level sequencers and their members<br />

6: TopSequence.Members = [ "Sequencer/Sequence1", "Sequencer/Sequence2"]<br />

7: Sequence1 = Algorithm( "Sequence1" )<br />

8: Sequence2 = Algorithm( "Sequence2" )<br />

9: TopSequence.StopOverride = true<br />

10: Sequence1.Members = [ "Prescaler/Prescaler1", "HelloWorld",<br />

"EventCounter/Counter1" ]<br />

11: Prescaler1 = Algorithm( "Prescaler1" )<br />

12: Counter1 = Algorithm( "Counter1" )<br />

13: Sequence2.Members = [ "Prescaler/Prescaler2", "HelloWorld",<br />

"EventCounter/Counter2" ]<br />

14: Prescaler2 = Algorithm( "Prescaler2" )<br />

15: Counter2 = Algorithm( "Counter2" )<br />

16:<br />

17: Prescaler1.PercentPass = 50.<br />

18: Prescaler2.PercentPass = 10.<br />

page 32<br />

Sequence branching<br />

Listing 5.4a and Listing 5.4b illustrate the use of explicit branching. The BranchMembers property<br />

of the Sequencer specifies some algorithms to be executed if the algorithm that is the first member of<br />

the branch (which is common to both the main and branch membership lists) indicates a filter failure. In

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

Saved successfully!

Ooh no, something went wrong!