Drell-Yan analysis Procedure
This twiki documents the most important steps of the Drell-Yan cross section measurement. It is intended to familiarize you with the technical aspects of the analysis procedure. At the end of each section there is a set of questions and exercises. Note, the software and samples evolve very frequently so some parts of the page will get obsolete soon!
Step 1: PAT/ntuples
- MC samples change frequently (usually we have a new generation of MC samples every season). Even though GEN level stays the same reconstruction keeps getting improved from release to release, so it is recommnded to use the most up-to-date MC. Another things that constantly changes is the vertex information (tuned to data) and pile up.
- MC: 311 Monte Carlo samples (this list shows all the signals and backgrounds we consider, but it is already superseded by Summer11 42X samples)
- We use SingleMu and DoubleMu Primary Datasets (PD), PromptReco (and ReReco when it becomes available)
- JSONs are constantly updated in this directory as we certify more and more data:
- "Golden" /afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/*Prompt/Cert_160404-161312_7TeV_PromptReco_Collisions11_JSON.txt
- Calo-free /afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions11/7TeV/Prompt/Cert_160404-161312_7TeV_PromptReco_Collisions11_JSON_MuonPhys.txt
- Use DBS tool to retrieve info about the most up-to-date MC and DATA samples
- Relevant software: CMSSW_4_1_3: see the twiki page to get the information about CMSSW releases used for data taking as they evolve
- Global tag
- Data: GR_R_311_V2 for reprocessing and GR_P_V14 for prompt reco
- MC: MC_311_V2, START311_v2
- ElectroWeakAnalysis/Skimming, ElectroWeakAnalysis/DYskimming, UserCode
- Global tag
- how to run: PATtuple production: see the corresponding twiki, note, a lot of code in CVS is outdated (we keep updating it)
cmsrel CMSSW_4_1_3 cd CMSSW_4_1_3/src cmsenv addpkg ElectroWeakAnalysis/Skimming cvs co -d ElectroWeakAnalysis/DYskimming -r V00-00-05 UserCode/Purdue/DYAnalysis/Skimming scram b cmsRun ElectroWeakAnalysis/DYskimming/PATTuple/test_cfg.py
Q1: Do you think the list of signal and background samples mentioned above is complete for the Drell-Yan cross section measurement in the region 15-600 GeV invariant mass? (You need to think not only about physics processes but also about kinematic region of the sample generated)
Q2: Using the DBS tool mentioned above or a command line equivalent find all the MC samples relevant for the Drell-Yan cross-section measurement for Summer11 production, example:
find file where file.tier=GEN-SIM-RECO and site=srm-dcache.rcac.purdue.edu and dataset like=*DYToMuMu*Summer11*
to your desired directories and the latest global tag.
Q1: Try to produce ntuple
Hint: spot all the errors, they might be related to global tag, REDIGI version (for MC)
Q2: Find the invariant mass branch and inspect it
Step 3: Event Selection
Once the ntuples are ready, one can proceed to the actual physics analysis. The first step of every analysis is the event selection. Currently, we use the so-called cut-based approach to discriminate between signal and background. For more on event selection please read chapter 3 in the analysis note CMS-AN-11-013. Before starting to run a macro, set up the working area. Find all the necessary scripts in:
Before running the macros, we need to fix few things which are changing frequently for our analysis:
- Mass range and binning:
for the early stage of 2011 analysis we keep the 2010 binning \ [15,20,30,40,50,60,76,86,96,106,120,150,200,600\] Wiki Markup
- Trigger selection:
- See the presentation on event selection for 2011
- Thus, for 2011 we consider a combination of Double muon trigger and a combination of single isolated muon triggers can be used as a cross-check. Use three following combinations:
- HLT_Mu15, HLT_Mu24, HLT_Mu30
- HLT_IsoMu15, HLT_IsoMu17, HLT_IsoMu24
- DoubleMu6, DoubleMu7, Mu13_Mu8
- Offline selection: Baseline event selection has not changed compared to 2010 analysis, see
- we will consider moving to PF muons and PF isolation: this study is in progress right now
Q1: Check data/MC agreement for each plot, look for discrepancies.
Checkpoint1 With the macros described above you should be able to *reproduce* following plots from the CMS-AN-11-013: 1,3-14, 17-29,51.
Note: for the 23,25-29 macros have different style and were produce with PU sample.
Note: plots 20-22 are reproducible by optimization macros but have different style.
Step 4: Acceptance
Another constituent of the cross-section measurement is the acceptance.
We use POWHEG NLO acceptance, see all the relevant formulas in this talk (the updated version), see slide18 for acceptance definitions and refer to earlier talks. Di\ue to the intrinsic discrepancies in the modeling between the POWHEG and FEWZ we correct the Z kinematics. For that, we extract the weight maps from POWHEG at NLO and from FEWZ at NNLO (to be more specific it is at NNLO below 40 GeV and NLO otherwise, as the effect of higher order corrections is negligible at the higher masses). The weight map is essentially the ratio of double inclusive cross-sections extracted from POWHEG and FEWZ per PT-Y bin (PT, Y refer to Z kinematics, which is identical here to dimuon kinematics, our final aim). Details on the re-weighting technique are also in the linked presentation.
How to run:
To setup area do:
cd $CMSSW_RELEASE_BASE/src cvs co -r V00-09-11 SUSYBSMAnalysis/Zprime2muAnalysis (38x analysis) # for 41x or higher, use V00-10-09 cmsenv SUSYBSMAnalysis/Zprime2muAnalysis/setup.csh # This last command checks # out other packages and # executes scramv1 b to # compile everything. cvs co UserCode/ASvyatkovskiyPurdue/DYAnalysis/AcceptanceAdam #rearrange stuff a little bit cp UserCode/ASvyatkovskiyPurdue/DYAnalysis/AcceptanceAdam/* .
First step: make the ntuples.
//description to be added - I will ask Adam. But actually we switched to Purdue ntuples so this section is obsolete....
Second step: make the cross section maps.
Inspect the countxsec.py script in the directory. What it does is following:
It takes hard interaction ntuple produced on the previous step, which contains the gen level information about the hard collision and produces the 2D histogram in the bins of dimuon Pt-Y for each mass bin, as well as 3 auxiliary histograms with mass spectrum pre-FSR (after acceptance cuts, marked with 'num'). The only part which is expected to be configured frequently is the mass, Pt, Y binning everything else is fixed. (Note that right now the input can also be set to Purdue ntuple!!)
To test the script locally on few hundred of events do:
python countxsec.py --s 1667 --n 20000000 --w 1.0 --sg DYM1020/a2_2011/AcceptanceFromPAT_2011_mapcfg-pat_9_1_WaI/zp2mu_histos.root
To submit the batch script on full statistics, use the farmaout scripts and the local batch system:
cd /home/ba01/u112/aeverett/scratch_rcac/20112011/DYM1020 //(don't really have to CD there but change all dirs accordingly) farmoutAnalysisJobsPyList.sh bob $CMSSW_BASE /home/ba01/u112/aeverett/scratch_rcac/20112011/countxsec.py --skip-srmcp --submit-dir=$PWD/xsec04w1_new --input-files-per-job=1 --assume-input-files-exist --input-file-list=$PWD/inFileList.txt --input-dir=$PWD/ --python-arguments="--s 3320.0 --n 9630633.0 --w 1.0 " # --w 6.06" #9780633 in DBS but only 9630633 in a2_2011 directory
here, 'bob' is a random name for a batch job, inFileList.txt is a list of files to run on, it has the format:
a2_2011/AcceptanceFromPAT_2011_mapcfg-pat_10_1_Ky5/zp2mu_histos.root a2_2011/AcceptanceFromPAT_2011_mapcfg-pat_11_1_l3o/zp2mu_histos.root a2_2011/AcceptanceFromPAT_2011_mapcfg-pat_12_1_xFB/zp2mu_histos.root a2_2011/AcceptanceFromPAT_2011_mapcfg-pat_13_1_hlY/zp2mu_histos.root a2_2011/AcceptanceFromPAT_2011_mapcfg-pat_14_1_Ufv/zp2mu_histos.root ....
i.e. the absolute path to file from withi DYM1020 directory. The contents of the directory can look something like this:
drwxr-xr-x 71 asvyatko phys 10240 Nov 1 13:02 a2_2011
-rwxr-xr-x 1 asvyatko phys 6257 Nov 2 12:53 cmsRun.sh
-rwxr-xr-x 1 asvyatko phys 17621 Nov 2 12:52 farmoutAnalysisJobsPyList.sh
rw-rr- 1 asvyatko phys 4752 Nov 2 12:48 inFileList.txt
drwxr-xr-x 2 asvyatko phys 2048 Nov 2 12:33 xsec04w1_new
The submission directory should not exist, otherwise you get an error.
Note: you obviously do not want to recalculate the weights, numbers of events for each stepwise DY sample. For Summer11 the numbers are already available here: /UserCode/Purdue/DYAnalysis/AcceptanceAdam/commands_XSEC.txt
But for Fall11 I will have to recalculate it and update the corresponding file.
Third step: make the weights
To make weights one needs to run following:
The weights referred here are the FEWZ-POWHEG cross section ratios per Pt-Y bin (see one of the Adam's presentations). What the script does is essentially following: it takes the POWHEG Pt-Y maps produced on the previous step, takes the FEWZ Pt-Y maps (which are produced by Alexey and usually latest are found here: https://twiki.cern.ch/twiki/bin/view/CMS/EWKDrellYan2011, the file starting with map2D_*.root), and just divides it bin by bin using the my_divide function (this is a clopper-pearson divide).
Complications: there is a set of parameters and input files which is configures inside the script.
First of all POWHEG input files:
## ADAM for NNLO #Get the files with POWHEG maps with fine Pt binning fileIn10fine=ROOT.TFile("DYM1020/xsec04w1_newFine/powheg_xs_full_04_2011.root") #coarse Pt binningfileIn10 = ROOT.TFile( "DYM1020/xsec04w1_new/powheg_xs_full_04_2011.root") #fine Pt binningfileIn20fine=ROOT.TFile("DYM20/xsec04w1_newFine/powheg_xs_full_04_2011.root") #coarse Pt binningfileIn20 = ROOT.TFile( "DYM20/xsec04w1_new/powheg_xs_full_04_2011.root") fileIn200 = ROOT.TFile( "DYM200/xsec04w1_new/powheg_xs_full_04_2011.root") fileIn500 = ROOT.TFile( "DYM500/xsec04w1_new/powheg_xs_full_04_2011.root") fileIn1000 = ROOT.TFile("DYM1000/xsec04w1_new/powheg_xs_full_04_2011.root")
There are multiple input files, because we use STEPWISE DY samples, they are split in generator mass. On the other hand, we fix the Pt-Y binning on the previous step, so that if we decide to play around with binning we need to provide a different input file (you can see fileIn10fine and fileIn10 for instance). The parameter finePtBins controls the number of first mass bins which will use fine binning.
Secondly, FEWZ input files: this are also hardcode inside the script, because multiple versions exist (differing by Vegas integration precision and NNLO/NLO order). The parameter nnloInBins controls the amount of first mass bins in which we have NNLO.
The output of the script is DYMoutput/weights_stepwise_precision10-5_fine12.root - the file with histograms with weights and errors.
Fourth step: make the corrected acceptance distributions (finally!!!)
Inspect the countcorracc.py script in the directory. What it does is following:
To test the script locally on few hundred of events do:
python countcorracc.py --r DYMoutput/fewz_powheg_weights_stepwise_2011_fine12.root --o fewz_powheg_corracc_2011 --n 5.78216 --s 3320.0 --e 9630633.0 --l 15 --h 20 --sg DYM1020/a2_2011/AcceptanceFromPAT_2011_mapcfg-pat_9_1_WaI/zp2mu_histos.root
Note that again one has to run a separate job on each of the stepwise DY samples. And the weights, event numbers and cross section passed as an argument would have to be different for each sample.
To submit a batch job do:
cd /home/ba01/u112/aeverett/scratch_rcac/20112011/DYM1020 farmoutAnalysisJobsPyList.sh bob $CMSSW_BASE /home/ba01/u112/aeverett/scratch_rcac/20112011/countcorracc.py --skip-srmcp --submit-dir=$PWD/corracc_stepwise_coarse7b --input-files-per-job=1 --assume-input-files-exist --input-file-list=$PWD/inFileList.txt --input-dir=$PWD/ --python-arguments=" --r /home/ba01/u112/aeverett/scratch_rcac/20112011/DYMoutput/fewz_powheg_weights_stepwise_2011_coarse7.root --o fewz_powheg_corracc_2011 --n 5.78216 --s 3320.0 --e 9630633.0 --l 15 --h 20"
The tricky part about this script is:
//this is still old
One needs to configure pT and eta cuts for each muon in the script. This is done very easily in two places:
inside this macro, you can uncomment what you need to plot and also adjust the input PDF sets as well as orders.
Checkpoint2 With the macros and scripts described in the step4 section you should be able to *reproduce* following macros from the CMS-AN-11-013: 2,30-38,61-63 and tables: 5-10, 21-24
- Trigger, Reconstruction+ID, PF isoloation, tracking:
- We use the officiela TagAndProbe package
- How to run (on top of CMSSW 414425 or later):
addpkg CommonTools/ParticleFlow V00-02-07 addpkg CommonTools/RecoAlgos V00-03-13 addpkg DataFormats/PatCandidates V06-04-18 addpkg MuonAnalysis/MuonAssociators V01-1413-0000 addpkg MuonAnalysis/TagAndProbe HEAD addpkg PhysicsTools/PatUtils Configuration V00-10-16 addpkg PhysicsTools/TagAndProbePatAlgos V04V08-0006-0638 cvs coaddpkg -A MuonAnalysis/TagAndProbe PhysicsTools/PatExamples V00-05-22 addpkg PhysicsTools/SelectorUtils V00-03-17 addpkg PhysicsTools/TagAndProbe HEAD addpkg RecoMuon/MuonIdentification V01-19-00 cvs co -d TagAndProbe UserCode/ASvyatkovskiy/TagAndProbe
Checkpoint3 With the macros describe in the step5 section it is possible to reproduce the following plots from the CMS-AN-11-013 note: 15-16, 39-42 and tables 11-12
Step 6: Background estimation
QCD data driven background estimation
There are various methods employed to estimate the QCD background in a data-driven way (QCD is currently the only background estimated not from MC). The most important are the template fit method and the weight map method: carefully read chapter6 of the CMS-AN-11-013 for more details on the methods.
Checkpoint: this macros will allow one to reproduce the plots 45-48 from the note as well as tables 13-15 from the note
We estimate QCD background using ABCD method in order to improve our systematic uncertainty on the background estimation. ABCD method is very simple.
1) choose 2 variables: assume two variables are independent
2) assume the fraction should be same if there is no correlation: N_A / N_B = N_C / N_D
3) In our study, use two variables: sign of muon pair, muon isolation
4) QCD fraction in each region has a dependence. We produce the correction factor for each region: B, C, D
5) Produce N_B, N_C, N_D from data sample, and estimate N_A from them at the end (applying the correction factors)
QCDFrac.C: to produce correction factors for each region
ABCD2vari.C: to produce the ABCD results. The correction factors from the QCDFrac.C are plugged in this macro as an input.
ttbar data driven background estimation
We employ the so-called e-mu data driven background estimation method. See the following comprehensive talk for more details on the method. Currently the procedure to apply this method consists of 2 steps:
1) produce the root files with histograms
2) run the macros on the root files produced
For both steps one needs to check out the following tags:
The highleted tags are important for step2).
Following is the description of how to produce the root files.
The mother script file is Zprime2muAnalysis/test/DataMCSpectraComparison/histos.py
Instructions related to this script file are at
The short instruction is this:
python histos.py submit testing no_data
or when you are ready
python histos.py submit
Wait for root files to be done. Currently it is configured to have histograms with selection marked 'VBTF' as what we have in DY2011.
Below I describe the step2 in detail. Check out addtional macros, and copy them to your working directory:
cvs co UserCode/Purdue/DYAnalysis/AnalysisMacros/TTbarEstimation cp UserCode/Purdue/DYAnalysis/AnalysisMacros/TTbarEstimation/* cd SUSYBSMAnalysis/Zprime2muAnalysis/test/DataMCSpectraComparison
Make sure the paths to datafiles inside the macros are pointing to the location of the root files you have produced. To produce the control plots for emu and mumu mass spectra use
To produce the correction factors run:
And finally, the MC expectation vs. data driven method prediction plots are produced with:
A good agreement between data and MC for both the mumu and emu spectra is necessary for a method to work reliably.
Step 7: Unfolding
Unfolding is applied to correct for migration of entries between bins caused by mass resolution effects (FSR correction is taken into account as a separate step). For use in the Drell-Yan analysis, the choice for unfolding is matrix inversion. Provides a common interface between channels for symmetry and ease in combination and systematic studies.
root -l yield.C
Checkpoint7 with this macros one should be able to reproduce the plot 49-50 from the note and Tables 17-18 (note, the table 18 uses the background yield result from the background section)
To get the FSR histograms one needs to turno on calculateFSR flag on.
Checkpoint: this macro will allow one to get plots 52-55 from the note
Step 9: Systematic uncertainty estimation
There are various sources of systematics affecting our analysis: the PDF, theoretical modeling uncertainty, efficiency estimation uncertainty, background estimation, unfolding etc.
For the background estimation, with the data driven method we estimate the systematic uncertainty as the difference between the result obtained with the method and that
expected from MC per mass bin. Corresponding numbers are obtained with the emu_prediction_plots.py
macro (see the recipe in the step 6 section).
PDF uncertainty estimation. The recipe for the method currently used (step by step).
Reweight the PDF using the current existing MC samples as implemented in CMSSW. First, check out the necessary packages:
scramv1 p CMSSW CMSSW_4_2_3 cvsco -r CMSSW_4_2_3 ElectroWeakAnalysis/Utilities
then replace the LHAPDF library as described here to the current up-to-date one:
or you can directly change in:
with above path:
touch $CMSSW_BASE/src/ElectroWeakAnalysis/Utilities/BuildFile.xml cmsenv scramv1 b cd ElectroWeakAnalysis/Utilities/test
then change the input file in PdfSystematicsAnalyzer.py and run:
With the up-to-date LHAPDF, one can use CT10, MSTW2008*, CTEQ66, NNPDF2.0, and other PDF sets.
Efficiency estimation uncertainty. The current method for efficiency estimation in the DY analysis is following: we estimate the MC truth efficiency and then we apply the efficiency correction map (Pt-eta) extracted using the data-driven tag and probe method applied to data and MC to weight the MC events. The systematic uncertainty associated with the Tag-and-Probe efficiency estimation is due to line-shape modelling, the difference between fit and counting and due to the binning. The two first are calculated inside the macros described in Step5. The binning systematic uncertainty is estimated using the following macro:
it takes as input the root files having the histogram with efficiency correction as a function of invariant mass with two binnings (to estimate the binning uncertainty), the other sources of uncertainty are also accessed.
Step 10: Plotting the results
The main result of the measurement is the cross-section ratio or r (and R) shape. We distinguish R and r shapes (see the note chapter9 for details on the definition and also see Figures 64). The figure 64 shows the shape R for theory and measurement (for two independent trigger scenarios). It relies on the theoretical cross-section measurement (1-2GeV bin), the final numbers for acceptance correction and also the final numbers for cross-section measurement. To give a clearer feeling of what this plot depends on I name the tables that are used to produce the number in the plot 64:
root -l DY.C root -l plot.C
To get all the up to date values for the shape r/R use:
cvs co UserCode/Purdue/DYAnalysis/AnalysisMacros/ShapeR./shapeDY.make ./shapeDY
Among the requirements to style of the results presented is to put the measurement point to the weighted position (i.e. the location of the point inside the bin makes the integral over sub-bins equal from both sides). The following macro can be used to calculate these positions do in root:
.L compare_r.cc; compare_r();