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

add machine learning implementation #6

Merged
merged 20 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
# HH->WWbb Run-3 analysis
----WORK IN PROGRESS----

Install **bamboo analysis framework** with the instructions here: https://bamboo-hep.readthedocs.io/en/latest/install.html#fresh-install
This repository uses the **bamboo analysis framework**, you can install it via the instructions here: https://bamboo-hep.readthedocs.io/en/latest/install.html#fresh-install

Then clone this repository in the parent directory containing the bamboo installation:

```bash
git clone https://github.com/cp3-llbb/HHtoWWbb_Run3.git && cd HHtoWWbb_Run3
```

Execute these each time you start from a clean shell:
Execute these each time you start from a clean shell on lxplus or any other machine with an cvmfs:
```bash
source /cvmfs/sft.cern.ch/lcg/views/LCG_102/x86_64-centos7-gcc11-opt/setup.sh
source (path to your bamboo installation)/bamboovenv/bin/activate
export PYTHONPATH="${PYTHONPATH}:${PWD}/python/"
```

and the followings before submitting to the batch system:
and the followings before submitting jobs to the batch system (HTCondor, Slurm, Dask and Spark are supported):

```bash
voms-proxy-init --voms cms -rfc --valid 192:00
Expand All @@ -33,14 +33,25 @@ voms-proxy-init --voms cms -rfc --valid 192:00 --out ~/private/gridproxy/x509
export X509_USER_PROXY=$HOME/private/gridproxy/x509
```

Then plot various control regions via the following command line using batch (you can pass `--maxFiles 1` to use only 1 file from each sample for a test):
Then plot various control regions via the following command line using batch (you can pass `--maxFiles 1` to use only 1 file from each sample for a quick test):

```bash
bambooRun -m python/controlPlotter.py config/analysis_2022.yml -o ./outputDir/ --distributed driver --envConfig config/cern.ini --eras combined -c <DL or SL>
```
Instead of passing everytime `--envConfig config/cern.ini`, you can copy the content of that file to `~/.config/bamboorc`.

to produce plots, just execute:
Pass `--mvaSkim` to produce skims for MVA. as well.

then to produce plots, just execute:

```sh
./scripts/plot_DL.sh <path to output/plots>
./scripts/plot_<SL or DL>.sh <path to output/plots>
```

using the `parquet` output file that contains skims and the DNN.py file, you can perform machine learning applications;

```sh
python DNN.py -s <path-to-the-skim-file> -o <path-to-an-output-directory>
```

Then passing `--mvaModels=<path-to-dnn-outputs>` option, you can apply DNN score cuts on your analysis.
52 changes: 43 additions & 9 deletions config/analysis_2022.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ samples:
HH:
era: "2022"
type: "signal"
group: "HH"
db: das:/GluGluToHHTo2B2VTo2L2Nu_node_SM_TuneCP5_PSWeights_13TeV-madgraph-pythia8/RunIIAutumn18NanoAODv7-Nano02Apr2020_102X_upgrade2018_realistic_v21-v1/NANOAODSIM
cross-section: 1
branching-ratio: 0.027669886574221
Expand All @@ -28,7 +27,6 @@ samples:
HH_EE: # using the same dataset
era: "2022EE"
type: "signal"
group: "HH"
db: das:/GluGluToHHTo2B2VTo2L2Nu_node_SM_TuneCP5_PSWeights_13TeV-madgraph-pythia8/RunIIAutumn18NanoAODv7-Nano02Apr2020_102X_upgrade2018_realistic_v21-v1/NANOAODSIM
cross-section: 1
branching-ratio: 0.027669886574221
Expand Down Expand Up @@ -307,12 +305,13 @@ samples:
generated-events: genEventSumw
split: 5

# TW cross section from: https://cms-talk.web.cern.ch/t/new-jecs-for-run3-prompt-fg-eras/26529
TbarWplusto2l2nu:
era: "2022"
group: "TW"
db: das:/TbarWplusto2L2Nu_TuneCP5_13p6TeV_powheg-pythia8/Run3Summer22NanoAODv11-126X_mcRun3_2022_realistic_v2-v1/NANOAODSIM
type: mc
cross-section: 36.05
cross-section: 4.668 # xsec(TW) / 2 (since t and tbar is included) x BR(W->l nu)^2 x 2 (since there are two W bosons) = 87.9 / 2 x 0.3259^2 x 2
generated-events: genEventSumw
split: 3

