Skip to content

Commit c02d437

Browse files
committed
testing pipeline commands
1 parent 259f805 commit c02d437

File tree

7 files changed

+90
-37
lines changed

7 files changed

+90
-37
lines changed

automation/config.yaml

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,41 @@ JetMET:
44
- 'JetMET1'
55
eras:
66
- 'Run2024*'
7+
- 'Run2025*'
78
scripts:
89
- 'python3 ../l1macros/performances_nano.py -i $INFILE -o $OUTDIR/all_DiJet.root -c DiJet'
910
plotting:
1011
- 'python3 ../plotting/make_DiJet_plots.py --dir $OUTDIR --config ../config_cards/full_DiJet.yaml'
1112

12-
EGamma:
13-
datasets:
14-
- 'EGamma0'
15-
- 'EGamma1'
16-
eras:
17-
- 'Run2024*'
18-
scripts:
19-
- 'python3 ../l1macros/performances_nano.py -i $INFILE -o $OUTDIR/all_PhotonJet.root -c PhotonJet'
20-
- 'python3 ../l1macros/performances_nano.py -i $INFILE -o $OUTDIR/all_ZToEE.root -c ZToEE'
21-
- 'python3 ../l1macros/performances_nano_dqmoff.py -i $INFILE -o $OUTDIR/oug_zee_dqmoff.root -c ZToEEDQMOff'
22-
plotting:
23-
- 'python3 ../plotting/make_ZToEE_plots.py --dir $OUTDIR --config ../config_cards/full_ZToEE.yaml'
24-
- 'python3 ../plotting/make_PhotonJet_plots.py --dir $OUTDIR --config ../config_cards/full_PhotonJet.yaml'
13+
# EGamma:
14+
# datasets:
15+
# - 'EGamma0'
16+
# - 'EGamma1'
17+
# eras:
18+
# - 'Run2025*'
19+
# scripts:
20+
# - 'python3 ../l1macros/performances_nano.py -i $INFILE -o $OUTDIR/all_PhotonJet.root -c PhotonJet'
21+
# - 'python3 ../l1macros/performances_nano.py -i $INFILE -o $OUTDIR/all_ZToEE.root -c ZToEE'
22+
# - 'python3 ../l1macros/performances_nano_dqmoff.py -i $INFILE -o $OUTDIR/oug_zee_dqmoff.root -c ZToEEDQMOff'
23+
# plotting:
24+
# - 'python3 ../plotting/make_ZToEE_plots.py --dir $OUTDIR --config ../config_cards/full_ZToEE.yaml'
25+
# - 'python3 ../plotting/make_PhotonJet_plots.py --dir $OUTDIR --config ../config_cards/full_PhotonJet.yaml'
2526

26-
Muon:
27-
datasets:
28-
- 'Muon0'
29-
- 'Muon1'
30-
eras:
31-
- 'Run2024*'
32-
scripts:
33-
- 'python3 ../l1macros/performances_nano.py -i $INFILE -o $OUTDIR/all_ZToMuMu.root -c ZToMuMu'
34-
- 'python3 ../l1macros/performances_nano.py -i $INFILE -o $OUTDIR/all_MuonJet.root -c MuonJet' #TODO not working
35-
- 'python3 ../l1macros/performances_nano.py -i $INFILE -o $OUTDIR/all_ZToTauTau.root -c ZToTauTau'
36-
- 'python3 ../l1macros/performances_nano_dqmoff.py -i $INFILE -o $OUTDIR/out_zmumu_dqmoffl.root -c ZToMuMuDQMOff'
37-
- 'python3 ../l1macros/performances_nano_dqmoff.py -i $INFILE -o $OUTDIR/out_jets_dqmoff.root -c JetsDQMOff'
38-
- 'python3 ../l1macros/performances_nano_dqmoff.py -i $INFILE -o $OUTDIR/out_ztautau_dqmoff.root -c ZToTauTauDQMOff'
39-
- 'python3 ../l1macros/performances_nano_dqmoff.py -i $INFILE -o $OUTDIR/out_etsum_dqmoff.root -c EtSumDQMOff'
40-
plotting:
41-
- 'python3 ../plotting/make_ZToMuMu_plots.py --dir $OUTDIR --config ../config_cards/full_ZToMuMu.yaml'
42-
- 'python3 ../plotting/make_ZToTauTau_plots.py --dir $OUTDIR --config ../config_cards/full_ZToTauTau.yaml'
43-
- 'python3 ../plotting/make_MuonJet_plots.py --dir $OUTDIR --config ../config_cards/full_MuonJet.yaml'
27+
# Muon:
28+
# datasets:
29+
# - 'Muon0'
30+
# - 'Muon1'
31+
# eras:
32+
# - 'Run2025*'
33+
# scripts:
34+
# - 'python3 ../l1macros/performances_nano.py -i $INFILE -o $OUTDIR/all_ZToMuMu.root -c ZToMuMu'
35+
# - 'python3 ../l1macros/performances_nano.py -i $INFILE -o $OUTDIR/all_MuonJet.root -c MuonJet' #TODO not working
36+
# - 'python3 ../l1macros/performances_nano.py -i $INFILE -o $OUTDIR/all_ZToTauTau.root -c ZToTauTau'
37+
# - 'python3 ../l1macros/performances_nano_dqmoff.py -i $INFILE -o $OUTDIR/out_zmumu_dqmoffl.root -c ZToMuMuDQMOff'
38+
# - 'python3 ../l1macros/performances_nano_dqmoff.py -i $INFILE -o $OUTDIR/out_jets_dqmoff.root -c JetsDQMOff'
39+
# - 'python3 ../l1macros/performances_nano_dqmoff.py -i $INFILE -o $OUTDIR/out_ztautau_dqmoff.root -c ZToTauTauDQMOff'
40+
# - 'python3 ../l1macros/performances_nano_dqmoff.py -i $INFILE -o $OUTDIR/out_etsum_dqmoff.root -c EtSumDQMOff'
41+
# plotting:
42+
# - 'python3 ../plotting/make_ZToMuMu_plots.py --dir $OUTDIR --config ../config_cards/full_ZToMuMu.yaml'
43+
# - 'python3 ../plotting/make_ZToTauTau_plots.py --dir $OUTDIR --config ../config_cards/full_ZToTauTau.yaml'
44+
# - 'python3 ../plotting/make_MuonJet_plots.py --dir $OUTDIR --config ../config_cards/full_MuonJet.yaml'

