Muon T&P Instructions for Run-II

%COMPLETE3%
Work in progress, under construction WARNING: the development of stable configuartions/instructions/recipes to run muon TnP studies is ongoing as part of the early commissioning with 2015 data.
Though instructions are expected to work, updates/changes are expected in the coming month(s).

Contacts

Introduction

The Tag and Probe is a generic method that uses narrow di-lepton resonances like Z or J/Psi to measure on data any sort of per-object efficiencies (reconstruction, trigger, ...). The estimation of the efficiency distributions are divided in two main steps: tree production and a fitting step. Each step as to be launched separately and has its own configuration file. More information on the tree producer and analyser (to perform the fitting procedure) are available here:

The producer takes input in the RECO format to produce Ntuples where the lepton are organized pairs containing a tag and a probe lepton. The analyser is then run on the Ntuples to extract the efficiencies by performing a fit of the invariant mass distribution of the tag and probe pairs.

Quick Tutorial

This tutorial shows how to install the TnP package, produce Ntuples and extract the efficiency using the analyser (instructions refer to the V3 version of the Muon TnP package described below.).

For the SUSY EA searches: a detailed documentation is avaiable in TnPMuonSUSLeptonSF.

Install the package

Start by setting up the CMSSW release:

cmsrel CMSSW_7_4_10
cd CMSSW_7_4_10/src
cmsenv

get the core packages and compile them:

git cms-merge-topic -u gpetruc:TnP-747-Bare
scramv1 b -j 8

then add the T&P package:

git clone https://github.com/cms-analysis/MuonAnalysis-TagAndProbe.git MuonAnalysis/TagAndProbe

and compile it:

cd MuonAnalysis/TagAndProbe
git checkout 74X-v3
scram b -j 8
cd ../../
scram b -j12

The T&P package is now ready to be used. The recipe may change as the package will get updated. This section keeps track of the recipe for the different version of the code.

Ntuples production

To use the producer and the analyser both use input parameters define in configuration files (config.py ). The configuration files used in this tutorial are located in /CMSSW_7_4_10/src/MuonAnalysis/TagAndProbe/test/zmumu. Two configuration files for the producer are tp_from_aod_Data.py and tp_from_aod_MC.py, producing Ntuples from Data and MC samples, respectively. For more details on the structure of the producer config files, have a look at this page. The production step is performed by the command

cmsRun MuonAnalysis/TagAndProbe/test/zmumu/tp_from_aod_MC.py

The end of the output should be like

MessageLogger Summary

 type     category        sev    module        subroutine        count    total
 ---- -------------------- -- ---------------- ----------------  -----    -----
    1 XrdAdaptor           -w file_open                              6        6
    2 fileAction           -s file_close                             6        6
    3 fileAction           -s file_open                             12       12

 type    category    Examples: run/evt        run/evt          run/evt
 ---- -------------------- ---------------- ---------------- ----------------
    1 XrdAdaptor           pre-events       PostProcessEvent PostProcessEvent
    2 fileAction           PostProcessEvent PostProcessEvent PostEndRun
    3 fileAction           pre-events       pre-events       PostProcessEvent

Severity    # Occurrences   Total Occurrences
--------    -------------   -----------------
Warning                 6                   6
System                 18                  18

and the output file tnpZ_MC.root saved in the current directory. This file contains the Ntuples taken as an input by the analyser.

Efficiency extraction

Once the Ntuple are produced, the analyser can be run to extract the efficiencies. In this example we will use the configuration file fitMuonID_Simple.py, which will compute the PF (Loose ID) and relative isolation efficiency for RECO muons as function of pt, eta and the number of vertices. However, the default input Ntuples in this config file don't correspond to the one we just produced, so we have to perform the following modification in fitMuonID_Simple.py: replace

InputFileNames = cms.vstring("root://eoscms//eos/cms/store/cmst3/user/botta/TnPtrees/tnpZ_Data.190456-193557.root",
                                 #"file:tnpZ_MC.root"
                                 ), ## can put more than one

by

InputFileNames = cms.vstring("root://eoscms//eos/cms/store/group/phys_muon/TagAndProbe/tnpZ_Data_25ns_Run2015C_v3.root",
                                 #"file:tnpZ_MC.root"
                                 ), ## can put more than one