Expand All @@ -321,16 +320,16 @@ samples:
group: "TW"
db: das:/TbarWplusto2L2Nu_TuneCP5_13p6TeV_powheg-pythia8/Run3Summer22EENanoAODv11-126X_mcRun3_2022_realistic_postEE_v1-v1/NANOAODSIM
type: mc
cross-section: 3.605e+01
cross-section: 4.668
generated-events: genEventSumw
split: 7
split: 8

TbarWplustoLNu2Q:
era: "2022"
group: "TW"
db: das:/TbarWplustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/Run3Summer22NanoAODv11-126X_mcRun3_2022_realistic_v2-v1/NANOAODSIM
type: mc
cross-section: 36.05
cross-section: 19.31 # xsec(TW) / 2 (since t and tbar is included) x BR(W->l nu) x BR(W->qq) x 2 (since there are two W bosons) = 87.9 / 2 x 0.3259 x 0.6741
generated-events: genEventSumw
split: 6

Expand All @@ -339,10 +338,45 @@ samples:
group: "TW"
db: das:/TbarWplustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/Run3Summer22EENanoAODv11-126X_mcRun3_2022_realistic_postEE_v1-v1/NANOAODSIM
type: mc
cross-section: 3.605e+01
cross-section: 19.31
generated-events: genEventSumw
split: 15

TWminusto2l2nu:
era: "2022"
group: "TW"
db: das:/TWminusto2L2Nu_TuneCP5_13p6TeV_powheg-pythia8/Run3Summer22NanoAODv11-126X_mcRun3_2022_realistic_v2-v1/NANOAODSIM
type: mc
cross-section: 4.668
generated-events: genEventSumw
split: 4

TWminusto2l2nu_EE:
era: "2022EE"
group: "TW"
db: das:/TWminusto2L2Nu_TuneCP5_13p6TeV_powheg-pythia8/Run3Summer22EENanoAODv11-126X_mcRun3_2022_realistic_postEE_v1-v1/NANOAODSIM
type: mc
cross-section: 4.668
generated-events: genEventSumw
split: 8

TWminustoLNu2Q:
era: "2022"
group: "TW"
db: das:/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/Run3Summer22NanoAODv11-126X_mcRun3_2022_realistic_v2-v1/NANOAODSIM
type: mc
cross-section: 19.31
generated-events: genEventSumw
split: 6

TWminustoLNu2Q_EE:
era: "2022EE"
group: "TW"
db: das:/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/Run3Summer22EENanoAODv11-126X_mcRun3_2022_realistic_postEE_v1-v1/NANOAODSIM
type: mc
cross-section: 19.31
generated-events: genEventSumw
split: 15

