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 *')
30 for i
in range(len(decfile_lines)):
32 match = re_enddecay.match(decfile_lines[i])
34 decays.append([particle, i - decay_line])
37 match = re_decay.match(decfile_lines[i])
39 particle = match.group(1)
44 def get_decay_length(particle_name):
46 if (decay[0] == particle_name):
51 for particle
in database.ParticleList():
52 code = particle.PdgCode()
53 name = particle.GetName()
55 antiparticle = database.GetParticle(-code)
57 antiname = antiparticle.GetName()
58 length = get_decay_length(name)
59 antilength = get_decay_length(antiname)
60 if (length > 0
and antilength > 0
and length != antilength):
61 print(f
'Inconsistent length of decay description '
62 f
'for {name} ({length}) and {antiname} ({antilength}).')