def __init__(self, dataset_manager_path, dataset_name, object_restrict=""):
     self.manager_path = dataset_manager_path
     self.dataset_name = dataset_name
     self.info = self.readAllInSet("FileInfo", self.dataset_name)
     self.config = config_object.ConfigObject(self.info)
     self.mc_info = UserInput.readAllJson('/'.join(
         [self.manager_path, "FileInfo", "montecarlo/*.json"]))
     self.data_info = UserInput.readAllJson('/'.join(
         [self.manager_path, "FileInfo", "data/*.json"]))
     self.styles = UserInput.readJson('/'.join(
         [self.manager_path, "Styles", "styles.json"]))
     base_name = self.dataset_name.split("/")[0]
     self.plot_groups = self.readAllInSet("PlotGroups", base_name)
     object_file = '/'.join([
         self.manager_path, "PlotObjects",
         ("_".join([self.dataset_name, object_restrict])
          if object_restrict != "" else self.dataset_name) + ".json"
     ])
     self.aliases = UserInput.readJson('/'.join(
         [self.manager_path, "Aliases",
          "%s.json" % base_name]))
     # Objects can be defined by the default dataset-wide file,
     # or by specific selection files
     if not os.path.isfile(object_file):
         object_file = object_file.replace(self.dataset_name, base_name)
     self.plot_objects = UserInput.readJson(object_file)
Esempio n. 2
0
 def __init__(self, dataset_manager_path, dataset_name, object_restrict=""):
     self.manager_path = dataset_manager_path
     self.dataset_name = dataset_name
     self.info = self.readAllInSet("FileInfo", self.dataset_name)
     self.config = config_object.ConfigObject(self.info)
     self.mc_info = ConfigHistTools.readAllInfo('/'.join([self.manager_path, "FileInfo", "montecarlo/*"]))
     self.data_info = ConfigHistTools.readAllInfo('/'.join([self.manager_path, "FileInfo", "data/*"]))
     self.styles = ConfigHistTools.readInfo('/'.join([self.manager_path, 
         "Styles", "styles.json"]))
     base_name = self.dataset_name.split("/")[0]
     self.plot_groups = self.readAllInSet("PlotGroups", base_name)
     object_file = '/'.join([self.manager_path,  "PlotObjects", 
         ("_".join([self.dataset_name, object_restrict])
             if object_restrict != "" else self.dataset_name) + ".py"])
     alias_file = '/'.join([self.manager_path, "Aliases", "%s.json" % base_name])
     self.aliases = ConfigHistTools.readInfo(alias_file) if os.path.isfile(alias_file) else {}
     # Objects can be defined by the default dataset-wide file, 
     # or by specific selection files
     if not os.path.isfile(object_file): 
         object_file = object_file.replace("py", "json")
     if not os.path.isfile(object_file): 
         #TODO: This is some dumb logic
         object_file = object_file.replace("json", "py")
         object_file = object_file.replace(self.dataset_name, base_name)
     self.plot_objects = ConfigHistTools.readInfo(object_file)
Esempio n. 3
0
    def setUp(self) -> None:
        self.config_object = config_object.ConfigObject()

        # default
        self.config_object.logs_dir = ["test"]
        self.config_object.store_dir = ["kv-skew"]
        self.config_object.trials = [1]

        # cluster
        self.config_object.cockroach_commit = ["master"]
        self.config_object.num_warm_nodes = [4]
        self.config_object.num_workload_nodes = [6]
        self.config_object.driver_node_ip_enum = [1]

        # self.config_object.workload_nodes = [] # to be populated
        # self.config_object.warm_nodes = [] # to be populated
        self.config_object.hot_key_threshold = [-1]
        self.config_object.should_create_partition = [False]
        self.config_object.disable_cores = [2, 4, 6]

        # benchmark
        self.config_object.keyspace = [1000000]
        # self.config_object.concurrency = [] # to be populated
        self.config_object.warm_up_duration = [10]  # in seconds
        self.config_object.duration = [2]  # in seconds
        self.config_object.read_percent = [100]  # percentage
        self.config_object.n_keys_per_statement = [6]
        self.config_object.use_original_zipfian = [False]
        self.config_object.distribution_type = ["zipf"]
        self.config_object.skews = [0, 0.9]
Esempio n. 4
0
def main():
    ROOT.gROOT.SetBatch(True)
    args = getComLineArgs()
    config_file = "/cms/kdlong/WZxsec/InitialStateAnalysis/" \
                  "my_plotting/config_files/cutflows.json"
    config = config_object.ConfigObject(config_file)
    canvas = config.getCanvas()
    if args.cutflow_name is not None:
    
        hist = getCutFlowHist(args.root_file, config,  args.cutflow_name)                                                                                                                         
    else:
        hist_stack = stackFromConfig(config, args.root_file)
        hist_stack.Draw("nostack")
        hist_stack.GetXaxis().SetRange(1, 8)    
        hist_stack.GetYaxis().SetTitleSize(0.035)    
        hist_stack.GetYaxis().SetTitle("Events Passing Selection")    
        hist_stack.GetHistogram().SetLabelSize(0.04)
        legend = ROOT.TLegend(.55, .75, .88, .88)

        name = {}
        name['cutflow'] = "Reconstructed fiducial"
        name['cutflow_genfid'] = "Gen-level fiducial"
        for hist in hist_stack.GetHists():
            legend.AddEntry(hist, name[hist.GetName()], "f")
        legend.SetFillColor(0)
        legend.Draw()

    canvas.Print(args.output_file)                                                                                       
Esempio n. 5
0
def main(): 
    args = getComLineArgs()
    root_file = ROOT.TFile(args.root_file)                          
    print root_file 
    cwd = os.getcwd()
    os.chdir(sys.path[0])
    
    eiso_cut = " && l%i.Iso < " + str(args.eiso_cut) if args.eiso_cut != 0 else ""
    miso_cut = " && l%i.Iso < " + str(args.miso_cut) if args.miso_cut != 0 else ""
    info = {'name' : "iso_%s",
            'branch' : "l%i.Iso",
            'cut_string' : "l%iFlv==\"%s\""
    } 
    config = config_object.ConfigObject("config_files/iso_all_hists.json")
    canvas = config.getCanvas()
    
    for lep in ["e", "m"]:
        name = info['name'].replace("_", "_all_" if args.combine else "_") % lep
        iso_hist = config.getObject(name)
        for i in args.lepton_nums:
            cut_string =  "".join([info['cut_string'] % (i, lep), ""])
                #(eiso_cut % i) if lep == "e" else (miso_cut % i)])
            print "The cut is %s" % cut_string
            plotter.loadHistFromTree(iso_hist, 
                root_file, 
                args.path_to_tree, 
                info['branch'] % i, 
                cut_string,
                args.combine if i != 1 else False)
            plotOverflow(iso_hist)
            config.setAttributes(iso_hist, name)
            if not args.combine:
                printHist(iso_hist, 
                    canvas,
                    args.output_file.replace(".", "_%s%i." % (lep, i)), 
                    cwd)
                iso_hist = config.getObject(name)
        if args.combine:
            printHist(iso_hist, 
                canvas,
                args.output_file.replace(".", "_%s_all." % lep), 
                cwd)