plotIt:
configuration:
Expand Down Expand Up @@ -376,13 +410,13 @@ plotIt:
fill-color: "#9FFF33"
WJets:
legend: WJets
fill-color: "#FF0000"
fill-color: "#FFC300"
VV:
legend: VV
fill-color: "#C900FF"
TW:
legend: TW
fill-color: "#C900FF"
fill-color: "#FF0000"
plotdefaults:
normalized: False
y-axis: Events
Expand Down
5 changes: 5 additions & 0 deletions config/dascache/TWminusto2l2nu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# das:/TWminusto2L2Nu_TuneCP5_13p6TeV_powheg-pythia8/Run3Summer22NanoAODv11-126X_mcRun3_2022_realistic_v2-v1/NANOAODSIM
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22NanoAODv11/TWminusto2L2Nu_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_v2-v1/60000/2e392234-494e-4396-90d8-fd39800a3ad0.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22NanoAODv11/TWminusto2L2Nu_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_v2-v1/60000/5a5b2cce-b28f-4619-871b-7402d181bf89.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22NanoAODv11/TWminusto2L2Nu_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_v2-v1/60000/3a0c7e06-e9ed-4611-8d6d-47c4d4b82445.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22NanoAODv11/TWminusto2L2Nu_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_v2-v1/60000/455a9660-d79c-4908-87f9-c88adadac823.root
9 changes: 9 additions & 0 deletions config/dascache/TWminusto2l2nu_EE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# das:/TWminusto2L2Nu_TuneCP5_13p6TeV_powheg-pythia8/Run3Summer22EENanoAODv11-126X_mcRun3_2022_realistic_postEE_v1-v1/NANOAODSIM
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22EENanoAODv11/TWminusto2L2Nu_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_postEE_v1-v1/80000/7e51dba3-6a7d-44c6-b19a-767e3aed65df.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22EENanoAODv11/TWminusto2L2Nu_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_postEE_v1-v1/80000/fcb39d43-55cd-4c5a-a4e3-3b435c5c2ad4.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22EENanoAODv11/TWminusto2L2Nu_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_postEE_v1-v1/80000/0e2b8c5e-34ab-4d95-acd6-1eea19cfdafc.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22EENanoAODv11/TWminusto2L2Nu_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_postEE_v1-v1/80000/d0fa196d-965f-4d08-b4f6-d9b72a6157ab.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22EENanoAODv11/TWminusto2L2Nu_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_postEE_v1-v1/80000/f8196550-7931-4e4e-94a8-21050c0a483e.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22EENanoAODv11/TWminusto2L2Nu_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_postEE_v1-v1/80000/4a1a6d21-b3e7-4681-92d9-59c0c234e58a.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22EENanoAODv11/TWminusto2L2Nu_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_postEE_v1-v1/80000/49d0b105-6b7f-4382-8054-2a63b5b0c8d0.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22EENanoAODv11/TWminusto2L2Nu_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_postEE_v1-v1/80000/4b2d99c5-f75a-408b-8078-3e844fce34c9.root
7 changes: 7 additions & 0 deletions config/dascache/TWminustoLNu2Q.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# das:/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/Run3Summer22NanoAODv11-126X_mcRun3_2022_realistic_v2-v1/NANOAODSIM
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22NanoAODv11/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_v2-v1/40000/40ea1d1f-cf92-4961-84ed-38ebde8ba49b.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22NanoAODv11/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_v2-v1/40000/7ed217f6-6a88-4539-82b8-1cada7c03f87.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22NanoAODv11/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_v2-v1/40000/870b2636-bfec-4979-bd8e-e989c256bda3.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22NanoAODv11/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_v2-v1/40000/0554cc19-5d8d-4447-a636-6383abbfddcc.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22NanoAODv11/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_v2-v1/40000/ed7d93ef-4e5d-4604-a59e-923068cb02ef.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22NanoAODv11/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_v2-v1/40000/528256f1-094a-41c2-a41e-a5c3179ee7e7.root
16 changes: 16 additions & 0 deletions config/dascache/TWminustoLNu2Q_EE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# das:/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/Run3Summer22EENanoAODv11-126X_mcRun3_2022_realistic_postEE_v1-v1/NANOAODSIM
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22EENanoAODv11/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_postEE_v1-v1/60000/0d05f028-8f2c-4ee5-ba5e-02becfdfce52.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22EENanoAODv11/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_postEE_v1-v1/60000/9650eb1b-d347-40df-8d0c-5196b9172a06.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22EENanoAODv11/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_postEE_v1-v1/60000/40a9c47c-baff-421d-b18a-ed2ebcb616d1.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22EENanoAODv11/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_postEE_v1-v1/60000/d136b950-8cbd-44ad-a8e8-0613b560dc93.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22EENanoAODv11/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_postEE_v1-v1/60000/e32d5d60-3381-4df9-a780-eac2187eed8d.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22EENanoAODv11/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_postEE_v1-v1/60000/c4b062a7-8f44-4724-90d2-cc8bb3bdb028.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22EENanoAODv11/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_postEE_v1-v1/60000/befda636-ba50-4a84-9d0f-aaf95c2c448f.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22EENanoAODv11/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_postEE_v1-v1/60000/2cce1656-f3ae-4c1d-885c-21d47213c58a.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22EENanoAODv11/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_postEE_v1-v1/60000/7a813108-7a99-4bf3-92b3-4bd209f3f88a.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22EENanoAODv11/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_postEE_v1-v1/60000/2f3b555c-c35a-4312-9123-e5820c12748b.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22EENanoAODv11/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_postEE_v1-v1/60000/56b8dc60-b068-49ef-b709-3504a305a433.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22EENanoAODv11/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_postEE_v1-v1/60000/6c37faed-db9f-4cd1-8b50-95c9f943d03e.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22EENanoAODv11/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_postEE_v1-v1/60000/70ab972f-525c-4394-9d97-142c7f689f0f.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22EENanoAODv11/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_postEE_v1-v1/60000/235ee0c4-84ef-4acd-b3d2-3c0f4abb3cd6.root
root://cms-xrd-global.cern.ch///store/mc/Run3Summer22EENanoAODv11/TWminustoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/126X_mcRun3_2022_realistic_postEE_v1-v1/60000/3ceb8058-6508-4712-846b-bed81c948bf8.root
Loading