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
24 __author__ =
"Vanya BELYAEV ibelyaev@physics.syr.edu"
31 Rndm = GaudiPython.gbl.Rndm
33 SUCCESS = GaudiPython.SUCCESS
43 """Simple algorithm which implicitely book&Fill Event Tag collection"""
47 TupleAlgo.__init__(self, name)
52 """The major method 'execute', it is invoked for each event"""
67 address = self.get(
"/Event")
68 address = address.registry().address()
71 tup = self.evtCol(
"COL1",
"My trivial N-tuple")
73 tup.column(
"Address", address)
75 tup.column(
"evtNum", self.
s_nEvt)
76 tup.column(
"runNum", self.
s_nRun)
78 tup.column(
"gauss",
gauss())
79 tup.column(
"flat", flat())
80 tup.column(
"expo", expo())
81 tup.column(
"poisson", int(poisson()))
82 tup.column(
"binom", int(binom()))
83 tup.column(
"flag", 0 >
gauss())
93 GaudiPython.AppMgr.evtcolsvc = _evtcolsvc_
101 """Configuration of the job"""
106 gaudi.HistogramPersistency =
"ROOT"
107 gaudi.DLLs += [
"GaudiAlg",
"RootHistCnv"]
108 gaudi.ExtSvc += [
"RndmGenSvc",
"NTupleSvc",
"TagCollectionSvc/EvtTupleSvc"]
111 gaudi.setAlgorithms([alg])
113 alg.EvtColLUN =
"EVTTAGS"
114 alg.EvtColsProduce =
True
115 alg.EvtColsPrint =
True
116 alg.NTupleProduce =
False
117 alg.HistoProduce =
False
119 gaudi.OutStream = [
"EvtCollectionStream/TagsWriter"]
120 tagsWriter = gaudi.algorithm(
"TagsWriter")
121 tagsWriter.ItemList = [
"/NTUPLES/EVTTAGS/Fill/COL1"]
122 tagsWriter.EvtDataSvc =
"EvtTupleSvc"
124 evtColSvc = gaudi.evtcolsvc()
125 evtColSvc.defineOutput({
"EVTTAGS":
"PFN:EvtTags1.root"}, typ=
"Gaudi::RootCnvSvc")
126 evtColSvc.OutputLevel = 2
128 evtSel = gaudi.evtSel()
129 evtSel.PrintFreq = 1000
130 evtSel.open([
"EvtColsEx.dst"])
138 if "__main__" == __name__:
141 from Configurables
import ApplicationMgr, FileCatalog, GaudiPersistency
144 ApplicationMgr().ExtSvc.append(
145 FileCatalog(Catalogs=[
"xmlcatalog_file:EvtColsEx.xml"])