W+jets Analysis Framework

B2G PATTuples

CMSW_5_3_8_patch1

Using CMSSW_5_3_8_patch1 as base distribution. General recipe, merging what suggested by:

  cmsrel CMSSW CMSSW_5_3_8_patch1
  cd CMSSW_5_3_8_patch1/src/
  cmsenv
  addpkg CommonTools/RecoUtils V00
-01-04
  addpkg DataFormats/METReco V03-03-11-01
  addpkg DataFormats/ParticleFlowCandidate V15-03-04-01
  addpkg DataFormats/PatCandidates V06-05-06-07
  addpkg DataFormats/StdDictionaries V00-02-13-01
  addpkg DataFormats/TrackReco V10-02-02-01
  addpkg DataFormats/VertexReco V02-00-04-01
  addpkg FWCore/GuiBrowsers V00-00-70
  addpkg JetMETCorrections/Type1MET V04-06-09-02
  addpkg PhysicsTools/PatAlgos V08-09-52
  addpkg PhysicsTools/PatUtils V03-09-28
  addpkg RecoJets/JetAlgorithms V04-05-01
  addpkg RecoJets/JetAssociationAlgorithms V03-01-01-00
  addpkg RecoJets/JetAssociationProducers V03-02-01
  addpkg RecoJets/JetProducers V05-11-01
  addpkg RecoMET/METAnalyzers V00-00-08
  addpkg RecoMET/METFilters V00-00-13-01
  addpkg RecoMET/METProducers V03-03-12-02
  addpkg RecoParticleFlow/PFProducer V15-02-09
  addpkg RecoTauTag/Configuration V01-04-10
  addpkg RecoTauTag/RecoTau V01-04-23
  addpkg TopQuarkAnalysis/TopPairBSM V04-02-09

  cvs co -r V00-03-05 -d CMGTools/External UserCode/CMG/CMGTools/External
  cvs co -r V00-00-31 -d EGamma/EGammaAnalysisTools UserCode/EGamma/EGammaAnalysisTools
  cd EGamma/EGammaAnalysisTools/data ; cat download.url | xargs wget
  cd - ; cvs co -d KStenson/TrackingFilters UserCode/KStenson/TrackingFilters
  cp KStenson/TrackingFilters/plugins/TobTecFakesFilter.cc RecoMET/METFilters/plugins/
  cp KStenson/TrackingFilters/python/tobtecfakesfilter_cfi.py RecoMET/METFilters/python
  rm -r KStenson/TrackingFilters
 
  git clone https://github.com/rgerosa/ElectroWeakAnalysis
  mv ElectroWeakAnalysis/VPlusJets/test/B2GPatuple/metUncertainty_cff.py TopQuarkAnalysis/TopPairBSM/python
  mv ElectroWeakAnalysis/VPlusJets/test/B2GPatuple/ttbsm_cfg.py TopQuarkAnalysis/TopPairBSM/test
  mv ElectroWeakAnalysis/VPlusJets/test/B2GPatuple/SmearedPATParticleProducer.cc PhysicsTools/PatUtils/plugins/
  rm -rf ElectroWeakAnalysis/
  scramv1 b -j 4

last updated on 04-Oct-2013

News in the ttbsm_cfg.py

Two new options : doMetUncertainty = if true , Met uncertainty Analysis is run calling with ../python/metUncertainty_cff.py

doPatJetSmearing = if true , apply resolution smearing on Jets to match what is observed in data and use this collection as well as the smeared

typeI pf met as default during the Met Uncertainty sequence


Type I MET correction in the PF2PAT

In the call of PF2PAT with postfix = "PFlow" and "PFLowLoose", typeI met correction is now applied in a consistent way:

      process.patPF2PATSequencePFlow.remove(process.patMETsPFlow)
      process.patPF2PATSequencePFlow.replace(process.producePatPFMETCorrectionsPFlow,process.makePatMETsPFlow)
      process.patMETsPFlow.metSource = cms.InputTag("pfType1CorrectedMetPFlow")
    

Photon Collection and Isolation :

Starting from and AOD or a RECO file, the default photon collection is the reco::Photon. During the PF2PAT + patDefaultSequence run with postfix="PFlow", we have different photon collection that can be considered and they have been added in the output:

PF Photons are isolated from the PFCanadidate list looking at the chs pfcandidate collection :

    process.pfAllPhotonsPFlow = cms.EDFilter("PdgIdPFCandidateSelector",
                      pdgId = cms.vint32(22),
                      src = cms.InputTag("pfNoPileUpIsoPFlow"))

    process.pfSelectedPhotonsPFlow = cms.EDFilter("GenericPFCandidateSelector",
                      src = cms.InputTag("pfAllPhotonsPFlow"),
                      cut = cms.string('mva_nothing_gamma>0'))

    process.pfIsolatedPhotonsPFlow = cms.EDFilter("IsolatedPFCandidateSelector",
                      src = cms.InputTag("pfSelectedPhotonsPFlow"),
                      isolationValueMapsCharged = cms.VInputTag(cms.InputTag("phPFIsoValueCharged04PFIdPFlow")),
                      deltaBetaIsolationValueMap = cms.InputTag("phPFIsoValuePU04PFIdPFlow"),
                      isRelative = cms.bool(True),
                      isolationCut = cms.double(999),
                      doDeltaBetaCorrection = cms.bool(False),
                      deltaBetaFactor = cms.double(-0.5),
                      isolationValueMapsNeutral = cms.VInputTag(cms.InputTag("phPFIsoValueNeutral04PFIdPFlow"), cms.InputTag("phPFIsoValueGamma04PFIdPFlow")))
    

