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

Run i ifinal #19

Open
wants to merge 135 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
fa42829
2018 branch to run on 102x mc
lsoffi Sep 25, 2018
13e4889
cut by cut bool
swagata87 Oct 17, 2018
4b82aaf
cut-by-cut ele branches
swagata87 Oct 17, 2018
a252248
changes
swagata87 Oct 19, 2018
dea118f
update
swagata87 Dec 10, 2018
278bc29
100X to 94X name change
swagata87 Feb 28, 2019
4a806f2
Do not track *.pyc, *.root or temporary crab files
Aug 29, 2019
c801ab0
Update README.md
Aug 29, 2019
1cbf97c
Comment added
Aug 29, 2019
5dcd9f7
Pile-up for 2018
Aug 29, 2019
f64d32d
Clean-up of unneeded old commented code
Aug 29, 2019
3272736
Make it possible to add multiple HLT filters to measure
Aug 29, 2019
67f9bba
Update README.md
tomcornelis Sep 4, 2019
269f9e2
2018 files
swagata87 Sep 9, 2019
d850acf
Merge pull request #1 from tomcornelis/Nm1_proposedUpdates
swagata87 Oct 2, 2019
1b58ef3
first commit
lfinco Dec 4, 2019
3bde22e
trying to match L1 objects
lfinco Dec 4, 2019
2e8b722
working L1 matching for Leg1
lfinco Dec 5, 2019
41465c3
Attempt to have the L1 leg thresholds based on prescale
Dec 6, 2019
784560a
Merge pull request #1 from tomcornelis/lfinco
lfinco Dec 9, 2019
386ab20
modified version of submitting script
lfinco Dec 16, 2019
449397d
Subtracting lumis from lower thresholds + merging files with the same…
Dec 16, 2019
3b0ceab
Merge pull request #2 from tomcornelis/lfinco
lfinco Dec 16, 2019
c5d46e3
Skipping empty jsons
Dec 17, 2019
04cf172
Merge pull request #3 from tomcornelis/lfinco
lfinco Dec 17, 2019
bd4b94e
correction of the allProbes collection for the case with L1 matching
lfinco Jan 16, 2020
9f926d8
few small corrections and tests
lfinco Jan 17, 2020
3119dd0
Simplifying/generalization of crab submission script
Feb 18, 2020
bf02db6
README: recommended release to include V2 ID's
Feb 18, 2020
b81fb62
Storing more ID's in the trigger tree
Feb 18, 2020
77d822a
Test directory
Feb 18, 2020
a1caf80
Move crab directory one level up
Feb 18, 2020
5f06b00
Quick way to test all data/MC and year combinations
Feb 19, 2020
b52ec39
Run trigger by default
Feb 19, 2020
4f19787
implement el_relPfLepIso03 and passingDoubleHLTsafe
guitargeek Feb 19, 2020
b8acc18
Merge pull request #1 from guitargeek/VVV_patch
tomcornelis Feb 19, 2020
fd7160a
Adding check for single values in the test runs
Feb 20, 2020
ab6f418
Big clean-up/refactoring, all ID's now added to the trigger tree
Feb 20, 2020
b722d8b
Merge remote-tracking branch 'myfork/RunIIfinal' into RunIIfinal
Feb 20, 2020
0bb0766
Print out the error when test fails
Feb 20, 2020
d47a635
Reference files uploaded to git
Feb 20, 2020
be188eb
In the process of adding 2016/2017
Feb 20, 2020
afc9ac0
Updating DY samples
Feb 21, 2020
7fa4c3b
README updated
Feb 21, 2020
2f46c2c
L1 matching requirement for leg23 flag, added flags for HLTDoubleEle33
lfinco Feb 21, 2020
7b17490
Merge remote-tracking branch 'lfinco/lfinco' into RunIIfinal_lfincoMerge
Feb 21, 2020
f14dc6a
L1 matching clean-up
Feb 21, 2020
2a8c7b5
Apply L1 matching based on the "L1match" occuring in the flag name
Feb 26, 2020
eebab97
Small print statement
Feb 27, 2020
9124096
Adding photon variables
Feb 27, 2020
6b9870a
Updating test files
Feb 27, 2020
045921b
Merge pull request #2 from tomcornelis/RunIIfinal_lfincoMerge
tomcornelis Feb 27, 2020
7c2f2cd
Adding two more photon variables
Feb 27, 2020
5b682a3
Correct HLT settings for all years
Feb 28, 2020
fab75d0
Print statement
Feb 28, 2020
c878088
print statement
Feb 28, 2020
bf03941
Update reference files
Feb 28, 2020
837ff10
Merge pull request #3 from tomcornelis/RunIIfinal_lfincoMerge
tomcornelis Feb 28, 2020
790ae04
Improving crab submission
Feb 28, 2020
88ed42e
typo solved
Feb 28, 2020
8482262
Make sure they make separate crab directories for different years
Feb 28, 2020
1d98bbc
Allow to submit from slc7
Feb 28, 2020
1d0c267
Use wrapper to avoid crazy crab errors
Feb 28, 2020
3c42d67
Make it work on lxplus
Mar 2, 2020
b98c2ec
Needs to differentiate between era=2016 and is80X, because 2016 MiniA…
Mar 2, 2020
be26178
Adding variable which seem to be in there in some other branches
Mar 3, 2020
5083d29
Implementing the possibility to submit with different L1 thresholds
Mar 3, 2020
dcc0f6d
Little script to merge the output files
Mar 5, 2020
c404f12
Automatic check if it was already merged correctly
Mar 5, 2020
debf6b6
To mix the prescales in monte carlo as they are in data
Mar 6, 2020
50aed17
Update README
Mar 9, 2020
3e5f9fc
Small fixes
Mar 14, 2020
0606440
Implementation of lepton mva's
Mar 20, 2020
bbe7ab9
Switch of debug output
Mar 20, 2020
b77a6dc
Refactoring the probe modules
Mar 23, 2020
1ff90cd
Removing duplicate code, use writeValueMap() everywhere
Mar 25, 2020
f249a2c
Adding the new TOP leptonMva
May 8, 2020
0247ea2
Update testing
May 8, 2020
1a17dbb
Updating README
May 8, 2020
2b85a53
Update README
May 8, 2020
b277d2b
Update README
May 8, 2020
f37c63e
Make sure there is a log directory
May 8, 2020
eab98da
Make sure ElectronVariableHelper.h can work on AOD
May 12, 2020
aa13dc9
Fix AOD running
May 12, 2020
b6458a6
Save mc_probe variables only for MC
May 12, 2020
43b5ecb
Do not ignore exceptions
May 12, 2020
d054740
Fix/improve compareTrees script
May 12, 2020
f3754d6
New test run finished
May 12, 2020
fa23503
update .gitignore
May 12, 2020
18be326
To quickly commit updated rootfiles and logs from test
May 12, 2020
4d12423
Putting GT's in TnPTreeProducer_cfg
May 14, 2020
fb1ba8e
New test run finished
May 14, 2020
2fb6e1a
Fixing variable input to lepton mva's
May 14, 2020
b530134
New test run finished
May 14, 2020
9636b75
Quick change in what to run for tests
May 15, 2020
87f7f2a
Quick change in what to run for tests
May 15, 2020
bcc1e0a
Typo and update README
May 15, 2020
8bb7fdf
Add DY NLO and reduce the units per job to avoid walltime limits
May 29, 2020
f3d79eb
Remove tabs from python code
Jun 2, 2020
571fabd
Avoid to run the try catch block for every event
Jun 3, 2020
73108b3
Adding location of tuples to README
Jun 5, 2020
35a7cc6
Use own test files
Jun 5, 2020
57a2bac
Adding a few more variables
Jun 8, 2020
2f8d7b3
Working towards a CMSSW-release indepedent branch
Jun 8, 2020
2524b1a
New test run finished
Jun 8, 2020
60787da
Combining branch RunIIfinal_UL into RunIIfinal
Jun 8, 2020
7c4a054
New test run finished
Jun 8, 2020
52334fa
Needed for compilation in CMSSW_10_6_X
Jun 9, 2020
d41c3ca
Small fix to find xml for leptonMvaTOP in UL
Jun 9, 2020
91a15ec
Also having the UL test files stored at eos
Jun 9, 2020
85b0783
runTests.py does UL tests when in CMSSW_10_6
Jun 9, 2020
8e972bf
Update README: RunIIfinal branch works now in both CMSSW_10_2 and CMS…
Jun 9, 2020
0932585
New test run finished (UL tests added)
Jun 9, 2020
eedea55
Get rereco and UL crab submission in same file
Jun 9, 2020
83ff108
Make it CMSSW_11_X compatible
Jun 9, 2020
6cda14b
Merge branch 'RunIIfinal' of https://github.com/tomcornelis/EgammaAna…
Jun 9, 2020
2069ed6
Update README
Jun 9, 2020
68690fd
Fix isReleaseAbove function
Jun 9, 2020
b7f4de3
Update GT for 2018
Jun 9, 2020
3f34119
We still had this old 80X-style 2016 data here, corrected now
Jun 10, 2020
bbe62cb
Typo in README
Jun 11, 2020
8382a15
Update README: new tuples location
Jun 15, 2020
e18c34b
Adding extension for 2018 DY NLO sample
Jun 20, 2020
901502b
Add matched conversion
Jul 8, 2020
cf79a2a
Don't fail when temp files already exist
Jul 16, 2020
de3b6c1
Updated general info for UL2016
ram1123 Feb 10, 2021
74d6b35
Merge pull request #5 from ram1123/dev/RunIIfinal_UL2016
swagata87 Jun 27, 2022
a378e17
change made
Aug 1, 2022
ac31b25
change made
Aug 1, 2022
c9acfdf
Update README.md
yiruole Aug 1, 2022
d23131f
Update TnPTreeProducer_cfg.py
yiruole Aug 2, 2022
df9fd9e
change made
Mar 20, 2023
e1b8d5f
change made
Mar 20, 2023
0e0da1f
change made
Apr 3, 2023
ac7d575
change made
Apr 3, 2023
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.root
*.pyc
__init__.py
crab/prescaleInformation
crab/crab*
152 changes: 143 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,151 @@
# EgammaAnalysis-TnPTreeProducer
TnP package for EGM

