uhussain / VVAnalysis

Analysis code for WZ --> 3lnu and ZZ --> 4l (2017)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Analysis code for WZ/ZZ analyses. Some scripts using selections to skim Ntuples and C++ code to make histogram files for WZ.

Setup


CMSSW version: CMSSW_10_4_0 # or CMSSW_9_2_14

X_Y_Z="10_4_0" # or 9_2_14
username="kdlong" # or your username

To checkout and compile:

cmsrel CMSSW_version
cd CMSSW_X_Y_Z/src
mkdir Analysis
cd Analysis
git clone git@github.com:<username>/VVAnalysis.git
scram b -j 8

You will also want to install a separate package that contains information on the datasets used and histograms and binning. It is not required that you use this file, but it will be convenient for managing larger datasets (e.g., for getting the correct cross sections). It's recommended that you fork this into your github because some files/settings will be user specific.

install_path = ~username/work/ (or whatever you prefer)

cd install_path
git clone git@github.com:<username>/AnalysisDatasetManager.git

You should create a new configuration file following the example here to have settings specific to you. Use the name config..

Overview


This repository includes scripts to run all steps (starting with UWVV ntuples) to produce the results of SMP-18-001. Many steps should be trivially modifiable for other analyses.

Current developement is in progress to also allow the use of NanoAOD in place of the UWVV ntuples. NanoAOD is a centrally-maintained ntuple which can signficantly reduce manpower needed to maintain private ntuples. More detail is given in the NanoAOD section.

The analysis processeeds in several steps.

  1. Produce ntuples using UWVV. See this package for further documentation. NanoAOD is also supported for some processes. In principle other packages could be used without much trouble, but variable names etc would need to be modified. Output is generally stored on a distributed storage system, e.g. /hdfs at UW or /eos at CERN.
  2. Skim ntuples or NanoAOD to create smaller files that can be copied to a "local" storage disk, such as /data at uwlogin or /nfs_scratch at Wisconsin.
  3. Run analysis code to estimate backgrounds and produce histograms with final selections.
  4. Plotting code combines histograms by scaling with cross section and luminosity information. Colors and CMS style are implemented.

Specifics


Each step deserves some degree of explanation. They are also all driven by independent scripts, and can be run separately. The ntuple skimming is generally run independently. It is not required, but is advantageous to reduce files sizes for convenience in storage and processing. It is absolutely necessary that the tightest condition you use in your skim be looser the selection you implement in a later selector, however. For a fully MC driven analysis, one can often implement the full selection at the skim step and produce plots from here. Note, however, that the statistical tools are designed to run over the output of the histogram files produced by the selector.

NanoAOD

https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookNanoAOD

Skimming NanoAOD

https://github.com/cms-nanoAOD/nanoAOD-tools

Dilepton and 3 lepton specific skimming tools:

https://github.com/kdlong/NanoVVSkims

Producing UWVV Ntuples

See the documentation in UWVV. It is possible to use other ntuples, but you will need to make extensive changes to variable names in the skimming step and branch names in the analysis code.

Skimming UWVV Ntuples

This code is based on "cut strings" applied to ROOT TTrees. It is driven by the script skimNtuples.py. This script takes as argument the analysis name and a list of selections to be applied. These selections are defined in the Cuts folder of this repository. To implement a new analysis, one should create a new folder in this repository. To add a selection, a new selection.json file should be added. Follow the example of e.g. 3LooseLeptonsNoVeto.json. Conditions can be object specific (e.g. pt for each muon or elector) or state specific.

Run ./skimNtuples.py --help for a full list of arguments to this script.

Generally you will want to farm this step out to condor, as it's real utility is to take files on hdfs, skim them, and produce output which can be copied locally. The script farmoutNtupleSkim.py is intended for this. It reads information about the input datasets from AnalysisDatasetManager and configures jobs to be submitted to condor using farmoutAnalysisJobs.sh, a script which is UW condor specific. Modifications would be required for use with other resources.

Run ./farmoutNtupleSkim.py --help for a full list of arguments to this script.

An example to produce the output for the WZ inclusive analysis, with loosely IDed leptons (necessary for the fake rate step) would be

./farmoutNtupleSkim.py -f data* -s 3MediumLeptonsNoVeto

This will submit jobs for each file with a name matching the pattern "data*", defined in AnalysisDatasetManager, creating a skim of events passing the 3LooseLeptonsNoVeto.json selection. The script creates submit folders for each dataset, by default in the location /<storage>/<username>/YYYY-MM-DD_VVAnalysisJobs, where is either /nfs_scratch or /data. It will produce output files copied to /store/user/<username>/VVAnalysisJobs_YYYY-MM-DD. If you want to copy these locally, you can use the script copyFromHdfs.py.

./copyFromHdfs.py /hdfs/store/user/<username>/...

Running analysis code

The Z selector example

See this commit for an example of how to add histograms to a selector using the configuration setup. These corresponding changes to the AnalysisDatasetManager repository are necessary.

Implementing your own selector

The WZ selector

Nonprompt background estimate for WZ

Running Statistical Analysis

Plotting

About

Analysis code for WZ --> 3lnu and ZZ --> 4l (2017)


Languages

Language:Jupyter Notebook 36.1%Language:C++ 31.1%Language:Python 29.6%Language:Shell 3.3%