Pat Photons are produced in the patDefaultSequence via the process.makePatPhotons sequence: at first, if you are running on the MC, reco::Photons are matched with genParticles acccording to a dR and dPt criterion, then patPhotons are produced just starting from the reco collection.

    process.photonMatch = cms.EDProducer("MCMatcher",
             src = cms.InputTag("photons"),
             maxDPtRel = cms.double(1.0),
             mcPdgId = cms.vint32(22),
             mcStatus = cms.vint32(1),
             resolveByMatchQuality = cms.bool(False),
             maxDeltaR = cms.double(0.2),
             checkCharge = cms.bool(True),
             resolveAmbiguities = cms.bool(True),
             matched = cms.InputTag("genParticles"))

    process.patPhotons = cms.EDProducer("PATPhotonProducer",
            userData = cms.PSet( userCands = cms.PSet( src = cms.VInputTag("")),
                                 userInts = cms.PSet( src = cms.VInputTag("")),
                                 userFloats = cms.PSet(src = cms.VInputTag("")),
                                 userClasses = cms.PSet(src = cms.VInputTag("")),
                                 userFunctionLabels = cms.vstring(),
                            userFunctions = cms.vstring()),
            addGenMatch = cms.bool(True),
            addResolutions = cms.bool(False),
            addEfficiencies = cms.bool(False),
            photonIDSources = cms.PSet(
                       PhotonCutBasedIDTight = cms.InputTag("PhotonIDProd","PhotonCutBasedIDTight"),
                       PhotonCutBasedIDLoose = cms.InputTag("PhotonIDProd","PhotonCutBasedIDLoose")),
            isoDeposits = cms.PSet(),
            efficiencies = cms.PSet(),
            embedSuperCluster = cms.bool(True),
            embedGenMatch = cms.bool(True),
            resolutions = cms.PSet(),
            addPhotonID = cms.bool(True),
            photonSource = cms.InputTag("photons"),
            userIsolation = cms.PSet(),
            genParticleMatch = cms.InputTag("photonMatch"))

    

In the actual version of the code, both pfPhotons and patPhoton are kept in the output. In addition, also the cleanedPhoton collection is stored since it is the one used during the metUncertainty analysis. This is why we don't want to double count electrons inside the photon collection when we shift or smear the photon energy. This is done modifying the standard cleanPatSequence inside the patDefaultSequence in the following way:

   process.cleanPatCandidates.replace(process.cleanPatMuons,process.cleanPatMuonsPFlow)
   process.cleanPatCandidates.replace(process.cleanPatElectrons,process.cleanPatElectronsPFlow)
   process.cleanPatPhotons.checkOverlaps.electrons.src = cms.InputTag("cleanPatElectronsPFlow")
   process.cleanPatCandidates.replace(process.cleanPatTaus,process.cleanPatTausPFlow)
   process.cleanPatCandidates.replace(process.cleanPatJets,process.cleanPatJetsPFlow)
   process.cleanPatJetsPFlow.checkOverlaps.photons.src = cms.InputTag("cleanPatPhotons")
   process.patDefaultSequence.remove(process.countPatCandidates)
   

For the isolation, the PF phoIso Value Maps are stored in the output and they should be used offline for photon identification:

    process.phoPFIso = cms.EDFilter("PhotonIsoProducer",
             verbose = cms.untracked.bool(False),
             photonTag = cms.InputTag("photons"),
             nameValueMapIsoNh = cms.string('nhIsoForGsfEle'),
             nameValueMapIsoCh = cms.string('chIsoForGsfEle'),
             vertexTag = cms.InputTag("offlinePrimaryVertices"),
             nameValueMapIsoPh = cms.string('phIsoForGsfEle'),
             particleFlowTag = cms.InputTag("particleFlow"))


   In the patseq : process.phoPFIso is added, and the in the output 'keep *_phoPFIso_*_*'    
   

PF Candidate and Gen Particles :

In the output, the complete list of PFCandidate is added when options.writePFCands or options.writeFat is set to True.
They are divided into two sub-collections: pfPileUpPFlow are charged hadrons not comming from PV, pfNoElectronPFlow are the full list pfCandidate - pfPileUpPFlow - pfMuons -pfElectrons.

In addition, when you run on MC, some gen truth are stored by default: 'keep _*GenEventInfoProduct*_*_ ', 'keep _*addPileupInfo*_*_ ', 'keep *_*LHEEventProduct*_*_*'
When the options.writeGenParticles is set to True, genParticles are now stored in the output : 'keep *_*genParticles*_*_*', 'keep *_*genParticlesForJetsNoNu*_*_*', 'keep recoGenParticles_*_*_*',

Met Uncertainty Code :

