Exemplo n.º 1
0
def load_fit_result(fit_result, ws):
    ''' Load the fit result values into the appropriate variables '''
    for var in roofit.iter_collection(ws.allVars()):
        name = var.GetName()
        if fit_result.floatParsFinal().find(name):
            value = fit_result.floatParsFinal().find(name).getVal()
            if math.isnan(value):
                log.error("Var %s is NAN - returning false!", name)
                return False
            var.setVal(value)
            log.info("Setting var %s to %f", name, value)
    return True
Exemplo n.º 2
0
    x = ws.var('x')
    cut = ws.cat('cut')

    # Put everything in python form
    data = {}
    fake_rate_datas = ws.allData()
    # Plot the results of each one
    for datum in fake_rate_datas:
        data[datum.GetName()] = datum
        print datum

    functions = {}
    log.info("Loading functions")
    # We need to unmangle the function names
    name_extractor = re.compile('func_(?P<name>.*)')
    for function in roofit.iter_collection(ws.allFunctions()):
        function_name = function.GetName()
        log.info("Found function: %s", function_name)
        match = name_extractor.match(function_name)
        if not match:
            log.warning("Can't find name for function, skipping!")
            continue
        functions[match.group('name')] = function
        log.info("Added function with name %s", match.group('name'))

    canvas = ROOT.TCanvas("basdf", "aasdf", 800, 600)

    keeps = []
    frame = x.frame()
    # Keep track of output files we write
    output_files = []