Пример #1
0
    if ext.find("root") == -1:
        continue

    mass = float(fname.split('_')[-1])

    samples[mass] = fname

    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)])
Пример #2
0
#create the W+jets plotters
wjPlotters=[]

for sample in ["WJetsToLNu_HT1200to2500","WJetsToLNu_HT2500toInf","WJetsToLNu_HT400to600","WJetsToLNu_HT600to800","WJetsToLNu_HT800to1200",'WJetsToLNu_HT100to200','WJetsToLNu_HT200to400']:
    wjPlotters.append(TreePlotter('samples/'+sample+'.root','tree'))
    wjPlotters[-1].setupFromFile('samples/'+sample+'.pck')
    wjPlotters[-1].addCorrectionFactor('xsec','tree')
    wjPlotters[-1].addCorrectionFactor('genWeight','tree')
    wjPlotters[-1].addCorrectionFactor('puWeight','tree')


WJets = MergedPlotter(wjPlotters)

tt=TreePlotter('samples/TTJets.root','tree')
tt.setupFromFile('samples/TTJets.pck')
tt.addCorrectionFactor('xsec','tree')
tt.addCorrectionFactor('genWeight','tree')
tt.addCorrectionFactor('puWeight','tree')




#create the Z+jets plotters

zPlotters=[]
for sample in ['DYJetsToLL_M50_HT100to200','DYJetsToLL_M50_HT200to400','DYJetsToLL_M50_HT400to600','DYJetsToLL_M50_HT600toInf']:  
    zPlotters.append(TreePlotter('samples/'+sample+'.root','tree'))
    zPlotters[-1].setupFromFile('samples/'+sample+'.pck')
    zPlotters[-1].addCorrectionFactor('xsec','tree')
    zPlotters[-1].addCorrectionFactor('genWeight','tree')
Пример #3
0
import ROOT

from CMGTools.VVResonances.plotting.TreePlotter import TreePlotter
from CMGTools.VVResonances.plotting.MergedPlotter import MergedPlotter
from CMGTools.VVResonances.plotting.StackPlotter import StackPlotter
 

#create the W+jets plotters
wjPlotters=[]


WJets = TreePlotter('samples/WJetsToLNu_50ns.root','tree')
WJets.setupFromFile('samples/WJetsToLNu_50ns.pck')
WJets.addCorrectionFactor('xsec','xsec',0.0,'lnN')
WJets.addCorrectionFactor('genWeight','genWeight',0.0,'lnN')
WJets.setFillProperties(1001,ROOT.kAzure-9)



TTJets = TreePlotter('samples/TTJets_50ns.root','tree')
TTJets.setupFromFile('samples/TTJets_50ns.pck')
TTJets.addCorrectionFactor('xsec','xsec',0.0,'lnN')
TTJets.addCorrectionFactor('genWeight','genWeight',0.0,'lnN')
TTJets.setFillProperties(1001,ROOT.kGreen-5)



qcdPlotters=[]

for sample in [
"QCD_Pt1000to1400_50ns","QCD_Pt120to170_50ns","QCD_Pt1400to1800_50ns","QCD_Pt170to300_50ns","QCD_Pt1800to2400_50ns","QCD_Pt2400to3200_50ns","QCD_Pt300to470_50ns","QCD_Pt3200_50ns","QCD_Pt470to600_50ns","QCD_Pt600to800_50ns","QCD_Pt800to1000_50ns","QCD_Pt80to120_50ns"
Пример #4
0
import ROOT

from CMGTools.VVResonances.plotting.TreePlotter import TreePlotter
from CMGTools.VVResonances.plotting.MergedPlotter import MergedPlotter
from CMGTools.VVResonances.plotting.StackPlotter import StackPlotter

#create the W+jets plotters
wjPlotters = []

WJets = TreePlotter('samples/WJetsToLNu_50ns.root', 'tree')
WJets.setupFromFile('samples/WJetsToLNu_50ns.pck')
WJets.addCorrectionFactor('xsec', 'xsec', 0.0, 'lnN')
WJets.addCorrectionFactor('genWeight', 'genWeight', 0.0, 'lnN')
WJets.setFillProperties(1001, ROOT.kAzure - 9)

TTJets = TreePlotter('samples/TTJets_50ns.root', 'tree')
TTJets.setupFromFile('samples/TTJets_50ns.pck')
TTJets.addCorrectionFactor('xsec', 'xsec', 0.0, 'lnN')
TTJets.addCorrectionFactor('genWeight', 'genWeight', 0.0, 'lnN')
TTJets.setFillProperties(1001, ROOT.kGreen - 5)

qcdPlotters = []

for sample in [
        "QCD_Pt1000to1400_50ns", "QCD_Pt120to170_50ns",
        "QCD_Pt1400to1800_50ns", "QCD_Pt170to300_50ns",
        "QCD_Pt1800to2400_50ns", "QCD_Pt2400to3200_50ns",
        "QCD_Pt300to470_50ns", "QCD_Pt3200_50ns", "QCD_Pt470to600_50ns",
        "QCD_Pt600to800_50ns", "QCD_Pt800to1000_50ns", "QCD_Pt80to120_50ns"
]:
    qcdPlotters.append(TreePlotter('samples/' + sample + '.root', 'tree'))
Пример #5
0
        

    samples[mass] = fname

    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()):
    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)])
