ATLAS Offline Software
Loading...
Searching...
No Matches
TruthTest.py
Go to the documentation of this file.
6
7# init application mgr
8theApp.initialize()
9
10# run 1 event
11theApp.nextEvent()
12
13# get MC Truth
14mcc = PyTruthTools.getMcEvents('GEN_AOD')
15
16# get GenEvent
17mc = mcc[0]
18
19# call a normal method
20print (mc.alphaQCD())
21
22# get particle-iterators
23# GenEvent::particles_begin() and _end() give ietrators
24it = mc.particles_begin()
25itE = mc.particles_end()
26
27# patch because HepMC::GenEvent::particle_const_iterator doesn't define end()
28it.end = mc.particles_end
29
30# loop over all particles
31while (it != itE):
32 # dereference and increment the iterator
33 # this corresponds to "p = *it++"
34 p = it.next()
35 print (p.pdg_id())
36
37# get vertex-iterator
38it = mc.vertices_begin()
39
40it.end = mc.vertices_end
41
42# get GenVertex obj
43v = it.next()
44
45# loop over all particles connected via a graph
46itp = v.particles_begin()
47itpE = v.particles_end(0)
48
49itp.end = v.particles_end
50
51while (itp != itpE):
52 print (itp.next().pdg_id())
53