Exemplo n.º 1
0
def main():
    args = getComLineArgs()
    ROOT.gROOT.SetBatch(True)
    ROOT.TProof.Open("workers=12")
    filelist = getListOfFiles(args.files_to_plot, args.selection)
    path = "/cms/kdlong" if "hep.wisc.edu" in os.environ["HOSTNAME"] else "/afs/cern.ch/user/k/kelong/work"
    print "MANAGER PATH IS ", path
    config_factory = ConfigHistFactory("%s/AnalysisDatasetManager" % path, args.selection, args.object_restrict)
    branches = (
        config_factory.getListOfPlotObjects()
        if args.branches == "all"
        else [x.strip() for x in args.branches.split(",")]
    )
    cut_string = args.make_cut
    (plot_path, html_path) = helper.getPlotPaths(args.selection, args.folder_name, True)
    for branch_name in branches:
        hist_stack = getStacked(
            config_factory,
            args.selection,
            filelist,
            branch_name,
            args.channels,
            not args.no_overflow,
            cut_string,
            args.luminosity,
            args.no_scalefactors,
            args.uncertainties,
        )
        if not args.no_data:
            data_hist = helper.getConfigHist(
                config_factory, "data", args.selection, branch_name, args.channels, not args.no_overflow, cut_string
            )
            with open("temp.txt", "a") as events_log_file:
                events_log_file.write("\nNumber of events in data: %i" % data_hist.Integral())
        else:
            data_hist = 0
        canvas = helper.makePlot(hist_stack, data_hist, branch_name, args)
        helper.savePlot(canvas, plot_path, html_path, branch_name, True, args)
        makeSimpleHtml.writeHTML(html_path, args.selection)
Exemplo n.º 2
0
    hist_stack = ROOT.THStack("cutflow", "")
    for plot_set in filelist:
        hist = cutflow_maker.getHist(plot_set)
        hist_stack.Add(hist)
    return hist_stack

ROOT.gROOT.SetBatch(True)
ROOT.TProof.Open('workers=12')
path = "/cms/kdlong" if "hep.wisc.edu" in os.environ['HOSTNAME'] else \
    "/afs/cern.ch/user/k/kelong/work"
parser = UserInput.getDefaultParser()
args = parser.parse_args()
cutflow_maker = CutFlowDefinitions.getWZCutFlow(
    "%s/AnalysisDatasetManager" % path,
    "full"
)
cutflow_maker.setLuminosity(1340)
cutflow_maker.setStates(["eee", "mmm", "emm", "eem"])
filelist = ["ttbar", "st", "ttv", "vvv", "ww", "zz", "dy-filt", "zg-filt",
        "wz"] if args.files_to_plot == "all" else \
        [x.strip() for x in args.files_to_plot.split(",")]
data_hist = cutflow_maker.getHist("data")
hist_stack = getMonteCarloStack(cutflow_maker, filelist)
hist_stack.Draw()
hist_stack.GetXaxis().SetLabelSize(0.4*8/9)
print "Now stack is %s" % hist_stack
canvas = helper.makePlot(hist_stack, data_hist, "CutFlow", args)
canvas.SetRightMargin(0.3)
(plot_path, html_path) = helper.getPlotPaths("CutFlow", False)
helper.savePlot(canvas, plot_path, html_path, "CutFlow", False, args)
Exemplo n.º 3
0
        hist = cutflow_maker.getHist(plot_set, unc, "", scale_facs)
        hist_stack.Add(hist)
    return hist_stack


ROOT.gROOT.SetBatch(True)
ROOT.TProof.Open('workers=12')
path = "/cms/kdlong" if "hep.wisc.edu" in os.environ['HOSTNAME'] else \
    "/afs/cern.ch/work/m/mumuhamm/WBoson/CMSSW_11_0_0/src/Data_Manager"
parser = UserInput.getDefaultParser()
args = parser.parse_args()
cutflow_maker = CutFlowDefinitions.getWZCutFlow(
    "%s/AnalysisDatasetManager" % path, "full")
cutflow_maker.setLuminosity(args.luminosity)
cutflow_maker.setStates(args.channels)
filelist = UserInput.getListOfFiles(args.files_to_plot, "Wselection")
if not args.no_data:
    data_hist = cutflow_maker.getHist("data_2016", "stat", "")
else:
    data_hist = 0
hist_stack = getMonteCarloStack(cutflow_maker, filelist, args.uncertainties,
                                not args.no_scalefactors)
hist_stack.Draw()
hist_stack.GetXaxis().SetLabelSize(0.4 * 8 / 9)
canvas = helper.makePlot(hist_stack, data_hist, "CutFlow", args)
canvas.SetRightMargin(0.3)
(plot_path, html_path) = helper.getPlotPaths("WZxsec2016/Wselection",
                                             args.folder_name)
helper.savePlot(canvas, plot_path, html_path, "CutFlow", False, args)
makeSimpleHtml.writeHTML(html_path, "Wselection")