Пример #6
0
from CMGTools.VVResonances.plotting.TreePlotter import TreePlotter
from CMGTools.VVResonances.plotting.MergedPlotter import MergedPlotter
from CMGTools.VVResonances.plotting.StackPlotter import StackPlotter

#create the W+jets plotters
wjPlotters = []

for sample in [
        'WJetsToLNu_HT100to200', 'WJetsToLNu_HT200to400',
        'WJetsToLNu_HT400to600', 'WJetsToLNu_HT600toInf'
]:
    wjPlotters.append(TreePlotter('samples/' + sample + '.root', 'tree'))
    wjPlotters[-1].setupFromFile('samples/' + sample + '.pck')
    wjPlotters[-1].addCorrectionFactor('xsec', 'xsec', 0.0, 'lnN')

WJets = MergedPlotter(wjPlotters)

WJets.setFillProperties(1001, ROOT.kAzure - 9)

RSGWWLNuQQ = TreePlotter('samples/RSGravToWWToLNQQ_2000.root', 'tree')
RSGWWLNuQQ.setupFromFile('samples/RSGravToWWToLNQQ_2000.pck')
RSGWWLNuQQ.setFillProperties(0, ROOT.kWhite)
RSGWWLNuQQ.setLineProperties(1, ROOT.kOrange + 10, 3)
#RSGWWLNuQQ..addCorrectionFactor('xsec',0.001,0.0,'lnN')

#Stack
vvStack = StackPlotter()
vvStack.addPlotter(WJets, "W+jets", "W+Jets", "background")
vvStack.addPlotter(RSGWWLNuQQ, "RSG2000", "RSGWW #rightarrow l#nu QQ",
                   "signal")
Пример #7
0
        "WJetsToLNu_HT400to600", "WJetsToLNu_HT600to800",
        "WJetsToLNu_HT800to1200", 'WJetsToLNu_HT100to200',
        'WJetsToLNu_HT200to400'
]:
    #for sample in ["WJetsToLNu_HT1200to2500","WJetsToLNu_HT2500toInf","WJetsToLNu_HT400to600","WJetsToLNu_HT600to800","WJetsToLNu_HT800to1200",'WJetsToLNu_HT100to200','WJetsToLNu_HT200to400']:
    wjPlotters.append(TreePlotter('samples/' + sample + '.root', 'tree'))
    wjPlotters[-1].setupFromFile('samples/' + sample + '.pck')
    wjPlotters[-1].addCorrectionFactor('xsec', 'tree')
    wjPlotters[-1].addCorrectionFactor('genWeight', 'tree')
    wjPlotters[-1].addCorrectionFactor('puWeight', 'tree')
#    wjPlotters[-1].addCorrectionFactor('0.82','flat')

WJets = MergedPlotter(wjPlotters)

ttO = TreePlotter('samples/TTJets.root', 'tree')
ttO.setupFromFile('samples/TTJets.pck')
ttO.addCorrectionFactor('xsec', 'tree')
ttO.addCorrectionFactor('genWeight', 'tree')
ttO.addCorrectionFactor('puWeight', 'tree')
ttO.addCorrectionFactor(
    '(!(lnujj_l2_mergedVTruth==1&&lnujj_l2_nearestBDRTruth>0.8))', 'tree')

ttM = TreePlotter('samples/TTJets.root', 'tree')
ttM.setupFromFile('samples/TTJets.pck')
ttM.addCorrectionFactor('xsec', 'tree')
ttM.addCorrectionFactor('genWeight', 'tree')
ttM.addCorrectionFactor('puWeight', 'tree')
ttM.addCorrectionFactor(
    '(lnujj_l2_mergedVTruth==1&&lnujj_l2_nearestBDRTruth>0.8)', 'tree')

qcdPlotters = []
Пример #8
0
from CMGTools.VVResonances.plotting.StackPlotter import StackPlotter
 

#create the W+jets plotters
wjPlotters=[]


