Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to latest 2022pre-EE recommendations; sync W+c selections #85

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3fa956f
fix : remove bad files & add cross-sections
Ming-Yan Oct 12, 2023
7c5005d
feat: add features for plotting scripts
Ming-Yan Oct 17, 2023
1282411
Merge branch 'div' into btv_upstream
Ming-Yan Oct 17, 2023
dcb4254
fix: add only for standalone condor& plot code
Ming-Yan Oct 26, 2023
44435c9
[run array] ci: customize ci , fix bugs in workflow
Ming-Yan Oct 27, 2023
32f6ec8
Fix compatibility with Nanov12, changes to --only
mondalspandan Nov 6, 2023
a2c1d2e
[run array] ci: customize ci , fix bugs in workflow
Ming-Yan Oct 27, 2023
af51af0
Fixing Summer22/EE PU files
mondalspandan Nov 6, 2023
dc1a473
Merge branch 'master' into master
mondalspandan Nov 6, 2023
f3517a1
Fixing file handling
mondalspandan Nov 7, 2023
10ee3a0
Fixing file handling
mondalspandan Nov 7, 2023
3132d96
Switch back PU files
mondalspandan Nov 7, 2023
f420b68
Fix output dir
mondalspandan Nov 7, 2023
ca11c36
Fix xrdcp
mondalspandan Nov 7, 2023
b98aa19
Merge pull request #3 from mondalspandan/master
Ming-Yan Nov 7, 2023
c40d26a
fix: merge Spandan's dev ci:skip syst
Ming-Yan Nov 7, 2023
2e2d36c
Unify Wc mu, elec and ttbarsemi mu, elec workflows; new common arrayw…
mondalspandan Nov 14, 2023
bc667ba
Merge branch 'master' into master
mondalspandan Nov 14, 2023
e7d7e1b
Add back soft mu iso cut
mondalspandan Nov 14, 2023
ff69e01
Merge branch 'master' of github.com:mondalspandan/BTVNanoCommissioning
mondalspandan Nov 14, 2023
25cc257
Sync variable names
mondalspandan Nov 14, 2023
9e6e9cd
Merge branch 'master' into BTVbranch
mondalspandan Nov 14, 2023
8a05e0a
Compatibility with missing DeepCSV info in inputs
mondalspandan Nov 14, 2023
9c7e5b1
Lint
mondalspandan Nov 14, 2023
17370a9
Merge pull request #1 from mondalspandan/master
mondalspandan Nov 14, 2023
f794f3b
Lint
mondalspandan Nov 14, 2023
965df29
Merge DY mu and DY e workflows
mondalspandan Nov 16, 2023
8978fba
Lint
mondalspandan Nov 16, 2023
ae9ca15
Merge branch 'master' of github.com:cms-btv-pog/BTVNanoCommissioning
mondalspandan Nov 28, 2023
84ceba8
Update to latest 2022pre-EE recommendations; sync W+c selections
mondalspandan Nov 29, 2023
6381f3c
feat: add jr in Summer23 and minor fixes
Ming-Yan May 10, 2024
c4d2210
add jec
Ming-Yan May 11, 2024
25bee05
Merge branch 'master' into master
mondalspandan May 19, 2024
95da839
Merge with new JEC/jet map features
mondalspandan May 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ python runner.py --workflow emctag_ttdilep_sf --json metadata/test_bta_run3.json
- `ci:skip syst` : remove `--isSyst all` option
- `ci:JERC_split` : change systematic option to split JERC uncertainty sources `--isSyst JERC_split`
- `ci:weight_only` : change systematic option to weight only variations `--isSyst weight_only`

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason to add additional line here?


### Running jupyter remotely
1. On your local machine, edit `.ssh/config`:
Expand Down

Large diffs are not rendered by default.

2,448 changes: 10 additions & 2,438 deletions metadata/data_Summer23_2023_jetmet_BTV_Run3_2023_Comm_MINIAODv4_NanoV12.json

Large diffs are not rendered by default.

