def getHistograms(path, plot, runRange, isMC, backgrounds, region=""):

    treesEE = readTrees(path, "EE")
    treesEM = readTrees(path, "EMu")
    treesMM = readTrees(path, "MuMu")

    if isMC:

        eventCounts = totalNumberOfGeneratedEvents(path)
        processes = []
        for background in backgrounds:
            processes.append(
                Process(getattr(Backgrounds, background), eventCounts))
        histoEE = TheStack(processes, runRange.lumi, plot, treesEE, "None",
                           1.0, 1.0, 1.0).theHistogram
        histoMM = TheStack(processes, runRange.lumi, plot, treesMM, "None",
                           1.0, 1.0, 1.0).theHistogram
        histoEM = TheStack(processes, runRange.lumi, plot, treesEM, "None",
                           1.0, 1.0, 1.0).theHistogram
        histoEE.Scale(getattr(triggerEffs, region).effEE.val)
        histoEE.Scale(getattr(triggerEffs, region).effMM.val)
        histoEM.Scale(getattr(triggerEffs, region).effEM.val)

    else:
        histoEE = getDataHist(plot, treesEE)
        histoMM = getDataHist(plot, treesMM)
        histoEM = getDataHist(plot, treesEM)

    return histoEE, histoMM, histoEM
def getHistograms(path, plot, runRange, isMC, backgrounds, EM=False):

    treesEE = readTrees(path, "EE")
    treesEM = readTrees(path, "EMu")
    treesMM = readTrees(path, "MuMu")

    if isMC:

        eventCounts = totalNumberOfGeneratedEvents(path)
        processes = []
        for background in backgrounds:
            processes.append(
                Process(getattr(Backgrounds, background), eventCounts))

        histoEE = TheStack(processes, runRange.lumi, plot, treesEE, "None",
                           1.0, 1.0, 1.0).theHistogram
        histoMM = TheStack(processes, runRange.lumi, plot, treesMM, "None",
                           1.0, 1.0, 1.0).theHistogram

        if EM:
            histoEM = TheStack(processes, runRange.lumi, plot, treesEM, "None",
                               1.0, 1.0, 1.0).theHistogram

    else:
        histoEE = getDataHist(plot, treesEE)
        histoMM = getDataHist(plot, treesMM)
        if EM:
            histoEM = getDataHist(plot, treesEM)

    if EM:
        return histoEE, histoMM, histoEM
    else:
        return histoEE, histoMM
def getHistograms(path,plot,runRange,isMC,backgrounds,EM=False):


	treesEE = readTrees(path,"EE")
	treesEM = readTrees(path,"EMu")
	treesMM = readTrees(path,"MuMu")
		
	
	
	if isMC:
		
		eventCounts = totalNumberOfGeneratedEvents(path)	
		processes = []
		for background in backgrounds:
			processes.append(Process(getattr(Backgrounds,background),eventCounts))
		
		histoEE = TheStack(processes,runRange.lumi,plot,treesEE,"None",1.0,1.0,1.0).theHistogram		
		histoMM = TheStack(processes,runRange.lumi,plot,treesMM,"None",1.0,1.0,1.0).theHistogram

		
		if EM:
			histoEM = TheStack(processes,runRange.lumi,plot,treesEM,"None",1.0,1.0,1.0).theHistogram		
		
	else:
		histoEE = getDataHist(plot,treesEE)
		histoMM = getDataHist(plot,treesMM)
		if EM:
			histoEM = getDataHist(plot,treesEM)
	
	if EM:
		return histoEE , histoMM, histoEM
	else:
		return histoEE , histoMM
def getHistogramsPrompt(path, plot, runRange):

    treesMu = readTrees(path, "MuMu")
    treesE = readTrees(path, "EE")

    histoM = getDataHist(plot, treesMu, dataname="MergedData_Loose")
    histoE = getDataHist(plot, treesE, dataname="MergedData_Loose")

    return [histoE, histoM]