for sample in ['WJetsToLNu_HT100to200','WJetsToLNu_HT200to400','WJetsToLNu_HT400to600','WJetsToLNu_HT600toInf']:
    wjPlotters.append(TreePlotter('samples/'+sample+'.root','tree'))
    wjPlotters[-1].setupFromFile('samples/'+sample+'.pck')
    wjPlotters[-1].addCorrectionFactor('xsec','xsec',0.0,'lnN')
    wjPlotters[-1].addCorrectionFactor('genWeight','genWeight',0.0,'lnN')


WJets = MergedPlotter(wjPlotters)


WJets.setFillProperties(1001,ROOT.kAzure-9)

RSGWWLNuQQ = TreePlotter('samples/RSGravToWWToLNQQ_kMpl01_2500.root','tree')
RSGWWLNuQQ.setupFromFile('samples/RSGravToWWToLNQQ_kMpl01_2500.pck')
RSGWWLNuQQ.setFillProperties(0,ROOT.kWhite)
RSGWWLNuQQ.setLineProperties(1,ROOT.kOrange+10,3)
RSGWWLNuQQ.addCorrectionFactor('xsec',0.001,0.0,'lnN')


#Stack
vvStack = StackPlotter()
vvStack.addPlotter(WJets,"W+jets","W+Jets","background")
vvStack.addPlotter(RSGWWLNuQQ,"RSG2000","RSGWW #rightarrow l#nu QQ","signal")
Пример #9
0
for sample in [
        "WJetsToLNu_HT1200to2500", "WJetsToLNu_HT2500toInf",
        "WJetsToLNu_HT400to600", "WJetsToLNu_HT600to800",
        "WJetsToLNu_HT800to1200", 'WJetsToLNu_HT100to200',
        'WJetsToLNu_HT200to400'
]:
    wjPlotters.append(TreePlotter('samples/' + sample + '.root', 'tree'))
    wjPlotters[-1].setupFromFile('samples/' + sample + '.pck')
    wjPlotters[-1].addCorrectionFactor('xsec', 'tree')
    wjPlotters[-1].addCorrectionFactor('genWeight', 'tree')
    wjPlotters[-1].addCorrectionFactor('puWeight', 'tree')

WJets = MergedPlotter(wjPlotters)

tt = TreePlotter('samples/TTJets.root', 'tree')
tt.setupFromFile('samples/TTJets.pck')
tt.addCorrectionFactor('xsec', 'tree')
tt.addCorrectionFactor('genWeight', 'tree')
tt.addCorrectionFactor('puWeight', 'tree')

#create the Z+jets plotters

zPlotters = []
for sample in [
        'DYJetsToLL_M50_HT100to200', 'DYJetsToLL_M50_HT200to400',
        'DYJetsToLL_M50_HT400to600', 'DYJetsToLL_M50_HT600toInf'
]:
    zPlotters.append(TreePlotter('samples/' + sample + '.root', 'tree'))
    zPlotters[-1].setupFromFile('samples/' + sample + '.pck')
    zPlotters[-1].addCorrectionFactor('xsec', 'tree')
    zPlotters[-1].addCorrectionFactor('genWeight', 'tree')
Пример #10
0
from CMGTools.VVResonances.plotting.MergedPlotter import MergedPlotter
from CMGTools.VVResonances.plotting.StackPlotter import StackPlotter

#create the W+jets plotters
wjPlotters = []

for sample in [
        'WJetsToLNu_HT100to200', 'WJetsToLNu_HT200to400',
        'WJetsToLNu_HT400to600', 'WJetsToLNu_HT600toInf'
]:
    wjPlotters.append(TreePlotter('samples/' + sample + '.root', 'tree'))
    wjPlotters[-1].setupFromFile('samples/' + sample + '.pck')
    wjPlotters[-1].addCorrectionFactor('xsec', 'xsec', 0.0, 'lnN')
    wjPlotters[-1].addCorrectionFactor('genWeight', 'genWeight', 0.0, 'lnN')

WJets = MergedPlotter(wjPlotters)

WJets.setFillProperties(1001, ROOT.kAzure - 9)

RSGWWLNuQQ = TreePlotter('samples/RSGravToWWToLNQQ_kMpl01_2500.root', 'tree')
RSGWWLNuQQ.setupFromFile('samples/RSGravToWWToLNQQ_kMpl01_2500.pck')
RSGWWLNuQQ.setFillProperties(0, ROOT.kWhite)
RSGWWLNuQQ.setLineProperties(1, ROOT.kOrange + 10, 3)
RSGWWLNuQQ.addCorrectionFactor('xsec', 0.001, 0.0, 'lnN')

#Stack
vvStack = StackPlotter()
vvStack.addPlotter(WJets, "W+jets", "W+Jets", "background")
vvStack.addPlotter(RSGWWLNuQQ, "RSG2000", "RSGWW #rightarrow l#nu QQ",
                   "signal")