Skip to content

harrypuuter/NanoTreeProducer

 
 

Repository files navigation

NanoTreeProducer

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.

Installation

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

Analysis

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

Run the postprocessor

Locally

For a local run, do something like

./postprocessors/local.py -c mutau -y 2017

Batch

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.

Examples

More examples of postprocessors are given in postprocessors.

Notes

NanoAOD

More notes.

Samples

PPD Run II summary table

Integrated luminosity

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.

Pileup

Corrections

Tools to apply corrections are available in corrections.

Known issues

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.)

About

Produce analysis tree directly from NanoAODs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 97.2%
  • Shell 2.5%
  • C 0.3%