For regular users
1. install
Package of the EGamma group to produce Tag-and-Probe trees

git clone https://github.com/cms-analysis/EgammaAnalysis-TnPTreeProducer EgammaAnalysis/TnPTreeProducer -b <branchVersion>
## Overview of branches

| Branch | release | tnpEleIDs | tnpPhoIDs | tnpEleTrig | tnpEleReco | purpose |
| ------------------------------------------ | ------------------ |:------------------:|:------------------:|:------------------:|:------------------:|:--------------------------------------:|
| | | *miniAOD* | *miniAOD* | *miniAOD* | *AOD* | |
| [RunIIfinal](../../tree/RunIIfinal) | CMSSW\_10\_2 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | Run II analysis |
| [RunIIfinal](../../tree/RunIIfinal) | CMSSW\_10\_6 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | Run II analysis using ultra-legacy |
| [CMSSW\_11\_X\_Y](../../tree/CMSSW_11_X_Y) | CMSSW\_11 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :white_check_mark: | Development for Run III (experimental) |

For developpers
1. On github fork the package https://github.com/cms-analysis/EgammaAnalysis-TnPTreeProducer
2. Add the remote
Note: because of a dataformat CMSSW\_10\_6 can only be used for ultra-legacy samples, and CMSSW\_10\_2 should be used for the rereco samples.