Following the suggested recipe, in order to call the tool for met Uncertainty propagation, the following lines are added in the main cfg:

   from TopQuarkAnalysis.TopPairBSM.metUncertainty_cff import runMetUncertainty

   ## in order to have the best photon collection cleaned from electrons
   process.cleanPatCandidates.replace(process.cleanPatMuons,process.cleanPatMuonsPFlow)
   process.cleanPatCandidates.replace(process.cleanPatElectrons,process.cleanPatElectronsPFlow) 
   process.cleanPatPhotons.checkOverlaps.electrons.src = cms.InputTag("cleanPatElectronsPFlow")
   process.cleanPatCandidates.replace(process.cleanPatTaus,process.cleanPatTausPFlow)
   process.cleanPatCandidates.replace(process.cleanPatJets,process.cleanPatJetsPFlow)
   process.cleanPatJetsPFlow.checkOverlaps.photons.src = cms.InputTag("cleanPatPhotons")   
   process.patDefaultSequence.remove(process.countPatCandidates)

   patJetCollection            = cms.InputTag("selectedPatJets"+postfix)
   patMuonCollection       = cms.InputTag("patMuons"+postfix)
   patElectronCollection   = cms.InputTag("patElectrons"+postfix)
   patTauCollection           = cms.InputTag("patTaus"+postfix)
   photonCollection           = cms.InputTag("cleanPatPhotons")
   patUnclusteredCandidate = cms.InputTag("pfCandMETcorr"+postfix)
   TypeIpatMetCollection   = cms.InputTag("patMETs"+postfix)
   useData    = options.useData
   doTauSystematic         = False
   doPhotonSystematic      = True
   storeSmearandShiftCollections = False

   if options.doMetUncertainty :
    runMetUncertainty(process,
                   useData,
                   options.doPatJetSmearing,
                   patJetCollection,
                   patMuonCollection,
                   patElectronCollection,
                   patTauCollection,
                   photonCollection,
                   patUnclusteredCandidate,
                   TypeIpatMetCollection,
                   doTauSystematic,
                   doPhotonSystematic,
                   storeSmearandShiftCollections
                  )

   

Pile Up Jet ID Sequence

It is run by default on selectedPatJetsPFlow (AK5chs jets), using goodOfflinePrimaryVertices vertex collection; both cut based and MVA pileUp jet ID are run.
In case you are using both doPatJetSmearing and doMetUncertainty options on the MC, the same sequence is also run on the smearedPatJetsPFlow collection, since this jet collection is added in the output.

