示例#1
0
def root_file_to_hist(input_filename, hist_templates):

    hists = copy.deepcopy(hist_templates)

    root_file = TFile(input_filename, "read")

    for var in hists.keys():
        mod_hist = hists[var]
        hist = root_file.Get(var)
        mod_hist.replace_hist(hist)

    return hists
示例#2
0
def root_file_to_hist(input_filename, hist_templates):

	hists = copy.deepcopy( hist_templates )

	root_file = TFile(input_filename, "read")

	for var in hists.keys():
		mod_hist = hists[var]
		hist = root_file.Get(var)
		mod_hist.replace_hist(hist)

		
	return hists
示例#3
0
def root_file_to_hist(input_filename, hist_templates):

    hists = copy.deepcopy(hist_templates)

    root_file = TFile(input_filename, "read")

    for var in hists.keys():

        index = 0

        for mod_hist in hists[var]:
            hist_name = "{}#{}".format(var, index)

            # Get hist from ROOT file.
            hist = root_file.Get(hist_name)

            mod_hist.replace_hist(hist)

            index += 1

    return hists
示例#4
0
def root_file_to_hist(input_filename, hist_templates):

	hists = copy.deepcopy( hist_templates )

	root_file = TFile(input_filename, "read")

	for var in hists.keys():
		
		index = 0

		for mod_hist in hists[var]:
			hist_name = "{}#{}".format(var, index)

			# Get hist from ROOT file.
			hist = root_file.Get(hist_name)

			mod_hist.replace_hist(hist)

			index += 1

	return hists
示例#5
0
def root_file_to_hist(input_filename, hist_templates, is_this_data):

    hists = copy.deepcopy(hist_templates)

    root_file = TFile(input_filename, "read")

    for var in hists.keys():

        index = 0

        # if var in ['hardest_pT', 'uncor_hardest_pT', 'hardest_eta']:
        # if var not in ['uncor_hardest_pT']:
        if is_this_data:
            for mod_hist in hists[var]:
                hist_name = "{}#{}".format(var, index)

                # Get hist from ROOT file.
                hist = root_file.Get(hist_name)

                mod_hist.replace_hist(hist)

                index += 1

        else:
            if var != 'uncor_hardest_pT':
                for mod_hist in hists[var]:
                    hist_name = "{}#{}".format(var, index)

                    # Get hist from ROOT file.
                    hist = root_file.Get(hist_name)

                    mod_hist.replace_hist(hist)

                    index += 1

    return hists
示例#6
0
def root_file_to_hist(input_filename, hist_templates, is_this_data):

    hists = copy.deepcopy(hist_templates)

    root_file = TFile(input_filename, "read")

    for var in hists.keys():

        index = 0

        # if var in ['hardest_pT', 'uncor_hardest_pT', 'hardest_eta']:
        # if var not in ['uncor_hardest_pT']:
        if is_this_data:
            for mod_hist in hists[var]:
                hist_name = "{}#{}".format(var, index)

                # Get hist from ROOT file.
                hist = root_file.Get(hist_name)

                mod_hist.replace_hist(hist)

                index += 1

        else:
            if var != 'uncor_hardest_pT':
                for mod_hist in hists[var]:
                    hist_name = "{}#{}".format(var, index)

                    # Get hist from ROOT file.
                    hist = root_file.Get(hist_name)

                    mod_hist.replace_hist(hist)

                    index += 1

    return hists