14 *******************************************************************************
16 * Simple example which illustrate the usage of useful *
17 * algorithm base class for writing of EventTag Collections *
19 *******************************************************************************
21 from __future__
import print_function
23 __author__ =
'Vanya BELYAEV ibelyaev@physics.syr.edu'
29 Rndm = GaudiPython.gbl.Rndm
31 SUCCESS = GaudiPython.SUCCESS
41 """ Simple algorithm which implicitely book&Fill Event Tag collection"""
45 TupleAlgo.__init__(self, name)
50 """ The major method 'execute', it is invoked for each event """
65 address = self.get(
'/Event')
66 address = address.registry().address()
69 tup = self.evtCol(
'COL1',
'My trivial N-tuple')
71 tup.column(
'Address', address)
73 tup.column(
'evtNum', self.
s_nEvt)
74 tup.column(
'runNum', self.
s_nRun)
76 tup.column(
'gauss',
gauss())
77 tup.column(
'flat', flat())
78 tup.column(
'expo', expo())
79 tup.column(
'poisson', int(poisson()))
80 tup.column(
'binom', int(binom()))
81 tup.column(
'flag', 0 >
gauss())
91 GaudiPython.AppMgr.evtcolsvc = _evtcolsvc_
99 """ Configuration of the job """
104 gaudi.HistogramPersistency =
"ROOT"
105 gaudi.DLLs += [
'GaudiAlg',
'RootHistCnv']
106 gaudi.ExtSvc += [
'RndmGenSvc',
'NTupleSvc',
'TagCollectionSvc/EvtTupleSvc']
109 gaudi.setAlgorithms([alg])
111 alg.EvtColLUN =
'EVTTAGS'
112 alg.EvtColsProduce =
True
113 alg.EvtColsPrint =
True
114 alg.NTupleProduce =
False
115 alg.HistoProduce =
False
117 gaudi.OutStream = [
'EvtCollectionStream/TagsWriter']
118 tagsWriter = gaudi.algorithm(
'TagsWriter')
119 tagsWriter.ItemList = [
'/NTUPLES/EVTTAGS/Fill/COL1']
120 tagsWriter.EvtDataSvc =
"EvtTupleSvc"
122 evtColSvc = gaudi.evtcolsvc()
123 evtColSvc.defineOutput({
124 'EVTTAGS':
'PFN:EvtTags1.root'
126 typ=
'Gaudi::RootCnvSvc')
127 evtColSvc.OutputLevel = 2
129 evtSel = gaudi.evtSel()
130 evtSel.PrintFreq = 1000
131 evtSel.open([
'EvtColsEx.dst'])
139 if '__main__' == __name__:
142 from Configurables
import GaudiPersistency, FileCatalog, ApplicationMgr
144 ApplicationMgr().ExtSvc.append(
145 FileCatalog(Catalogs=[
'xmlcatalog_file:EvtColsEx.xml']))