9 from ROOT
import Belle2
10 from ROOT.Belle2
import EvtGenDatabasePDG
12 database = EvtGenDatabasePDG.Instance()
15 decfile_lines = f.readlines()
18 re_decay = re.compile(
'Decay *([^ ]+).*\n')
19 re_enddecay = re.compile(
'Enddecay *')
23 for i
in range(len(decfile_lines)):
25 match = re_enddecay.match(decfile_lines[i])
27 decays.append([particle, i - decay_line])
30 match = re_decay.match(decfile_lines[i])
32 particle = match.group(1)
37 def get_decay_length(particle_name):
39 if (decay[0] == particle_name):
43 for particle
in database.ParticleList():
44 code = particle.PdgCode()
45 name = particle.GetName()
47 antiparticle = database.GetParticle(-code)
49 antiname = antiparticle.GetName()
50 length = get_decay_length(name)
51 antilength = get_decay_length(antiname)
52 if (length > 0
and antilength > 0
and length != antilength):
53 print(f
'Inconsistent length of decay description '
54 f
'for {name} ({length}) and {antiname} ({antilength}).')