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 12 N-tuple and Event Collection facilities Version/Issue: 2.0.0<br />
the series (and the event not selected for the collection) if one of the algorithms in the sequence fails to<br />
pass a filter.<br />
12.3.1.1 Defining the Address Tag<br />
The event data is accessed using a special n-tuple tag of the type<br />
NTuple::Item m_evtAddress<br />
It is defined in the algorithm’s header file in addition to any other ordinary n-tuple tags, as described in<br />
section 12.2.2.1. When booking the n-tuple, the address tag must be declared like any other tag, as<br />
shown in Listing 12.1. It is recommended to use the name "Address" for this tag.<br />
Listing 12.1 Connecting an address tag to an n-tuple.<br />
1: NTuplePtr nt(ntupleSvc(), "/NTUPLES/EvtColl/Collection");<br />
1: ... Book N-tuple<br />
2: // Add an event address column<br />
3: StatusCode status = nt->addItem ("Address", m_evtAddress);<br />
The usage of this tag is identical to any other tag except that it only accepts variables of type<br />
IOpaqueAddress - the information necessary to retrieve the event data.<br />
12.3.1.2 Filling the Event Collection<br />
At fill time the address of the event must be supplied to the Address item. Otherwise the n-tuple may<br />
be written, but the information to retrieve the corresponding event data later will be lost. Listing 12.2<br />
also demonstrates the setting of a filter to steer whether the event is written out to the event collection.<br />
Listing 12.2 Fill the address tag of an n-tuple at execution time:<br />
1: SmartDataPtr evt(eventSvc(),"/Event");<br />
2: if ( evt ) {<br />
3: ... Some data analysis deciding whether to keep the event or not<br />
4: // keep_event=true if event should be written to event collection<br />
5: setFilterPassed( keep_event );<br />
6: m_evtAddrColl = evt->address();<br />
7: }<br />
12.3.1.3 Writing out the Event Collection<br />
page 90<br />
The event collection is written out by an EvtCollectionStream, which is the last member of the<br />
event collection Sequencer. Listing 12.3 (which is taken from the job options of EvtCollection<br />
example), shows how to set up such a sequence consisting of a user written Selector algorithm<br />
(which could for example contain the code in Listing 12.2), and of the EvtCollectionStream.