16from ROOT.Belle2
import EvtGenDatabasePDG
18database = EvtGenDatabasePDG.Instance()
20f = open(basf2.find_file(
'decfiles/dec/DECAY_BELLE2.DEC'))
21decfile_lines = f.readlines()
24re_decay = re.compile(
'Decay *([^ ]+).*\n')
25re_enddecay = re.compile(
'Enddecay *')
31for i
in range(len(decfile_lines)):
33 match = re_enddecay.match(decfile_lines[i])
35 decays.append([particle, i - decay_line])
38 match = re_decay.match(decfile_lines[i])
40 particle = match.group(1)
45def get_decay_length(particle_name):
47 if (decay[0] == particle_name):
52for particle
in database.ParticleList():
53 code = particle.PdgCode()
54 name = particle.GetName()
56 antiparticle = database.GetParticle(-code)
58 antiname = antiparticle.GetName()
59 length = get_decay_length(name)
60 antilength = get_decay_length(antiname)
61 if (length > 0
and antilength > 0
and length != antilength):
62 print(f
'Inconsistent length of decay description '
63 f
'for {name} ({length}) and {antiname} ({antilength}).')