def prepFitter(config = opts.modeConfig, initFiles = mWWArgs): theArgs = dict(configArgs) theArgs['mjj_config'] = config theArgs['initFile'] = initFiles pars_mWW = HWW1D2FitsConfig_mWW.theConfig(**theArgs) pars_mWW.yieldConstraints['WpJ'] = fitter.ws.var('WpJ_nrm').getError() if opts.toy or opts.sb: pars_mWW.blind = False # add systematic errors multipliers to ggH signals if (opts.mH >= 400): pars_mWW.ggHdoSystMult = True fitter_mWW = RooWjj2DFitter.Wjj2DFitter(pars_mWW) fitter_mWW.ws.SetName("w_mWW") totalPdf_mWW = fitter_mWW.makeFitter() fitter_mWW.readParametersFromFile() regionName = 'signalRegion' if opts.sb: regionName = 'sidebandRegion' fitter.ws.var(fitter.pars.var[0]).setRange(regionName, pars_mWW.regionLow, pars_mWW.regionHigh) sigInt = fitter.ws.pdf('WpJ').createIntegral(fitter.ws.set('obsSet'), fitter.ws.set('obsSet'), regionName) fullInt = fitter.ws.pdf('WpJ').createIntegral(fitter.ws.set('obsSet'), fitter.ws.set('obsSet')) n_WpJ_sig = sigInt.getVal()/fullInt.getVal()*fitter.ws.function('f_WpJ_norm').getVal() print 'W+jets integral in signal region:',sigInt.getVal()/fullInt.getVal(), print 'W+jets yield in the signal region:',n_WpJ_sig WpJ_mWW = fitter_mWW.ws.var('n_WpJ') WpJ_mWW.setVal(n_WpJ_sig) fitter_mWW.expectedFromPars() fitter_mWW.resetYields() if opts.sigInject: fitter_mWW.ws.var('r_signal').setVal(opts.sigInject) fitter_mWW.ws.var('r_signal').setError(0.1) fitter_mWW.ws.var('r_signal').setRange(-3., 9.) fitter_mWW.ws.var('r_signal').setConstant(False) return fitter_mWW
WpJ_params_sideband = RooArgSet('WpJ_params_sideband') sigInt = fitter.ws.pdf('WpJ').createIntegral(fitter.ws.set('obsSet'), fitter.ws.set('obsSet'), 'signalRegion') fullInt = fitter.ws.pdf('WpJ').createIntegral(fitter.ws.set('obsSet'), fitter.ws.set('obsSet')) n_WpJ_sig = sigInt.getVal()/fullInt.getVal()*fitter.ws.function('f_WpJ_norm').getVal() print 'W+jets integral in signal region:',sigInt.getVal()/fullInt.getVal(), print 'W+jets yield in the signal region:',n_WpJ_sig import HWW1D2FitsConfig_mWW print mWWArgs pars_mWW = HWW1D2FitsConfig_mWW.theConfig(Nj = opts.Nj, mH = opts.mH, isElectron = opts.isElectron, initFile = mWWArgs, includeSignal = True, MVACutOverride = mvaCutOverride) pars_mWW.yieldConstraints['WpJ'] = fitter.ws.var('WpJ_nrm').getError() # add systematic errors multipliers to ggH signals if (opts.mH >= 400): pars_mWW.ggHdoSystMult = True fitter_mWW = RooWjj2DFitter.Wjj2DFitter(pars_mWW) fitter_mWW.ws.SetName("w_mWW") totalPdf_mWW = fitter_mWW.makeFitter() fitter_mWW.readParametersFromFile() WpJ_mWW = fitter_mWW.ws.var('n_WpJ') WpJ_mWW.setVal(n_WpJ_sig) fitter_mWW.expectedFromPars()
'includeSignal': True, 'MVACutOverride': mvaCutOverride, 'mjj_config': opts.modeConfig } sb = None if opts.sb > 0: sb = 'high' configArgs['sideband'] = sb elif opts.sb < 0: sb = 'low' configArgs['sideband'] = sb import HWW1D2FitsConfig_mWW print mWWArgs pars_mWW = HWW1D2FitsConfig_mWW.theConfig(**configArgs) pars_mWW.blind = False mjj = fitter.ws.var(fitter.pars.var[0]) mjj.setRange('sidebandRegion', pars_mWW.regionLow, pars_mWW.regionHigh) sigInt = fitter.ws.pdf('WpJ').createIntegral(fitter.ws.set('obsSet'), fitter.ws.set('obsSet'), 'sidebandRegion') fullInt = fitter.ws.pdf('WpJ').createIntegral(fitter.ws.set('obsSet'), fitter.ws.set('obsSet')) n_WpJ_sig = sigInt.getVal()/fullInt.getVal()*fitter.ws.function('f_WpJ_norm').getVal() print 'W+jets integral in %s sideband region:' % pars_mWW.region, print sigInt.getVal()/fullInt.getVal() print 'W+jets yield in the signal region:',n_WpJ_sig pars_mWW.yieldConstraints['WpJ'] = fitter.ws.var('WpJ_nrm').getError()
WpJ_params_sideband = RooArgSet('WpJ_params_sideband') sigInt = fitter.ws.pdf('WpJ').createIntegral(fitter.ws.set('obsSet'), fitter.ws.set('obsSet'), 'signalRegion') fullInt = fitter.ws.pdf('WpJ').createIntegral(fitter.ws.set('obsSet'), fitter.ws.set('obsSet')) n_WpJ_sig = sigInt.getVal()/fullInt.getVal()*fitter.ws.function('f_WpJ_norm').getVal() print 'W+jets integral in signal region:',sigInt.getVal()/fullInt.getVal(), print 'W+jets yield in the signal region:',n_WpJ_sig import HWW1D2FitsConfig_mWW print mWWArgs pars_mWW = HWW1D2FitsConfig_mWW.theConfig(opts.Nj, opts.mH, opts.isElectron, mWWArgs, True) pars_mWW.yieldConstraints['WpJ'] = fitter.ws.var('WpJ_nrm').getError() # add systematic errors multipliers to ggH signals if (opts.mH >= 400): pars_mWW.ggHdoSystMult = True fitter_mWW = RooWjj2DFitter.Wjj2DFitter(pars_mWW) fitter_mWW.ws.SetName("w_mWW") totalPdf_mWW = fitter_mWW.makeFitter() fitter_mWW.readParametersFromFile() WpJ_mWW = fitter_mWW.ws.var('n_WpJ') WpJ_mWW.setVal(n_WpJ_sig) fitter_mWW.expectedFromPars()
WpJ_params_sideband = RooArgSet('WpJ_params_sideband') sigInt = fitter.ws.pdf('WpJ').createIntegral(fitter.ws.set('obsSet'), fitter.ws.set('obsSet'), 'signalRegion') fullInt = fitter.ws.pdf('WpJ').createIntegral(fitter.ws.set('obsSet'), fitter.ws.set('obsSet')) n_WpJ_sig = sigInt.getVal()/fullInt.getVal()*fitter.ws.function('f_WpJ_norm').getVal() print 'W+jets integral in signal region:',sigInt.getVal()/fullInt.getVal(), print 'W+jets yield in the signal region:',n_WpJ_sig import HWW1D2FitsConfig_mWW print mWWArgs pars_mWW = HWW1D2FitsConfig_mWW.theConfig(opts.Nj, opts.mH, opts.isElectron, mWWArgs, True) pars_mWW.yieldConstraints['WpJ'] = fitter.ws.var('WpJ_nrm').getError() fitter_mWW = RooWjj2DFitter.Wjj2DFitter(pars_mWW) fitter_mWW.ws.SetName("w_mWW") totalPdf_mWW = fitter_mWW.makeFitter() fitter_mWW.readParametersFromFile() WpJ_mWW = fitter_mWW.ws.var('n_WpJ') WpJ_mWW.setVal(n_WpJ_sig) fitter_mWW.expectedFromPars() mWWCut = '((%s>%.0f)&&(%s<%.0f))' % \ (pars.var[0], pars.exclude[pars.var[0]][0], pars.var[0], pars.exclude[pars.var[0]][1]) print 'signal region cut:',mWWCut fitter_mWW.loadDataFromWorkspace(fitter.ws, mWWCut)