where the modified string correspond to the path of the Ntuple produced in the previous section. Additionally, the following block from line 59 need to be removed (this produce an error when the code is executed )

        vpvPlusExpo = cms.vstring(
            "Voigtian::signal1(mass, mean1[90,80,100], width[2.495], sigma1[2,1,3])",
            "Voigtian::signal2(mass, mean2[90,80,100], width,        sigma2[4,2,10])",
            "SUM::signal(vFrac[0.8,0,1]*signal1, signal2)",
            "Exponential::backgroundPass(mass, lp[-0.1,-1,0.1])",
            "Exponential::backgroundFail(mass, lf[-0.1,-1,0.1])",
            "efficiency[0.9,0,1]",
            "signalFractionInPassing[0.9]"
        ),

After this modifications the analyser can be run.

cmsRun MuonAnalysis/TagAndProbe/test/zmumu/fitMuonID_Simple.py

The output is stored in two root files in the current directory: TnP_Muon_ID_Simple.root and TnP_Muon_ID_Simple.root. They contain the efficiency distribution as well as the fit canvases for each bin.

Trees production recipes

Current working recipe

Recipe V4.0

set up the release:

cmsrel CMSSW_7_6_3_patch2
cd CMSSW_7_6_3_patch2/src/
cmsenv
get core packages:
git cms-merge-topic gpetruc:fix-muon-associator-hltTracksIter   
git clone https://github.com/cms-analysis/MuonAnalysis-TagAndProbe.git MuonAnalysis/TagAndProbe
cd MuonAnalysis/TagAndProbe
git checkout 76X
compile the package
cmsenv
cd ../../
scramv1 b -j 10
the tree production can be test using the config. files:
MuonAnalysis/TagAndProbe/test/zmumu/{tp_from_aod_Data/MC}.py 
and the analyser using the config. file:
MuonAnalysis/TagAndProbe/test/zmumu/fitMuonID_Simple.py

Previous recipes

Recipe V3.2

set up the release:

cmsrel CMSSW_7_4_10
cd CMSSW_7_4_10/src
cmsenv
get core packages:
git cms-merge-topic -u gpetruc:TnP-747-Bare
scramv1 b -j 8
get the Muon T&P package:
git clone https://github.com/cms-analysis/MuonAnalysis-TagAndProbe.git MuonAnalysis/TagAndProbe
cd MuonAnalysis/TagAndProbe
git remote add HughGit git@github.com:HuguesBrun/MuonAnalysis-TagAndProbe.git
git fetch HughGit
git checkout 74X-v3.2_fixed
compile the code
scram b -j 8
cd ../../
scram b -j12
the tree production can be test using the config. files:
MuonAnalysis/TagAndProbe/test/zmumu/{tp_from_aod_Data/MC}.py 
and the analyser using the config. file:
MuonAnalysis/TagAndProbe/test/zmumu/fitMuonID_Simple.py

Recipe V3.1

set up the release:

cmsrel CMSSW_7_4_10
cd CMSSW_7_4_10/src
cmsenv
get core packages:
git cms-merge-topic -u gpetruc:TnP-747-Bare
scramv1 b -j 8
get the Muon T&P package:
git clone https://github.com/cms-analysis/MuonAnalysis-TagAndProbe.git MuonAnalysis/TagAndProbe
cd MuonAnalysis/TagAndProbe
git checkout 74X-v3.1
compile the code
scram b -j 8
cd ../../
scram b -j12
the tree production can be test using the config. files:
MuonAnalysis/TagAndProbe/test/zmumu/{tp_from_aod_Data/MC}.py 
and the analyser using the config. file:
MuonAnalysis/TagAndProbe/test/zmumu/fitMuonID_Simple.py

Recipe V3

set up the release:

cmsrel CMSSW_7_4_10
cd CMSSW_7_4_10/src
cmsenv
get core packages:
git cms-merge-topic -u gpetruc:TnP-747-Bare
scramv1 b -j 8
get the Muon T&P package:
git clone https://github.com/cms-analysis/MuonAnalysis-TagAndProbe.git MuonAnalysis/TagAndProbe
compile the code
cd MuonAnalysis/TagAndProbe
git checkout 74X-v3
scram b -j 8
cd ../../
scram b -j12
the tree production can be test using the config. files:
MuonAnalysis/TagAndProbe/test/zmumu/{tp_from_aod_Data/MC}.py 
and the analyser using the config. file:
MuonAnalysis/TagAndProbe/test/zmumu/fitMuonID_Simple.py

