PAT Examples: SUSY Analysis



In this tutorial we will show how to make a PAT-based analysis in the context of the SUSY PAG. Since there is a broad variety of signals in different SUSY models, the idea of this tutorial is to include many physics objects

In the first step we run the SusyPAT over the original AOD collections. The SusyPAT creates PAT objects from the "standard" RECO objects provided by the CMS reconstruction, and stores many observables used in SUSY searches in the output file.

Per default it SusyPAT runs PAT and PF2PAT in parallel and adds a AK5 jet collection for each jet type (Calo, PF, JPT and TrackJets).

You will learn:

  • how to run the SusyPAT
  • how to configure SusyPAT according to your needs
  • how to access some variables from the PAT objects

How to get the SusyPAT code

The tutorial analysis works in CMSSW_3_8_5 release. So, first create a project area based on 3_8_5:
cmsrel CMSSW_3_8_5
cd CMSSW_3_8_5/src/

Then, get the packages for SusyPAT and compile:

addpkg PhysicsTools/Configuration V00-08-05
#For eleID from VBTF
addpkg RecoEgamma/ElectronIdentification V00-03-13
addpkg ElectroWeakAnalysis/WENu V00-02-01
#Optional for some options
addpkg MuonAnalysis/MuonAssociators V01-09-01
addpkg PhysicsTools/PFCandProducer V04-06-03
scram b -j4

How to run SusyPAT

Go to the test directory of the package:

cd PhysicsTools/Configuration/test/

The config file uses CommandLineOptions to pass parameters to the config.

Specify a file from LM0 (SUSY benchmark point) MC as input and specify the number of events you want to run on (few hundred is enough for the tutorial)

python maxEvents=300 files=/store/relval/CMSSW_3_8_4/RelValLM1_sfts/GEN-SIM-RECO/MC_38Y_V12-v1/0025/ECF484F1-9AC2-DF11-9A20-00304867918A.root

This will generate you a fully resolved config, that you can use for example with CRAB.

Now run the created config locally:


At the end you will get a file containing PAT objects:


Details about the SusyPAT configuration possibilities

To get the details about the configuration posibilities use:
python help

You will get a listing of all configuration possibilities and their default values.

The option for MC matching is set to true by default

  mcInfo             : True
                     - process CMS.MonteCarlo data
to process data you need to set it to fals using
python mcInfo=0

Note that there are changes of the default parameters of the module making MC matching of PAT objects:

process.electronMatch.checkCharge = False
    process.electronMatch.maxDeltaR   = cms.double(0.2)
    process.electronMatch.maxDPtRel   = cms.double(999999.)
    process.muonMatch.checkCharge     = False
    process.muonMatch.maxDeltaR       = cms.double(0.2)
    process.muonMatch.maxDPtRel       = cms.double(999999.)
    process.tauMatch.checkCharge      = False
    process.tauMatch.maxDeltaR        = cms.double(0.3)
    process.patJetPartonMatch.maxDeltaR  = cms.double(0.25)
    process.patJetPartonMatch.maxDPtRel  = cms.double(999999.)
    process.patJetGenJetMatch.maxDeltaR  = cms.double(0.25)
    process.patJetGenJetMatch.maxDPtRel  = cms.double(999999.)

The filtering in TriggerBits is set to no filtering by default

  hltSelection       : []
                     - hlTriggers (OR) used to filter events
If you want to filter events based on a trigger selection you can specify the parameter hltSelection
python hltSelection=HLT_Mu9 hltSelection=HLT_Jet15U
and the or of all specified triggers is used to filter the events.

To use a different HLT menu (for example REDIGI37X for recent MC reprocessings) use the parameter hltName

  hltName            : HLT
                     - HLT menu to use for trigger matching

If you want to use a different set of jet energy correction you can use the parameter JetCorrections

  JetCorrections     : Spring10
                     - Jet corrections to use, default 'Spring10'

