def multiplot(plotdict):
	"""This function makes similar plots with the same quantities and different cuts and selections"""
	pdgids = [211, 321, 11, 13]
	quantities = ["TauSpinnerWeight", "1genBoson1Daughter2GranddaughterPt", "1genBoson1Daughter2GranddaughterEta", "1genBoson1Daughter2GranddaughterPhi", "1genBoson1Daughter2GranddaughterMass"]
	for i in pdgids:
		for quantity in quantities:
			local_plotdict = utils.copyplotdict(plotdict)
			for key in xlimsdict.keys():
				if key in quantity:
					local_plotdict['xlims'] = xlimsdict[key]
					if local_plotdict['xlims'] == ["mass"]:
						local_plotdict['xlims'] = particledict.get(i)[1]

			local_plotdict["x"] = [quantity]
			if quantity == "TauSpinnerWeight":
				local_plotdict["log"] = True
			local_plotdict["weights"][0] = 'abs(1genBoson1Daughter2GranddaughterPdgId) == %0.0f && TauSpinnerWeight != -999 && TauSpinnerWeight != -777' % i
			#print local_plotdict["weights"][0]
			local_plotdict["filename"] = local_plotdict["x"][0] + 'ForPdgId%s' % i
			local_plotdict["title"] = local_plotdict["x"][0] + ' for ' + particledict.get(i)[0] + ' and ' + particledict.get(-i)[0]
			#local_local_plotdict["labels"] = local_plotdict["x"][0] + ' for ' + particledict.get(i) + ' and ' + particledict.get(-i)
			plot1d.get_root_histos(local_plotdict)

			plot1d.get_mpl_histos(local_plotdict)
			plot1d.plot1d_mpl(local_plotdict)

			labels.add_labels(local_plotdict)
			utils.setaxislimits(local_plotdict)
			utils.save(local_plotdict)
示例#2
0
def example_plotscale(plotdict):
	""" This function does basically the same as plot1d, but scales the root
		histograms with a factor and then convertes them to MPL.
	"""
	#TODO: The conversion ROOT->MPL is actually done twice - avoid this

	plot1d.get_root_histos(plotdict)

	for n, (roothisto, rootfile) in enumerate(zip(plotdict['roothistos'], plotdict['rootfiles'])):
		# Scale (or whatever you want to do with the root histos):
		roothisto.Scale(plotdict['scalefactor'])
		plotdict["mplhistos"][n] = mplconvert.root2histo(roothisto, rootfile.GetName(), 1)

	plot1d.plot1d_mpl(plotdict)
	utils.setaxislimits(plotdict)
	labels.add_labels(plotdict)
	utils.save(plotdict)
示例#3
0
def example_plotscale(plotdict):
    """ This function does basically the same as plot1d, but scales the root
		histograms with a factor and then convertes them to MPL.
	"""
    #TODO: The conversion ROOT->MPL is actually done twice - avoid this

    plot1d.get_root_histos(plotdict)

    for n, (roothisto, rootfile) in enumerate(
            zip(plotdict['roothistos'], plotdict['rootfiles'])):
        # Scale (or whatever you want to do with the root histos):
        roothisto.Scale(plotdict['scalefactor'])
        plotdict["mplhistos"][n] = mplconvert.root2histo(
            roothisto, rootfile.GetName(), 1)

    plot1d.plot1d_mpl(plotdict)
    utils.setaxislimits(plotdict)
    labels.add_labels(plotdict)
    utils.save(plotdict)
def multiplot(plotdict):
    """This function makes similar plots with the same quantities and different cuts and selections"""
    pdgids = [211, 321, 11, 13]
    quantities = [
        "TauSpinnerWeight", "1genBoson1Daughter2GranddaughterPt",
        "1genBoson1Daughter2GranddaughterEta",
        "1genBoson1Daughter2GranddaughterPhi",
        "1genBoson1Daughter2GranddaughterMass"
    ]
    for i in pdgids:
        for quantity in quantities:
            local_plotdict = utils.copyplotdict(plotdict)
            for key in xlimsdict.keys():
                if key in quantity:
                    local_plotdict['xlims'] = xlimsdict[key]
                    if local_plotdict['xlims'] == ["mass"]:
                        local_plotdict['xlims'] = particledict.get(i)[1]

            local_plotdict["x"] = [quantity]
            if quantity == "TauSpinnerWeight":
                local_plotdict["log"] = True
            local_plotdict["weights"][
                0] = 'abs(1genBoson1Daughter2GranddaughterPdgId) == %0.0f && TauSpinnerWeight != -999 && TauSpinnerWeight != -777' % i
            #print local_plotdict["weights"][0]
            local_plotdict[
                "filename"] = local_plotdict["x"][0] + 'ForPdgId%s' % i
            local_plotdict[
                "title"] = local_plotdict["x"][0] + ' for ' + particledict.get(
                    i)[0] + ' and ' + particledict.get(-i)[0]
            #local_local_plotdict["labels"] = local_plotdict["x"][0] + ' for ' + particledict.get(i) + ' and ' + particledict.get(-i)
            plot1d.get_root_histos(local_plotdict)

            plot1d.get_mpl_histos(local_plotdict)
            plot1d.plot1d_mpl(local_plotdict)

            labels.add_labels(local_plotdict)
            utils.setaxislimits(local_plotdict)
            utils.save(local_plotdict)