Recipe V2

set up the release:

cmsrel CMSSW_7_4_7
cd CMSSW_7_4_7/src
cmsenv
get core packages:
git cms-merge-topic -u gpetruc:TnP-747-Bare
get the Muon T&P package:
git clone https://github.com/cms-analysis/MuonAnalysis-TagAndProbe.git MuonAnalysis/TagAndProbe
compile the code
scram b -j12
the tree production can be test using the config. files:
MuonAnalysis/TagAndProbe/test/zmumu/{tp_from_aod_Data/MC}.py 
and the analyser using the config. file:
MuonAnalysis/TagAndProbe/test/zmumu/fitMuonID_Simple.py

Recipe V1

set up the release:

cmsrel CMSSW_7_4_1
cd CMSSW_7_4_1/src
cmsenv
get core packages:
git cms-merge-topic -u gpetruc:TnP-74X-Bare
get the Muon T&P package:
git clone https://github.com/cms-analysis/MuonAnalysis-TagAndProbe.git MuonAnalysis/TagAndProbe
the tree production can be test using the config. files:
MuonAnalysis/TagAndProbe/test/zmumu/{tp_from_aod_Data/MC}.py
and the analyser using the config. file:
MuonAnalysis/TagAndProbe/test/zmumu/fitMuonID_Simple.py

Recipe V0

cmsrel CMSSW_7_4_0
cd CMSSW_7_4_0/src
cmsenv
git clone https://github.com/gpetruc/MuonAnalysis-TagAndProbe.git MuonAnalysis/TagAndProbe
...

Pile-up reweighting according to number of primary vertices

In order to do pile-up reweighting of a MC tree to match the data one you can use the addNVtxWeight.cxx macro to add a new branch weight to the tree with the proper weight. Given one MC tree MC.root and one or more Data trees, simply do

  root.exe -b -l -q MC.root DATA.root  [DATA2.root  ... DATAn.root ] addNVtxWeight.cxx+ 
This spits out a "tnpZ_withNVtxWeights.root" tree with a new branch "weight", and also a "nVtx.png" plot for checking.

You also need to modify the fitter configuration in three points:

  1. in the Variables PSet, declare weight = cms.vstring("weight","0","10","")
  2. at top level of the TagProbeFitTreeAnalyzer, set WeightVariable = cms.string("weight")
  3. add the "weight" variable name to the list of UnbineedVariables in each PSet under Efficiency
Note that the weights are only used to determine the best fit value of the efficiency but don't affect the uncertainties (a limitation of the version of RooFit we're using) This shouldn't be a real problem provided the average weight is close to 1, or as long as the uncertainties on the MC are negligible w.r.t. the ones from data.

If your tag selection efficiency can depend on the pile-up, it is better to perform the reweighting after selecting only the pairs that satisfy the tag selection. You can use the subTree.cxx macro for this purpose.

Configuration files

Tree production versions

Data

Latest version

DY trees, versions 4.0

Recipe Run range lumi JSON Description Sample/reprocessing Location/files Known issues
4.0 256630-260627 2.21 /fb Cert_246908-260627_13TeV_PromptReco_Collisions15_25ns_JSON_v2.txt JSON of the Prompt RECO /SingleMuon/Run2015D-16Dec2015-v1/AOD
/store/group/phys_muon/TagAndProbe/76XtreeProduction/TnPTree_76X_RunD_part1.root
41.3/pb missing
/store/group/phys_muon/TagAndProbe/76XtreeProduction/TnPTree_76X_RunD_part2.root
/store/group/phys_muon/TagAndProbe/76XtreeProduction/TnPTree_76X_RunD_part3.root
/store/group/phys_muon/TagAndProbe/76XtreeProduction/TnPTree_76X_RunD_part4.root
4.0 254227-254914 17.2 /pb Cert_246908-260627_13TeV_PromptReco_Collisions15_25ns_JSON_v2.txt JSON of the Prompt RECO /SingleMuon/Run2015C_25ns-16Dec2015-v1/AOD
/store/group/phys_muon/TagAndProbe/tTnPTree_76X_RunC.root
 

