print 'found', filename, 'mass', str(mass) #Now we have the samples: Sort the masses and run the fits N = 0 for mass in sorted(samples.keys()): print 'fitting', str(mass) plotter = TreePlotter(args[0] + '/' + samples[mass] + '.root', 'tree') # plotter.setupFromFile(args[0]+'/'+samples[mass]+'.pck') plotter.addCorrectionFactor('genWeight', 'tree') # plotter.addCorrectionFactor('xsec','tree') plotter.addCorrectionFactor('puWeight', 'tree') fitter = Fitter(['MVV', 'MJJ']) fitter.signal2D('model', ['MVV', 'MJJ']) fitter.w.var("MH").setVal(mass) histo = plotter.drawTH2(options.mjj + ':' + options.mvv, options.cut, "1", 500, 0, 6000, 100, options.minMJJ, options.maxMJJ) fitter.importBinnedData(histo, ['MVV', 'MJJ'], 'data') fitter.fit('model', 'data', [ROOT.RooFit.SumW2Error(0)]) fitter.fit('model', 'data', [ROOT.RooFit.SumW2Error(0)]) fitter.projection("model", "data", "MVV", "debugVV_" + str(mass) + ".root") fitter.projection("model", "data", "MJJ", "debugJJ_" + str(mass) + ".root") for var, graph in graphs.iteritems(): value, error = fitter.fetch(var) graph.SetPoint(N, mass, value) graph.SetPointError(N, 0.0, error)
print 'found', filename, 'mass', str(mass) #Now we have the samples: Sort the masses and run the fits N = 0 for mass in sorted(samples.keys()): print 'fitting', str(mass) plotter = TreePlotter(args[0] + '/' + samples[mass] + '.root', 'tree') plotter.setupFromFile(args[0] + '/' + samples[mass] + '.pck') plotter.addCorrectionFactor('genWeight', 'tree') plotter.addCorrectionFactor('xsec', 'tree') plotter.addCorrectionFactor('puWeight', 'tree') fitter = Fitter(['m', 'M']) fitter.signal2D('model', options.boson) fitter.w.var("MH").setVal(mass) histo = plotter.drawTH2(options.mjj + ":" + options.mvv, options.cutShape, "1", 500, 0, 13000, 120, 25, 165) histoYield = plotter.drawTH2(options.mjj + ":" + options.mvv, options.cutYield, "1", 130, 0, 13000, 100, 25, 165) fitter.importBinnedData(histo, ['M', 'm'], 'data') fitter.fit('model', 'data', [ROOT.RooFit.SumW2Error(0)]) #create the yield # fitter.w.var('m').setMax(options.maxMJJ) # fitter.w.var('m').setMin(options.minMJJ) # integral = fitter.w.pdf("model").createIntegral(ROOT.RooArgSet(fitter.w.var("m"),fitter.w.var("M")))
#Now we have the samples: Sort the masses and run the fits N=0 for mass in sorted(samples.keys()): if mass<999: continue print 'fitting',str(mass) plotter=TreePlotter(args[0]+'/'+samples[mass]+'.root','tree') plotter.setupFromFile(args[0]+'/'+samples[mass]+'.pck') plotter.addCorrectionFactor('genWeight','tree') plotter.addCorrectionFactor('xsec','tree') plotter.addCorrectionFactor('puWeight','tree') fitter=Fitter(['m','M']) fitter.signal2D('model',options.boson) fitter.w.var("MH").setVal(mass) histo = plotter.drawTH2(options.mjj+":"+options.mvv,options.cutShape,"1",500,0,13000,120,60,140) histoYield = plotter.drawTH2(options.mjj+":"+options.mvv,options.cutYield,"1",130,0,13000,100,25,165) fitter.importBinnedData(histo,['M','m'],'data') fitter.fit('model','data',[ROOT.RooFit.SumW2Error(1)]) #create the yield fitter.w.var('m').setMax(options.maxMJJ) fitter.w.var('m').setMin(options.minMJJ) integral = fitter.w.pdf("model").createIntegral(ROOT.RooArgSet(fitter.w.var("m"),fitter.w.var("M"))) analysisIntegral=integral.getVal() fitter.w.var('m').setMin(40)