git remote add username-push git@github.com:username/EgammaAnalysis-TnPTreeProducer.git
## Available tuples

### ReReco 2016, 2017 and 2018
If you do not need changes to the default code, you can simply use existing flat tag and probe trees, avalaible for both 2016, 2017 and 2018 (RunIIfinal branch):

```bash
ls /eos/cms/store/group/phys_egamma/tnpTuples/tomc/2020-06-09/*/merged/
```

These inlcude the tnpEleTrig, tnpEleIDs and tnpPhoIDs trees produced with the RunIIfinal branch.
*Main change with respect to the 2020-02-28 production is the inclusion of some additional branches, e.g. the leptonMva's*

### ReReco 2016, 2017 and 2018 - L1 matched
In case you need L1 matching for the measurement of doubleEle HLT triggers, you can use the tnpEleTrig trees found in:

```bash
ls /eos/cms/store/group/phys_egamma/tnpTuples/tomc/2020-03-03/*/merged/*L1matched.root
```

### UL2017 and UL2018
For ultra-legacy we have tnpEleTrig, tnpEleIDs and tnpPhoIDs trees available at:
```
ls /eos/cms/store/group/phys_egamma/tnpTuples/tomc/2020-05-20/UL2018/merged
ls /eos/cms/store/group/phys_egamma/tnpTuples/tomc/2020-05-20/UL2017/merged
ls /eos/cms/store/group/phys_egamma/tnpTuples/rasharma/2021-02-10/UL2016postVFP/merged
ls /eos/cms/store/group/phys_egamma/tnpTuples/rasharma/2021-02-10/UL2016preVFP/merged
```


