Exercise 2
Overview
Teaching: min
Exercises: minQuestions
Objectives
Event Analysis code
We now need to write the main portion of the code which will reconstruct our Z candidate, as well as other variables which we will use in the background estimation. At the very least, you will need to include
- The visible mass of your reconstructed final state particle pair.
- If the event does not have such a pair, you may discard it (return False) as you will never be using it for your analysis.
- The number of b-tagged jets.
- b-tagging is achieved with the Jet_btagDeepB variable, where you require the value to be greater than 0.1241, 0.4184, 0.7527 depending on your intended working point.
- The transverse mass of either $e+$MET or $\mu+$ MET (for $e+\tau_h$ or $\mu+\tau_h$ only).
Start with MuTauProducer.py
, ETauProducer.py
, and TauTauProducer.py
(under ${CMSSW_BASE}/src/PhysicsTools/NanoAODTools/python/postprocessing/examples/)
as a boiler plate and create a new analyze function to calculate the relevant variables for your analysis on an event-by-event basis.
To run the example:
cd ${CMSSW_BASE}/src/PhysicsTools/NanoAODTools/analysis/
python ${CMSSW_BASE}/src/PhysicsTools/NanoAODTools/python/postprocessing/examples/example_postproc.py
It is similiar to the exampleAnalysis.py
you modified yesterday, but instead of creating a histogram this creates a new branch EventMass which is added to the Events tree in addition to those already in the NANOAOD file. The input file is the DYJetsToLL_M-50 signal file used yesterday. As we are now working to understand the backgrounds in addition to our Z signal, you may interested in any of the following three MC samples, accessed in the following manner:
root://cmseos.fnal.gov//store/user/cmsdas/2023/short_exercises/Tau/DYJetsToLL__7B7D90CB-14EF-B749-B4D7-7C413FE3CCC1.root
root://cmseos.fnal.gov//store/user/cmsdas/2023/short_exercises/Tau/WJetsToLNu__AE18A33F-9CF5-BC4E-A1E9-46F7BF382AF1.root
root://cmseos.fnal.gov//store/user/cmsdas/2023/short_exercises/Tau/TTTo2L2Nu__1656732C-0CD4-F54B-B39D-19CA08E18A77.root
Deliverable
For each of the MC samples, make a histogram of the three variables mentioned in the bullets above. An example code to make the histograms from a given file/TTree and plot them can be found here. Before we submit jobs to condor to run over the whole datasets (which takes overnight) please understand these distributions:
- Are you able to see a peak in the visible mass distribution in the $Z$ mc? (You can compare with Slide 10 of the introductory slides.)
- How many b-tagged jets do you expect in in the TTJets MC sample? DYJetsToLL_M-50, WJetsToLNu?
- Does your mt distribution in the WJetsToLNu MC appear as you would expect; given the W boson mass is 80.379. (You can compare with that seen on Slide 8 of the introductory slides.)
As you make these, please paste these in the Mattermost chat for discussion and comparisons.
Once you have made (and tested/verified) your main analysis loops it is now time to run the code on the full datasets including MC. We will use condor to process the data. This is done with a script called submitToGrid.py
. You will need to modify your username on L1. You can see the “main” function which is called is example_postproc.py
which we modified before.
You may see the list of our datasets and mc samples of interest which will be submitted here. One job is created for each of those files. These are skims which have made of the entire datasets prior to CMSDAS. To (drastically) increase processing time and decrease the output file size, make sure to enable friend mode. This creates a friend tree. This ensures that only new variables which you created are written into your output tree, and not the entire Events tree.. Do not apply any additional preselection at this time either. Friends are important. The smaller input files may finish within 30 minutes, check one of these to make sure everything is as expected (ZZ has 0 entries so do not be worried about this file).
cd ${CMSSW_BASE}/src/PhysicsTools/NanoAODTools/condor/
python submitToGrid.py
It would be good if you can submit the condor job before you go to sleep so that you can get the result the next morning.
Key Points