Previous versions

Versions 3.2 and 3.3 (slightly different in information content, but equivalent for final SF computation studies)

Recipe Run range lumi JSON Description Sample/reprocessing Location/files Known issues
3.3 254227-254914 16.34 /pb Cert_246908-260627_13TeV_PromptReco_Collisions15_25ns_JSON JSON of the 13th November 2015 /SingleMuon/Run2015C_25ns-05Oct2015-v1/AOD
/store/group/phys_muon/TagAndProbe/tnpZ_Data_25ns_run2015C_v3p31.root
 
3.3 260424-260627 524.3 /pb Cert_246908-260627_13TeV_PromptReco_Collisions15_25ns_JSON JSON of the 13th November 2015 /SingleMuon/Run2015D-PromptReco-v4/AOD
/store/group/phys_muon/TagAndProbe/trees_Data_25ns_run2015D_v3p31
ALERT! This is a directory containing more than one file !
 
3.3 259626-259891 280.9 /pb Cert_246908-259891_13TeV_PromptReco_Collisions15_25ns_JSON JSON of the 30th October 2015 /SingleMuon/Run2015D-PromptReco-v4/AOD
/store/group/phys_muon/TagAndProbe/trees_Data_25ns_run2015D_v3p3
ALERT! This is a directory containing more than one file !
missing 2/pb
3.2 259892-258750 1251.4 /pb Cert_246908-258750_13TeV_PromptReco_Collisions15_25ns_JSON JSON of the 19th October /SingleMuon/Run2015D-PromptReco-v[3/4]/AOD
/store/group/phys_muon/TagAndProbe/trees_Data_25ns_run2015D_v3p2
ALERT! This is a directory containing more than one file !
missing 12.4 /pb
Versions < 3.2
Recipe Run range lumi JSON Description Sample/reprocessing Location/files Known issues
3.1 256630-258159 550.1 /pb Cert_246908-258159_13TeV_PromptReco_Collisions15_25ns_JSON_v2 JSON file of 9th October /SingleMuon/Run2015D-PromptReco-v3/AOD /store/group/phys_muon/TagAndProbe/tnpZ_Data_25ns_run2015D_v3p1.root see *
3 -   JSON_6   /SingleMuon/Run2015C-PromptReco-v1/AOD /store/group/phys_muon/TagAndProbe/tnpZ_Data_25ns_Run2015C_v3.root  
3 -   JSON_6   /SingleMuon/Run2015D-PromptReco-v3/AOD /store/group/phys_muon/TagAndProbe/tnpZ_Data_25ns_run2015D_v3.root  
3 246908-255031   JSON_5   Run2015C PromptReco /store/group/phys_muon/TagAndProbe/TnP_trees_aod747_25ns_goldenJSON_246908-255031_withFixes.root  
2 246908-251883   JSON_2 Trigger: HLT_IsoMu20 Run2015B PromptReco /store/group/phys_muon/TagAndProbe/TnP_trees_aod747_goldenJSON_246908-251883_HLT_IsoMu20.root 86.2 % processed
2 254833   JSON_4 Trigger: HLT_IsoMu20 Run2015C PromptReco /store/group/phys_muon/TagAndProbe/TnP_trees_aod747_50ns_goldenJSON_254833.root  
2 254790-254879   JSON_3 Trigger: HLT_IsoMu20 Run2015C PromptReco /store/group/phys_muon/TagAndProbe/TnP_trees_aod747_25ns_goldenJSON_254790-254879.root  
2 246908-251883   JSON_2   Run2015B PromptReco /store/group/phys_muon/TagAndProbe/TnP_trees_aod747_goldenJSON.root 39.647 /pb out of 40.03/pb processed
2 251244-251562   JSON_1   Run2015B PromptReco /store/group/phys_muon/TagAndProbe/TnP_trees_aod747_251244_to_251562.root  
1     Filtered using trigger: IsoMu24_eta2p1   /afs/cern.ch/user/g/gpetrucc/public/tnp/tnpZ_Data_run251168.root /afs/cern.ch/user/g/gpetrucc/public/tnp/tnpZ_Data_run251244.root /afs/cern.ch/user/g/gpetrucc/public/tnp/tnpZ_Data_run251251.root /afs/cern.ch/user/g/gpetrucc/public/tnp/tnpZ_Data_run251252.root  
* 25.6 /pb is missing because of crab problem, run 256729 and 256735 removed by hand (they were remove from the next JSON v3)

