Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-26 03:37:04

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 from RecoMET.METPUSubtraction.objectSelection_cff import *
0004 
0005 
0006 ##================================================
0007 ## MVA MET sequence
0008 ##================================================
0009 from JetMETCorrections.Configuration.JetCorrectionServicesAllAlgos_cff import *
0010 from JetMETCorrections.Configuration.DefaultJEC_cff import *
0011 from RecoJets.JetProducers.PileupJetIDParams_cfi import JetIdParams
0012 
0013 from RecoJets.JetProducers.kt4PFJets_cfi import kt4PFJets
0014 kt6PFJets = kt4PFJets.clone(rParam = 0.6, doRhoFastjet = True )
0015 
0016 calibratedAK4PFJetsForPFMVAMEt = cms.EDProducer('PFJetCorrectionProducer',
0017     src = cms.InputTag('ak4PFJets'),
0018     correctors = cms.vstring("ak4PFL1FastL2L3") # NOTE: use "ak5PFL1FastL2L3" for MC / "ak5PFL1FastL2L3Residual" for Data
0019 )
0020 
0021 pfMVAMEt = cms.EDProducer("PFMETProducerMVA",
0022     srcCorrJets = cms.InputTag('calibratedAK4PFJetsForPFMVAMEt'),
0023     srcUncorrJets = cms.InputTag('ak4PFJets'),
0024     srcPFCandidates = cms.InputTag('particleFlow'),
0025     srcVertices = cms.InputTag('offlinePrimaryVertices'),
0026     srcLeptons = cms.VInputTag('selectedElectrons',
0027                                'selectedMuons',
0028                                'selectedTaus',
0029                                'selectedPhotons',
0030                                'selectedJets'),
0031     minNumLeptons = cms.int32(0),                     
0032     srcRho = cms.InputTag('fixedGridRhoFastjetAll'),
0033     globalThreshold = cms.double(-1.),
0034     minCorrJetPt = cms.double(-1.),
0035     inputFileNames = cms.PSet(
0036        U     = cms.FileInPath('RecoMET/METPUSubtraction/data/gbrmet_53_June2013_type1.root'),
0037        DPhi  = cms.FileInPath('RecoMET/METPUSubtraction/data/gbrmetphi_53_June2013_type1.root'),
0038        CovU1 = cms.FileInPath('RecoMET/METPUSubtraction/data/gbru1cov_53_Dec2012.root'),
0039        CovU2 = cms.FileInPath('RecoMET/METPUSubtraction/data/gbru2cov_53_Dec2012.root')
0040     ),
0041     loadMVAfromDB = cms.bool(False),                             
0042     is42 = cms.bool(False), # CV: set this flag to true if you are running mvaPFMET in CMSSW_4_2_x
0043     corrector = cms.string("ak4PFL1Fastjet"),
0044     useType1  = cms.bool(True), 
0045     useOld42  = cms.bool(False),
0046     dZcut     = cms.double(0.1),
0047     impactParTkThreshold = cms.double(0.),
0048     tmvaWeights = cms.string("RecoJets/JetProducers/data/TMVAClassificationCategory_JetID_MET_53X_Dec2012.weights.xml.gz"),
0049     tmvaMethod = cms.string("JetID"),
0050     version = cms.int32(-1),
0051     cutBased = cms.bool(False),                      
0052     tmvaVariables = cms.vstring(
0053         "nvtx",
0054         "jetPt",
0055         "jetEta",
0056         "jetPhi",
0057         "dZ",
0058         "beta",
0059         "betaStar",
0060         "nCharged",
0061         "nNeutrals",
0062         "dR2Mean",
0063         "ptD",
0064         "frac01",
0065         "frac02",
0066         "frac03",
0067         "frac04",
0068         "frac05"
0069     ),
0070     tmvaSpectators = cms.vstring(),
0071     JetIdParams = JetIdParams,                      
0072     verbosity = cms.int32(0)
0073 )
0074 
0075 pfMVAMEtTask  = cms.Task(
0076     kt6PFJets,
0077     calibratedAK4PFJetsForPFMVAMEt,
0078     pfMVAMEt
0079 )
0080 pfMVAMEtSequence  = cms.Sequence(pfMVAMEtTask)
0081 
0082 ##================================================
0083 ## Pf No Pileup MET sequence
0084 ##================================================
0085 pfNoPUMEtTask = cms.Task()
0086 
0087 from JetMETCorrections.Configuration.JetCorrectionServices_cff import *
0088 calibratedAK4PFJetsForPFNoPUMEt = cms.EDProducer('PFJetCorrectionProducer',
0089     src = cms.InputTag('ak4PFJets'),
0090     correctors = cms.vstring('ak4PFL1FastL2L3Residual') # NOTE: use "ak4PFL1FastL2L3" for MC / "ak4PFL1FastL2L3Residual" for Data
0091 )
0092 ak4PFJetTaskForPFNoPUMEt = cms.Task(calibratedAK4PFJetsForPFNoPUMEt)
0093 pfNoPUMEtTask.add(ak4PFJetTaskForPFNoPUMEt)
0094 
0095 from RecoJets.JetProducers.PileupJetID_cfi import *
0096 puJetIdForPFNoPUMEt = pileupJetId.clone(
0097     algos = cms.VPSet(
0098         full_53x,
0099         cutbased,
0100         PhilV1
0101         ),
0102 #    label = "fullId", #MM does not work for weird reasons, cannot be cloned properly
0103     produceJetIds    = True,
0104     runMvas          = True,
0105     jets             = "calibratedAK4PFJetsForPFNoPUMEt",
0106     applyJec         = False,
0107     inputIsCorrected = True,
0108     )
0109 pfNoPUMEtTask.add(puJetIdForPFNoPUMEt)
0110 
0111 from JetMETCorrections.Type1MET.pfMETCorrectionType0_cfi import *
0112 pfNoPUMEtTask.add(type0PFMEtCorrection)
0113 pfCandidateToVertexAssociationForPFNoPUMEt = pfCandidateToVertexAssociation.clone(
0114     MaxNumberOfAssociations = 1,    
0115     doReassociation         = False,
0116     FinalAssociation        = 1,                
0117     nTrackWeight            = 0.
0118 )
0119 pfNoPUMEtTask.add(pfCandidateToVertexAssociationForPFNoPUMEt)
0120 pfMETcorrType0ForPFNoPUMEt = pfMETcorrType0.clone(
0121     srcPFCandidateToVertexAssociations = 'pfCandidateToVertexAssociationForPFNoPUMEt'
0122 )
0123 pfNoPUMEtTask.add(pfMETcorrType0ForPFNoPUMEt)
0124 
0125 jvfJetIdForPFNoPUMEt = cms.EDProducer("JVFJetIdProducer",
0126     srcJets = cms.InputTag('calibratedAK4PFJetsForPFNoPUMEt'),
0127     srcPFCandidates = cms.InputTag('particleFlow'),
0128     srcPFCandToVertexAssociations = cms.InputTag('pfCandidateToVertexAssociationForPFNoPUMEt'),
0129     srcHardScatterVertex = cms.InputTag('selectedPrimaryVertexHighestPtTrackSumForPFMEtCorrType0'),
0130     minTrackPt = cms.double(1.),                                    
0131     dZcut = cms.double(0.2), # cm
0132     JVFcut = cms.double(0.75),
0133     neutralJetOption = cms.string("noPU")
0134 )
0135 pfNoPUMEtTask.add(jvfJetIdForPFNoPUMEt)
0136 
0137 import RecoMET.METProducers.METSigParams_cfi as met_config
0138 pfNoPUMEtData = cms.EDProducer("NoPileUpPFMEtDataProducer",
0139     srcJets = cms.InputTag('calibratedAK4PFJetsForPFNoPUMEt'),
0140     srcJetIds = cms.InputTag('puJetIdForPFNoPUMEt', 'full53xId'),
0141  
0142     minJetPt = cms.double(30.0),
0143     jetIdSelection = cms.string('loose'),
0144     jetEnOffsetCorrLabel = cms.string("ak4PFL1Fastjet"),
0145     srcPFCandidates = cms.InputTag('particleFlow'),
0146     srcPFCandToVertexAssociations = cms.InputTag('pfCandidateToVertexAssociationForPFNoPUMEt'),
0147     srcJetsForMEtCov = cms.InputTag('ak4PFJets'),
0148     minJetPtForMEtCov = cms.double(10.),
0149     srcHardScatterVertex = cms.InputTag('selectedPrimaryVertexHighestPtTrackSumForPFMEtCorrType0'),
0150     dZcut = cms.double(0.2), # cm
0151     resolution = met_config.METSignificance_params,
0152     verbosity = cms.int32(0)     
0153 )
0154 pfNoPUMEtTask.add(pfNoPUMEtData)
0155 
0156 pfNoPUMEt = cms.EDProducer("NoPileUpPFMEtProducer",
0157     srcMEt = cms.InputTag('pfMet'),
0158     srcMEtCov = cms.InputTag(''), # NOTE: leave empty to take MET covariance matrix from reco::PFMET object //MM 08/29/14, bypass hardcoded as this variable has never been used so far
0159     srcMVAMEtData = cms.InputTag('pfNoPUMEtData'),                               
0160     srcLeptons = cms.VInputTag( 'selectedElectrons',
0161                                 'selectedMuons',
0162                                 'selectedTaus',
0163                                 'selectedPhotons',
0164                                 'selectedJets'),
0165 # NOTE: you need to set this to collections of electrons, muons and tau-jets
0166 #passing the lepton reconstruction & identification criteria applied in your analysis                               
0167     srcMVAMEtDataLeptonMatch = cms.InputTag('pfNoPUMEtData'),                       
0168     srcType0Correction = cms.InputTag('pfMETcorrType0ForPFNoPUMEt'),                    
0169     sfNoPUjets = cms.double(1.0),
0170     sfNoPUjetOffsetEnCorr = cms.double(0.0),                    
0171     sfPUjets = cms.double(1.0),
0172     sfNoPUunclChargedCands = cms.double(1.0),
0173     sfPUunclChargedCands = cms.double(1.0),
0174     sfUnclNeutralCands = cms.double(0.6),
0175     sfType0Correction = cms.double(1.0),
0176     sfLeptonIsoCones = cms.double(0.6),       
0177     resolution = met_config.METSignificance_params,
0178     sfMEtCovMin = cms.double(0.6),
0179     sfMEtCovMax = cms.double(1.0),                           
0180     saveInputs = cms.bool(True),
0181     verbosity = cms.int32(0)                               
0182 )
0183 pfNoPUMEtTask.add(pfNoPUMEt)
0184 pfNoPUMEtSequence = cms.Sequence(pfNoPUMEtTask)
0185 
0186 mitigatedMETTask = cms.Task(
0187 selectionSequenceForMVANoPUMETTask,
0188 pfMVAMEtTask,
0189 pfNoPUMEtTask
0190 )
0191 mitigatedMETSequence = cms.Sequence(mitigatedMETTask)