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 barcode number for decay N of truth particle T
as a string.  Return an empty string if there's no such decay.

Definition at line 21 of file truth.py.

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

◆ 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 32 of file truth.py.

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

◆ 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 barcode number.
This is followed by the particle type, and then by the barcode 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 53 of file truth.py.

53 def dump_truth(f=sys.stdout, sgkey="SpclMC", maxn=None):
54  """Dump out truth information for the current event.
55 F is the file to which the dump is sent.
56 SGKEY is the StoreGate key which is used to retrieve the truth information.
57 
58 The first column in the dump is the particle barcode number.
59 This is followed by the particle type, and then by the barcode numbers
60 of any decay daughters (up to 3). This is followed by the four-momentum
61 in two versions: first as pt, eta, phi, m and then as px, py, pz, e.
62 """
63  parts = [p for p in PyParticleTools.getTruthParticles (sgkey)]
64  if maxn is not None:
65  parts = parts[:maxn]
66  for t in parts:
67  dump_one_truth (t, f)
68  return
python.truth.do_decay
def do_decay(t, n)
Definition: truth.py:21
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
python.truth.dump_truth
def dump_truth(f=sys.stdout, sgkey="SpclMC", maxn=None)
Definition: truth.py:53
python.truth.dump_one_truth
def dump_one_truth(t, f=sys.stdout)
Definition: truth.py:32
str
Definition: BTagTrackIpAccessor.cxx:11