Retrieve McEventCollection object from SG
:param aKey: key of the object
**examples**::
athena> mcc = PyTruthTools.getMcEvents('GEN_EVENT')
athena> len(mcc)
athena> mc = mcc[0]
athena> mc.alphaQCD()
athena> it = mc.particles_begin() # GenEvent::particles_begin() and _end() give ietrators
athena> itE = mc.particles_end()
athena> while (it != itE): # loop over all particles
... p = it.next() # dereference and increment the ietrator
... print p.pdg_id()
... # just hit return key
**Note:** Some methods of GenEvent_/GenVertex_, e.g., particles_begin(), give an iterator. One may use it like as a python iterator. But don't try 'for i in iterator:'. It should cause a crash since an iterator of C++ doesn't know it's boundary.
.. _GenEvent: http://reserve02.usatlas.bnl.gov/lxr/source/atlas/Simulation/HepMC/HepMC/GenEvent.h
.. _GenVertex: http://reserve02.usatlas.bnl.gov/lxr/source/atlas/Simulation/HepMC/HepMC/GenVertex.h
Definition at line 18 of file PyTruthTools.py.
19 """Retrieve McEventCollection object from SG
21 :param aKey: key of the object
25 athena> mcc = PyTruthTools.getMcEvents('GEN_EVENT')
29 athena> it = mc.particles_begin() # GenEvent::particles_begin() and _end() give ietrators
30 athena> itE = mc.particles_end()
31 athena> while (it != itE): # loop over all particles
32 ... p = it.next() # dereference and increment the ietrator
34 ... # just hit return key
37 **Note:** Some methods of GenEvent_/GenVertex_, e.g., particles_begin(), give an iterator. One may use it like as a python iterator. But don't try 'for i in iterator:'. It should cause a crash since an iterator of C++ doesn't know it's boundary.
39 .. _GenEvent: http://reserve02.usatlas.bnl.gov/lxr/source/atlas/Simulation/HepMC/HepMC/GenEvent.h
40 .. _GenVertex: http://reserve02.usatlas.bnl.gov/lxr/source/atlas/Simulation/HepMC/HepMC/GenVertex.h
43 return PyK.retrieve(PyK.GNS.McEventCollection,aKey)