If you want to use a different jet algorithm or type use

  jetTypes           : ['IC5Calo', 'AK5JPT']
                     - Additional jet types that will be produced (AK5Calo and AK5PF, cross cleaned in PF2PAT, are included anyway)
Per default AK5Calo (_cleanPatJetsAK5Calo_*_) and AK5PF (_selectedPatJetsPF_*_) from PF2PAT are produced

To have a more powerfull MC matching one can set doExtensiveMatching

  doExtensiveMatching: False
                     - Matching to simtracks (needs extra tags)
to true and the matching of light leptons is performed to simtracks as well, i.e. the lepton->genLepton() contains electrons from conversions as well.
#Create merged truth of genParticles and simtracks
    process.mergedTruth = cms.EDProducer("GenPlusSimParticleProducer",
        src           = cms.InputTag("g4SimHits"), # use "famosSimHits" for FAMOS
        setStatus     = cms.int32(5),             # set status = 8 for GEANT GPs
        filter        = cms.vstring("pt > 0.0"),  # just for testing (optional)
        genParticles   = cms.InputTag("genParticles") # original genParticle list
    #Match both genParticles and simtracks to leptons 
    process.electronMatch.mcStatus = cms.vint32(1,5)
    process.electronMatch.matched = "mergedTruth"
    process.muonMatch.mcStatus = cms.vint32(1,5)
    process.muonMatch.matched = "mergedTruth"
Additionally a UserInt is saved for muons that contains the information based on the matching by hits as well. It can be accessed by muon->userInt('classByHitsGlb') and a detailed description is given here. The clssification is the following
CLASSIFICATION: For each RECO Muon, match to SIM particle, and then:
  - If the SIM is not a Muon, label as Punchthrough (1)
  - If the SIM is a Muon, then look at it's provenance.
     A) the SIM muon is also a GEN muon, whose parent is NOT A HADRON AND NOT A TAU
        -> classify as "primary" (4).
     B) the SIM muon is also a GEN muon, whose parent is HEAVY FLAVOURED HADRON OR A TAU
        -> classify as "heavy flavour" (3)
     C) classify as "light flavour/decay" (2)

  In any case, if the TP is not preferentially matched back to the same RECO muon,
  label as Ghost (flip the classification)

  - for non-muons: 0
  - for primary muons: 13
  - for non primary muons: flavour of the mother: abs(pdgId) of heaviest quark, or 15 for tau

One configuration parameter that concerns the PF2PAT part, is

  doSusyTopProjection: False
                     - Apply Susy selection in PF2PAT to obtain lepton cleaned jets (needs validation)