When doMetUncertainty, storeSmearandShiftCollections are true and doPatJetSmearing is false, it is run also on shiftedPatJetsPFlowEnUp , shiftedPatJetsPFlowEnDown, while, if doPatJetSmearing is changed to true, in the output the value map for these collection are added: shiftedSmearedPatJetsPFlowEnUp , shiftedSmearedPatJetsPFlowEnDown, smearedPatJetsPFlowResUp and smearedPatJetsPFlowResDown

    process.load("CMGTools.External.pujetidsequence_cff")

    process.puJetIdChs.jets     = cms.InputTag("selectedPatJetsPFlow")
    process.puJetIdChs.vertexes = cms.InputTag("goodOfflinePrimaryVertices")

    process.puJetMvaChs.jets     = cms.InputTag("selectedPatJetsPFlow")
    process.puJetMvaChs.vertexes = cms.InputTag("goodOfflinePrimaryVertices")

    process.puJetMvaChs.algos[0].tmvaWeights = cms.string("CMGTools/External/data/TMVAClassificationCategory_JetID_53X_chs_Dec2012.weights.xml")

    process.puJetIdSequenceChs = cms.Sequence(process.puJetIdChs*
                                          process.puJetMvaChs)

    if not options.useData and options.doMetUncertainty :

     if not options.doPatJetSmearing :

       process.puJetIdChsEnUp  = process.puJetIdChs.clone(jets = cms.InputTag("shiftedPatJetsPFlowEnUp"))
       process.puJetMvaChsEnUp = process.puJetMvaChs.clone(jets = cms.InputTag("shiftedPatJetsPFlowEnUp"),
                                                     jetids = cms.InputTag("puJetIdChsEnUp"))

       process.puJetIdChsEnDown  = process.puJetIdChs.clone(jets = cms.InputTag("shiftedPatJetsPFlowEnDown"))
       process.puJetMvaChsEnDown = process.puJetMvaChs.clone(jets = cms.InputTag("shiftedPatJetsPFlowEnDown"),
                                                        jetids = cms.InputTag("puJetIdChsEnDown"))

        process.puJetIdSequenceChs += process.puJetIdChsEnUp*process.puJetMvaChsEnUp
        process.puJetIdSequenceChs += process.puJetIdChsEnDown*process.puJetMvaChsEnDown

        if not storeSmearandShiftCollections :
           process.puJetIdSequenceChs.remove(process.puJetIdChsEnUp)
           process.puJetIdSequenceChs.remove(process.puJetMvaChsEnUp)
           process.puJetIdSequenceChs.remove(process.puJetIdChsEnDown)
           process.puJetIdSequenceChs.remove(process.puJetMvaChsEnDown)

 else :
        process.puSmearedJetMvaChs = process.puJetMvaChs.clone(jets = cms.InputTag("smearedPatJetsPFlow"),
                                                         jetids = cms.InputTag("puSmearedJetIdChs"))
        process.puSmearedJetIdChsResUp    = process.puJetIdChs.clone(jets = cms.InputTag("smearedPatJetsPFlowResUp"))

        process.puSmearedJetMvaChsResUp   = process.puJetMvaChs.clone(jets = cms.InputTag("smearedPatJetsPFlowResUp"),
                                                                jetids = cms.InputTag("puSmearedJetIdChsResUp"))
        process.puSmearedJetIdChsResDown  = process.puJetIdChs.clone(jets = cms.InputTag("smearedPatJetsPFlowResDown"))

        process.puSmearedJetMvaChsResDown = process.puJetMvaChs.clone(jets = cms.InputTag("smearedPatJetsPFlowResDown"),
                                                                jetids = cms.InputTag("puSmearedJetIdChsResDown"))
        process.pushiftedSmearedJetIdChsEnUp    = process.puJetIdChs.clone(jets = cms.InputTag("shiftedSmearedPatJetsPFlowEnUp"))

        process.pushiftedSmearedJetMvaChsEnUp   = process.puJetMvaChs.clone(jets = cms.InputTag("shiftedSmearedPatJetsPFlowEnUp"),
                                                                      jetids = cms.InputTag("pushiftedSmearedJetIdChsEnUp"))
        process.pushiftedSmearedJetIdChsEnDown  = process.puJetIdChs.clone(jets = cms.InputTag("shiftedSmearedPatJetsPFlowEnDown"))

        process.pushiftedSmearedJetMvaChsEnDown = process.puJetMvaChs.clone(jets = cms.InputTag("shiftedSmearedPatJetsPFlowEnDown"),
                                                                      jetids = cms.InputTag("pushiftedSmearedJetIdChsEnDown"))

        process.puJetIdSequenceChs += process.puSmearedJetIdChs*process.puSmearedJetMvaChs
        process.puJetIdSequenceChs += process.puSmearedJetIdChsResUp*process.puSmearedJetMvaChsResUp
        process.puJetIdSequenceChs += process.puSmearedJetIdChsResDown*process.puSmearedJetMvaChsResDown
        process.puJetIdSequenceChs += process.pushiftedSmearedJetIdChsEnUp*process.pushiftedSmearedJetMvaChsEnUp
        process.puJetIdSequenceChs += process.pushiftedSmearedJetIdChsEnDown*process.pushiftedSmearedJetMvaChsEnDown
  
       if not storeSmearandShiftCollections :

        process.puJetIdSequenceChs.remove(process.puSmearedJetIdChsResUp)
        process.puJetIdSequenceChs.remove(process.puSmearedJetMvaChsResUp)
        process.puJetIdSequenceChs.remove(process.puSmearedJetIdChsResDown)
        process.puJetIdSequenceChs.remove(process.puSmearedJetMvaChsResDown)
        process.puJetIdSequenceChs.remove(rocess.pushiftedSmearedJetIdChsEnUp)
        process.puJetIdSequenceChs.remove(process.pushiftedSmearedJetMvaChsEnUp)
        process.puJetIdSequenceChs.remove(rocess.pushiftedSmearedJetIdChsEnDown)
        process.puJetIdSequenceChs.remove(process.pushiftedSmearedJetMvaChsEnDown)

   process.patseq += process.puJetIdSequenceChs

   process.out.outputCommands += ['keep *_pu*JetId*_*_*',
                         'keep *_pu*JetMva*_*_*']




    

Tool for Met Uncertainty studies: metUncertainty_cff.py

it is a python function taking as input a set of bools and pat collections:

useData = bool variable true if you are running on real data
doJetSmearing = bool variable true if you want to produce smeared jet collection, smeared met and use it as new default
doTauSystematic = bool variable true if you want to store the met derived from tau scale and resolution uncertainty
doPhotonSystematic = bool variable true if you want to store the met derived from tau scale and resolution uncertainty
storeSmearandShiftCollections = bool variable true if you want to store shifted and smeared particle and jet collection in the output

patJetCollection = input pat jet collection to be used
patElectronCollection = input pat electron collection to be used
patMuonCollection = input pat muon collection to be used
patTauCollection = input pat tau collection to be used
patPhotonCollection = input pat photon collection to be used
patUnclusteredCandidate = input pf particles not clustered in jets to be used
TypeIpatMetcollection = input type I corrected pat met using patJetCollection as reference

Some parameters are inner declared in the runMetUncertainty function:

resolutionFile = name of the file to take info of how to smeared MC jets to match data because of different resolution
histoName = name of the histo to be taken inside the resolutionFile
JECFileForJetShift = JEC uncertainty to be applied in order to shift jets for JES uncertainty

EleEnergyScaleUncEB = uncertainty on the electron energy scale in EB to be used for shifted electron collection -> See e/gamma POG
EleEnergyScaleUncEE = uncertainty on the electron energy scale in EE to be used for shifted electron collection -> See e/gamma POG
EleEnergyResEB = resolution on the electron energy in EB to be used for smeared electron collection -> See e/gamma POG
EleEnergyResEE = resolution on the electron energy in EE to be used for smeared electron collection -> See e/gamma POG
EleEnergyResUncEB = resolution uncertainty on the electron energy in EB to be used for smeared electron collection -> See e/gamma POG
EleEnergyResUncEE = resolution uncertainty on the electron energy in EE to be used for smeared electron collection -> See e/gamma POG

