Esempio n. 1
0
def main():
    # Create all datasets from a multicrab task
    datasets = dataset.getDatasetsFromMulticrabCfg(counters=counters)
    datasets.updateNAllEventsToPUWeighted()

    # Read integrated luminosities of data datasets from lumi.json
    datasets.loadLuminosities()

    # Default merging nad ordering of data and MC datasets
    # All data datasets to "Data"
    # All QCD datasets to "QCD"
    # All single top datasets to "SingleTop"
    # WW, WZ, ZZ to "Diboson"
    plots.mergeRenameReorderForDataMC(datasets)

    # Set the signal cross sections to a given BR(t->H), BR(h->taunu)

    #xsect.setHplusCrossSectionsToBR(datasets, br_tH=0.2, br_Htaunu=1)
    # LandS assumes ttbar cross section  for both HW and HH
    #xsect.setHplusCrossSectionsToBR(datasets, br_tH=0.05, br_Htaunu=1)

    # LandS expects that HW and HH are normalized to top cross section

    xsect.setHplusCrossSectionsToTop(datasets)

    # Create data-MC comparison plot to get the proper normalization
    # easily
    mt = plots.DataMCPlot(datasets, analysis+"/transverseMassBeforeFakeMet")

    # Rebin to have the agreed 10 GeV binning
    mt.histoMgr.forEachHisto(lambda h: h.getRootHisto().Rebin(10))

    # Create the output ROOT file
    f = ROOT.TFile.Open(outputFile, "RECREATE")
    
    # Add the histograms of the wanted datasets to the tree
    for datasetName, outputName in [
        ("Data", "data"),
        ("TTToHplusBWB_M100", "hw_100"),
        ("TTToHplusBHminusB_M100", "hh_100"),
        ("TTToHplusBWB_M120", "hw_120"),
        ("TTToHplusBHminusB_M120", "hh_120"),
        ("TTToHplusBWB_M160", "hw_160"),
        ("TTToHplusBHminusB_M160", "hh_160")
        ]:
        th1 = mt.histoMgr.getHisto(datasetName).getRootHisto().Clone("mt_"+outputName)
        th1.SetDirectory(f)
        th1.Write()

    # Write and close the file
    f.Close()

    print
    print "Wrote transverse mass histograms to %s for LandS" % outputFile
Esempio n. 2
0
def main():
    # Create all datasets from a multicrab task
    datasets = dataset.getDatasetsFromMulticrabCfg(counters=counters)
    datasets.updateNAllEventsToPUWeighted()

    # Read integrated luminosities of data datasets from lumi.json
    datasets.loadLuminosities()

    # Default merging nad ordering of data and MC datasets
    # All data datasets to "Data"
    # All QCD datasets to "QCD"
    # All single top datasets to "SingleTop"
    # WW, WZ, ZZ to "Diboson"
    plots.mergeRenameReorderForDataMC(datasets)

    # Set the signal cross sections to a given BR(t->H), BR(h->taunu)

    #xsect.setHplusCrossSectionsToBR(datasets, br_tH=0.2, br_Htaunu=1)
    # LandS assumes ttbar cross section  for both HW and HH
    #xsect.setHplusCrossSectionsToBR(datasets, br_tH=0.05, br_Htaunu=1)

    # LandS expects that HW and HH are normalized to top cross section

    xsect.setHplusCrossSectionsToTop(datasets)

    # Create data-MC comparison plot to get the proper normalization
    # easily
    mt = plots.DataMCPlot(datasets, analysis + "/transverseMassBeforeFakeMet")

    # Rebin to have the agreed 10 GeV binning
    mt.histoMgr.forEachHisto(lambda h: h.getRootHisto().Rebin(10))

    # Create the output ROOT file
    f = ROOT.TFile.Open(outputFile, "RECREATE")

    # Add the histograms of the wanted datasets to the tree
    for datasetName, outputName in [("Data", "data"),
                                    ("TTToHplusBWB_M100", "hw_100"),
                                    ("TTToHplusBHminusB_M100", "hh_100"),
                                    ("TTToHplusBWB_M120", "hw_120"),
                                    ("TTToHplusBHminusB_M120", "hh_120"),
                                    ("TTToHplusBWB_M160", "hw_160"),
                                    ("TTToHplusBHminusB_M160", "hh_160")]:
        th1 = mt.histoMgr.getHisto(datasetName).getRootHisto().Clone(
            "mt_" + outputName)
        th1.SetDirectory(f)
        th1.Write()

    # Write and close the file
    f.Close()

    print
    print "Wrote transverse mass histograms to %s for LandS" % outputFile
