b-tagging tutorial
Btagging example
Let's create a working are based on CMSSW 1.1.1, add the latest b tagging software packages, and run the
TrackCounting and
SoftLepton algorithms on some b and c jets:
scramv1 project -n Tutorial20061116 CMSSW CMSSW_1_1_1
cd Tutorial20061116/src/
project CMSSW
cvs co -r Tutorial20061116 DataFormats/BTauReco
cvs co -r Tutorial20061116 RecoBTau
cvs co -r Tutorial20061116 RecoBTag
scramv1 b -r
eval `scram runtime -sh`
cd ..
Two sample config files are
test_b.cfg and
test_c.cfg.
mkdir analysis
cd analysis
wget https://twiki.cern.ch/twiki/pub/CMS/BTagTutorialFnal/test_b.cfg
cmsRun test_b.cfg
and
wget https://twiki.cern.ch/twiki/pub/CMS/BTagTutorialFnal/test_c.cfg
cmsRun test_c.cfg
We can look at the output with ROOT and fwLite:
gSystem->Load("libFWCoreFWLite.so";
AutoLibraryLoader::enable();
TFile* file = new TFile("test_b.root");
new TBrowser;
Events->SetAlias("tkCountBase", "recoJetTags_trackCountingJetTags__bTag.obj");
Events->SetAlias("tkCountExt", "recoTrackCountingTagInfos_trackCountingJetTags__bTag.obj");
Events->SetAlias("leptonBase", "recoJetTags_softLeptonJetTags_softLepton_bTag.obj");
Events->SetAlias("leptonExt", "recoSoftLeptonTagInfos_softLeptonJetTags__bTag.obj");
c1 = new TCanvas();
c1->Divide(2,2);
c1->cd(1);
Events->Draw("tkCountBase.discriminator()", "tkCountBase.jet().pt() > 20");
c1->cd(2);
Events->Draw("tkCountBase.jet().pt()");
c1->cd(3);
Events->Draw("tkCountExt.discriminator(3,1)", "tkCountBase.jet().pt() > 20");
c1->cd(4);
Events->Draw("tkCountExt.discriminator(3,0)", "tkCountBase.jet().pt() > 20");
c2 = new TCanvas();
c2->Divide(2,2);
c2->cd(1);
Events->Draw("leptonExt.discriminator()", "(leptonExt.jet().pt() > 20) && (leptonExt.leptons() > 0)");
c2->cd(2);
Events->Draw("leptonExt.jet().pt()");
c2->cd(3);
Events->Draw("leptonExt.properties(0).sip3d", "(leptonExt.jet().pt() > 20) && (leptonExt.leptons() > 0)");
c2->cd(4);
Events->Draw("leptonExt.properties(0).ptRel", "(leptonExt.jet().pt() > 20) && (leptonExt.leptons() > 0)");
Analysis
For this tutorial, check out the head of
RecoBTag/Analysis
and
RecoBTag/MCTools
, and compile the two packages.
The full explanation of the Analysis package is given in
this page.
Exercise:
replace bTagTrackCountingAnalysis.rootfile = "plots_b.root"
- Run on your sample of c jets, calling the ouptut file plots_c.root
- You now have two root files. Merge the files obtained using the root executable
hadd
(you should have this in your path, in $ROOTSYS/bin
):
hadd plots_add.root plots_b.root plots_c.root
- Run the cfg file
nicePlots.cfg
to produce the final performance plots and produce a root file (test_final.root
) and eps and ps files of the merged plots (= cmsRun nicePlots.cfg=
). Notice in nicePlots.cfg the replace statements, to replace the parameters of the default configuration. In case you have used different eta and pt bins, put in the correct bins through two other replace statements. For example:
replace bTagTrackCountingAnalysis.etaRanges = { 0.0, 2.4 }
replace bTagTrackCountingAnalysis.ptRanges = { 30.0, 400.0 }
Look at the plots produced, either in the root file, the ps or the eps file.
MC tools
An example of the usage of the Jet flavour identification tools is given in the EDAnalyzer
RecoBTag/MCTools/test/BtagMCTest.cc
.
It is explained in the
BTagMCTools page. A sample configuration file to run it is provided in the same directory (
test.cfg
).
-- Andrea Bocci, Thomas Speer - 15 Nov 2006