-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from cmstas/Run3_Dilepton
Run3 dilepton
- Loading branch information
Showing
26 changed files
with
64,080 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import uproot | ||
import argparse | ||
import gzip | ||
import sys | ||
import pickle | ||
|
||
parser = argparse.ArgumentParser(description='You can customize your run') | ||
parser.add_argument('--prefix', '-r' , nargs='?', default='', help = 'Prefix to look for the files') | ||
parser.add_argument('pickleFiles' , nargs='+', default='', help = 'Input file(s) containing hists') | ||
parser.add_argument('--outname','-o' , nargs='*', default=[], help = 'Output file(s) names (Deafult is the same name as input)') | ||
|
||
args = parser.parse_args() | ||
prefix = args.prefix | ||
pickleFiles = args.pickleFiles | ||
print(pickleFiles) | ||
outname = args.outname | ||
if len(outname) == 0: | ||
outname = [item.replace('.pkl.gz', '') for item in pickleFiles] | ||
print(outname) | ||
|
||
#Do some basic input checks | ||
print("Input Filie(s): ",pickleFiles) | ||
if prefix != '': | ||
print("All will accessed with prefix ",prefix) | ||
if (len(pickleFiles) < 1): | ||
print("ERROR: No Input Files given!") | ||
sys.exit() | ||
if len(pickleFiles) != len(outname): | ||
print("ERROR: Input and Output File lengths do not match!") | ||
|
||
#Create the file path(s) | ||
file_path = [prefix + item for item in pickleFiles] | ||
|
||
for i in range(len(pickleFiles)): | ||
#Create output | ||
with gzip.open(file_path[i],'rb') as f: | ||
data = pickle.load(f) | ||
|
||
hist_lst = list(data.keys()) | ||
|
||
with uproot.recreate(f"{outname[i]}.root") as root_file: | ||
for hist_name in hist_lst: | ||
pickle_hist = data[hist_name] | ||
root_file[f"{hist_name}"] = pickle_hist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/env python | ||
|
||
import argparse | ||
import plottery_wrapper as p | ||
|
||
parser = argparse.ArgumentParser(description='Input Root Files and Directory Name') | ||
parser.add_argument('-dir', '--plot_dir', type=str, help='Plot Directory Name') | ||
parser.add_argument('-dy', '--DY_file', type=str, help='DY File Name') | ||
parser.add_argument('-w', '--W_file', type=str, help='W File Name') | ||
parser.add_argument('-ww', '--WW_file', type=str, help='WW File Name') | ||
parser.add_argument('-tt', '--TT_file', type=str, help='TT File Name') | ||
parser.add_argument('-dt', '--Data_file', type=str, help='Data File Name') | ||
|
||
args = parser.parse_args() | ||
|
||
dir_name = args.plot_dir | ||
dy_file = args.DY_file | ||
w_file = args.W_file | ||
ww_file = args.WW_file | ||
tt_file = args.TT_file | ||
data_file = args.Data_file | ||
|
||
p.dump_plot( | ||
fnames=[ | ||
dy_file, | ||
tt_file, | ||
w_file, | ||
ww_file, | ||
], | ||
data_fname = data_file, | ||
|
||
legend_labels=[ | ||
"DY", | ||
"TT", | ||
"W", | ||
"WW", | ||
], | ||
|
||
extraoptions={ | ||
"no_overflow": True, | ||
"print_yield": True, | ||
"yield_prec": 4, | ||
"lumi_value": 35.1, | ||
#"yaxis_log": True, | ||
"ratio_range": [0.5, 1.5], | ||
}, | ||
|
||
dirname=dir_name, | ||
) |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#Run all samples | ||
|
||
trap "kill 0" SIGINT | ||
|
||
#Data | ||
python run_run3_2lep.py ../../input_samples/sample_jsons/run3_2lep_skims/FG_Skims/EGamma_EraF_2L_Loose_Skim.json,../../input_samples/sample_jsons/run3_2lep_skims/FG_Skims/EGamma_EraG_2L_Loose_Skim.json,../../input_samples/sample_jsons/run3_2lep_skims/FG_Skims/MuonEG_EraF_2L_Loose_Skim.json,../../input_samples/sample_jsons/run3_2lep_skims/FG_Skims/MuonEG_EraG_2L_Loose_Skim.json,../../input_samples/sample_jsons/run3_2lep_skims/FG_Skims/Muon_EraF_2L_Loose_Skim.json,../../input_samples/sample_jsons/run3_2lep_skims/FG_Skims/Muon_EraG_2L_Loose_Skim.json -x futures -o Data_Out -n 125 & | ||
wait | ||
|
||
#TT | ||
python run_run3_2lep.py ../../input_samples/sample_jsons/run3_2lep_skims/FG_Skims/TT_EE_2L_Loose_Skim.json -x futures -o TT_Out -n 125 & | ||
wait | ||
|
||
#WW | ||
python run_run3_2lep.py ../../input_samples/sample_jsons/run3_2lep_skims/FG_Skims/WW_EE_2L_Loose_Skim.json -x futures -o WW_Out -n 125 & | ||
wait | ||
|
||
#W | ||
python run_run3_2lep.py ../../input_samples/sample_jsons/run3_2lep_skims/FG_Skims/WtoLNu_EE_2L_Loose_Skim.json -x futures -o W_Out -n 125 & | ||
wait | ||
|
||
#DY | ||
python run_run3_2lep.py ../../input_samples/sample_jsons/run3_2lep_skims/FG_Skims/DY_EE_2L_Loose_Skim.json -x futures -o DY_Out -n 125 & | ||
wait | ||
|
||
#Make Root Files | ||
python pickleroot_plotter.py Data_Out.pkl.gz DY_Out.pkl.gz TT_Out.pkl.gz WW_Out.pkl.gz W_Out.pkl.gz -r histos/ | ||
wait | ||
|
||
#Make the Plots (Change directory name as needed) | ||
python plot.py -dir DiLep_EraFG_2Lep_LIN -tt TT_Out.root -ww WW_Out.root -w W_Out.root -dy DY_Out.root -dt Data_Out.root | ||
wait | ||
|
||
#Publish them to UAF | ||
publish DiLep_EraFG_2Lep_LIN/ | ||
|
Oops, something went wrong.