def main():
    # Read the datasets
    datasets = dataset.getDatasetsFromMulticrabCfg(counters=counters)
    datasets.loadLuminosities()

    # Take QCD from data
    datasetsQCD = None
    if QCDfromData:
        datasetsQCD = dataset.getDatasetsFromMulticrabCfg(
            cfgfile=
            "/home/rkinnune/signalAnalysis/CMSSW_4_2_8_patch2/src/HiggsAnalysis/HeavyChHiggsToTauNu/test/multicrab_111123_132128/multicrab.cfg",
            counters=counters)
        datasetsQCD.loadLuminosities()
        datasetsQCD.mergeData()
        datasetsQCD.remove(datasetsQCD.getMCDatasetNames())
        datasetsQCD.rename("Data", "QCD")

#Rtau =0
#    datasetsSignal = dataset.getDatasetsFromMulticrabCfg(cfgfile="/home/rkinnune/signalAnalysis/CMSSW_4_2_5/src/HiggsAnalysis/HeavyChHiggsToTauNu/test/multicrab_110804_104313/multicrab.cfg", counters=counters)

#    datasetsSignal.selectAndReorder(["HplusTB_M200_Summer11"])
#    datasetsSignal = dataset.getDatasetsFromMulticrabCfg(cfgfile="/home/rkinnune/signalAnalysis/CMSSW_4_2_4_patch1/src/HiggsAnalysis/HeavyChHiggsToTauNu/test/multicrab_110622_112321/multicrab.cfg", counters=counters)
#datasetsSignal = dataset.getDatasetsFromMulticrabCfg(cfgfile="/home/rkinnune/signalAnalysis/CMSSW_4_1_5/src/HiggsAnalysis/HeavyChHiggsToTauNu/test/Signal_v11f_scaledb_424/multicrab.cfg", counters=counters)

#datasetsSignal.selectAndReorder(["TTToHplusBWB_M120_Summer11", "TTToHplusBHminusB_M120_Summer11"])
#datasetsSignal.renameMany({"TTToHplusBWB_M120_Summer11" :"TTToHplusBWB_M120_Spring11",
#                           "TTToHplusBHminusB_M120_Summer11": "TTToHplusBHminusB_M120_Spring11"})
#datasets.extend(datasetsSignal)

    plots.mergeRenameReorderForDataMC(datasets)

    print "Int.Lumi", datasets.getDataset("Data").getLuminosity()

    # Remove signals other than M120
    #datasets.remove(filter(lambda name: "TTToHplus" in name, datasets.getAllDatasetNames()))
    datasets.remove(
        filter(lambda name: "TTToHplus" in name and not "M120" in name,
               datasets.getAllDatasetNames()))
    datasets.remove(
        filter(lambda name: "HplusTB" in name, datasets.getAllDatasetNames()))

    # Remove QCD
    datasets.remove(
        filter(lambda name: "QCD" in name, datasets.getAllDatasetNames()))
    histograms.createLegend.moveDefaults(dx=-0.02)
    histograms.createLegend.moveDefaults(dh=-0.03)

    datasets_lands = datasets.deepCopy()

    # Set the signal cross sections to the ttbar for datasets for lands
    xsect.setHplusCrossSectionsToTop(datasets_lands)

    # Set the signal cross sections to a given BR(t->H), BR(h->taunu)
    xsect.setHplusCrossSectionsToBR(datasets, br_tH=0.05, br_Htaunu=1)

    # Set the signal cross sections to a value from MSSM
    #    xsect.setHplusCrossSectionsToMSSM(datasets, tanbeta=20, mu=200)

    plots.mergeWHandHH(
        datasets
    )  # merging of WH and HH signals must be done after setting the cross section

    # Replace signal dataset with EWK+signal
    if True:
        ttjets2 = datasets.getDataset("TTJets").deepCopy()
        ttjets2.setName("TTJets2")
        ttjets2.setCrossSection(
            ttjets2.getCrossSection() -
            datasets.getDataset("TTToHplus_M120").getCrossSection())
        datasets.append(ttjets2)
        datasets.merge("EWKnoTT",
                       ["WJets", "DYJetsToLL", "SingleTop", "Diboson"],
                       keepSources=True)
        datasets.merge("TTToHplus_M120",
                       ["TTToHplus_M120", "EWKnoTT", "TTJets2"])
        plots._legendLabels[
            "TTToHplus_M120"] = "with H^{#pm}#rightarrow#tau^{#pm}#nu"

    # Apply TDR style
    style = tdrstyle.TDRStyle()

    # Create plots
    doPlots(datasets)

    # Write mt histograms to ROOT file
    #writeTransverseMass(datasets_lands)

    # Print counters
    doCounters(datasets)
