import os from ROOT import * from array import array from JPsi.MuMu.common.pmvTrees import getChains #weight = { #"data": 1., #"z" : 0.030541912803076, #"qcd": 0.10306919044126, #"w" : 0.074139194512438, #"tt" : 0.005083191122289, #} tree = getChains('v15reco') canvases = [] graphs = [] ## Set TDR style macroPath = "tdrstyle.C" if os.path.exists(macroPath): gROOT.LoadMacro(macroPath) ROOT.setTDRStyle() gROOT.ForceStyle() gStyle.SetPadRightMargin(0.05) gStyle.SetPadTopMargin(0.05) wWidth = 600 wHeight = 600 canvasDX = 20 canvasDY = 20
"qcd" : "QCD", "tt" : "t#bar{t}", "w" : "W", } histograms = {} ## gStyle.SetPadRightMargin(0.05) #print 'PadTopMargin:', gStyle.GetPadTopMargin() #gStyle.SetPadTopMargin(0.15) #print 'PadTopMargin:', gStyle.GetPadTopMargin() latexLabel = TLatex() latexLabel.SetNDC() chains = pmvTrees.getChains('v19') tree = {} for tag in 'data z qcd w tt'.split(): tree[tag] = chains[tag] #______________________________________________________________________________ def get_selection(): ''' Return the TTree selection expression based on the name. ''' if 'EB' in name: selection = '&'.join([ 'phoIsEB', 'phoPt > 25', 'scEt > 10', 'phoHoE < 0.5',
latexLabel = TLatex() latexLabel.SetNDC() ## open files # file = {} # for tag, name in fileName.items(): # file[tag] = TFile(os.path.join(path, name)) ## get trees tree = {} # for tag, f in file.items(): # tree[tag] = f.Get("pmvTree/pmv") # import JPsi.MuMu.common.energyScaleChains as esChains import JPsi.MuMu.common.pmvTrees as pmvTrees chains = pmvTrees.getChains("v15") tree = {} for tag in "data z qcd w tt".split(): tree[tag] = chains[tag] ## make histos of pmv vs mmgMass # ebSelection = "phoIsEB & abs(mmgMass-90)<15 & (minDEta > 0.04 | minDPhi > 0.3)" # eeSelection = "!phoIsEB & abs(mmgMass-90)<15 & (minDEta > 0.08 | minDPhi > 0.3)" selection = "scEt > 10 && phoHoE < 0.5 && mmMass < 80" # selection = 'phoIsEB' # selection = '!phoIsEB' ############################################################################### # Plot a quantity in data for EB yRange = (1e-4, 7000.0)
sys.argv.append( '-b' ) import ROOT import JPsi.MuMu.common.pmvTrees as pmvTrees ## Configuration # sample = "data39x" sample, version = 'z', 'v12' # sample, version = 'data2011', 'v9' # sample = "zg" # sample = "qcd" ROOT.gROOT.LoadMacro("resolutionErrors.C++") ROOT.gROOT.LoadMacro("res/tools.C++") chain = pmvTrees.getChains(version)[sample] ## Apply run-based energy scale correction to MC ## Store the pileup weight for MC, dummy weight for real data if sample == 'data2011': outputVars = """ mmMass scaledMmgMass3(corrByRun(id.run,scEta,phoR9),mmgMass,mmMass) phoPt*corrByRun(id.run,scEta,phoR9) scEta phoR9 1 """.split() else: outputVars = """ mmMass
latexLabel = TLatex() latexLabel.SetNDC() ## open files file = {} for tag, name in fileName.items(): file[tag] = TFile(os.path.join(path, name)) ## get trees tree = {} for tag, f in file.items(): tree[tag] = f.Get("pmvTree/pmv") import JPsi.MuMu.common.pmvTrees as pmvtrees treev15reco = pmvtrees.getChains('v15reco') tree['z'] = treev15reco['z'] tree['data'] = treev15reco['data'] ## make histos of pmv vs deta ############################################################################### # Plot PMV eff. vs photon pt in data for EB c1 = TCanvas() canvases.append(c1) #xbins = [0., 0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 2.0, 2.5] xbins = [0.1 * i for i in range(26)] h_Eta = TH1F("h_Eta_data_eb", "#eta^#gamma", len(xbins)-1, array("d", xbins))