Skip to content

Commit

Permalink
Added event selection for 2l2q and 2l2nu (#64)
Browse files Browse the repository at this point in the history
* Updates for 2l2q channel (#4)

* H4L updates

* “Fsr Recovery & Rochester correction”

* Jet Selection Updated

* Mela loaded

* Delete helloworld.h

* Delete NJettiness.h

* Delete NJettiness.cc

* Delete helloworld.cc

* Delete proxy.sh

* Delete condor_setup_lpc.py

* Delete JetSFMaker.py

* Delete HZZAnalysisModule.py

* Delete condor_setup_lxplus.py

* Add files via upload

* Remove redundancy

* Update README.md

* Add files via upload

* Update README.md

* Update README.md

* Update README.md

* RoccoR Added

* Path fixed

* Add files via upload

* Add files via upload

* Delete __init__.pyc

* Delete RoccoR.cc

* Delete RoccoR.h

* Update README.md

* Update H4LCppModule.py

* Update keep_and_drop.txt

* Update README.md

Following updates:

- Updated to `CMSSW_10_6_30` from `CMSSW_10_6_20`
- Updated to the latest version of official nanoAOD-tools
- Added back the instruction of batch job.

* Update README.md

* MELA updates

* Delete KalmanMuonCalibrationsProducer/interface directory

* Delete KalmanMuonCalibrationsProducer/plugins directory

* Delete KalmanMuonCalibrationsProducer/python directory

* Delete KalmanMuonCalibrationsProducer/src directory

* Delete BuildFile.xml

* Trigger selection added

* Trigger Updated

* Update keep_and_drop.txt with Mela branches

* Update keep_and_drop.txt

* Update keep_and_drop.txt

* Sync for Lepton

* Add Z selection

* Lepton Module Changed

* hard code removed

* Reading branch modified

* First update for 2l2q

* UPdate the printing style and fixed the flags

* Added additional variables for resolved category

* updated condor script

* Added total number of events to print and in post-proc.py switched total entries to run to all

* Fixed the bug for FatJet selection; Updated the log summary

* Removed unnecessary lines

* Updated trigger list similar to HIG-23-001

* Update condor_setup_lxplus.py

To avoid confusion, I updated the name of the variables.

Also, I added all the variables we might update for each run in argparser.

* Updated Trigger list for 2l2q channel; Added mll cut of 40-180 GeV, and added option for output log file path in condor script

* Added argparser to GetLogSummary.py script; Added 2017 trigger list to Helper.py script; Added UL2017 root file path to post_proc.py

* - Updated 2018 trigger list for 202q

- Added option in post-proc such that it won't break the condor job

* made compatible with python2

* making compatible with python2

* added new root file

* Updated utils files; made compitable with python2

* added energy, pt, eta and phi for 2j system

* updated 2j part to ZZ system

* updated 2j part to ZZ system

* updated file

* updated file

* changes for 2l2nu branch

* update to the 2l2nu part

* Revert "Adding HZZ->2l2nu Category" (#15)

* - Removed the submodule utils

* - Minor update in condor submission script.
- Added summary of additional script information in the README file

* Added golden json information to post-proc

* - Few files changed "nanoAOD_vvVBS" -> "nanoAOD_skim"
- Added golden josn file (last commit there was a bug)
- Added JME corrector
- Added PU SF module
- Added bTag SF module (For now its not working)

* added data root file

* update

* Hzz analysis 2l2q v2 dev r (#5)

* Add golden json & fix submodule utils (#16)

* - Removed the submodule utils

* - Minor update in condor submission script.
- Added summary of additional script information in the README file

* Added golden json information to post-proc

* - replaced string "nanoAOD_vvVBS"  to "nanoAOD_skim" in few files
- Fix the json bug (For MC we don't need to provide)
- Added modules createJMECorrector, btagSFProducer, etc

* - Still issue with the btagSF
- Updated the method for modules to run
- Added PUWeightProducer

* Added a text file having list of MC samples

* Added additional cuts for 2l2q channel

* - Improved post-proc for the condor jobs submission

* Fix a bug in root file name

* input file updated to run over data and mc

* updates for running over data sample

* updates

* update for nElectron/nMuon issue

* update

* updates

* updates

* Debuging the cut-flow between h4l and h2l2q.. bug is still there

* Update H4LCppModule.py

Fixed the bug of bool branch passZZ*

* Hzz analysis 2l2v dev (#6)

* corrected TLorentz vector for MET part

* updates

* updates

* updates

* updated with MET part

* updated with MET part

* updates

* updates

* Temporary

* updates

* updates

* update for merging 2l2q and 2l2nu

* Fixed lepton selection

* updates

* BUGFIX: Leading two leptons kinematics were identical for all events (#7)

* Fixed the bug of bool branch passZZ*

* RoccoR with official nano-tools (#27)

* RoccoRUpdate

* Delete KalmanMuonCalibrationsProducer/data/roccor.Run2.v5 directory

---------

Co-authored-by: yuji <[email protected]>

* mergeOutput.py

* Some minor changes

* Added modules/functions for MET filters and GEN variables (#20)

* - Improved post-proc for the condor jobs submission

* Fix a bug in root file name

* Added the GEN producer and the MET filter

* - Added total entries
- Updated event summary print statement

* Committed changes without testing

* Updated keep_and_drop files

* Added METfilter in cut-flow

* Updated README

* Updating formating mainly to improve readebility

* Improved working of "--NOsyst" option

* - BUGFIX: Each leptons had same pT value. This is because we forgot the clear the vector.
- Added DEBUG option
- Updated condor job such that it can run over sl7 machine

* BugFix: We need to initialize TLorentzVector everytime by 0

---------

Co-authored-by: YujiLee301 <[email protected]>
Co-authored-by: yuji <[email protected]>

* Update for 2l2nu and Bug fix for 2l2q channel (#9)

* RoccoR with official nano-tools (#27)

* RoccoRUpdate

* Delete KalmanMuonCalibrationsProducer/data/roccor.Run2.v5 directory

---------

Co-authored-by: yuji <[email protected]>

* # For 2l2nu channel

- Added b-tagged jet info
- Added VBF jets and VBF di-jet kinematics. Along with the VBF jet index

# For 2l2q channel

BUGFIX-1: Updated "jetidx.size()+1" with "jetidx.size()" to select di-jet

BUBFIX-2: Jet index was wrong while accessing jets info when selecting based on mass

BUGFIX-3: Also, fixed jet index that was saved in output branch

* Added deltaPhi var for 2l2nu channel

---------

Co-authored-by: YujiLee301 <[email protected]>
Co-authored-by: yuji <[email protected]>

* RoccoR with official nano-tools (#27) (#10)

* RoccoRUpdate

* Delete KalmanMuonCalibrationsProducer/data/roccor.Run2.v5 directory

---------

Co-authored-by: YujiLee301 <[email protected]>
Co-authored-by: yuji <[email protected]>

* Some fixes (#11)

* Update condor job info and keep_and_drop file

* Fix: Size of output root file

Details here: #38

* - Updated condor job script
- Updated condor job resubmit script
- Updated the keep and drop file- reduced the list
- Updated the merge nanoAOD root file script
- Updated README file

* - Updated condor setup script
- Updated condor resubmit script
- Added nanoAOD root file hadd-ed script

* Updated keep_and_drop*.txt

* - Removed the hardcoded output root file name in the post-proc and in the condor job script

* Added few scripts; later remove once that are not necessary or obselete

* Running version after update 2l2nu function

* Added some new variables to the output and naming convention

* Some updates to workflow of 2l2nu and 2l2q

* Removed the hardcoded cut-flow json file name and added option "--Nosyst" in condor script so that one can submit jobs without systematics

* - Updated 2018 YAML file to incorporate the separate trigger list for the different final states
- Accordingly update the code

* updates

* selection of z1 candidate for emu control region

* emu controlregion - lepton pt and eta update

* updates for emu control region

* updates

* update to find delta boost between two Z bosons

* Pz of neutrino

* update

* change of initial values of njets

* Merge branch and some minor changes (#12)

* Update condor job info and keep_and_drop file

* Fix: Size of output root file

Details here: #38

* - Updated condor job script
- Updated condor job resubmit script
- Updated the keep and drop file- reduced the list
- Updated the merge nanoAOD root file script
- Updated README file

* - Updated condor setup script
- Updated condor resubmit script
- Added nanoAOD root file hadd-ed script

* Updated keep_and_drop*.txt

* - Removed the hardcoded output root file name in the post-proc and in the condor job script

* Added few scripts; later remove once that are not necessary or obselete

* Running version after update 2l2nu function

* Added some new variables to the output and naming convention

* Some updates to workflow of 2l2nu and 2l2q

* Removed the hardcoded cut-flow json file name and added option "--Nosyst" in condor script so that one can submit jobs without systematics

* - Updated 2018 YAML file to incorporate the separate trigger list for the different final states
- Accordingly update the code

* - BugFix: Mass windown of leptonic Z boson was missing the `fabs` function, which caused the window to be incorrectly defined
- BugFix: nJets branches should be initialize with ZERO, but it was initialize with -999
- Removed b-tag cut from 2l2nu selection
- Moved the hardcoded b-tag cut to the configuration file
- Added missing background samples

* - BugFix: Condor job not using custom name for the cut-flow file
- BugFix: If two sample names are same then it checks for word `ext` in the name to differentiate them

* Added script to remove duplicates from root file

* Updated condor for the output dir naming convention

* To avoid updating two keep and drop file I made two list for general variable and MC variables and keep them in .py file. Now, we need to write any variable only once in proper list GEN only or Data_MC.

* update lepton id

* update lepton id

* update lepton id

* update lepton id

* updates for lepton id

* update on object selection

* update for jet_puid for pt < 50

* update for jet_puid for pt < 50

* update for jet_puid for pt < 50

* update for object selection

* update for gen part

* update for gen part

* update for gen part

* update to the gen part

* update to pz of neutrino

* list of signal dataset for different mass point

* Bug fix and condor improvement (#13)

* Removed transfer file from condor as now we don't have any files to transfer

* Now condor job will take arguments from txt file instead of many jdl files #51

* Update .write method to file instead of multi-string now just using one string using """

* As yaml-cpp is not available on el7 container so now cloe the yaml-cpp package and build it to remove the official dependencies. This solves Issue #54

* - Fix the ele eta cut for barrel and endcap transition
- Added the print statement under debug condition
- Added all high mass 2l2nu signal sample

* Changing the setup to work with EL9 #56

* Added variables to yml file for studying Di and single lepton triggers. (#57)

* Added variables to yml file for studying Di and single lepton triggers.

* Added leptons high pT triggers

---------

Co-authored-by: skeshri <[email protected]>

* Update condor script

* Fixed the library issue and nanohadd script fix for python2 to 3 shift

* Update condor job script

* Added output Dir option when running locally

* BugFix: Condor resubmit script is adapted as per the changes made for improving condor script #51 #56

---------

Co-authored-by: skeshri <[email protected]>
Co-authored-by: skeshri <[email protected]>

* Updated README (#14)

* - Bugfix for GEN variables module. It was also triggering for the data but it should not. (#15)

- Added VBF MC sample in the sample list
- Updated the README

---------

Co-authored-by: YujiLee301 <[email protected]>
Co-authored-by: Ramkrishna Sharma <[email protected]>
Co-authored-by: Ram Krishna Sharma <[email protected]>
Co-authored-by: yuji <[email protected]>
Co-authored-by: skeshri <[email protected]>
Co-authored-by: skeshri <[email protected]>

* updates for emu control region (#62)

* updates for emu control region

* updates for emu control region

* updates for emu control region

* updates to emu control region

* modified print statement

* Addition of cutflow histogram (#63)

* updates for emu control region

* updates for emu control region

* updates for emu control region

* updates to emu control region

* modified print statement

* addition of cutflow histogram

* add cutflow table

* add cutflow table

* add cutflow table

* update for cutflow table

* cut flow table

* cut-flow bug fix (#16)

* cut-flow bug fix

* - Updated naming convention for systematics
- Added script to set the environment named `set_env.sh`
- Updated README
- Added script to get the text file for sync

* Added the arguments to choose which channel to run

* Bug fix

---------

Co-authored-by: Ram krishna Sharma <[email protected]>

* Code restructured & Option to run all three channels (#66)

* First running version of all channels: But it does not contain the latest run3 changes

* Removed unwanted files and updated README

* Restructured the code

* Update README.md

Updated path for commit to master branch

* Update setup.sh

Updated branch for accepting PR to master

* Update README.md

Updated branch name for accepting PR to master

---------

Co-authored-by: Anusreevijay769 <[email protected]>
Co-authored-by: YujiLee301 <[email protected]>
Co-authored-by: yuji <[email protected]>
Co-authored-by: skeshri <[email protected]>
Co-authored-by: skeshri <[email protected]>
  • Loading branch information
6 people authored Dec 2, 2024
1 parent 580b4d4 commit feb2613
Show file tree
Hide file tree
Showing 109 changed files with 5,905 additions and 33,336 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# Ignore root files
*.tgz
*.xml
*.1
*.png
*.pdf
crab_project*/
*.rst
*.swp
*.swm
*.swn
*.swo
*.bkup
*.patch
summary.dat
Expand Down Expand Up @@ -158,3 +169,7 @@ br.sm2
*maincc
*linkdef.h
JHUGenMELA/
cutFlow.json
yaml-cpp/
nanoAOD_skim.wiki/
*.bak
1 change: 0 additions & 1 deletion ExampleInputFileList.txt

This file was deleted.

369 changes: 0 additions & 369 deletions H4LCppModule.py

This file was deleted.

97 changes: 0 additions & 97 deletions Input_2018.yml

This file was deleted.

115 changes: 24 additions & 91 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,108 +1,41 @@
# NanoAOD Skim
nanoAOD skiming code for H->ZZ->2l2Q studies.
nanoAOD skiming code for H->ZZ->4l/2l2Q/2l2nu studies.

## Code setup
# Setup

1. Step: 1: Get CMSSW release
To setup the code, download the setup script and run it. As it will download four GitHub repository using ssh link, so it will ask for the password. The details of the `setup.sh` script is given in this [README.md](docs/README.md) file.

```bash
cmsrel CMSSW_10_6_30
cd CMSSW_10_6_30/src
cmsenv
```

2. Step: 2: Get official nanoAODTools

```bash
git clone [email protected]:cms-nanoAOD/nanoAOD-tools.git PhysicsTools/NanoAODTools
cd PhysicsTools/NanoAODTools
git checkout 65359982275c476834ad4b37363d658166881f12 # Updated to commit on 16 June 2023 in official nanoAOD-tools
```

3. Step: 3: Get our analysis repository

```bash
cd $CMSSW_BASE/src
git clone [email protected]:ram1123/nanoAOD_skim.git PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim
cd PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim
git checkout HZZ_Analysis
cd -
cmsenv
# patch PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim/nanoAOD_tools.patch
cp PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim/data/btag/*.csv PhysicsTools/NanoAODTools/data/btagSF/.
scram b
voms-proxy-init --voms cms --valid 168:00
```
```bash
wget https://raw.githubusercontent.com/ram1123/nanoAOD_skim/refs/heads/HZZ_Analysis/setup.sh
source setup.sh
```

(Optional: Fix git repo)

```bash
find PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim/.git/ -name "*.py*" -delete
```
Once it's done, you can set the environment and run the code.

4. Step: 4: Get the MELA package
```bash
cmsenv
source set_env.sh
python3 post_proc.py
```

```bash
cd $CMSSW_BASE/src/PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim
git clone -b v2.3.5 https://github.com/JHUGen/JHUGenMELA
sh JHUGenMELA/MELA/setup.sh -j 8
cd JHUGenMELA/MELA
make
```
# batch job submission.
Condor-job submission (recommended)

4. Step: 4: interactive running
In the file [condor_setup_lxplus.py](scripts/condor/condor_setup_lxplus.py), specify the correct input text file (present inside directory [input_data_Files](input_data_Files)) from which you need to take input NanoAOD DAS names. Also, updated the output EOS path. Then do the following:

```bash
cd $CMSSW_BASE/src/PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim
python post_proc.py
```

5. batch job submission.
1. Step: 5 (a): Condor-job submission (recommended)
1. In the file [condor_setup_lxplus.py](condor_setup_lxplus.py), specify the correct input text file (present inside directory [input_data_Files](input_data_Files)) from which you need to take input NanoAOD DAS names. Also, updated the output EOS path. Then do the following:

```bash
cd $CMSSW_BASE/src/PhysicsTools/NanoAODTools/python/postprocessing/analysis/nanoAOD_skim
# Use the arguments that you need.
python condor_setup_lxplus.py --input-file sample_list_v9.dat
# Set proxy before submitting the condor jobs.
voms-proxy-init -voms cms --valid 200:00
condor_submit <Files-created-from-above-command>.jdl
```

1. Step: 5(b): Crab-job submission (Not tested recently)
```bash
cd crab/
voms-proxy-init -voms cms --valid 200:00
source /cvmfs/cms.cern.ch/crab3/crab.sh
crab submit -c crab_cfg.py
```

## Few additioanl scripts

1. [condor_setup_lxplus.py](condor_setup_lxplus.py): This script can be used to setup the condor jobs. It takes the input text file (present inside directory [input_data_Files](input_data_Files)) from which you need to take input NanoAOD DAS names. Also, updated the output EOS path. Then do the following:

```bash
python condor_setup_lxplus.py --input-file sample_list_v9.dat
```
This will create the condor job files and the condor log files.

1. [scripts/GetLogSummary.py](scripts/GetLogSummary.py): This script can be used to get the summary of the condor jobs. It takes the condor log files as input and gives the summary of the jobs. This summary contains the cut-flow table. It can be used as follows:

```bash
python scripts/GetLogSummary.py <condor_log_file_base_path>
```

2. [scripts/check_das_sample.py](scripts/check_das_sample.py): This script can be used to check the status of the DAS samples. It takes the DAS name of the sample as input and gives the status of the sample. It can be used as follows:

```bash
python scripts/check_das_sample.py <DAS_name_of_the_sample>
# Use the arguments that you need.
python3 scripts/condor/condor_setup_lxplus.py --input_file sample_list_v9_2018.dat
# Set proxy before submitting the condor jobs.
voms-proxy-init -voms cms --valid 200:00
condor_submit <Files-created-from-above-command>.jdl
```

3. [scripts/condor_resubmit.py](scripts/condor_resubmit.py): This script can be used to resubmit the failed condor jobs. It takes the condor log files as input and resubmits the failed jobs. It can be used as follows:
To resubmit the failed jobs, use the following command:

```bash
python scripts/condor_resubmit.py <condor_log_file_base_path>
python3 scripts/condor/nanoAOD_condor_resubmit.py -d condor_logs/SkimNanoAOD_2022_ZXCR/240312_135155/ -s /eos/user/r/rasharma/nanoAOD_ntuples/SkimNanoAOD_2022_ZXCR/ -i submit_condor_jobs_lnujj_SkimNanoAOD_2022_ZXCR.txt -n 1
```

## Few important points
This will give you new txt file. Then you can submit the condor job using new txt file.
Loading

0 comments on commit feb2613

Please sign in to comment.