## To produce new tuples
### 1a. Install for rereco (CMSSW\_10\_2\_X with X=10 or higher, works for 2016, 2017 and 2018 data/MC)

```bash
cmsrel CMSSW_10_2_22
cd CMSSW_10_2_22/src
cmsenv
git clone -b RunIIfinal git@github.com:cms-egamma/EgammaAnalysis-TnPTreeProducer.git EgammaAnalysis/TnPTreeProducer
scram b -j8
```

### 1b. Install for ultra-legacy (CMSSW\_10\_6\_X, works for UL2017 and UL2018 data/MC)

```bash
cmsrel CMSSW_10_6_13
cd CMSSW_10_6_13/src
cmsenv
git clone -b RunIIfinal git@github.com:cms-egamma/EgammaAnalysis-TnPTreeProducer.git EgammaAnalysis/TnPTreeProducer
scram b -j8
```

### 2. Try-out
You can find the cmsRun executable in EgammaAnalysis/TnPTreeProducer/python:
```bash
cd EgammaAnalysis/TnPTreeProducer/python/
cmsRun TnPTreeProducer_cfg.py isMC=True doTrigger=True era=UL2018
```
Check [TnPTreeProducer\_cfg.py](python/TnPTreeProducer_cfg.py) for all available options. Update the code if you need to implement custom-made recipes.

Test files can be defined in [python/etc/tnpInputTestFiles\_cff.py](python/etc/tnpInputTestFiles_cff.py)
If you update the code, you can use the ./runTests.py script in the test directory to check for new differences in the 2016, 2017 and 2018 test files.

### 3. Submit jobs
Check in EgammaAnalysis/TnPTreeProducer//crab the tnpCrabSubmit.py script to submit your jobs using crab

```bash
source /cvmfs/cms.cern.ch/common/crab-setup.sh
```

## To make a pull request to this repository
1. On github fork the package https://github.com/cms-analysis/EgammaAnalysis-TnPTreeProducer
2. Add the remote
```bash
git remote add username-push git@github.com:username/EgammaAnalysis-TnPTreeProducer.git
```
3. push commits to fork and then standard pull request process
git push username-push branchname
```bash
git push username-push branchname
```