MuonEnergyScaleUnc = uncertainty on the muon energy scale to be used for shifted muon collection -> See muon POG
MuonEnergyRes = resolution on the muon energy to be used for smeared muon collection -> See muon POG
MuonEnergyResUnc = resolution uncertainty on the muon energy to be used for smeared muon collection -> See muon POG

TauEnergyScaleUnc = uncertainty on the tau energy scale to be used for shifted tau collection -> See tau POG
TauEnergyRes = resolution on the tau energy to be used for smeared tau collection -> See tau POG (TO BE FIXED)
TauEnergyResUnc = resolution uncertainty on the tau energy to be used for smeared tau collection -> See tau POG (TO BE FIXED)

PhotonEnergyScaleUncEB = uncertainty on the photon energy scale in EB to be used for shifted photon collection -> See e/gamma POG
PhotonEnergyScaleUncEE = uncertainty on the photon energy scale in EE to be used for shifted photon collection -> See e/gamma POG
PhotonEnergyResEB = resolution on the photon energy in EB to be used for smeared photon collection -> See e/gamma POG
PhotonEnergyResEE = resolution on the photon energy in EE to be used for smeared photon collection -> See e/gamma POG
PhotonEnergyResUncEB = resolution uncertainty on the photon energy in EB to be used for smeared photon collection -> See e/gamma POG
PhotonEnergyResUncEE = resolution uncertainty on the photon energy in EE to be used for smeared photon collection -> See e/gamma POG

UnclusteredEnergyUnc = uncertainty on the energy scale of unclustered component and soft jets (pt < 10 GeV)

Skipping the code technicalities, these are the output collections looking at shifted and smeared particles (keep in mind that this tool is run only for MC events, not for real data). They are store only if the storeSmearandShiftCollections is set to true.

Shifted Collections (this shifted jets are produce just if doJetSmearing flag is set to false):

    vector<pat::Electron>                "shiftedPatElectronsPFlowEnDown"   "PAT"     
    vector<pat::Electron>                "shiftedPatElectronsPFlowEnUp"        "PAT"     
    vector<pat::Jet>                          "shiftedPatJetsPFlowEnDown"            "PAT"     
    vector<pat::Jet>                          "shiftedPatJetsPFlowEnUp"                  "PAT"      
    vector<pat::Muon>                     "shiftedPatMuonsPFlowEnDown"        "PAT"     
    vector<pat::Muon>                     "shiftedPatMuonsPFlowEnUp"             "PAT"     
    vector<pat::Photon>                  "shiftedPatPhotonPFlowEnDown"       "PAT"     
    vector<pat::Photon>                  "shiftedPatPhotonPFlowEnUp"            "PAT"     
    vector<pat::Tau>                        "shiftedPatTausPFlowEnDown"           "PAT"     
    vector<pat::Tau>                        "shiftedPatTausPFlowEnUp"                "PAT"
    

Smeared Collections( this smeared jets are produced only when doJetSmearing is set to true) :

     vector<pat::Electron>                 "smearedPatElectronsPFlow"           "PAT"      
     vector<pat::Electron>                 "smearedPatElectronsPFlowResDown"           "PAT"     
     vector<pat::Electron>                 "smearedPatElectronsPFlowResUp"                "PAT"     
     vector<pat::Jet>                          "smearedPatJetsPFlow"                   "PAT"     
     vector<pat::Jet>                          "shiftedsmearedPatJetsPFlowEnUp"                   "PAT"     
     vector<pat::Jet>                          "shiftedsmearedPatJetsPFlowEnDown"                   "PAT"     
     vector<pat::Jet>                          "smearedPatJetsPFlowResDown"                "PAT"     
     vector<pat::Jet>                          "smearedPatJetsPFlowResUp"              "PAT"     
     vector<pat::Muon>                     "smearedPatMuonsPFlow"                "PAT"     
     vector<pat::Muon>                     "smearedPatMuonsPFlowResDown"               "PAT"     
     vector<pat::Muon>                     "smearedPatMuonsPFlowResUp"               "PAT"     
     vector<pat::Photon>                   "smearedPatPhotonPFlow"                 "PAT"     
     vector<pat::Photon>                   "smearedPatPhotonPFlowResDown"               "PAT"     
     vector<pat::Photon>                   "smearedPatPhotonPFlowResUp"                "PAT"     
     vector<pat::Tau>                         "smearedPatTausPFlow"               "PAT"     
     vector<pat::Tau>                         "smearedPatTausPFlowResDown"               "PAT"     
     vector<pat::Tau>                         "smearedPatTausPFlowResUp"             "PAT" 
 

