ATLAS Offline Software
Classes | Functions
python.truth Namespace Reference

Classes

class  _Truthtmp
 

Functions

def do_decay (t, n)
 
def dump_one_truth (t, f=sys.stdout)
 
def dump_truth (f=sys.stdout, sgkey="SpclMC", maxn=None)
 

Function Documentation

◆ do_decay()

def python.truth.do_decay (   t,
  n 
)
Return the unique ID number for decay N of truth particle T
as a string.  Return an empty string if there's no such decay.

Definition at line 20 of file truth.py.

20 def do_decay (t, n):
21  """Return the unique ID number for decay N of truth particle T
22 as a string. Return an empty string if there's no such decay.
23 """
24  if t.nDecay() <= n:
25  return ''
26  bc = t.child(n).genParticle().id()
27  return str(bc)
28 

◆ dump_one_truth()

def python.truth.dump_one_truth (   t,
  f = sys.stdout 
)
Dump truth information for truth particle T to file F.

Definition at line 31 of file truth.py.

31 def dump_one_truth (t, f=sys.stdout):
32  """Dump truth information for truth particle T to file F."""
33  d = _Truthtmp()
34  d.bc = t.genParticle().id()
35  d.name = PDG.pdgid_to_name(t.pdgId())
36  d.da1 = do_decay(t, 0)
37  d.da2 = do_decay(t, 1)
38  d.da3 = do_decay(t, 2)
39  d.pt = t.pt()/1000
40  d.eta = t.eta()
41  d.phi = t.phi()
42  d.m = t.m()/1000
43  d.px = t.px()/1000
44  d.py = t.py()/1000
45  d.pz = t.pz()/1000
46  d.e = t.e()/1000
47  print ("%(id)3d %(name)-4s %(da1)4s %(da2)4s %(da3)4s %(pt)6.1f %(eta)5.2f %(phi)5.2f %(m)5.1f %(px)6.1f %(py)6.1f %(pz)6.1f %(e)6.1f" % d.__dict__, file=f)
48  if t.nDecay() > 3:
49  print (" (more than 3 decays)", file=f)
50 
51 

◆ dump_truth()

def python.truth.dump_truth (   f = sys.stdout,
  sgkey = "SpclMC",
  maxn = None 
)
Dump out truth information for the current event.
F is the file to which the dump is sent.
SGKEY is the StoreGate key which is used to retrieve the truth information.

The first column in the dump is the particle unique ID number.
This is followed by the particle type, and then by the unique ID numbers
of any decay daughters (up to 3).  This is followed by the four-momentum
in two versions: first as pt, eta, phi, m and then as px, py, pz, e.

Definition at line 52 of file truth.py.

52 def dump_truth(f=sys.stdout, sgkey="SpclMC", maxn=None):
53  """Dump out truth information for the current event.
54 F is the file to which the dump is sent.
55 SGKEY is the StoreGate key which is used to retrieve the truth information.
56 
57 The first column in the dump is the particle unique ID number.
58 This is followed by the particle type, and then by the unique ID numbers
59 of any decay daughters (up to 3). This is followed by the four-momentum
60 in two versions: first as pt, eta, phi, m and then as px, py, pz, e.
61 """
62  parts = [p for p in PyParticleTools.getTruthParticles (sgkey)]
63  if maxn is not None:
64  parts = parts[:maxn]
65  for t in parts:
66  dump_one_truth (t, f)
67  return
python.truth.do_decay
def do_decay(t, n)
Definition: truth.py:20
python.truth.dump_truth
def dump_truth(f=sys.stdout, sgkey="SpclMC", maxn=None)
Definition: truth.py:52
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:239
python.truth.dump_one_truth
def dump_one_truth(t, f=sys.stdout)
Definition: truth.py:31
str
Definition: BTagTrackIpAccessor.cxx:11