Exercise 6: Muon Tracking Efficiency using T&P method
The Tag and Probe tool is a generic tool developed to measure any user defined object efficiency from data at
CMS by exploiting di-object resonances like Z or J/Psi. the efficiency is measured as following:
- Resonances are reconstructed as pairs with one leg passing a tight selection which called (tag) and the other one passing a loose selection (probe).
- Passing probes are defined according to whatever is the efficiency to measure.
- the (tag + passing probe) and (tag + failing probe) lineshapes are fit separately with a signal + background model.
- then the efficiency is computed from the ratio of the passing probe and all probe.
- the procedures can be done for any probe variable (e.g. pT, η ...) to compute efficiency histograms as a function of those variables.
Question 1: What do you think the probe and the passing probe should be defined for measuring the tracking efficiency?
Step 1: Create and set up a CMSSW working area
set up the release:
cmsrel CMSSW_9_4_0_pre3
cd CMSSW_9_4_0_pre3/src
cmsenv
get core packages:
git cms-merge-topic HuguesBrun:updateL3MuonCollectionsToMatch
git clone git@github.com:GLP90/Tnp94.git MuonAnalysis/TagAndProbe -b 94_newSelector
git cms-addpkg PhysicsTools/PatAlgos
compile the package
cmsenv
scramv1 b -j 5
To produce the Ntuples, put bool simInfoIsAvailalbe=false in
link
cmsenv
git cms-addpkg PhysicsTools/PatAlgos
vim PhysicsTools/PatAlgos/plugins/PATMuonProducer.cc
(modify the line mentioned above)
For adding the standalone muon to the tree, replace the files in your the folder of your local working area by those ones
xrdcp -f root://cmseos.fnal.gov///store/user/cmsdas/2018/short_exercises/Muons/Exercises/MuonExercise6/tp_from_aod_Data.py MuonAnalysis/TagAndProbe/test/zmumu/tp_from_aod_Data.py
xrdcp -f root://cmseos.fnal.gov///store/user/cmsdas/2018/short_exercises/Muons/Exercises/MuonExercise6/tp_from_aod_MC.py MuonAnalysis/TagAndProbe/test/zmumu/tp_from_aod_MC.py
Assignment 1: produce the TP tree for data and MC
Hint: cmsRun
MuonAnalysis /TagAndProbe/test/zmumu/{tp_from_aod_Data/MC}.y
Step 2: Skim the T&P trees
With the program skimTree, you can reduce 'T&P ntuples' size by applying cuts on a specified input tree and copy the result to an output ROOT file. Moreover, you can remove branches from the tree completely. This is mainly done to reduce the file size and therefore to reduce the memory consumption and processing time for T&P studies. Note, that you can load multiple files at once from your local storage device or EOS and merge them together in the output.
The tool can be found as part of the
cms-MuonPOG/TnPUtils
package
git clone https://github.com/cms-MuonPOG/TnPUtils.git
Then copy the template file "skimTree" to the folder of your local working area
xrdcp -f root://cmseos.fnal.gov///store/user/cmsdas/2018/short_exercises/Muons/Exercises/MuonExercise6/skimTree TnPUtils/skimTree
Both data and MC have been skimmed using
./skimTree root://cmseos.fnal.gov///store/user/cmsdas/2018/short_exercises/Muons/Exercises/MuonExercise6/TnPTree_17Nov2017_SingleMuon_Run2017Bv1_Full_GoldenJSON.root TnPTree_17Nov2017_SingleMuon_Run2017Bv1_Full_GoldenJSON.root -r "all" -k "mass pt eta abseta phi staValidStations staQoverPerror tk_deltaR tk_deltaEta tk_deltaR_NoZ tk_deltaEta_NoZ tk0_deltaR tk0_deltaEta tk0_deltaR_NoZ tk0_deltaEta_NoZ tag_nVertices tag_vz tag_bx tag_combRelIsoPF04dBeta run lumi tag_instLumi tag_eta tag_IsoMu24_eta2p1 outerValidHits StaTkSameCharge" -c "(tag_combRelIsoPF04dBeta < 0.15 && tag_combRelIsoPF04dBeta > -0.5 && mass > 69.5 && mass < 130.1 && tag_pt > 23 && (tag_IsoMu22 == 1|| tag_IsoMu24 == 1) && abseta <2.401)"
./skimTree root://cmseos.fnal.gov///store/user/cmsdas/2018/short_exercises/Muons/Exercises/MuonExercise6/DYJetsToLL_M-50_TuneCP5_13TeV-madgraphMLM-pythia8.root DYJetsToLL_M-50_TuneCP5_13TeV-madgraphMLM-pythia8.root -r "all" -k "mass pt eta abseta phi staValidStations staQoverPerror tk_deltaR tk_deltaEta tk_deltaR_NoZ tk_deltaEta_NoZ tk0_deltaR tk0_deltaEta tk0_deltaR_NoZ tk0_deltaEta_NoZ tag_nVertices tag_vz tag_bx tag_combRelIsoPF04dBeta run lumi tag_instLumi tag_eta tag_IsoMu24_eta2p1 outerValidHits StaTkSameCharge mcTrue weight" -c "(tag_combRelIsoPF04dBeta < 0.15 && tag_combRelIsoPF04dBeta > -0.5 && mass > 69.5 && mass < 130.1 && tag_pt > 23 && (tag_IsoMu22 == 1|| tag_IsoMu24 == 1) && abseta <2.401)"
Step 3: Running the fits on your data and MC files
The configuration file used to perform the fit is
MuonAnalysis /TagAndProbe/test/zmumu/fitTracking.py
Copy the python file to the folder of your local working area:
xrdcp -f root://cmseos.fnal.gov///store/user/cmsdas/2018/short_exercises/Muons/Exercises/MuonExercise6/fitTracking.py MuonAnalysis/TagAndProbe/test/zmumu/fitTracking.py
The module takes as input
- A set of skimmed rootfiles produced from step 2
- Information about which columns to use inside of the dataset:
- for the binning variables for the efficiency (e.g. pT, η, φ)).
- select which type of files you will run on (Data or MC).
- A lineshape model, parametrized using RooFit classes
The fitting functions used here are:
- Signal: sum of 2 Voigtians.
- Background: Exponential.
PDFs = cms.PSet(
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]"
),
),
Open your python file and modify it by putting your files which you got in step 2 as input files "Line 215":
if "TestData_" in scenario:
process.TnP_Tracking.InputFileNames = ["TnPTree_17Nov2017_SingleMuon_Run2017Bv1_Full_GoldenJSON.root"]
if "TestMC_" in scenario:
process.TnP_Tracking.InputFileNames = [ "DYJetsToLL_M-50_TuneCP5_13TeV-madgraphMLM-pythia8.root"]
To produce the fit files for data using eta binning you can use
cmsRun MuonAnalysis/TagAndProbe/test/zmumu/fitTracking.py TestData_et3
And to produce the fit files for MC using eta binning you can use
cmsRun MuonAnalysis/TagAndProbe/test/zmumu/fitTracking.py TestMC_et3
Assignment 2:
1)produce the fit files for Dtata and MC by using phi binning
2)produce the fit files for Dtata and MC by using nVertices binning
Step 4: Calculate the muon tracking efficiency
Between
RunI and
RunII, some developments have been made in the
CMS experiment in different aspects of the tracking procedure in order to cope with the increasing luminosity.
There are two new iterations dedicated exclusively to muons.
- An outside-in track reconstruction step seeded in the muon system.
- An inside-out iteration that re-reconstructs muon-tagged tracks.
Where the tracks fulfill these these requirements Kept in the so called
All-Tracks collection and tracks that do not belong to these two above iterations are kept in the so called
Tracker-only seeded collection.
Question 2: What do you think the tracker only seeded tracks is used for?
Copy these two C++ files to the folder of your local working area:
xrdcp -f root://cmseos.fnal.gov///store/user/cmsdas/2018/short_exercises/Muons/Exercises/MuonExercise6/plotTracking.cxx MuonAnalysis/TagAndProbe/test/zmumu/plotTracking.cxx
xrdcp -f root://cmseos.fnal.gov///store/user/cmsdas/2018/short_exercises/Muons/Exercises/MuonExercise6/plotUtil_Tracking.cxx MuonAnalysis/TagAndProbe/test/zmumu/plotUtil_Tracking.cxx
For producing the tracking efficiency for the All- tracks collection as a function of pseudorapidity " η".
root -b -l -q TnP_Tracking_dr030e030_TestData_et3.root TnP_Tracking_dr030e030NoZ_TestData_et3.root TnP_Tracking_dr030e030_TestMC_et3.root TnP_Tracking_dr030e030NoZ_TestMC_et3.root MuonAnalysis/TagAndProbe/test/zmumu/plotTracking.cxx
Then to produce the tracking efficiency for the Tracker only seeded tracks collection as a function of pseudorapidity "η".
root -b -l -q TnP_Tracking_tk0_dr030e030_TestData_et3.root TnP_Tracking_tk0_dr030e030NoZ_TestData_et3.root TnP_Tracking_tk0_dr030e030_TestMC_et3.root TnP_Tracking_tk0_dr030e030NoZ_TestMC_et3.root MuonAnalysis/TagAndProbe/test/zmumu/plotTracking.cxx
Question 3:
1)What do you think the "fake matching rate" means?
2)What is the difference between the two plots "Raw efficiency" and "Efficiency"?