## Adding new workingpoints
You can add new electron workingpoints in [python/egmElectronIDModules\_cff.py](python/egmElectronIDModules_cff.py) and new photon workingpoints
in [python/egmPhotonIDModules\_cff.py](python/egmPhotonIDModules_cff.py). Each new workingpoint added in these python config fragments will
add a new "passing<WP>" boolean in the electron and photon trees respectively. Of course, one can also choose to simply add a variable in
[python/egmTreesContent\_cff.py](python/egmTreesContent\_cff.py), which might be preferred for MVA variables when you want to have the
flexibility to explore different workingpoints: you can simply put a cut on these variable in the egm\_tnp\_analysis package.

## Description of variables

Description of some of variables in the output tree is given [here](VariablesInfo.md).




## notes from Ruole Yi
The process of Tag&probe analysis

1. Make tnptree https://github.com/sethcooper/EgammaAnalysis-TnPTreeProducer
* Dataset: https://twiki.cern.ch/twiki/bin/viewauth/CMS/PdmVRun2LegacyAnalysis NLO sample https://cms-pdmv.cern.ch/grasp/samples?dataset_query=*DYJetsToLL_LHEFilterPtZ*&campaign=RunIISummer20UL16*GEN,RunIISummer20UL16*GENAPV,RunIISummer20UL17*GEN,RunIISummer20UL18*GEN
* Setup tree structure: https://github.com/sethcooper/EgammaAnalysis-TnPTreeProducer/blob/legacyTriggerScaleFactorsLQ/python/TnPTreeProducer_cfg.py
* Use file to submit job to crab: https://github.com/sethcooper/EgammaAnalysis-TnPTreeProducer/blob/legacyTriggerScaleFactorsLQ/crab/tnpCrabSubmit.py
* Submit to crab: crab submit -c tnpCrabSubmit.py
* If wanna kill job: crab kill + path of output file
* Summit failed job: first check job status then `crab resubmit`
* Check output: login cmslpc check /eos/uscms/store/user/ryi/LQ/TnP/
* Combine crab output:https://twiki.cern.ch/twiki/bin/view/CMSPublic/CRAB3AdvancedTopic#Merging_output_files or use hadd mergedfile.root out_file_*.root (先开启cmssw-cmsenv)
* Cmslpc-eos 的job可以转移到lxplus-afs 的cern box:/eos/user/r/ryi
scp /eos/uscms/store/user/ryi/LQ/TnP/2018UL-DY-LO-ext.root ryi@lxplus.cern.ch:/eos/user/r/ryi/TagandProbe/TnP2017/


2. Analyse tnptree https://github.com/sethcooper/egm_tnp_analysis
* Cmsenv first
* python tnpEGM_fitter.py etc/config/settings_passTrigger.py
* python tnpEGM_fitter.py etc/config/settings_passTrigger.py --flag passingTrigger --createBins
* python tnpEGM_fitter.py etc/config/settings_passTrigger.py --flag passingTrigger --checkBins
* python tnpEGM_fitter.py etc/config/settings_passTrigger.py --flag passingTrigger --createHists

nominal fit
python tnpEGM_fitter.py etc/config/settings_passTrigger.py --flag passingTrigger --doFit

MC fit to constrain alternate signal parameters
python tnpEGM_fitter.py etc/config/settings_passTrigger.py --flag passingTrigger --doFit --mcSig --altSig --addGaus

Alternate signal fit
python tnpEGM_fitter.py etc/config/settings_passTrigger.py --flag passingTrigger --doFit --altSig --addGaus

Alternate background fit
python tnpEGM_fitter.py etc/config/settings_passTrigger.py --flag passingTrigger --doFit --altBkg

Check fits and redo failed ones
python tnpEGM_fitter.py etc/config/settings_passTrigger.py --flag passingTrigger --doFit --iBin ib

egm txt ouput file
* python tnpEGM_fitter.py etc/config/settings_passTrigger.py --flag passingTrigger --sumUp



Loading