Newer
Older
LbLcsFormFactors / eos-toys / scan-dBRds.py
# -*- coding: utf-8 -*-
# @Author: Elena Graverini
# @Date:   2017-03-22 11:15:24
# @Last Modified by:   Elena Graverini
# @Last Modified time: 2017-07-04 11:39:29
import os
tempfile = 'out.temp'
step = 0.5
bounds = {
    'mu': (0.0, 8.5),
    'tau': (3.0, 8.5),
}
scan = {
    'mu': {'s': [], 'br': []},
    'tau': {'s': [], 'br': []}
}
# Scanning differential branching ratio for muons and taus
for l in bounds.keys():
    os.system("for i in $(LANG=en_US seq {min} {step} {max});"
              "do out=$(eos-evaluate  --kinematics s $i"
              " --observable 'Lambda_b->Lambda_c(2625)lnu::dBR/ds;l={l},model=SM');"
              " echo $out; done > {tempf}".format(min=bounds[l][0],
                    max=bounds[l][1], l=l, tempf=tempfile, step=step))
    with open(tempfile, 'rb') as f:
        for line in f:
            # take the part we are interested into
            line = line.split('delta_max')
            line = line[-1]
            # split by blank spaces
            line = line.split()
            scan[l]['s'].append(float(line[0]))
            scan[l]['br'].append(float(line[1]))
    os.remove(tempfile)
    print("l={l}: \t{q2:>8} = {s}\n"
          "\t{dbr:>8} = {br}\n".format(l=l,
            q2='q^2', dbr='dBR/dq^2',
            s=scan[l]['s'], br=scan[l]['br']))

# Total BR:
# eos-evaluate --kinematics s_min 0.012 --kinematics s_max 8.948 --observable 'Lambda_b->Lambda_c(2625)lnu::BR;l=mu,model=SM'