Muon efficiencies with the Btag Performance DB

THIS PAGE IS OBSOLETE!!

Simple example

This is a simple example of loading binned muon efficiencies to an SQLite/DB and reading them back in an analyzer. It's based on copying the btagging examples (lots of documentation here). The payload class names and bin variables still have "btag" names, but it seems generic enough to deal with any efficiencies or fake rates binned in pT/eta/phi.

Setup

Loading efficiencies to the DB (SQLite file)

  • The globalMuon.txt file contains a fake efficiency table (that would come from Tag&Probe)
  • The entries in the text file follow the btagging format, and correspond to:
    • The name of the algorithm corresponding to the efficiencies (Here: GlobalMuon)
    • The "discriminator" cut value (this is relevant for btagging, maybe not really needed for muons. It's set to 0.0 in the example)
    • The type of efficiency table payload. The example (BtagPerformancePayloadFromTableEtaJetEtOnlyBeff) corresponds to a table binned in eta and pT, with only efficiencies (no fake rates). See CondFormats/BTauObjects/interface for examples of other payload classes.
    • The number of columns in the table (6, corresponding to upper and lower bin edges in eta and pT, and the efficiency and error on the efficiency)
    • A comment string labelling the bins (etamin_etamax_etmin_etmax_bef_berr)
    • The actual bin ranges, efficiency, and error on the efficiency ( -2.50 -1.25 10 20 0.45 0.01, etc.)

  • To load the efficiencies from this text file: cmsRun write_globalmu.py.

  • This will create an sqlite file called MuonPhysicsPerformance.db. By default the IOV for the efficiencies is forever (PoolDBOutputService::beginOfTime to PoolDBOutputService::endOfTime).

Reading back the efficiencies from the DB (SQLite)

  • To run a test analyzer that reads back the efficiencies: cmsRun test_GlobalMu.py

  • This will load the efficiencies from MuonPhysicsPerformance.db in the EventSetup, then loop over a Z->mumu RelVal sample and lookup the efficiencies based on the pT and eta of the generated muons.

More complicated example

This example adds a new set of muon performance conditions formats, with an example of creating a new kind of table binned in pT, eta, isolation, and charge. The relevant format changes are in CondFormats/MuObjects, CondCore/MuPlugins and CondFormats/DataRecord. The data format for the new table is defined in CondFormats/MuObjects/interface/MuPerformancePayloadEtaPtIsoChargeOnlyMueff.h. To run the example:

  • Copy MuPerformance.tar.gz to a CMSSW_3_1_0_pre7/src area
  • tar -xzvf MuPerformance.tar.gz
  • scramv1 b
  • cd RecoBTag/PerformanceDB/test
  • cmsRun write_globalmu.py
  • cmsRun test_GlobalMu.py

The first step (write_globalmu.py) will load the efficiencies from RecoBTag/PerformanceDB/test/globalMuonIsoCharge.txt and create an sqlite file called MuonPhysicsPerformanceIsoChg.db. The second step (test_GlobalMu.py) will run over the Z->mumu RelVal sample and retrieve the efficiencies from the db.

Updated full example (June 29, 2009)

This example is based on the design for a new common performance DB framework from Tommaso, with an example of creating a new kind of table binned in pT, eta, isolation, and charge. Currently this runs in 2_1_12 to avoid recompilation of a large number of packages. To run the example:

  • Copy muonperformance_2112.tar.gz to a CMSSW_2_1_12/src area
  • =tar -xzvf muonperformance_2112.tar.gz =
  • scramv1 b
  • cd RecoBTag/PerformanceDB/test
  • cmsRun write_globalmu.py
  • cmsRun test_GlobalMu.py

The first step (write_globalmu.py) will load the efficiencies from RecoBTag/PerformanceDB/test/globalMuonIsoCharge.txt and create an sqlite file called MuonPhysicsPerformanceIsoChg.db. The second step (test_GlobalMu.py) will run over the Upsilon->mumu RelVal sample and retrieve the efficiencies from the db.

Updated full example (Sept 29, 2009)

In 3_1_2 this requires the following tags (most of these are already in 32X/33X).

cvs co -r V00-00-03-01   CondCore/PhysicsToolsPlugins                     
cvs co -r V01-03-00      CondFormats/BTauObjects                          
cvs co -r V06-07-03-01   CondFormats/DataRecord                           
cvs co -r V01-02-07-01   CondFormats/PhysicsToolsObjects                  
cvs co -r V00-01-00      RecoBTag/PerformanceDB                           
cvs co -r V00-01-00      RecoBTag/Records                                 

Temporarily, the toy example for writing fake "standalone muon" and "tracking" efficiencies from flat text files binned in pT, eta, phi, and charge can be run as follows:

cvs co -r V00-01-03      RecoMuon/Records                                 
cvs co UserCode/JHollar/MuonEfficiencies
mv UserCode/JHollar/MuonEfficiencies/ UserCode/.
scramv1 b

cd UserCode/MuonEfficiencies/test
cmsRun write_standalonemu.py
cmsRun write_trackertrackmu.py

This will load the fake tracking and standalone efficiencies with IOV 1:50 for MC and produce an sqlite file named MuonPhysicsPerformance.db The EDAnalyzer for testing the readback can be run with:

cmsRun test_TrackingAndStandaloneMuReadback.py

This will run over a Z->mumu RelVal and print the efficiency and uncertainty for each muon for both the standalone and tracking efficiency tables. It outputs a root file with histograms of the GEN-level muon pT, RECO-level muon pT (for all "muons"), and a corrected GEN-level pT using an accept-reject method ("Killing") to apply the efficiencies from the DB.

TBD

  • Make the DB writer able to read TnP histograms directly without an intermediate text file
  • Make the test readback example more flexible
    • Arbitrary numbers of corrections (trigger*tracking*standalone*...)
    • Examples of other methods of applying corrections
  • Add an option for just extracting the full table from the DB instead of event-by-event
  • Eventually: figure out where to put this in a release (PAT?)

Updated full example (Sept 30, 2009)

(Future updates will go here)

In 3_1_2 this requires the following tags (most of these are already in 32X/33X).

cvs co -r V00-00-03-01   CondCore/PhysicsToolsPlugins                     
cvs co -r V01-03-00      CondFormats/BTauObjects                          
cvs co -r V06-07-03-01   CondFormats/DataRecord                           
cvs co -r V01-02-07-01   CondFormats/PhysicsToolsObjects                  
cvs co -r V00-01-00      RecoBTag/PerformanceDB                           
cvs co -r V00-01-00      RecoBTag/Records                                 

Temporarily, the toy example for writing fake "standalone muon" and "tracking" efficiencies from flat text files binned in pT, eta, phi, and charge can be run as follows:

cvs co -r V00-01-03      RecoMuon/Records                                 
cvs co MuonAnalysis/TagAndProbe
scramv1 b

cd MuonAnalysis/TagAndProbe/test/performanceDB
cmsRun write_standalonemu.py
cmsRun write_trackertrackmu.py

This will load the fake tracking and standalone efficiencies with IOV 1:50 for MC and produce an sqlite file named MuonPhysicsPerformance.db The EDAnalyzer for testing the readback can be run with:

cmsRun test_TrackingAndStandaloneMuReadback.py

This will run over a Z->mumu RelVal and print the efficiency and uncertainty for each muon for both the standalone and tracking efficiency tables. It outputs a root file with histograms of the GEN-level muon pT, RECO-level muon pT (for all "muons"), and a corrected GEN-level pT using an accept-reject method ("Killing") to apply the efficiencies from the DB.

TBD

  • Make the DB writer able to read TnP histograms directly without an intermediate text file
  • Make the test readback example more flexible
    • Arbitrary numbers of corrections (trigger*tracking*standalone*...)
    • Examples of other methods of applying corrections
  • Add an option for just extracting the full table from the DB instead of event-by-event
  • Eventually: figure out where to put this in a release (PAT?)

-- JonathanHollar - 25 May 2009

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatext BuildFile r1 manage 0.4 K 2009-05-25 - 17:36 JonathanHollar  
Unknown file formatgz MuPerformance.tar.gz r1 manage 80.8 K 2009-06-03 - 21:08 JonathanHollar Full example with CondFormats
Unknown file formatcc MuTestPerformanceFW_ES.cc r1 manage 4.1 K 2009-05-25 - 17:35 JonathanHollar Analyzer for reading back efficiencies frim ESsource, and applying to MC muons
Texttxt MuonPerformanceFragment.py.txt r1 manage 0.4 K 2009-05-25 - 17:35 JonathanHollar  
Texttxt PoolMuonEffFragment.py.txt r1 manage 0.6 K 2009-05-25 - 17:36 JonathanHollar  
Texttxt globalMuon.txt r1 manage 0.3 K 2009-05-25 - 17:33 JonathanHollar dummy muon eff text file
Unknown file formatgz muonperformance_2112.tar.gz r1 manage 173.7 K 2009-06-26 - 17:41 JonathanHollar Full example with CondFormats and generic PerformanceDatabase
Texttxt test_GlobalMu.py.txt r1 manage 0.9 K 2009-05-25 - 17:34 JonathanHollar Test reading back efficiencies from SQLite
Texttxt write_globalmu.py.txt r1 manage 1.1 K 2009-05-25 - 17:33 JonathanHollar Example for writing efficiencies to SQLite
Edit | Attach | Watch | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r9 - 2009-10-21 - AafkeKraan
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Sandbox All webs login

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