Esempio n. 4
0
def main():
    # Read the datasets
    datasets = dataset.getDatasetsFromMulticrabCfg(counters=counters)
    datasets.loadLuminosities()

    # Take QCD from data
    datasetsQCD = None
    if QCDfromData:
        datasetsQCD = dataset.getDatasetsFromMulticrabCfg(cfgfile="/home/rkinnune/signalAnalysis/CMSSW_4_2_8_patch2/src/HiggsAnalysis/HeavyChHiggsToTauNu/test/multicrab_111123_132128/multicrab.cfg", counters=counters)
        datasetsQCD.loadLuminosities()
        datasetsQCD.mergeData()
        datasetsQCD.remove(datasetsQCD.getMCDatasetNames())
        datasetsQCD.rename("Data", "QCD")
    
#Rtau =0
#    datasetsSignal = dataset.getDatasetsFromMulticrabCfg(cfgfile="/home/rkinnune/signalAnalysis/CMSSW_4_2_5/src/HiggsAnalysis/HeavyChHiggsToTauNu/test/multicrab_110804_104313/multicrab.cfg", counters=counters)

#    datasetsSignal.selectAndReorder(["HplusTB_M200_Summer11"])
#    datasetsSignal = dataset.getDatasetsFromMulticrabCfg(cfgfile="/home/rkinnune/signalAnalysis/CMSSW_4_2_4_patch1/src/HiggsAnalysis/HeavyChHiggsToTauNu/test/multicrab_110622_112321/multicrab.cfg", counters=counters)
    #datasetsSignal = dataset.getDatasetsFromMulticrabCfg(cfgfile="/home/rkinnune/signalAnalysis/CMSSW_4_1_5/src/HiggsAnalysis/HeavyChHiggsToTauNu/test/Signal_v11f_scaledb_424/multicrab.cfg", counters=counters)

    #datasetsSignal.selectAndReorder(["TTToHplusBWB_M120_Summer11", "TTToHplusBHminusB_M120_Summer11"])
    #datasetsSignal.renameMany({"TTToHplusBWB_M120_Summer11" :"TTToHplusBWB_M120_Spring11",
    #                           "TTToHplusBHminusB_M120_Summer11": "TTToHplusBHminusB_M120_Spring11"})
    #datasets.extend(datasetsSignal)

    plots.mergeRenameReorderForDataMC(datasets)

    print "Int.Lumi",datasets.getDataset("Data").getLuminosity()

    # Remove signals other than M120
    #datasets.remove(filter(lambda name: "TTToHplus" in name, datasets.getAllDatasetNames()))
    datasets.remove(filter(lambda name: "TTToHplus" in name and not "M120" in name, datasets.getAllDatasetNames()))
    datasets.remove(filter(lambda name: "HplusTB" in name, datasets.getAllDatasetNames()))
    
    # Remove QCD
    datasets.remove(filter(lambda name: "QCD" in name, datasets.getAllDatasetNames()))
    histograms.createLegend.moveDefaults(dx=-0.02)
    histograms.createLegend.moveDefaults(dh=-0.03)
    
    datasets_lands = datasets.deepCopy()

    # Set the signal cross sections to the ttbar for datasets for lands
    xsect.setHplusCrossSectionsToTop(datasets_lands)

    # Set the signal cross sections to a given BR(t->H), BR(h->taunu)
    xsect.setHplusCrossSectionsToBR(datasets, br_tH=0.05, br_Htaunu=1)

    # Set the signal cross sections to a value from MSSM
#    xsect.setHplusCrossSectionsToMSSM(datasets, tanbeta=20, mu=200)

    plots.mergeWHandHH(datasets) # merging of WH and HH signals must be done after setting the cross section


    # Replace signal dataset with EWK+signal
    if True:
        ttjets2 = datasets.getDataset("TTJets").deepCopy()
        ttjets2.setName("TTJets2")
        ttjets2.setCrossSection(ttjets2.getCrossSection() - datasets.getDataset("TTToHplus_M120").getCrossSection())
        datasets.append(ttjets2)
        datasets.merge("EWKnoTT", ["WJets", "DYJetsToLL", "SingleTop", "Diboson"], keepSources=True)
        datasets.merge("TTToHplus_M120", ["TTToHplus_M120", "EWKnoTT", "TTJets2"])
        plots._legendLabels["TTToHplus_M120"] = "with H^{#pm}#rightarrow#tau^{#pm}#nu"

    # Apply TDR style
    style = tdrstyle.TDRStyle()

    # Create plots
    doPlots(datasets)

    # Write mt histograms to ROOT file
    #writeTransverseMass(datasets_lands)

    # Print counters
    doCounters(datasets)