These are the related typeI corrected met after the propagation of shifted and smeared quantities, when you set doJetSmearing to false:

 
   vector<pat::MET>                      "patType1CorrectedPFMetElectronEnDown"             "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFMetElectronEnUp"                  "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFMetElectronRes"                     "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFMetElectronResDown"           "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFMetElectronResUp"                  "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFMetJetEnDown"                  "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFMetJetEnUp"                "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFMetMuonEnDown"                   "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFMetMuonEnUp"                  "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFMetMuonRes"                   "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFMetMuonResDown"                   "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFMetMuonResUp"                   "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFMetPhotonEnDown"                  "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFMetPhotonEnUp"                  "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFMetPhotonRes"                   "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFMetPhotonResDown"                  "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFMetPhotonResUp"                 "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFMetTauRes"                   "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFMetTauResDown"                   "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFMetTauResUp"                  "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFMetTausEnDown"                  "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFMetTausEnUp"                   "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFMetUnclusteredEnDown"                  "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFMetUnclusteredEnUp"                   "PAT"     
  

These are the related typeI corrected met after the propagation of shifted and smeared quantities, obtained when doJetSmearing is set to true :

 
   vector<pat::MET>                      "patType1CorrectedPFSmearedMet"             "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetElectronEnDown"                   "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetElectronEnUp"                  "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetElectronRes"                   "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetElectronResDown"                   "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetElectronResUp"                  "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetJetEnDown"                  "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetJetEnUp"                   "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetJetResDown"                  "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetJetResUp"                  "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetMuonEnDown"                  "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetMuonEnUp"                   "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetMuonRes"                   "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetMuonResDown"                   "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetMuonResUp"                  "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetPhotonEnDown"                   "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetPhotonEnUp"                  "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetPhotonRes"                  "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetPhotonResDown"                  "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetPhotonResUp"                   "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetTauRes"                   "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetTauResDown"                   "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetTauResUp"                   "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetTausEnDown"                  "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetTausEnUp"                   "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetUnclusteredEnDown"                  "PAT"     
   vector<pat::MET>                      "patType1CorrectedPFSmearedMetUnclusteredEnUp"                   "PAT"     
 

Suggested way to run it:

 DATA:   cmsRun ttbsm_cfg.py useData=0 writePFCands=1 writeGenParticles=1 useExtraJetColls=0 doMetUncertainty=0 doPatJetSmearing=0 

 MC if you want to smear jet to reproduce resolution in data:   cmsRun ttbsm_cfg.py useData=0 writePFCands=1 writeGenParticles=1 useExtraJetColls=0 doMetUncertainty=1 doPatJetSmearing=1 

 MC if you not to smear jet to reproduce resolution in data:   cmsRun ttbsm_cfg.py useData=0 writePFCands=1 writeGenParticles=1 useExtraJetColls=0 doMetUncertainty=1 doPatJetSmearing=0 

Here we can find a common point, for me is better to apply jet smearing in order to have something closer to data and have a coherent met with resolution effect inside. Of course this trick is applied only on ak5 PF jets, for other jet collections it should be do offiline and no effect has to be propagated on the met.

W+Jets Analyzer on B2GPAT

Using CMSSW_5_3_8_patch1 this is the last recipe :

  source /uscmst1/prod/sw/cms/setup/cshrc prod (at Fermilab LPC only)
  kserver_init (at Fermilab LPC only)
  cmsrel CMSSW_5_3_8_patch1
  cd CMSSW_5_3_8_patch1/src/
  cmsenv
  addpkg CommonTools/RecoUtils V00-01-04
  addpkg CondFormats/JetMETObjects V03-03-00
  addpkg DataFormats/METReco V03-03-11-01
  addpkg DataFormats/PatCandidates V06-05-06-07
  addpkg JetMETCorrections/Type1MET V04-06-09-02
  addpkg PhysicsTools/PatAlgos V08-09-52
  addpkg PhysicsTools/PatUtils V03-09-28
  addpkg RecoMET/METAnalyzers V00-00-08
  addpkg RecoMET/METFilters V00-00-13-01
  addpkg RecoMET/METProducers V03-03-12-02

  cvs co -r HEAD PhysicsTools/KinFitter
  cvs co -r HEAD EgammaAnalysis/ElectronTools/interface/ElectronEffectiveArea.h
  cvs co -d EGamma/EGammaAnalysisTools -r V00-00-31 UserCode/EGamma/EGammaAnalysisTools
  cd EGamma/EGammaAnalysisTools/data
  cat download.url | xargs wget ; cd -
  cvs up -r 1.13 EGamma/EGammaAnalysisTools/interface/PFIsolationEstimator.h
  cvs up -r 1.20 EGamma/EGammaAnalysisTools/src/PFIsolationEstimator.cc
  cvs co -r V00-03-05 -d CMGTools/External UserCode/CMG/CMGTools/External
  cvs co -d MMozer/powhegweight UserCode/MMozer/powhegweight
  cvs co -d KStenson/TrackingFilters UserCode/KStenson/TrackingFilters
  cp KStenson/TrackingFilters/plugins/TobTecFakesFilter.cc RecoMET/METFilters/plugins/
  cp KStenson/TrackingFilters/python/tobtecfakesfilter_cfi.py RecoMET/METFilters/python
  rm -r KStenson/TrackingFilters
  cvs co -d SHarper/HEEPAnalyzer UserCode/SHarper/HEEPAnalyzer

  git clone https://github.com/nhanvtran/JetSubstructure
  git clone https://github.com/rgerosa/ElectroWeakAnalysis
  scramv1 b -j 4

