Beispiel #1
0
    def calc_lumi(self):
        """
        Walk over samples, take xSecAndNumber, calc lumi, put back to settings.
        """

        from UserCode.RWTH3b.cmsRunController.classes.CRRootStyle import CRRootStyle
        root_style = CRRootStyle()
        qset = root_style.get_main_settings()

        for group in qset.childGroups():
            qset.beginGroup(group)
            if qset.contains("xSecAndNumber"):
                x_sec_and_number = qset.value("xSecAndNumber").toStringList()
                x_sec   = float(str(x_sec_and_number[0]))
                number  = int(str(x_sec_and_number[1]))
                qset.setValue("lumi", number/x_sec)
            qset.endGroup()
Beispiel #2
0
    def build_follow_up(self):
        """
        Make follow-up .ini file. Takes output info from given .ini.
        """

        from PyQt4 import QtCore
        from os.path import basename
        from UserCode.RWTH3b.cmsRunController.classes.CRRootStyle import CRRootStyle
        root_style = CRRootStyle()
        ini_name = root_style.get_ini_file()
        ini_name = basename(ini_name[:-4] + "_FOLLOWUP.ini")
        qset = root_style.get_main_settings()
        new_set = QtCore.QSettings(ini_name, 1)
        new_set.setValue("tryReuseResults", False)
        new_set.setValue("enableByDefault", True)
        new_set.setValue("commonInputPath", qset.value("commonOutputPath"))
        new_set.setValue("commonOutputPath", "")
        new_set.setValue("cfgFile", "")

        for sample in qset.childGroups():
            qset.beginGroup(sample)
            new_set.beginGroup(sample)
            if qset.contains("eventOutput"):
                new_set.beginGroup("eventInput")
                file = str(qset.value("eventOutput", "").toString())
                if file[-5:] != ".root":
                    file += str(sample) + ".root"
                    new_set.setValue("files", file)
                new_set.endGroup()
            if qset.contains("lumi"):
                new_set.setValue("lumi", qset.value("lumi"))
            if qset.contains("isData"):
                new_set.setValue("isData", qset.value("isData"))
            if qset.contains("enable"):
                new_set.setValue("enable", qset.value("enable"))
            new_set.setValue("eventOutput", "")
            qset.endGroup()
            new_set.endGroup()

        new_set.sync()
        print "'" + ini_name + "' created."
        return True
Beispiel #3
0
    def data_lumi_sum(self):
        """
        Walk over data samples, add up lumi, store in [General]/dataLumiSum
        """

        from UserCode.RWTH3b.cmsRunController.classes.CRRootStyle import CRRootStyle
        root_style = CRRootStyle()
        qset = root_style.get_main_settings()

        data_lumi_sum = 0.
        for group in qset.childGroups():
            qset.beginGroup(group)
            if qset.value("isData", False).toBool():
                lumi, parse_ok = qset.value("lumi", 0.).toDouble()
                if parse_ok and lumi:
                    data_lumi_sum += lumi
            qset.endGroup()

        if data_lumi_sum > 0:
            qset.setValue("dataLumiSum", data_lumi_sum)
"""
This program manages cmsRun processes. It reads run information
from *.ini configuration files and starts cmsRun with proper
parameters.
"""

__author__ = 'Heiner Tholen'

import ROOT
from UserCode.RWTH3b.cmsRunController.classes.CRUtilities import CRShellUtility
from UserCode.RWTH3b.cmsRunController.classes.CRRootStyle import CRRootStyle
root_style = CRRootStyle()

if __name__ == '__main__':

    if CRShellUtility().do_utility_stuff():
        import sys
        sys.exit()

    # colors
    colors = dict()
    colors["Signal"]            = ROOT.kRed + 1
    colors["q_{top} = 4/3"]     = ROOT.kViolet + 8
    colors["Semi-#mu t#bart"]   = ROOT.kAzure + 7
    colors["W + Jets"]          = ROOT.kSpring + 8
    colors["Z + Jets"]          = ROOT.kSpring + 5
    colors["Single Top"]        = ROOT.kOrange + 2
    colors["QCD"]               = ROOT.kYellow + 2
    root_style.set_colors(colors)
"""
This program manages cmsRun processes. It reads run information
from *.ini configuration files and starts cmsRun with proper
parameters.
"""

__author__ = 'Heiner Tholen'

import ROOT
from UserCode.RWTH3b.cmsRunController.classes.CRRootStyle import CRRootStyle
root_style = CRRootStyle()

if __name__ == '__main__':

    # colors
    colors = dict()
    colors["TTBar"]            = ROOT.kRed + 1
    colors["WJets"]	       = ROOT.kBlue
    colors["QCD"]	       = ROOT.kGreen

    root_style.set_colors(colors)

    # Stacking Order (lowest first, also non-mc should be stated)
    order = []
    order.append("Data")
    order.append("TTBar")
    order.append("WJets")
    order.append("QCD")