automation/lebeling.cc

5.65 KB
Binary file not shown.

automation/make_hists_old.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/python3
2+
3+
import os, yaml
4+
from glob import glob
5+
from utils import write_queue, parse_file, run_command, htcondor_flag, tier0, dqm_prefix
6+
7+
config_dict = yaml.safe_load(open('config.yaml', 'r'))
8+
9+
htcondor = htcondor_flag()
10+
11+
# main logic: glob files on tier 0 and run plotting scripts
12+
for label, config in config_dict.items():
13+
print(20*"#" + f" Running plots for {label} " + 20*"#")
14+
15+
# step 1 - find all files on tier 0
16+
fnames = []
17+
for dataset in config["datasets"]:
18+
for era in config["eras"]:
19+
fnames += glob(f"{tier0}/{era}/{dataset}/NANOAOD/PromptReco-v*/*/*/*/*/*.root")
20+
21+
# step 2 - for each file, run scripts
22+
# fnames = fnames[:100]
23+
for fname in fnames:
24+
print(f"Processing file {fname}")
25+
26+
out_web_path = dqm_prefix + parse_file(fname)
27+
28+
# abort if histogram root files already exist
29+
root_files = glob(f"{out_web_path}/*.root")
30+
if len(root_files) > 0:
31+
print(f"Skipping {out_web_path} - already processed")
32+
continue
33+
34+
for cmd in config["scripts"]:
35+
cmd = cmd.replace("$OUTDIR", out_web_path)
36+
cmd = cmd.replace("$INFILE", fname)
37+
38+
os.makedirs(out_web_path, exist_ok=True)
39+
40+
if htcondor: write_queue(cmd) # write script into htcondor queue file
41+
else: run_command(cmd, out_web_path+"/log.txt") # run script on current shell

automation/merge_per_era.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
htcondor = htcondor_flag()
77

88
# collect all histogram root files merged by run
9-
all_files = glob(f"{dqm_prefix}/*/*/*/*/*/merged/*.root") #change later to dqm_prefix
9+
all_files = glob(f"{dqm_prefix}/*/*/*/*/*/merged/*.root")
1010

1111
weeks = get_weeks()
1212

@@ -33,7 +33,17 @@
3333
file_groups[target] = []
3434
file_groups[target].append(file)
3535

36+
# era split
37+
split = 391884
38+
if run <= split:
39+
target = f"{dqm_prefix}/{label}/{era}_pre_{split}/merged/{filename}"
40+
else:
41+
target = f"{dqm_prefix}/{label}/{era}_post_{split}/merged/{filename}"
42+
if target not in file_groups:
43+
file_groups[target] = []
44+
file_groups[target].append(file)
45+
3646

37-
# Hadd grouped files
47+
# # Hadd grouped files
3848
for target, files in file_groups.items():
3949
hadd(target, files, htcondor)

automation/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import os, subprocess, argparse, uproot
22
import pandas as pd
33

4-
#dqm_prefix = '/eos/cms/store/group/dpg_trigger/comm_trigger/L1Trigger/cmsl1dpg/www/DQM/T0PromptNanoMonit'
5-
dqm_prefix = "/eos/user/l/lebeling/www/DQM"
4+
dqm_prefix = '/eos/cms/store/group/dpg_trigger/comm_trigger/L1Trigger/cmsl1dpg/www/DQM/T0PromptNanoMonit/testing/'
5+
#dqm_prefix = "/eos/user/l/lebeling/www/DQM"
66
tier0 = "/eos/cms/tier0/store/data"
77

88

automation/wrapper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
import argparse
44
import os
55

6-
automation_path = os.path.dirname(os.path.abspath(__file__))
6+
#automation_path = os.path.dirname(os.path.abspath(__file__))
7+
automation_path = "/afs/cern.ch/user/l/lebeling/MacrosNtuples/automation"
78

89
# parse commands to be executed as arguments
910
parser = argparse.ArgumentParser(description="wrapper running script on htcondor")

l1macros/performances_nano.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def main():
121121
h.set_runnb_bins(df)
122122

123123
#Define ETMHF
124-
df = h.L1ETMHF(df)
124+
#df = h.L1ETMHF(df)
125125
if args.outputFile == '':
126126
args.outputFile = 'output_'+args.channel+'.root'
127127
out = ROOT.TFile(args.outputFile, "recreate")

0 commit comments

Comments
 (0)