This repo provides some modules that can be used with the
nanoAOD-tools
framework for post-processing CMS's nanoAOD files.
The modules add new branches like lepton scale factors, using the
correctionlib
tool, and official
JSON correction files
provided by the CMS POGs.
First, install your favorite CMSSW release.
If you rely on correctionlib
and python3
,
it is strongly recommend to use CMSSW 11.3 or newer.
For example,
CMSSW 11.3.4 (for combine v9) | CMSSW 12.4.8 |
export SCRAM_ARCH=slc7_amd64_gcc900
cmsrel CMSSW_11_3_4
cd CMSSW_11_3_4/src
cmsenv |
export SCRAM_ARCH=slc7_amd64_gcc10
cmsrel CMSSW_12_4_8
cd CMSSW_12_4_8/src/
cmsenv |
Install nanoAOD-tools
to process nanoAOD files.
Note that starting from CMSSW 13_0_16, 13_1_5 and 13_3_0, a basic version of nanoAOD-tools
is included.
To install the standalone version, please do
cd $CMSSW_BASE/src/
git clone https://github.com/cms-nanoAOD/nanoAOD-tools.git PhysicsTools/NanoAODTools
Now install this repository as PhysicsTools/NATModules
and compile (build) everything:
cd $CMSSW_BASE/src/
cmsenv
git clone git@github.com:cms-cat/nanoAOD-tools-modules.git PhysicsTools/NATModules
scram b
Starting from CMSSW 11.3,
correctionlib
should come pre-installed.
To install yourself for older CMSSW versions,
please see have a look at documentation.
Note that correctionlib
works best for python3
.
Finally, install the correctionlib
JSON files provided by CMS
into PhysicsTools/NATModules/data
from the
cms-nanoAOD/jsonpog-integration
repository
on GitLab:
cd $CMSSW_BASE/src/PhysicsTools/NATModules
git clone ssh://git@gitlab.cern.ch:7999/cms-nanoAOD/jsonpog-integration.git data
or clone via Kerberos, where $USER
is your CERN lxplus name:
kinit $USER@CERN.CH
git clone https://$USER:@gitlab.cern.ch:8443/cms-nanoAOD/jsonpog-integration.git
Alternatively, this repository is regularly synchronized to /cvmfs/
,
so if your system has access, you can copy the latest version
cd $CMSSW_BASE/src/PhysicsTools/NATModules
cp -r /cvmfs/cms.cern.ch/rsync/cms-nanoAOD/jsonpog-integration data
Run a module, for example
cd $CMSSW_BASE/src/PhysicsTools/NATModules
python3 ./test/example_muonSF.py -i root://cms-xrd-global.cern.ch//store/mc/RunIISummer20UL16NanoAODv9/DYJetsToLL_M-50_TuneCP5_13TeV-amcatnloFXFX-pythia8/NANOAODSIM/20UL16JMENano_106X_mcRun2_asymptotic_v17-v1/2820000/11061525-9BB6-F441-9C12-4489135219B7.root
To use in your own analysis, you can use the standalone scripts in test
as an example.
If you compiled this package correctly, you can import the modules in
PhysicsTools/NATModules/python/modules
as
from PhysicsTools.NATModules.modules.muonSF import *