WJetsAnalyzer for Muon Channel: test/patuple_2_ntuple/WmunuJetsAnalysisPAT_cfg.py

A set of input options can be specified by command line :

  isMC = when is set to 1 it means that the analysis is run on simulated events, default value = True
  isQCD = when is set to 1 it means that in the analysis isolation cut on tight muons are inverted default value = False
  isTransverseMassCut = when is set to 1 it means that in the analysis a cut on Wleptonic mT is applied, default value = False
  isHEEPID = when is set to 1 it means that in the analysis high pT muon ID and heep electron ID are considered, default value = True
  globalTag = string value if you want to specify the GT by command line, default value = ''
  numEventsToRun = in order to specify how many events you want to process, default value =-1 ''
  outputFileName = in order to specify the name of the output root file, default value = "WmunuJetAnalysisntuple.root"
  reportEvery = choose the number of events after which have the summary , default value = 500
  runMetFilters = when is set to 1, it means run the metFilter before the other steps (by default already run in the B2G pat) default value = False
  useSmearedCollection = when is set to 1, specify that you have smeared jets and met in the input and use them in the analysis default value = True
  hltPath = string name of the path you want to ask (or logic if more than one are selected) default value = 'HLT_IsoMu24_*, HLT_Mu40_eta2p1*'
  didPhotonSmearing = when is set to 1, consider also smeared photon met typeI collection default value = True
  didTauSmearing = when is set to 1, consider also smeared taus met typeI collection default value = True
  isPileUpJetID = when is set to 1, run the pileUp jet ID skim using looseID by default, + storing info of stronger wp default value = True
  isRequireTwoJets = when is set to 1, do "unboosted analysis" (2 jets over pt >30) default value = False
  storeSmearandShiftCollections = when set to 1, you store and skim also all the shifted and smeared jet collection default value = False
  skipAnalyzerAndDumpOutput = when is set to 1, all the modules are run unless the analyzer and a edm root output is created with only the PAT and demo collections. default value = False

Default GT if not specified in the options stage: for data is GR_P_V39_AN3::All ; for MC is START53_V7E::All

Looking at the cms.Path of this analyzer :

process.TrackVtxPath

This is the METFilter sequence, exactly the same as the one defined in the B2G pattuplizer, called if you set options.runMetFilters = 1. It is directly loaded in the process by means of:

       process.load("ElectroWeakAnalysis.VPlusJets.TrackCollections_cfi")
       

process.HLTMu

Run only on real data, it filters the event according to the HLT path define in the options.hltPath, making the logic or by default

process.metShiftSystematicCorrectionSequence

Sequence to apply the phi-shift correction on top of typeI corrected PFPAT Met. It uses a python function, called metShiftSystematicCorrection, defined in the :

      from ElectroWeakAnalysis.VPlusJets.patMETSysShiftCorrection_cfi import *
      
it takes some input parameters:

  options.isMC
  options.useSmearedCollection = if this is set to true, it runs the correction also of all the met smeared collections
  runCorrection = string use to specify which period to take into account for shift correction value, default : Run2012ABCD
  vertexCollection = vertex collection to be considered, default : goodOfflinePrimaryVertices
  options.didPhotonSystematic = if you want to consider also photon shifted/smeared met collections
  options.didTauSystematic = if you want to consider also tau smeared/shifted met collections
  patTypeIMetCorrected = default unsmeared type I corrected met, default : patMETsPFlow
  patTypeIMetCorrectedForMetUncertainty = vector defined in the patMETSysShiftCorrection_cfi with all the typeI met for shift and smeared particles to be considered

It produces in the output a lot of met collections, which are the ones to be taken into account for the VplusJets analyzer in the last stage

process.WPath

Sequence to require exactly one tight muon + no loose electrons + no more loose muons in the event topology. It is imported in the main code via WmunuCollectionsPAT python function:

       from ElectroWeakAnalysis.VPlusJets.WmunuCollectionsPAT_cfi import*
      
Input parameters :

  patMuonCollection = input collection for muons, default : selectedPatMuonsPFlow
  patElectronCollection = input collection for electrons default : selectedPatElectronsPFlow
  vertexCollection = vertex collection to be considered, default : goodOfflinePrimaryVertices
  options.isQCD = if you want to invert iso cut for muons
  pTCutValue = Cut on the pT of the tight muon, font color="blue"> set at 50 GeV for HEEPid and 20 GeV for Higgs
  pTCutLooseMuonVeto = pT cut for loose muon definition, default : 20 GeV
  pTCutLooseElectronVeto = pT cut for loose electron definition, default : 20 GeV
  options.isTransverseMassCut = in order to apply transverse mass cut
  TransverseMassCutValue = value for mT cut, default : 30 GeV
  patTypeICorrectedMetSysShifted = default typeI met corrected + phi shift default : patMETsPFlowSysShifted

process.GenJetPath, process.genTagJetPath, process.ak5PFJetPath

These sequences are defined by means of AK5JetCollectionsPATSelection python function, imported via:

          from ElectroWeakAnalysis.VPlusJets.AK5JetCollectionsPATSelection_cfi import *
       