11 changes: 4 additions & 7 deletions runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ def get_main_parser():
if args.output == parser.get_default("output"):
index = args.samplejson.rfind("/") + 1
sample_json = args.samplejson[index:]
histoutdir = f"hists_{args.workflow}_{sample_json.rstrip('.json')}"
outdir = f"arrays_{args.workflow}_{sample_json.rstrip('.json')}"
histoutdir = f"hists_{args.workflow}"
outdir = f"arrays_{args.workflow}"
coffeaoutput = (
f'{histoutdir}/hists_{args.workflow}_{(sample_json).rstrip(".json")}.coffea'
)
Expand Down Expand Up @@ -267,7 +267,7 @@ def get_main_parser():
isamp = int(args.only)
nsamp = len(sample_dict.keys())
if isamp >= nsamp:
print(
raise RuntimeError(
f"There are {nsamp} datasets, please use --only n with n<{nsamp}."
)
key = list(sample_dict.keys())[isamp]
Expand Down Expand Up @@ -350,10 +350,7 @@ def get_main_parser():
raise Exception(f"{coffeaoutput} exists")

if args.isArray:
if path.exists(outdir) and args.overwrite == False and args.only is None:
raise Exception("Directory exists")
else:
os.system(f"mkdir -p {outdir}")
os.system(f"mkdir -p {outdir}")

if args.executor not in ["futures", "iterative", "dask/lpc", "dask/casa"]:
"""
Expand Down
23 changes: 23 additions & 0 deletions scripts/dohadd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import os, sys
from glob import glob

indir = sys.argv[1]

systs = os.listdir(indir)

outfile = open("hadd.sh", "w")

for syst in systs:
roots = glob(f"{indir}/{syst}/*/*.root")
if len(roots) == 0:
print(f"Skipping {indir}/{syst}. Not the right directory structure.")
continue
samps = os.listdir(f"{indir}/{syst}")
for samp in samps:
if len(glob(f"{indir}/{syst}/{samp}/*.root")) == 0:
continue
outfile.write(
f"hadd -v 0 {indir}/{syst}/{samp}.root {indir}/{syst}/{samp}/*.root\n"
)

print("Now run `parallel :::: hadd.sh` from an environment with ROOT installed. E.g. \nconda activate rootenv\nparallel :::: hadd.sh\nconda activate btv_coffea")
9 changes: 6 additions & 3 deletions scripts/dump_processed.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,17 @@ def dump_dataset(output, fname, alljson):
original_list, list_from_coffea = {}, {}
for j in jsonlist:
old = json.load(open(j))
original_list[j] = []
for o in old.keys():
if o not in original_list.keys():
original_list[o] = []
original_list[o].append(old[o])

for m in output.keys():
list_from_coffea[m] = []
for f in output[m].keys():
list_from_coffea[f].append(list(set(output[m][f]["fname"])))
if f not in list_from_coffea.keys():
list_from_coffea[f] = []
else:
list_from_coffea[f] += list(set(output[m][f]["fname"]))
failed = {}
for t in original_list.keys():
failed[t] = []
Expand Down
33 changes: 29 additions & 4 deletions scripts/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,24 @@
action="store_true",
default=False,
)
parser.add_argument(
'-r', "--redirector",
help="xrootd ridirector in case sites are not found",
choices=["infn","fnal","cern"],
default="infn"
)
parser.add_argument(
'-j', "--ncpus",
help="Number of CPUs to use for validation",
default="4"
)
parser.add_argument(
"--skipvalidation",
action="store_true",
help="If true, the readability of files will not be validated.",
default=False,
)

parser.add_argument("--campaign", help="campaign info", default=None, type=str)


Expand Down Expand Up @@ -210,9 +228,14 @@ def getFilesFromDas(args):

if xrd is None:
print(
f"No SITE available in the whitelist for file {dsname}, change to global redirector"
f"No SITE available in the whitelist for file {dsname}, change to global redirector: {args.redirector}"
)
xrd = "root://xrootd-cms.infn.it//"
redirector = {
"infn": "root://xrootd-cms.infn.it//",
"fnal": "root://cmsxrootd.fnal.gov/",
"cern": "root://cms-xrd-global.cern.ch/"
}
xrd = redirector[args.redirector]
if args.limit is not None:
flist = flist[: args.limit]
if dsname not in fdict:
Expand Down Expand Up @@ -335,7 +358,7 @@ def remove_bad_files(sample_dict, outname, remove_bad=True):
_rmap = p_map(
validate,
sample_dict[sample],
num_cpus=4,
num_cpus=int(args.ncpus),
desc=f"Validating {sample[:20]}...",
)

Expand Down Expand Up @@ -373,6 +396,7 @@ def main(args):
outf = open(args.input + "_DAS_" + args.campaign, "w")
short_campaign = args.campaign
for l in f.readlines():
print(l)
l = l.replace("\n", "")
dataset = (
os.popen(
Expand Down Expand Up @@ -418,7 +442,8 @@ def main(args):
empty = False
assert empty, "you have empty lists"
output_file = "./%s" % (args.output)
# fdict = remove_bad_files(fdict, args.output, True) # remove bad files
if not args.skipvalidation:
fdict = remove_bad_files(fdict, args.output, True) # remove bad files
with open(output_file, "w") as fp:
json.dump(fdict, fp, indent=4)
print("The file is saved at: ", output_file)
Expand Down
Binary file modified src/BTVNanoCommissioning/data/JME/Summer22/jec_compiled.pkl.gz
Binary file not shown.
Loading
Loading