If you set it to True the jet produced in PF2PAT (selectedPatJetsPF) are fully lepton cleaned using a baseline SUSY lepton selection
#-- Top projection selection -----------------------------------------------------------
    #Good vertices
    process.goodVertices = cms.EDFilter("VertexSelector",
        src = cms.InputTag("offlinePrimaryVertices"),
        cut = cms.string("!isFake && ndof > 4 && abs(z) <= 24 && position.Rho <= 2"),
        filter = cms.bool(False),
    #Electron selection
    #Isolation (combined)
    process.pfIsolatedElectronsPF.combinedIsolationCut = 0.3
    #Impact parameter cut
    process.pfElectronsFromVertex = cms.EDFilter(
        src = cms.InputTag("pfIsolatedElectronsPF"),  # PFCandidate source
        vertices = cms.InputTag("goodVertices"),  # vertices source
        d0Cut = cms.double(0.04),  # transverse IP
        dzCut = cms.double(1.),  # longitudinal IP
        d0SigCut = cms.double(99.),  # transverse IP significance
        dzSigCut = cms.double(99.),  # longitudinal IP significance
    # Acceptance, ID and conversion rejection
    electronSelection =  "abs( eta ) < 2.5 & pt > 5"
    electronSelection += " & mva_e_pi > 0.6" # same as patElectron::mva()
    electronSelection += " & gsfTrackRef().isNonnull() & gsfTrackRef().trackerExpectedHitsInner().numberOfHits() > 1"   
    #Muon selection
    #Isolation (combined relative)
    process.pfIsolatedMuonsPF.combinedIsolationCut = 0.25
    #Impact parameter cut
    process.pfMuonsFromVertex = cms.EDFilter(
        src = cms.InputTag("pfIsolatedMuonsPF"),  # PFCandidate source
        vertices = cms.InputTag("goodVertices"),  # vertices source
        d0Cut = cms.double(0.02),  # transverse IP
        dzCut = cms.double(1.),  # longitudinal IP
        d0SigCut = cms.double(99.),  # transverse IP significance
        dzSigCut = cms.double(99.),  # longitudinal IP significance
    # Acceptance and ID
    muonSelection =  "abs( eta ) < 2.5 & pt > 5"
    muonSelection += " & muonRef().isNonnull & muonRef().isGlobalMuon()"
    muonSelection += " & muonRef().isTrackerMuon() & muonRef().numberOfMatches > 1"
    muonSelection += " & muonRef().globalTrack().normalizedChi2() < 10"
    muonSelection += " & muonRef().track().numberOfValidHits() > 10"
    muonSelection += " & muonRef().globalTrack().hitPattern().numberOfValidMuonHits() > 0"
    muonSelection += " & muonRef().innerTrack().hitPattern().numberOfValidPixelHits() > 0"

To trim the event content according to the needs of your analysis you can use the parameter

  addKeep            : []
                     - Additional keep and drop statements to trim the event content
Create a text file, named keep.txt containing
drop *_selectedPatJetsPF__PAT
drop *_selectedPatElectronsPF_*_*
drop *_selectedPatMuonsPF_*_*
drop *_selectedPatTausPF_*_*
drop *_cleanPatJetsAK5Calo__PAT
drop *_cleanPatJetsIC5Calo__PAT
drop *_cleanPatJetsAK5PF__PAT
drop *_cleanPatElectrons_*_*
drop *_cleanPatMuons_*_*
drop *_cleanPatTaus_*_*
drop *_cleanPatPhotons_*_*
keep *_triggerMatchedPat*_*_*
drop *_towerMaker_*_*
Afterwards you can run
python addKeep_load=keep.txt
and the event content is adjusted. Now the PatTuple contains all types of objects (*_triggerMatchedPat*_*_*), where the TriggerMatching is applied to.

To specify the HLT paths used in the matching use the parameters

  electronHLTMatches : ['HLT_Ele15_LW_L1R']
                     - HLT paths matched to electrons
  jetHLTMatches      : ['HLT_Jet15U', 'HLT_Jet30U', 'HLT_Jet50U']
                     - HLT paths matched to jets
  muonHLTMatches     : ['HLT_Mu9']
                     - HLT paths matched to muons
  photonHLTMatches   : ['HLT_Photon30']
                     - HLT paths matched to photons
  tauHLTMatches      : ['HLT_Jet15U', 'HLT_Jet30U', 'HLT_Jet50U']
                     - HLT paths matched to taus

You can combine all options according to the needs of your analysis.

The following collections of direct interst for physics analysis are created

vector<pat::Electron>             "cleanPatElectrons"     ""            "PAT."         
vector<pat::Electron>             "selectedPatElectronsPF"    ""            "PAT."         
vector<pat::Jet>                  "cleanPatJetsAK5Calo"    ""            "PAT."         
vector<pat::Jet>                  "cleanPatJetsAK5JPT"    ""            "PAT."         
vector<pat::Jet>                  "cleanPatJetsIC5Calo"    ""            "PAT."         
vector<pat::Jet>                  "selectedPatJetsPF"     ""            "PAT."         
vector<pat::MET>                  "patMETsAK5Calo"        ""            "PAT."         
vector<pat::MET>                  "patMETsIC5Calo"        ""            "PAT."         
vector<pat::MET>                  "patMETsPF"             ""            "PAT."         
vector<pat::MET>                  "patMETsTC"             ""            "PAT."         
vector<pat::Muon>                 "cleanPatMuons"         ""            "PAT."         
vector<pat::Muon>                 "selectedPatMuonsPF"    ""            "PAT."         
vector<pat::Photon>               "cleanPatPhotons"       ""            "PAT."         
vector<pat::Tau>                  "cleanPatTaus"          ""            "PAT."         
vector<pat::Tau>                  "selectedPatTausPF"     ""            "PAT."         
The collections with extension PF are created using PF2PAT, while the others are created by PAT.

If you want to analyze the trigger matched quantities you need to specify = addKeep=*_triggerMatchedPat*_*_* = and will get

vector<pat::Electron>             "triggerMatchedPatElectrons"    ""            "PAT."         
vector<pat::Electron>             "triggerMatchedPatElectronsPF"    ""            "PAT."         
vector<pat::Jet>                  "triggerMatchedPatJetsAK5Calo"    ""            "PAT."         
vector<pat::Jet>                  "triggerMatchedPatJetsAK5PF"    ""            "PAT."         
vector<pat::Jet>                  "triggerMatchedPatJetsIC5Calo"    ""            "PAT."         
vector<pat::Jet>                  "triggerMatchedPatJetsPF"    ""            "PAT."         
vector<pat::MET>                  "patMETsAK5Calo"        ""            "PAT."         
vector<pat::MET>                  "patMETsIC5Calo"        ""            "PAT."         
vector<pat::MET>                  "patMETsPF"             ""            "PAT."         
vector<pat::MET>                  "patMETsTC"             ""            "PAT."         
vector<pat::Muon>                 "triggerMatchedPatMuons"    ""            "PAT."         
vector<pat::Muon>                 "triggerMatchedPatMuonsPF"    ""            "PAT."         
vector<pat::Photon>               "triggerMatchedPatPhotons"    ""            "PAT."         
vector<pat::Tau>                  "triggerMatchedPatTaus"    ""            "PAT."         
vector<pat::Tau>                  "triggerMatchedPatTausPF"    ""            "PAT." 
and the trigger matched collections for all the objects are stored.

How to get the analyzer code

The tutorial analyzer runs in the CMSSW_3_8_4 release used in the first part Go to the test directory of the package and check out the analyzer:
cd ${CMSSW_BASE}/src/CMS.PhysicsTools/Configuration/test/
cvs co -d__temp__ -rV00-09-03 UserCode/NiklasMohr/V9/
/bin/mv __temp__/ .
rm -r __temp__

How to run the analyzer

You can run on the SusyPAT file made in the previous step. Alternatively, if you want to run on more events, a test file (made from 1000 events) is available on castor. Specify the path of the file by editing the following parameter in the file
files = ["rfio:/castor/"]

Run the analysis:

At the end you will get an output root file containing a few histograms containing MET for all reconstruction algorithms:
and a plot of all collections overlayed
  • susy_met_plot.png:

Make changes by yourself

  • Add different jet types (KT6 calo jets) to the PatTuple
  • Test the Susy Top projection by running on ZMuMu MC from relvals
  • Calculate the HT (=Sum(Jet_pt)) and plot the diribution for different jet types

How to get more information

Refer to the SUSY twiki for more general informations about PAG analyses: (SUSY main page) (Summary of each reference analysis)

Review status

Reviewer/Editor and Date (copy from screen) Comments
NiklasMohr - 22 Sep 2010 Added tutorial description
RogerWolf - 22 Sep 2010 Created the template page

Responsible: NiklasMohr
Last reviewed by: most recent reviewer and date

Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r6 - 2011-08-23 - WilliamSutcliffe
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    CMSPublic All webs login

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