MC

Latest version

Recipe Number of Events Sample Location/files Known issues
4.0 9056998 /DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIIFall15DR76-PU25nsData2015v1_76X_mcRun2_asymptotic_v12-v1/AODSIM
/store/group/phys_muon/TagAndProbe/76XtreeProduction/TnPTree_76X_DYLL_M50_MadGraphMLM_part1.root
 
/store/group/phys_muon/TagAndProbe/76XtreeProduction/TnPTree_76X_DYLL_M50_MadGraphMLM_part2.root
 

Previous versions

Version 3.2

Recipe Number of Events Sample Location/files Known issues
3.2 5 975 544 /DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/RunIISpring15DR74-Asympt25ns_MCRUN2_74_V9-v3/AODSIM
/store/group/phys_muon/TagAndProbe/tnpZ_MC_25ns_amcatnloFXFX-pythia8_v3p2/
ALERT! This is a directory containing more than one file !
 
3.2 8 523 243 /DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISpring15DR74-Asympt25ns_MCRUN2_74_V9-v1/AODSIM
/store/group/phys_muon/TagAndProbe/tnpZ_MC_25ns_madgraphMLM-pythia8_v3p2
ALERT! This is a directory containing more than one file !
 
Version < 3.2
MC Production Recipe Sample Location/files Known issues
3   /DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/RunIISpring15DR74-Asympt25ns_MCRUN2_74_V9-v3/AODSIM /store/group/phys_muon/TnP_trees_aod747_DY_amcatnlo_50ns_withFixes.root  
3   /DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISpring15DR74-Asympt25ns_MCRUN2_74_V9-v1/AODSIM /store/group/phys_muon/TnP_trees_aod747_DY_LOmadgraph_50ns_withFixes.root  
2   /DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISpring15DR74-Asympt25ns_MCRUN2_74_V9-v1/AODSIM /store/group/phys_muon/TnP_trees_aod747_DY_LOmadgraph_25ns_withFixes.root  
2   /DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/RunIISpring15DR74-Asympt25ns_MCRUN2_74_V9-v3/AODSIM /store/group/phys_muon/TnP_trees_aod747_DY_amcatnlo_25ns_withFixes.root  
2   /DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISpring15DR74-Asympt50ns_MCRUN2_74_V9A-v1/AODSIM /store/group/phys_muon/TagAndProbe/TnP_trees_aod747_DY_LOmadgraph.root  
2   /DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/RunIISpring15DR74-Asympt50ns_MCRUN2_74_V9A-v2/AODSIM /store/group/phys_muon/TagAndProbe/TnP_trees_aod747_DY.root  
1 configuration in /afs/cern.ch/user/m/mirena/public/TnP/ /store/relval/CMSSW_7_4_0/RelValZMM_13/GEN-SIM-RECO/PU25ns_MCRUN2_74_V7_gs7115_puProd-v1/ /eos/cms/store/group/phys_muon/TagAndProbe/  
1 configuration in /afs/cern.ch/user/m/mirena/public/TnP/ /store/relval/CMSSW_7_4_0/RelValZMM_13/GEN-SIM-RECO/PU25ns_MCRUN2_74_V7_gs7115_puProd-v1/ /eos/cms/store/group/phys_muon/TagAndProbe/  
1   /DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/RunIISpring15DR74-Asympt50ns_MCRUN2_74_V9A-v2/AODSIM /store/group/phys_muon/perrin/Ntuples/DYJetsToLL_1/tree.root  
1   /DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/RunIISpring15DR74-Asympt25ns_MCRUN2_74_V9-v3/AODSIM /store/group/phys_muon/perrin/Ntuples/DYJetsToLL_2/tree.root  

Tree content

The list of variables available in T&P trees is documented under MuonTagAndProbeTreesContent.

Details on JSON files used for processing

  • JSON_1: json_DCSONLY_Run2015B_tnp.txt
  • JSON_2: Cert_246908-251883_13TeV_PromptReco_Collisions15_JSON_v2.txt

-- DanieleTrocino - 2015-05-15

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r4 - 2016-02-02 - HuguesBrun
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback