def get_samples(path, channel, systematic): samples2 = None if systematic in ["EnDown", "EnUp", "ResDown", "ResUp", "UnclusteredEnDown", "UnclusteredEnUp"]: datadir = "/".join((path, channel, "mc", "iso", systematic, "Jul15")) elif systematic != "nominal": #datadir2 = "/".join((path, channel, "mc_syst", "iso", "SYST", "Jul15")) #datadir = "/".join((path, channel, "mc", "iso", "nominal", "Jul15")) datadir = "/".join(("/hdfs/local/stpol/step3/Sep4_syst_a554579", channel, "mc", "iso", "nominal", "Jul15")) datadir2 = "/".join(("/home/andres/single_top/stpol/Sep4_syst_a554579/", channel, "mc_syst", "iso", "SYST", "Jul15")) datadir3 = "/".join(("/home/andres/single_top/stpol/Sep4_syst_a554579/", channel, "mc_syst", "iso", "SYST", "Sep4")) #print "dd2", datadir2 #print "dd3", datadir3 samples2 = Sample.fromDirectory(datadir2, out_type="dict") #print "samp2", samples2 #datadir3 = "/".join(("/hdfs/local/stpol/step3/Sep1_wjets_fsim", channel, "mc_syst", "nominal", "wjets_fsim")) samples2.update(Sample.fromDirectory(datadir3, out_type="dict")) #print "samp3", samples2 else: #datadir = "/".join((path, channel, "mc", "iso", systematic, "Jul15")) datadir = "/".join(("/hdfs/local/stpol/step3/Sep4_syst_a554579", channel, "mc", "iso", systematic, "Jul15")) datadir2 = "/".join(("/home/andres/single_top/stpol/Sep4_syst_a554579/", channel, "mc_syst", "iso", "SYST", "Jul15")) datadir3 = "/".join(("/home/andres/single_top/stpol/Sep4_syst_a554579/", channel, "mc_syst", "iso", "SYST", "Sep4")) #datadir2 = "/".join((path, channel, "mc_syst", "iso", "SYST", "Jul15")) samples2 = Sample.fromDirectory(datadir2, out_type="dict") samples2.update(Sample.fromDirectory(datadir3, out_type="dict")) samples = Sample.fromDirectory(datadir, out_type="dict") datadir_data = "/".join((path, channel, "data", "iso", "Jul15")) datadir_data_Aug1 = "/".join((path, channel, "data", "iso", "Aug1")) samples.update(Sample.fromDirectory(datadir_data, out_type="dict")) samples.update(Sample.fromDirectory(datadir_data_Aug1, out_type="dict")) if samples2 is not None: samples.update(samples2) if channel == "mu": samples["SingleMu1_aiso"] = Sample.fromFile("/".join((path, channel, "data", "antiiso", "Jul15", "SingleMu1.root"))) samples["SingleMu2_aiso"] = Sample.fromFile("/".join((path, channel, "data", "antiiso", "Jul15", "SingleMu2.root"))) samples["SingleMu3_aiso"] = Sample.fromFile("/".join((path, channel, "data", "antiiso", "Jul15", "SingleMu3.root"))) samples["SingleMu_miss_aiso"] = Sample.fromFile("/".join((path, channel, "data", "antiiso", "Jul15", "SingleMu_miss.root"))) elif channel == "ele": samples["SingleEle1_aiso"] = Sample.fromFile("/".join((path, channel, "data", "antiiso", "Jul15", "SingleEle1.root"))) samples["SingleEle2_aiso"] = Sample.fromFile("/".join((path, channel, "data", "antiiso", "Jul15", "SingleEle2.root"))) samples["SingleEle_miss_aiso"] = Sample.fromFile("/".join((path, channel, "data", "antiiso", "Jul15", "SingleEle_miss.root"))) return samples
if __name__=="__main__": #import plots.common.tdrstyle as tdrstyle #tdrstyle.tdrstyle() datadirs = dict() #This symlink is present in the repo for *.hep.kbfi.ee, if running on other machines, you must make it yourself by doing #ln -s /path/to/step3/out $STPOL_DIR/step3_latest #isolated files are by default in $STPOL_DIR/step3_latest/mu/iso/nominal/*.root datadirs["iso"] = "/".join((os.environ["STPOL_DIR"], "step3_latest", "mu" ,"iso", "nominal")) #Use the anti-isolated data for QCD $STPOL_DIR/step3_latest/mu/antiiso/nominal/SingleMu.root datadirs["antiiso"] = "/".join((os.environ["STPOL_DIR"], "step3_latest", "mu" ,"antiiso", "nominal")) #Load all the samples in the isolated directory samples = Sample.fromDirectory(datadirs["iso"], out_type="dict") samples["SingleMu_aiso"] = Sample.fromFile(datadirs["antiiso"] + "/SingleMu.root") hists_mc = dict() hist_data = None #Define the variable, cut, weight and lumi var = "cos_theta" cut_name = "2j1t" cut_str = str(Cuts.n_jets(2)*Cuts.n_tags(1)*Cuts.lepton_veto*Cuts.one_muon*Cuts.mt_mu*Cuts.top_mass_sig*Cuts.eta_lj) weight_str = "1.0" lumi = 20000 #FIXME: take from the step2 output filelists/step2/latest/iso/nominal/luminosity.txt #nbins, min, max plot_range= [20, -1, 1]
def load_nominal_mc_samples(path, channel, iso): datadir = "/".join((path, channel, "mc", iso, "nominal", "Jul15")) samples = Sample.fromDirectory(datadir, out_type="dict") return samples