17 from ROOT.Belle2
import EvtGenDatabasePDG
19 database = EvtGenDatabasePDG.Instance()
21 f = open(basf2.find_file(
'decfiles/dec/DECAY_BELLE2.DEC'))
22 decfile_lines = f.readlines()
25 re_decay = re.compile(
'Decay *([^ ]+).*\n')
26 re_enddecay = re.compile(
'Enddecay *')
32 for i
in range(len(decfile_lines)):
34 match = re_enddecay.match(decfile_lines[i])
36 decays.append([particle, i - decay_line])
39 match = re_decay.match(decfile_lines[i])
41 particle = match.group(1)
46 def get_decay_length(particle_name):
48 if (decay[0] == particle_name):
53 for particle
in database.ParticleList():
54 code = particle.PdgCode()
55 name = particle.GetName()
57 antiparticle = database.GetParticle(-code)
59 antiname = antiparticle.GetName()
60 length = get_decay_length(name)
61 antilength = get_decay_length(antiname)
62 if (length > 0
and antilength > 0
and length != antilength):
63 print(f
'Inconsistent length of decay description '
64 f
'for {name} ({length}) and {antiname} ({antilength}).')