Produce skimmed analysis trees directly from centrally-produced NanoAOD, using the official postprocessing tools. This repository is meant for an analysis with a pair of tau leptons in several final states, and for 2016, 2017 and 2018 data, but can easily be used for other analyses.
First, install NanoAODTools
:
export SCRAM_ARCH=slc6_amd64_gcc700
cmsrel CMSSW_10_3_3
cd CMSSW_10_3_3/src
cmsenv
git clone https://github.com/cms-nanoAOD/nanoAOD-tools.git PhysicsTools/NanoAODTools
scram b
Then, install this NanoTreeProducer
:
git clone https://github.com/IzaakWN/NanoTreeProducer NanoTreeProducer
cd NanoTreeProducer
In case you use lepton scale factors and efficiencies from the HTT group, it available as the submodule HTT
in corrections/leptonEfficiencies
. You will need to make sure you have the latest version with
git submodule update --remote --merge
Otherwise, install manually with
cd corrections/leptonEfficiencies
git clone https://github.com/CMS-HTT/LeptonEfficiencies HTT
And if you want to use recoil corrections of the MET for W/Z/Higgs samples:
cd $CMSSW_BASE/src
git clone https://github.com/CMS-HTT/RecoilCorrections.git HTT-utilities/RecoilCorrections
scram b
Each time you want to run the code in a new shell session, do
cd CMSSW_10_3_3/src
cmsenv
source setupEnv.sh
You need to change the analyse code in the modules and tree branches for the analysis you want to perform. These are the examples for an analysis selecting for a muon and tau:
ModuleMuTau.py
ModuleCommon.py
TreeProducerMuTau.py
TreeProducerCommon.py
For a local run, do something like
./postprocessors/local.py -c mutau -y 2017
For job submission, you need to modify the list of samples you want to process in the config file, e.g.
samples_2017.cfg
and then do, submit with something like
./submit.py -c mutau -y 2017
To the check job success, you need to ensure that all the output file contains the expected tree with the expected number of processed events (-d
to compare to DAS):
./checkFiles.py -c mutau -y 2017 -d
If the output is fine, one can hadd (-m
) all the output:
./checkFiles.py -c mutau -y 2017 -m
Use the -o
option for the desired output directory, or edit samplesdir
in checkFiles.py
to set your default one.
To resubmit failed jobs, do:
./resubmit.py -c mutau -y 2017
Note: this submission works for the Sun Grid Engine (SGE) system of PSI Tier3 with qsub
. For other batch systems, one needs to create their own version of submit.sh
and submit_SGE.sh
.
More examples of postprocessors are given in postprocessors
.
- working book: https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookNanoAOD
- 2016
9_4_X
: https://cms-nanoaod-integration.web.cern.ch/integration/master/mc94X2016_doc.html - 2017
9_4_X
: https://cms-nanoaod-integration.web.cern.ch/integration/master/mc94X_doc.html - 2018
10_2_X
: https://cms-nanoaod-integration.web.cern.ch/integration/master-102X/mc102X_doc.html
More notes.
- 2016: https://twiki.cern.ch/twiki/bin/viewauth/CMS/PdmV2016Analysis#DATA
- 2017: https://twiki.cern.ch/twiki/bin/viewauth/CMS/PdmV2017Analysis#DATA, brilcalc
- 2018: https://twiki.cern.ch/twiki/bin/viewauth/CMS/PdmV2018Analysis#DATA, brilcalc
The integrated luminosity per era can be computed with scripts/eralumi.py
using brilcalc
on lxplus
.
JSON files are copied to the json
directory to prevent issues with connection to /afs
.
Tools to apply corrections are available in corrections.
When running the postprocessor with ROOT
version older than 6.12
, you might be prompted with
/work/ineuteli/analysis/CMSSW_9_4_6/python/PhysicsTools/NanoAODTools/postprocessing/framework/treeReaderArrayTools.py:69: RuntimeWarning: creating executor for unknown type "ULong64_t*"
ret = _vr.Get()[0]
/work/ineuteli/analysis/CMSSW_9_4_6/python/PhysicsTools/NanoAODTools/postprocessing/framework/treeReaderArrayTools.py:69: RuntimeWarning: creating executor for unknown type "unsigned char*"
ret = _vr.Get()[0]
And saving the LHE_Njets
(UChar_t
) variable in an integer branch (Int_t
via an numpy.int64
array) might give some unphysical values. (See this JIRA ticket, or this this issue.)