def theConfig(Nj, mH, isElectron = False, initFile = [], includeSignal = True): pars = Wjj2DFitterPars() pars.MCDirectory = '/uscms_data/d2/andersj/Wjj/2012/data/Moriond2013/ReducedTrees/' # pars.MCDirectory = "root://cmseos:1094//eos/uscms/store/user/lnujj/Moriond2013/RD_includingDiboson/" # pars.MCDirectory = "root://cmseos:1094//eos/uscms/store/user/lnujj/HCP2012METfix/ReducedTrees/" #pars.DataDirectory = '/uscms_data/d2/andersj/Wjj/2012/data/Moriond2013/HWWTrees/' pars.DataDirectory = pars.MCDirectory pars.isElectron = isElectron pars.initialParametersFile = initFile pars.backgrounds = ['diboson', 'top', 'WpJ'] pars.includeSignal = includeSignal pars.signals = ['ggH', 'qqH'] pars.yieldConstraints = { 'diboson' : 0.034, 'top' : 0.07 } #pars.yieldConstraints = {} pars.constrainShapes = ['WpJ'] pars.Njets = Nj pars.mHiggs = mH modePars = mu2Pars if isElectron: flavorString = 'el' if Nj == 3: modePars = el3Pars else: modePars = el2Pars else: flavorString = 'mu' if Nj == 3: modePars = mu3Pars else: modePars = mu2Pars pars.cuts = \ '(W_pt>200.)&&(GroomedJet_CA8_pt[0]>200)&&(ggdboostedWevt==1)' +\ '&&(event_metMVA_met>50.)&&(GroomedJet_CA8_deltaphi_METca8jet>2.0)' +\ '&&(GroomedJet_CA8_mass_pr[0]>40)&&(numPFCorJetBTags==0)' +\ '&&(GroomedJet_CA8_tau2tau1[0]<0.53)' #btag veto pars.btagVeto = False # for i in range(0, 6): # pars.cuts += '&&((abs(JetPFCor_Eta[%i])>2.4)||' % i + \ # '(JetPFCor_Pt[%i]<30.)||' % i + \ # '(JetPFCor_bDiscriminatorCSV[%i]<0.679))' % i # veto boosted topology # if mH >= 600: # pars.cuts += '&&(W_pt<200.)' # veto vbf pars.cuts += '&&(vbf_event==0)' # you need a files entry and a models entry for each of the fit # compoents in backgrounds and signals # the files should a list with entries like (filename, Ngen, xsec) pars.dibosonFiles = [ (pars.MCDirectory + 'RD_%s_WW_CMSSW532.root' % (flavorString), 9450414, 57.1097), (pars.MCDirectory + 'RD_%s_WZ_CMSSW532.root' % (flavorString), 10000267, 32.3161), ] pars.dibosonModels = [ modePars[mH][5]['diboson'][0] ] pars.WpJFiles = [ (pars.MCDirectory + 'RD_%s_WJets_madgraph_CMSSW532.root' % (flavorString), 8955318, 1.3*228.9), ] pars.WpJModels = [ modePars[mH][5]['WpJ'][0] ] pars.topFiles = [ (pars.MCDirectory + 'RD_%s_TTbar_CMSSW532.root' % (flavorString), 6893735, 225.197), (pars.MCDirectory + 'RD_%s_STopS_Tbar_CMSSW532.root' % (flavorString), 139974, 1.75776), (pars.MCDirectory + 'RD_%s_STopS_T_CMSSW532.root' % (flavorString), 259960, 3.89394), (pars.MCDirectory + 'RD_%s_STopT_Tbar_CMSSW532.root' % (flavorString), 1935066, 30.0042), (pars.MCDirectory + 'RD_%s_STopT_T_CMSSW532.root' % (flavorString), 3758221, 55.531), (pars.MCDirectory + 'RD_%s_STopTW_Tbar_CMSSW532.root' % (flavorString), 493458, 11.1773), (pars.MCDirectory + 'RD_%s_STopTW_T_CMSSW532.root' % (flavorString), 497657, 11.1773), ] pars.topModels = [ modePars[mH][5]['top'][0] ] ngen = HWWSignalShapes.NgenHiggs(mH, 'ggH') pars.ggHFiles = [ (pars.MCDirectory + HWWSignalShapes.makeSignalFilename(mH, "ggH", isElectron), ngen[0], ngen[1]*ngen[2]) ] pars.ggHModels = [ modePars[mH][5]['ggH'][0] ] if pars.mHiggs >= 400: pars.ggHInterference = True ngen = HWWSignalShapes.NgenHiggs(mH, 'qqH') pars.qqHFiles = [ (pars.MCDirectory + HWWSignalShapes.makeSignalFilename(mH, "qqH", isElectron), ngen[0], ngen[1]*ngen[2]) ] pars.qqHModels = [ modePars[mH][5]['qqH'][0] ] pars.dibosonPlotting = {'color' : kAzure+8, 'title' : 'WW+WZ'} pars.WpJPlotting = { 'color' : kRed, 'title' : 'V+jets'} pars.topPlotting = {'color' : kGreen+2, 'title' : 'top'} pars.ggHPlotting = {'color' : kBlue, 'title' : "H(%i) #rightarrow WW" % mH} pars.qqHPlotting = {'color' : kBlue, 'title' : "H(%i) #rightarrow WW" % mH, 'visible' : True} pars.var = ['GroomedJet_CA8_mass_pr[0]', 'boostedW_lvj_m'] pars.varRanges = {'GroomedJet_CA8_mass_pr[0]': (20, 40., 140., []), 'boostedW_lvj_m': (modePars[mH][4], modePars[mH][2], modePars[mH][3], []) } pars.varTitles = {'GroomedJet_CA8_mass_pr[0]': 'm_{j}', 'boostedW_lvj_m' : 'm_{l#nuj}' } pars.varNames = {'GroomedJet_CA8_mass_pr[0]': 'GroomedJet_CA8_mass_pr', 'boostedW_lvj_m' : 'boostedW_lvj_m' } pars.exclude = {'GroomedJet_CA8_mass_pr[0]' : (70., 100.)} pars.blind = True pars.binData = False # pars.binData = True return customizeElectrons(pars) if isElectron else \ customizeMuons(pars)
def theConfig(Nj, mH, isElectron=False, initFile=[], includeSignal=True): pars = Wjj2DFitterPars() pars.MCDirectory = '/uscms_data/d2/andersj/Wjj/2012/data/Moriond2013/ReducedTrees/' pars.QCDDirectory = "/uscms_data/d3/ilyao/QCD8TeV/Moriond13/" # pars.MCDirectory = "root://cmseos:1094//eos/uscms/store/user/lnujj/Moriond2013/RD_includingDiboson/" # pars.MCDirectory = "root://cmseos:1094//eos/uscms/store/user/lnujj/HCP2012METfix/ReducedTrees/" pars.DataDirectory = '/uscms_data/d2/andersj/Wjj/2012/data/Moriond2013/HWWTrees/' pars.isElectron = isElectron pars.initialParametersFile = initFile pars.backgrounds = ['diboson', 'WpJ', 'top'] pars.includeSignal = includeSignal pars.signals = ['ggH', 'qqH'] pars.yieldConstraints = {'diboson': 0.034, 'top': 0.07} #pars.yieldConstraints = {} pars.constrainShapes = ['WpJ'] if mH > 200: pars.constrainShapes = ['WpJ'] pars.Njets = Nj pars.mHiggs = mH modePars = mu2Pars if isElectron: flavorString = 'el' if Nj == 3: modePars = el3Pars else: modePars = el2Pars else: flavorString = 'mu' if Nj == 3: modePars = mu3Pars else: modePars = mu2Pars pars.cuts = '(ggdevt==%i)&&(fit_status==0)&&(W_mt>30)' % Nj pars.cuts = '(fit_status==0)&&(W_mt>30)' pars.cuts += '&&(%s>%.3f)' % (modePars[mH][0], modePars[mH][1]) #btag veto pars.btagVeto = False for i in range(0, 6): pars.cuts += '&&((abs(JetPFCor_Eta[%i])>2.4)||' % i + \ '(JetPFCor_Pt[%i]<30.)||' % i + \ '(JetPFCor_bDiscriminatorCSV[%i]<0.244))' % i # veto boosted topology # if mH >= 600: # pars.cuts += '&&(W_pt<200.)' # veto vbf pars.cuts += '&&(vbf_event==0)' # you need a files entry and a models entry for each of the fit # compoents in backgrounds and signals # the files should a list with entries like (filename, Ngen, xsec) pars.dibosonFiles = [ (pars.MCDirectory + 'RD_%s_WW_CMSSW532.root' % (flavorString), 9450414, 57.1097), (pars.MCDirectory + 'RD_%s_WZ_CMSSW532.root' % (flavorString), 10000267, 32.3161), ] pars.dibosonModels = [modePars[mH][5]['diboson'][0]] wpj_kfactor = 1.16 pars.WpJFiles = [ # (pars.MCDirectory + 'RD_%s_WpJ_CMSSW532.root' % (flavorString), # 18353019+50768992, 36257.2), (pars.MCDirectory + 'RD_%s_ZpJ_CMSSW532.root' % (flavorString), 30209426, 3503.71), # (pars.MCDirectory + 'RD_%s_W1Jets_CMSSW532.root' % (flavorString), # 19871598, 5400.0*wpj_kfactor), (pars.MCDirectory + 'RD_%s_W2Jets_CMSSW532.root' % (flavorString), 33004921, 1750.0 * wpj_kfactor), (pars.MCDirectory + 'RD_%s_W3Jets_CMSSW532.root' % (flavorString), 15059503, 519.0 * wpj_kfactor), (pars.MCDirectory + 'RD_%s_W4Jets_CMSSW532.root' % (flavorString), 12842803, 214.0 * wpj_kfactor), ] pars.WpJModels = [modePars[mH][5]['WpJ'][0]] pars.topFiles = [ (pars.MCDirectory + 'RD_%s_TTbar_CMSSW532.root' % (flavorString), 6893735, 225.197), (pars.MCDirectory + 'RD_%s_STopS_Tbar_CMSSW532.root' % (flavorString), 139974, 1.75776), (pars.MCDirectory + 'RD_%s_STopS_T_CMSSW532.root' % (flavorString), 259960, 3.89394), (pars.MCDirectory + 'RD_%s_STopT_Tbar_CMSSW532.root' % (flavorString), 1935066, 30.0042), (pars.MCDirectory + 'RD_%s_STopT_T_CMSSW532.root' % (flavorString), 3758221, 55.531), (pars.MCDirectory + 'RD_%s_STopTW_Tbar_CMSSW532.root' % (flavorString), 493458, 11.1773), (pars.MCDirectory + 'RD_%s_STopTW_T_CMSSW532.root' % (flavorString), 497657, 11.1773), ] pars.topModels = [modePars[mH][5]['top'][0]] pars.QCDFracOfData = 0.05 pars.QCDFiles = [ (pars.QCDDirectory + 'RDQCD_WenuJets_Isog0p3NoElMVA_19p2invfb.root', 1, 1), #The events come from the data sideband ] pars.QCDModels = [27] ngen = HWWSignalShapes.NgenHiggs(mH, 'ggH') pars.ggHFiles = [ (pars.MCDirectory + HWWSignalShapes.makeSignalFilename(mH, "ggH", isElectron), ngen[0], ngen[1] * ngen[2]) ] pars.ggHModels = [modePars[mH][5]['ggH'][0]] if pars.mHiggs >= 400: pars.ggHInterference = True ngen = HWWSignalShapes.NgenHiggs(mH, 'qqH') pars.qqHFiles = [ (pars.MCDirectory + HWWSignalShapes.makeSignalFilename(mH, "qqH", isElectron), ngen[0], ngen[1] * ngen[2]) ] pars.qqHModels = [modePars[mH][5]['qqH'][0]] pars.dibosonPlotting = {'color': kAzure + 8, 'title': 'WW+WZ'} pars.WpJPlotting = {'color': kRed, 'title': 'V+jets'} pars.topPlotting = {'color': kGreen + 2, 'title': 'top'} pars.ggHPlotting = {'color': kBlue, 'title': "H(%i) #rightarrow WW" % mH} pars.qqHPlotting = { 'color': kBlue, 'title': "H(%i) #rightarrow WW" % mH, 'visible': True } pars.QCDPlotting = {'color': kGray, 'title': 'multijet'} pars.var = ['Mass2j_PFCor', 'fit_mlvjj'] pars.varRanges = { 'Mass2j_PFCor': (12, 50., 146., []), 'fit_mlvjj': (modePars[mH][4] * 10, modePars[mH][2], modePars[mH][3], []) } pars.plotRanges = { 'Mass2j_PFCor': (12, 50., 146., []), 'fit_mlvjj': (modePars[mH][4], modePars[mH][2], modePars[mH][3], []) } pars.varTitles = {'Mass2j_PFCor': 'm_{jj}', 'fit_mlvjj': 'm_{l#nujj}'} pars.exclude = {'Mass2j_PFCor': (66., 66. + 32.)} pars.doExclude = True pars.blind = True pars.binData = False # pars.binData = True return customizeElectrons(pars) if isElectron else \ customizeMuons(pars)
def theConfig(**kwargs): # (Nj, mH, isElectron = False, initFile = [], includeSignal = True, # MVACutOverride = None): print 'mjj',kwargs pars = Wjj2DFitterPars() # pars.MCDirectory = '/uscms_data/d2/andersj/Wjj/2012/data/Moriond2013/ReducedTrees/' pars.MCDirectory = '/eos/uscms/store/user/lnujj/RDtrees_with_8TeV_MVA/Higgs_22Oct/' if ('xrootd' in kwargs) and kwargs['xrootd']: pars.MCDirectory = 'root://cmseos:1094/' + pars.MCDirectory pars.QCDDirectory = "/uscms_data/d3/ilyao/QCD8TeV/Moriond13/" # pars.MCDirectory = "root://cmseos:1094//eos/uscms/store/user/lnujj/Moriond2013/RD_includingDiboson/" # pars.MCDirectory = "root://cmseos:1094//eos/uscms/store/user/lnujj/HCP2012METfix/ReducedTrees/" pars.DataDirectory = pars.MCDirectory pars.isElectron = kwargs['isElectron'] if ('initFile' in kwargs): pars.initialParametersFile = list(kwargs['initFile']) else: pars.initialParametersFile = [] pars.backgrounds = ['diboson', 'WpJ', 'top'] if ('includeSignal' in kwargs): pars.includeSignal = kwargs['includeSignal'] else: pars.includeSignal = False pars.signals = ['ggH', 'qqH'] pars.yieldConstraints = { 'diboson' : 0.10, 'top' : 0.07 } #pars.yieldConstraints = {} pars.constrainShapes = ['WpJ'] # if kwargs['mH'] > 200: # pars.constrainShapes = ['WpJ'] pars.Njets = kwargs['Nj'] pars.mHiggs = kwargs['mH'] modePars = mu2Pars if pars.isElectron: flavorString = 'el' if pars.Njets == 3: modePars = el3Pars else: modePars = el2Pars else: flavorString = 'mu' if pars.Njets == 3: modePars = mu3Pars else: modePars = mu2Pars pars.cuts = '(ggdevt==%i)&&(fit_status==0)&&(W_mt>30)' % pars.Njets pars.cuts = '(fit_status==0)&&(W_mt>30)' if ('MVACutOverride' in kwargs) and (kwargs['MVACutOverride'] != None): pars.cuts += '&&(%s>%.3f)' % \ (modePars[pars.mHiggs][0].replace('mu', flavorString), kwargs['MVACutOverride']) else: pars.cuts += '&&(%s>%.3f)' % \ (modePars[pars.mHiggs][0].replace('mu', flavorString), modePars[pars.mHiggs][1]) #btag veto pars.btagVeto = False for i in range(0, 6): pars.cuts += '&&((abs(JetPFCor_Eta[%i])>2.4)||' % i + \ '(JetPFCor_Pt[%i]<30.)||' % i + \ '(JetPFCor_bDiscriminatorCSV[%i]<0.244))' % i # veto boosted topology # if pars.mHiggs >= 600: # pars.cuts += '&&(W_pt<200.)' # veto vbf # pars.cuts += '&&(vbf_event==0)' # you need a files entry and a models entry for each of the fit # compoents in backgrounds and signals # the files should a list with entries like (filename, Ngen, xsec) pars.dibosonFiles = [ (pars.MCDirectory + 'RD_%s_WW_CMSSW532.root' % (flavorString), 9450414, 57.1097), (pars.MCDirectory + 'RD_%s_WZ_CMSSW532.root' % (flavorString), 10000267, 32.3161), ] pars.dibosonModels = [ modePars[pars.mHiggs][5]['diboson'][0] ] wpj_kfactor = 1.16 pars.WpJFiles = [ # (pars.MCDirectory + 'RD_%s_WpJ_CMSSW532.root' % (flavorString), # 18353019+50768992, 36257.2), (pars.MCDirectory + 'RD_%s_ZpJ_CMSSW532.root' % (flavorString), 30209426, 3503.71), # (pars.MCDirectory + 'RD_%s_W1Jets_CMSSW532.root' % (flavorString), # 19871598, 5400.0*wpj_kfactor), (pars.MCDirectory + 'RD_%s_W2Jets_CMSSW532.root' % (flavorString), 33004921, 1750.0*wpj_kfactor), (pars.MCDirectory + 'RD_%s_W3Jets_CMSSW532.root' % (flavorString), 15059503, 519.0*wpj_kfactor), # (pars.MCDirectory + 'RD_%s_W4Jets_CMSSW532.root' % (flavorString), # 12842803, 214.0*wpj_kfactor), (pars.MCDirectory + 'RD_%s_W4Jets_CMSSW532_old.root' % (flavorString), 4369420, 214.0*wpj_kfactor), ] pars.WpJModels = [ modePars[pars.mHiggs][5]['WpJ'][0] ] if (len(modePars[pars.mHiggs][5]['WpJ']) > 2): pars.WpJAuxModels = [ modePars[pars.mHiggs][5]['WpJ'][2] ] pars.topFiles = [ (pars.MCDirectory + 'RD_%s_TTbar_CMSSW532.root' % (flavorString), 6893735, 225.197), (pars.MCDirectory + 'RD_%s_STopS_Tbar_CMSSW532.root' % (flavorString), 139974, 1.75776), (pars.MCDirectory + 'RD_%s_STopS_T_CMSSW532.root' % (flavorString), 259960, 3.89394), (pars.MCDirectory + 'RD_%s_STopT_Tbar_CMSSW532.root' % (flavorString), 1935066, 30.0042), (pars.MCDirectory + 'RD_%s_STopT_T_CMSSW532.root' % (flavorString), 3758221, 55.531), (pars.MCDirectory + 'RD_%s_STopTW_Tbar_CMSSW532.root' % (flavorString), 493458, 11.1773), (pars.MCDirectory + 'RD_%s_STopTW_T_CMSSW532.root' % (flavorString), 497657, 11.1773), ] pars.topModels = [ modePars[pars.mHiggs][5]['top'][0] ] pars.QCDFracOfData = 0.05 pars.QCDFiles = [ (pars.QCDDirectory + 'RDQCD_WenuJets_Isog0p3NoElMVA_19p2invfb.root', 1,1), #The events come from the data sideband ] pars.QCDModels = [27] ngen = HWWSignalShapes.NgenHiggs(pars.mHiggs, 'ggH') pars.ggHFiles = [ (pars.MCDirectory + HWWSignalShapes.makeSignalFilename(pars.mHiggs, "ggH", pars.isElectron), ngen[0], ngen[1]*ngen[2]) ] pars.ggHModels = [ modePars[pars.mHiggs][5]['ggH'][0] ] pars.ggHdoSystMult = False if pars.mHiggs >= 400: pars.ggHInterference = True pars.ggHSystMult = 'interf_ggH' ngen = HWWSignalShapes.NgenHiggs(pars.mHiggs, 'qqH') pars.qqHFiles = [ (pars.MCDirectory + HWWSignalShapes.makeSignalFilename(pars.mHiggs, "qqH", pars.isElectron), ngen[0], ngen[1]*ngen[2]) ] pars.qqHModels = [ modePars[pars.mHiggs][5]['qqH'][0] ] pars.dibosonPlotting = {'color' : kAzure+8, 'title' : 'WW+WZ'} pars.WpJPlotting = { 'color' : kRed, 'title' : 'V+jets'} pars.topPlotting = {'color' : kGreen+2, 'title' : 'top'} pars.ggHPlotting = {'color' : kBlue, 'title' : "H(%i) #rightarrow WW" % pars.mHiggs} pars.qqHPlotting = {'color' : kBlue, 'title' : "H(%i) #rightarrow WW" % pars.mHiggs, 'visible' : True} pars.QCDPlotting = {'color' : kGray, 'title':'multijet'} pars.var = ['Mass2j_PFCor', 'fit_mlvjj'] pars.varRanges = {'Mass2j_PFCor': (13, 50., 154., []), 'fit_mlvjj': (modePars[pars.mHiggs][4]*10, modePars[pars.mHiggs][2], modePars[pars.mHiggs][3], []) } pars.plotRanges = {'Mass2j_PFCor': (13, 50., 154., []), 'fit_mlvjj': (modePars[pars.mHiggs][4], modePars[pars.mHiggs][2], modePars[pars.mHiggs][3], []) } pars.varTitles = {'Mass2j_PFCor': 'm_{jj}', 'fit_mlvjj' : 'm_{l#nujj}' } pars.exclude = {'Mass2j_PFCor' : (66., 66.+32.)} pars.doExclude = True pars.blind = True pars.binData = False # pars.binData = True return customizeElectrons(pars) if pars.isElectron else \ customizeMuons(pars)
event.getByLabel(label, handle) genParts = handle.product() if (eventN % 100 == 0): print "Record:", eventN, print "Run:", event.object().id().run(), print "event:", event.object().id().event() for particle in genParts: if (abs(particle.pdgId()) == 25) and (particle.status() == 3): dauMode = abs(particle.daughter(0).pdgId()) if not (dauMode in decayCnts): decayCnts[dauMode] = 0 decayCnts[dauMode] += 1 # printParticleDecayTree(particle, statusCutoff = 3) Higgs_mass[0] = particle.mass() Event_wgt[0] = HWWSignalShapes.HiggsCPWeight( opts.mH, particle.mass()) sumWgts += Event_wgt[0] # Running_wgt[0] = HWWSignalShapes.runningWidthWeight(350, # particle.mass()) # sumRunning += Running_wgt[0] break outTree.Fill() if eventN >= 10000: break print decayCnts #print "n events:",eventN print "avg CP weight:", sumWgts / (eventN + 1) # print "avg running width weight:", sumRunning/(eventN+1)
## assert(False) mf4 = fitter4.stackedPlot(False, RooWjjMjjFitter.mlnujj) mf4.SetName("Mlvjj_Stacked") ## sf4 = fitter4.residualPlot(mf4, "h_background", "dibosonPdf", False) # pf4 = fitter4.residualPlot(mf4, "h_total", "", True) pf4 = pulls.createPull(mf4.getHist('theData'), mf4.getCurve('h_total')) pf4.SetName("Mlvjj_Pull") lf4 = fitter4.stackedPlot(True, RooWjjMjjFitter.mlnujj) lf4.SetName("Mlvjj_log") fitUtils = RooWjjFitterUtils(pars4) iwt = 0 if (opts.mH >= 500): iwt = 1 sigHists = HWWSignalShapes.GenHiggsHists(pars4, opts.mH, fitUtils, iwt = iwt) extraFactor = 2. otherdata = HWWSignalShapes.NgenHiggs(opts.mH, 'HWW') SigVisual = TH1D(sigHists['HWW']) SigVisual.Print() SigVisual.SetName('SigVisual') SigVisual.SetLineColor(kBlue) SigVisual.SetLineWidth(3) SigVisual.Scale(pars4.intLumi*extraFactor*otherdata[1]*otherdata[2]/2.) SigVisual.Print() SigVisualLog = TH1D(SigVisual) SigVisualLog.SetName("SigVisualLog") c4body = TCanvas('c4body', '4 body stacked') mf4.addTH1(SigVisual, "hist")
pars4.wHiggs = HWWSignalShapes.HiggsWidth[mHmorph] # fitter4 = RooWjjMjjFitter(pars4) higgsModes = HWWSignalShapes.modes morphedHists = [] utils = RooWjjFitterUtils(pars4) print 'basis Higgs', mHbasis, 'morphing with Higgs', mHmorph, print 'to make Higgs', opts.mH iwt = 0 if (opts.mH >= 500): iwt = 1 higgsHists = HWWSignalShapes.GenHiggsHists(pars4, mHmorph, utils, iwt=iwt) fbasis = TFile(opts.basisFile) # fmorph = TFile(opts.morphFile) gROOT.cd() for higgsMode in higgsModes: basisName = '%s%i_%s_shape' % (higgsMode, mHbasis, modeString) morphName = '%s%i_%s_shape' % (higgsMode, mHmorph, modeString) print 'basis hist name:', basisName, 'morph hist name:', morphName histbasis = scaleUnwidth(fbasis.Get(basisName)) histmorph = scaleUnwidth(higgsHists[higgsMode])
if fitterPars.includeMuons and fitterPars.includeElectrons: modeString = '' elif fitterPars.includeMuons: modeString = 'Muon' elif fitterPars.includeElectrons: modeString = 'Electron' else: modeString = '' pars4 = config.the4BodyConfig(fitterPars, mHbasis, opts.syst, opts.alpha) # fitter4 = RooWjjMjjFitter(pars4) (halfGen, otherdata) = HWWSignalShapes.NgenHiggs(opts.mH, 'HWW') SignalHist = HWWSignalShapes.makeHiggsHist(opts.mH, pars4, 'HWW') SignalHist.Scale(otherdata[1]*otherdata[2]*pars4.intLumi* \ opts.factor/otherdata[0]) print "signal only" SignalHist.Print() if opts.debug: print 'drawing signal histogram...' SignalHist.Draw() gPad.Update() gPad.WaitPrimitive() basisFilename = 'H%i_%s_%iJets_Fit_Shapes.root' % (mHbasis, modeString, opts.Nj) print 'opening', basisFilename bfile = TFile(basisFilename) bgCurve = bfile.Get('h_total')
def theConfig(Nj, mH, isElectron = False, initFile = [], includeSignal = True): pars = Wjj2DFitterPars() pars.MCDirectory = '/uscms_data/d2/andersj/Wjj/2012/data/Moriond2013/ReducedTrees/' # pars.MCDirectory = "root://cmseos:1094//eos/uscms/store/user/lnujj/Moriond2013/RD_includingDiboson/" # pars.MCDirectory = "root://cmseos:1094//eos/uscms/store/user/lnujj/HCP2012METfix/ReducedTrees/" pars.DataDirectory = '/uscms_data/d2/andersj/Wjj/2012/data/Moriond2013/HWWTrees/' pars.isElectron = isElectron pars.initialParametersFile = initFile pars.backgrounds = ['diboson', 'WpJ', 'top'] pars.includeSignal = includeSignal pars.signals = ['ggH', 'qqH'] pars.yieldConstraints = { 'diboson' : 0.034, 'top' : 0.07 } #pars.yieldConstraints = {} pars.constrainShapes = [] pars.Njets = Nj pars.mHiggs = mH modePars = mu2Pars if isElectron: flavorString = 'el' if Nj == 3: modePars = el3Pars else: modePars = el2Pars else: flavorString = 'mu' if Nj == 3: modePars = mu3Pars else: modePars = mu2Pars pars.cuts = '(ggdevt==%i)&&(fit_status==0)&&(W_mt>30)' % Nj pars.cuts += '&&(%s>%.3f)' % (modePars[mH][0], modePars[mH][1]) # pars.cuts = '(fit_status==0)&&(W_mt>30)' + \ # '&&(%s>%.3f)' % (modePars[mH][0], modePars[mH][1]) #btag veto pars.btagVeto = False # for i in range(0, 6): # pars.cuts += '&&((abs(JetPFCor_Eta[%i])>2.4)||' % i + \ # '(JetPFCor_Pt[%i]<30.)||' % i + \ # '(JetPFCor_bDiscriminatorCSV[%i]<0.679))' % i # veto boosted topology # if mH >= 600: # pars.cuts += '&&(W_pt<200.)' # veto vbf pars.cuts += '&&(vbf_event==0)' # you need a files entry and a models entry for each of the fit # compoents in backgrounds and signals # the files should a list with entries like (filename, Ngen, xsec) pars.dibosonFiles = [ (pars.MCDirectory + 'RD_%s_WW_CMSSW532.root' % (flavorString), 9450414, 57.1097), (pars.MCDirectory + 'RD_%s_WZ_CMSSW532.root' % (flavorString), 10000267, 32.3161), ] pars.dibosonModels = modePars[mH][5]['diboson'] pars.WpJFiles = [ (pars.MCDirectory + 'RD_%s_WpJ_CMSSW532.root' % (flavorString), 18353019+50768992, 36257.2), (pars.MCDirectory + 'RD_%s_ZpJ_CMSSW532.root' % (flavorString), 30209426, 3503.71), ] pars.WpJModels = modePars[mH][5]['WpJ'] pars.topFiles = [ (pars.MCDirectory + 'RD_%s_TTbar_CMSSW532.root' % (flavorString), 6893735, 225.197), (pars.MCDirectory + 'RD_%s_STopS_Tbar_CMSSW532.root' % (flavorString), 139974, 1.75776), (pars.MCDirectory + 'RD_%s_STopS_T_CMSSW532.root' % (flavorString), 259960, 3.89394), (pars.MCDirectory + 'RD_%s_STopT_Tbar_CMSSW532.root' % (flavorString), 1935066, 30.0042), (pars.MCDirectory + 'RD_%s_STopT_T_CMSSW532.root' % (flavorString), 3758221, 55.531), (pars.MCDirectory + 'RD_%s_STopTW_Tbar_CMSSW532.root' % (flavorString), 493458, 11.1773), (pars.MCDirectory + 'RD_%s_STopTW_T_CMSSW532.root' % (flavorString), 497657, 11.1773), ] pars.topModels = modePars[mH][5]['top'] ngen = HWWSignalShapes.NgenHiggs(mH, 'ggH') pars.ggHFiles = [ (pars.MCDirectory + HWWSignalShapes.makeSignalFilename(mH, "ggH", isElectron), ngen[0], ngen[1]*ngen[2]) ] pars.ggHModels = modePars[mH][5]['ggH'] if pars.mHiggs >= 400: pars.ggHInterference = True ngen = HWWSignalShapes.NgenHiggs(mH, 'qqH') pars.qqHFiles = [ (pars.MCDirectory + HWWSignalShapes.makeSignalFilename(mH, "qqH", isElectron), ngen[0], ngen[1]*ngen[2]) ] pars.qqHModels = modePars[mH][5]['qqH'] pars.dibosonPlotting = {'color' : kAzure+8, 'title' : 'WW+WZ'} pars.WpJPlotting = { 'color' : kRed, 'title' : 'V+jets'} pars.topPlotting = {'color' : kGreen+2, 'title' : 'top'} pars.ggHPlotting = {'color' : kBlue, 'title' : "H(%i) #rightarrow WW" % mH} pars.qqHPlotting = {'color' : kBlue, 'title' : "H(%i) #rightarrow WW" % mH, 'visible' : True} pars.var = ['Mass2j_PFCor', 'fit_mlvjj'] pars.varRanges = {'Mass2j_PFCor': (18, 50., 194., []), 'fit_mlvjj': (modePars[mH][4], modePars[mH][2], modePars[mH][3], []) } pars.varTitles = {'Mass2j_PFCor': 'm_{jj}', 'fit_mlvjj' : 'm_{l#nujj}' } pars.exclude = {} pars.blind = False # pars.v1binEdges = [50, 55.,60.,65.,70.,75.,80.,85.,95., # 105.,115.,125.,135.,150.,165.,180.,200.] # pars.v1nbins = len(pars.v1binEdges)-1 pars.binData = False # pars.binData = True return customizeElectrons(pars) if isElectron else \ customizeMuons(pars)
def theConfig(Nj, mH, isElectron=False, initFile=[], includeSignal=True): pars = Wjj2DFitterPars() pars.MCDirectory = "/uscms_data/d2/andersj/Wjj/2012/data/Moriond2013/ReducedTrees/" pars.QCDDirectory = "/uscms_data/d3/ilyao/QCD8TeV/Moriond13/" # pars.MCDirectory = "root://cmseos:1094//eos/uscms/store/user/lnujj/Moriond2013/RD_includingDiboson/" # pars.MCDirectory = "root://cmseos:1094//eos/uscms/store/user/lnujj/HCP2012METfix/ReducedTrees/" pars.DataDirectory = "/uscms_data/d2/andersj/Wjj/2012/data/Moriond2013/HWWTrees/" pars.isElectron = isElectron pars.initialParametersFile = initFile pars.backgrounds = ["diboson", "WpJ", "top"] pars.includeSignal = includeSignal pars.signals = ["ggH", "qqH"] pars.yieldConstraints = {"diboson": 0.034, "top": 0.07} # pars.yieldConstraints = {} pars.constrainShapes = ["WpJ"] if mH > 200: pars.constrainShapes = ["WpJ"] pars.Njets = Nj pars.mHiggs = mH modePars = mu2Pars if isElectron: flavorString = "el" if Nj == 3: modePars = el3Pars else: modePars = el2Pars else: flavorString = "mu" if Nj == 3: modePars = mu3Pars else: modePars = mu2Pars pars.cuts = "(ggdevt==%i)&&(fit_status==0)&&(W_mt>30)" % Nj pars.cuts = "(fit_status==0)&&(W_mt>30)" pars.cuts += "&&(%s>%.3f)" % (modePars[mH][0], modePars[mH][1]) # btag veto pars.btagVeto = False for i in range(0, 6): pars.cuts += ( "&&((abs(JetPFCor_Eta[%i])>2.4)||" % i + "(JetPFCor_Pt[%i]<30.)||" % i + "(JetPFCor_bDiscriminatorCSV[%i]<0.244))" % i ) # veto boosted topology # if mH >= 600: # pars.cuts += '&&(W_pt<200.)' # veto vbf pars.cuts += "&&(vbf_event==0)" # you need a files entry and a models entry for each of the fit # compoents in backgrounds and signals # the files should a list with entries like (filename, Ngen, xsec) pars.dibosonFiles = [ (pars.MCDirectory + "RD_%s_WW_CMSSW532.root" % (flavorString), 9450414, 57.1097), (pars.MCDirectory + "RD_%s_WZ_CMSSW532.root" % (flavorString), 10000267, 32.3161), ] pars.dibosonModels = [modePars[mH][5]["diboson"][0]] wpj_kfactor = 1.16 pars.WpJFiles = [ # (pars.MCDirectory + 'RD_%s_WpJ_CMSSW532.root' % (flavorString), # 18353019+50768992, 36257.2), (pars.MCDirectory + "RD_%s_ZpJ_CMSSW532.root" % (flavorString), 30209426, 3503.71), # (pars.MCDirectory + 'RD_%s_W1Jets_CMSSW532.root' % (flavorString), # 19871598, 5400.0*wpj_kfactor), (pars.MCDirectory + "RD_%s_W2Jets_CMSSW532.root" % (flavorString), 33004921, 1750.0 * wpj_kfactor), (pars.MCDirectory + "RD_%s_W3Jets_CMSSW532.root" % (flavorString), 15059503, 519.0 * wpj_kfactor), (pars.MCDirectory + "RD_%s_W4Jets_CMSSW532.root" % (flavorString), 12842803, 214.0 * wpj_kfactor), ] pars.WpJModels = [modePars[mH][5]["WpJ"][0]] pars.topFiles = [ (pars.MCDirectory + "RD_%s_TTbar_CMSSW532.root" % (flavorString), 6893735, 225.197), (pars.MCDirectory + "RD_%s_STopS_Tbar_CMSSW532.root" % (flavorString), 139974, 1.75776), (pars.MCDirectory + "RD_%s_STopS_T_CMSSW532.root" % (flavorString), 259960, 3.89394), (pars.MCDirectory + "RD_%s_STopT_Tbar_CMSSW532.root" % (flavorString), 1935066, 30.0042), (pars.MCDirectory + "RD_%s_STopT_T_CMSSW532.root" % (flavorString), 3758221, 55.531), (pars.MCDirectory + "RD_%s_STopTW_Tbar_CMSSW532.root" % (flavorString), 493458, 11.1773), (pars.MCDirectory + "RD_%s_STopTW_T_CMSSW532.root" % (flavorString), 497657, 11.1773), ] pars.topModels = [modePars[mH][5]["top"][0]] pars.QCDFracOfData = 0.05 pars.QCDFiles = [ ( pars.QCDDirectory + "RDQCD_WenuJets_Isog0p3NoElMVA_19p2invfb.root", 1, 1, ) # The events come from the data sideband ] pars.QCDModels = [27] ngen = HWWSignalShapes.NgenHiggs(mH, "ggH") pars.ggHFiles = [ (pars.MCDirectory + HWWSignalShapes.makeSignalFilename(mH, "ggH", isElectron), ngen[0], ngen[1] * ngen[2]) ] pars.ggHModels = [modePars[mH][5]["ggH"][0]] if pars.mHiggs >= 400: pars.ggHInterference = True ngen = HWWSignalShapes.NgenHiggs(mH, "qqH") pars.qqHFiles = [ (pars.MCDirectory + HWWSignalShapes.makeSignalFilename(mH, "qqH", isElectron), ngen[0], ngen[1] * ngen[2]) ] pars.qqHModels = [modePars[mH][5]["qqH"][0]] pars.dibosonPlotting = {"color": kAzure + 8, "title": "WW+WZ"} pars.WpJPlotting = {"color": kRed, "title": "V+jets"} pars.topPlotting = {"color": kGreen + 2, "title": "top"} pars.ggHPlotting = {"color": kBlue, "title": "H(%i) #rightarrow WW" % mH} pars.qqHPlotting = {"color": kBlue, "title": "H(%i) #rightarrow WW" % mH, "visible": True} pars.QCDPlotting = {"color": kGray, "title": "multijet"} pars.var = ["Mass2j_PFCor", "fit_mlvjj"] pars.varRanges = { "Mass2j_PFCor": (12, 50.0, 146.0, []), "fit_mlvjj": (modePars[mH][4] * 10, modePars[mH][2], modePars[mH][3], []), } pars.plotRanges = { "Mass2j_PFCor": (12, 50.0, 146.0, []), "fit_mlvjj": (modePars[mH][4], modePars[mH][2], modePars[mH][3], []), } pars.varTitles = {"Mass2j_PFCor": "m_{jj}", "fit_mlvjj": "m_{l#nujj}"} pars.exclude = {"Mass2j_PFCor": (66.0, 66.0 + 32.0)} pars.doExclude = True pars.blind = True pars.binData = False # pars.binData = True return customizeElectrons(pars) if isElectron else customizeMuons(pars)
if opts.ParamWpJ < 0: fitterPars.smoothingOrder = 0 if fitterPars.includeMuons and fitterPars.includeElectrons: modeString = '' elif fitterPars.includeMuons: modeString = 'Muon' elif fitterPars.includeElectrons: modeString = 'Electron' else: modeString = '' pars4 = config.the4BodyConfig(fitterPars, mHbasis, opts.syst, opts.alpha) # fitter4 = RooWjjMjjFitter(pars4) (halfGen, otherdata) = HWWSignalShapes.NgenHiggs(opts.mH, 'HWW') SignalHist = HWWSignalShapes.makeHiggsHist(opts.mH, pars4, 'HWW') SignalHist.Scale(otherdata[1]*otherdata[2]*pars4.intLumi* \ opts.factor/otherdata[0]) print "signal only" SignalHist.Print() if opts.debug: print 'drawing signal histogram...' SignalHist.Draw() gPad.Update() gPad.WaitPrimitive() basisFilename = 'H%i_%s_%iJets_Fit_Shapes.root' % (mHbasis, modeString, opts.Nj) print 'opening', basisFilename bfile = TFile(basisFilename)