Beispiel #5
0
def getSignalMCHistograms(path, plot, runRange, sampleName):

    treesEE = readTrees(path, "EE")
    treesEM = readTrees(path, "EMu")
    treesMM = readTrees(path, "MuMu")

    histoEE = getDataHist(plot, treesEE, dataname=sampleName)
    histoMM = getDataHist(plot, treesMM, dataname=sampleName)
    histoEM = getDataHist(plot, treesEM, dataname=sampleName)

    return histoEE, histoMM, histoEM
def getHistograms(path, plot, runRange):

    treesMu = readTrees(path, "", "Fake", "FakemuonIso")
    treesE = readTrees(path, "", "Fake", "FakeelectronIso")

    histoE = ROOT.TH1F("", "", plot.nBins, plot.firstBin, plot.lastBin)
    histoM = ROOT.TH1F("", "", plot.nBins, plot.firstBin, plot.lastBin)

    for index, tree in treesMu.iteritems():
        histoM.Add(getDataHist(plot, treesMu, dataname=index))

    for index, tree in treesE.iteritems():
        histoE.Add(getDataHist(plot, treesE, dataname=index))

    return [histoE, histoM]
Beispiel #7
0
def getHistograms(path,
                  source,
                  modifier,
                  plot,
                  runRange,
                  isMC,
                  nonNormalized,
                  backgrounds,
                  region=""):

    treesEE = readTrees(path, "EE", source=source, modifier=modifier)
    treesEM = readTrees(path, "EMu", source=source, modifier=modifier)
    treesMM = readTrees(path, "MuMu", source=source, modifier=modifier)

    if isMC:
        #~ print path, source, modifier
        eventCounts = totalNumberOfGeneratedEvents(path, source, modifier)
        processes = []
        for background in backgrounds:
            if nonNormalized:
                processes.append(
                    Process(getattr(Backgrounds, background),
                            eventCounts,
                            normalized=False))
            else:
                processes.append(
                    Process(getattr(Backgrounds, background), eventCounts))

        histoEE = TheStack(processes, runRange.lumi, plot, treesEE, "None",
                           1.0, 1.0, 1.0).theHistogram
        histoMM = TheStack(processes, runRange.lumi, plot, treesMM, "None",
                           1.0, 1.0, 1.0).theHistogram
        histoEM = TheStack(processes, runRange.lumi, plot, treesEM, "None",
                           1.0, 1.0, 1.0).theHistogram

        histoEE.Scale(getattr(triggerEffs, region).effEE.val)
        histoEE.Scale(getattr(triggerEffs, region).effMM.val)
        histoEM.Scale(getattr(triggerEffs, region).effEM.val)

    else:
        histoEE = getDataHist(plot, treesEE)
        histoMM = getDataHist(plot, treesMM)
        histoEM = getDataHist(plot, treesEM)

    return histoEE, histoMM, histoEM
Beispiel #8
0
def getHistograms(path, plot, runRange, isMC, backgrounds):

    treesEE = readTrees(path, "EE")
    treesEM = readTrees(path, "EMu")
    treesMM = readTrees(path, "MuMu")

    if "NLL" in path:
        isNLL = True
        plot.cuts = plot.cuts.replace(" && metFilterSummary > 0", "")

    if isMC:
        eventCounts = totalNumberOfGeneratedEvents(path)
        processes = []
        for background in backgrounds:
            processes.append(
                Process(getattr(Backgrounds[runRange.era], background),
                        eventCounts))
        histoEE = TheStack(processes,
                           runRange.lumi,
                           plot,
                           treesEE,
                           "None",
                           1.0,
                           1.0,
                           1.0,
                           useTriggerEmulation=(not isNLL)).theHistogram
        histoMM = TheStack(processes,
                           runRange.lumi,
                           plot,
                           treesMM,
                           "None",
                           1.0,
                           1.0,
                           1.0,
                           useTriggerEmulation=(not isNLL)).theHistogram
    else:
        histoEE = getDataHist(plot, treesEE)
        histoMM = getDataHist(plot, treesMM)

    return histoEE, histoMM