Input parameters :

  patJetCollection = input jet collections, in the most general case: default : selectedPatJetsPFlow, shiftedPatJetsPFlowEnUp, shiftedPatJetsPFlowEnDown
  patSmearedJetCollection = input smeared jet collection, in general case: default : smearedPatJetsPFlow, shiftedSmearedPatJetsPFlowEnUp,
  shiftedSmearedPatJetsPFlowEnDown, smearedPatJetsPFlowResDown, smearedPatJetsPFlowResUp
  options.isPileUpJetID = in order to apply loose pile Up jet ID and store flag info for harder wp
  useMVAPileUpJetID = if set to True, mva pile up discriminator used instead of cut based one default : True
  options.useSmearedCollection =apply the sequence also on smearedPatJetsPFlow
  options.useSmearedCollection =apply the sequence also on smearedPatJetsPFlow
  options.storeSmearandShiftCollections, = to run jet id, pileup id, cleaning and pT skim also on all the other jet collection (shifted+smeared) default : 30 GeV
  options.isRequireTwoJets = if set to True, require at least two jets with pT > threshold. Useful for resolved analysis
  options.isMC = this option is useful to run the genTagJetPath and the GenJetPath.

process.RequireTwoJetsORboostedV

Filter used to select events with at least two jets over threshold or a leptonic W with high pT, obtained by tight muon pT and standard pat typeI met.

The Producer is defined in the plugins directory with the name JetsORboostedV.cc

Important input parameters:

  srcJets =input ak5 jet collection, default : ak5PFJetsPtSkimmed
  srcVectorBoson = input leptonic W, default : bestWmunu
  srcPhotons = input pat photon collection, default : selectedPatPhotons
  minVpt = vector boson pT threshold, default : 100 GeV
  minNumber = min number of jets to be required, default : 2

process.VplusJets

Input Collection to be considered in the analyzer are the following (these are the collection to be considered when you run with the suggested set of options) :

          JetCollection = ak5PFJetsPtSkimmed , ak5PFJetsPtSkimmedCentral,  ak5PFJetsPtSkimmedForward </br>
                         ak5PFSmearedJetsPtSkimmed , ak5PFSmearedJetsPtSkimmedCentral,  ak5PFSmearedJetsPtSkimmedForward (only onMC)
                 
          srcPhoton = cleanPatPhotons
          IsoValPhoton = cms.VInputTag(cms.InputTag('phoPFIso:chIsoForGsfEle'),  cms.InputTag('phoPFIso:phIsoForGsfEle'), cms.InputTag('phoPFIso:nhIsoForGsfEle')
          srcVectorBoson = bestWmunu or bestWToEnu 
          srcPrimaryVertex = goodOfflinePrimaryVertices
          srcMet = here all the shifted met collection should be stored in principle 
                          you can find the list here (patTypeIMetCorrected,  patTypeIMetCorrectedForMetUncertainty --> only when you run on MC): 
                            https://github.com/rgerosa/ElectroWeakAnalysis/blob/master/VPlusJets/python/patMETSysShiftCorrection_cfi.py </br>
                          you have just to add "SysShifted" for having the met after the shift 
         srcMetMVA = we don't have mva met now, so drop this
         srcGen  =  ak5GenJets
         srcMuons =  patTunePMuonPFlow are new tune p muon collection, tightMuons is the pat muon collection after the id
         srcBeamSpot = offlineBeamSpot
         srcCaloMet = drop this part
         srcgenMet = genMetTrue
         srcGenParticles = genParticles
         srcJetsforRho = kt6PFJetsPFlow
         srcJetsforRho_lepIso = kt6PFJetsForIsolation
         srcJetsforRhoCHS = probably not inside the pat but i have to cross check with the previous collections
         srcJetsforRho_lepIsoCHS = probably not inside the pat but i have to cross check with the previous collections
         srcFlavorByValue = ak5tagJet
        all the other option are ok till now
       

Suggested way to run it:

For Data: cmsRun WmunuJetsAnalysisPAT_cfg.py isMC=0 isPileUpJetID=1 isRequireTwoJets=0 isHEEPID=1 useSmearedCollection=0 storeSmearandShiftCollections=0  (Mu Channel)
          cmsRun WenuJetsAnalysisPAT_cfg.py isMC=0 isPileUpJetID=1 isRequireTwoJets=0 isHEEPID=1 useSmearedCollection=0 storeSmearandShiftCollections=0  (Ele Channel) 

For MC  : cmsRun WmunuJetsAnalysisPAT_cfg.py isMC=1 isPileUpJetID=1 isRequireTwoJets=0 isHEEPID=1 useSmearedCollection=1 storeSmearandShiftCollections=0  (Mu Channel)
          cmsRun WenuJetsAnalysisPAT_cfg.py isMC=1 isPileUpJetID=1 isRequireTwoJets=0 isHEEPID=1 useSmearedCollection=1 storeSmearandShiftCollections=0  (Ele Channel)

Edit | Attach | Watch | Print version | History: r15 < r14 < r13 < r12 < r11 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r15 - 2013-10-31 - RaffaeleAngeloGerosa
 
    • 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-2023 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