[ cfgTauMuonVetoBgEstWplusJetsEnriched, cfgTauMuonVetoBgEstWplusJetsEnrichedFRweighted],
    [ cfgMuTauPairBgEstWplusJetsEnriched, cfgMuTauPairBgEstWplusJetsEnrichedFRweighted],
    [ cfgMuTauPairMt1MEtBgEstWplusJetsEnriched, cfgMuTauPairMt1MEtBgEstWplusJetsEnrichedFRweighted],
    [ cfgCentralJetVetoBgEstWplusJetsEnriched, cfgCentralJetVetoBgEstWplusJetsEnrichedFRweighted]
]

analyzerModuleReplacementsWplusJetsEnrichedFRweighted = [
    [ caloMEtHistManagerBgEstWplusJetsEnriched, caloMEtHistManagerBgEstWplusJetsEnrichedFRweighted ],
    [ pfMEtHistManagerBgEstWplusJetsEnriched, pfMEtHistManagerBgEstWplusJetsEnrichedFRweighted ],
    [ jetHistManagerBgEstWplusJetsEnriched, jetHistManagerBgEstWplusJetsEnrichedFRweighted ]
]

analyzeEventsBgEstWplusJetsEnrichedFRmcWeighted = analyzeEventsBgEstWplusJetsEnriched.clone(
  name = cms.string('BgEstTemplateAnalyzer_WplusJetsEnrichedFRmcWeighted')
)
replaceEventSelections(analyzeEventsBgEstWplusJetsEnrichedFRmcWeighted, eventSelectionReplacementsWplusJetsEnrichedFRweighted)
analyzerModuleReplacementsWplusJetsEnrichedFRmcWeighted = copy.deepcopy(analyzerModuleReplacementsWplusJetsEnrichedFRweighted)
analyzerModuleReplacementsWplusJetsEnrichedFRmcWeighted.extend([
    [ tauHistManagerBgEstWplusJetsEnriched, tauHistManagerBgEstWplusJetsEnrichedFRmcWeighted ],
    [ diTauCandidateHistManagerBgEstWplusJetsEnriched, diTauCandidateHistManagerBgEstWplusJetsEnrichedFRmcWeighted ],    
    #[ diTauCandidateNSVfitHistManagerBgEstWplusJetsEnriched, diTauCandidateNSVfitHistManagerBgEstWplusJetsEnrichedFRmcWeighted ]
])
replaceAnalyzerModules(analyzeEventsBgEstWplusJetsEnrichedFRmcWeighted, analyzerModuleReplacementsWplusJetsEnrichedFRmcWeighted)
psetFRmcEventWeightWplusJetsEnriched = cms.PSet(
    src = cms.InputTag('bgEstFakeRateEventWeights', 'WplusJetsSim'),
    applyAfterFilter = cms.string("tauTaNCdiscrCutNotAppliedBgEstWplusJetsEnrichedFRweighted")
)
if hasattr(analyzeEventsBgEstWplusJetsEnrichedFRmcWeighted, "eventWeights"):
    getattr(analyzeEventsBgEstWplusJetsEnrichedFRmcWeighted, "eventWeights").append(psetFRmcEventWeightWplusJetsEnriched)
else:
    setattr(analyzeEventsBgEstWplusJetsEnrichedFRmcWeighted, "eventWeights", cms.VPSet(psetFRmcEventWeightWplusJetsEnriched))
Exemple #2
0
#
#      --> analyzeWtoTauNuEventsBoosted_factorizedWithTauIsolation needs to be defined
#          before analyzeWtoTauNuEventsBoosted_factorizedWithoutTauIsolation !!
#--------------------------------------------------------------------------------

analyzeWtoTauNuEventsBoosted_factorizedWithoutTauIsolation = copy.copy(
    analyzeWtoTauNuEventsBoosted)
analyzeWtoTauNuEventsBoosted_factorizedWithoutTauIsolation.name = cms.string(
    'wTauNuBoostedAnalyzer_factorizedWithoutTauIsolation')
replaceEventSelections(
    analyzeWtoTauNuEventsBoosted_factorizedWithoutTauIsolation,
    [[evtSelTauLeadTrkPtBoosted, evtSelTauLeadTrkPtBoostedLooseIsolation],
     [evtSelTauIsoBoosted, evtSelTauEcalIsoBoostedLooseIsolation],
     [evtSelTauTaNCBoosted, evtSelTauTrkIsoBoostedLooseIsolation],
     [evtSelTauProngBoosted, evtSelTauProngBoostedLooseIsolation],
     [evtSelTauChargeBoosted, evtSelTauChargeBoostedLooseIsolation],
     [evtSelTauMuonVetoBoosted, evtSelTauMuonVetoBoostedLooseIsolation],
     [
         evtSelTauElectronVetoBoosted,
         evtSelTauElectronVetoBoostedLooseIsolation
     ],
     [
         evtSelTauEcalCrackVetoBoosted,
         evtSelTauEcalCrackVetoBoostedLooseIsolation
     ], [evtSelRecoilJetBoosted, evtSelRecoilJetBoostedLooseIsolation],
     [evtSelCentralJetVetoBoosted, evtSelCentralJetVetoBoostedLooseIsolation],
     [evtSelPhiMetTauBoosted, evtSelPhiMetTauBoostedLooseIsolation]])
analyzeWtoTauNuEventsBoosted_factorizedWithoutTauIsolation.eventDumps[
    0] = wTauNuBoostedEventDump_factorizedWithoutTauIsolation
analyzeWtoTauNuEventsBoosted_factorizedWithoutTauIsolation.analysisSequence = wTauNuBoostedAnalysisSequence_factorizedWithoutTauIsolation
#--------------------------------------------------------------------------------
# define W --> tau-jet + nu analysis module for the path with "loose" tau isolation criteria applied
#
# NOTE: modifications to analyzeWtoTauNuEventsBoosted_factorizedWithoutTauIsolation
#       modify the original analyzeWtoTauNuEventsBoosted sequence
#
#      --> analyzeWtoTauNuEventsBoosted_factorizedWithTauIsolation needs to be defined
#          before analyzeWtoTauNuEventsBoosted_factorizedWithoutTauIsolation !!
#--------------------------------------------------------------------------------

analyzeWtoTauNuEventsBoosted_factorizedWithoutTauIsolation = copy.copy(analyzeWtoTauNuEventsBoosted)
analyzeWtoTauNuEventsBoosted_factorizedWithoutTauIsolation.name = cms.string('wTauNuBoostedAnalyzer_factorizedWithoutTauIsolation')
replaceEventSelections(analyzeWtoTauNuEventsBoosted_factorizedWithoutTauIsolation, 
                       [ 
        [ evtSelTauLeadTrkPtBoosted, evtSelTauLeadTrkPtBoostedLooseIsolation],
        [ evtSelTauIsoBoosted, evtSelTauEcalIsoBoostedLooseIsolation],
        [ evtSelTauTaNCBoosted, evtSelTauTrkIsoBoostedLooseIsolation ],
        [ evtSelTauProngBoosted, evtSelTauProngBoostedLooseIsolation ],
        [ evtSelTauChargeBoosted, evtSelTauChargeBoostedLooseIsolation ],
        [ evtSelTauMuonVetoBoosted, evtSelTauMuonVetoBoostedLooseIsolation ],
        [ evtSelTauElectronVetoBoosted, evtSelTauElectronVetoBoostedLooseIsolation ],
        [ evtSelTauEcalCrackVetoBoosted, evtSelTauEcalCrackVetoBoostedLooseIsolation ],
        [ evtSelRecoilJetBoosted, evtSelRecoilJetBoostedLooseIsolation ],
        [ evtSelCentralJetVetoBoosted, evtSelCentralJetVetoBoostedLooseIsolation],
        [ evtSelPhiMetTauBoosted, evtSelPhiMetTauBoostedLooseIsolation]
        ]
                       )                       
analyzeWtoTauNuEventsBoosted_factorizedWithoutTauIsolation.eventDumps[0] = wTauNuBoostedEventDump_factorizedWithoutTauIsolation
analyzeWtoTauNuEventsBoosted_factorizedWithoutTauIsolation.analysisSequence = wTauNuBoostedAnalysisSequence_factorizedWithoutTauIsolation
        psKine_MEt_logM_int = cms.string('psKine_MEt_logM_int')
    )
)    

analyzeZtoDiTauEvents_factorizedLoose2ndTau = analyzeZtoDiTauEvents.clone(
    name = cms.string('zDiTauAnalyzer_factorizedLoose2ndTau')
)
if len(analyzeZtoDiTauEvents_factorizedLoose2ndTau.eventDumps) > 0:
    analyzeZtoDiTauEvents_factorizedLoose2ndTau.eventDumps[0] = diTauEventDump_factorizedLoose2ndTau
replaceEventSelections(analyzeZtoDiTauEvents_factorizedLoose2ndTau, 
    [ [ evtSelSecondTauLeadTrkPt, evtSelSecondTauLeadTrkPtLoose ],
      [ evtSelSecondTauTaNCdiscr, evtSelSecondTauTaNCdiscrLoose ],
      [ evtSelSecondTauTrkIso, evtSelSecondTauTrkIsoLoose ],
      [ evtSelSecondTauEcalIso, evtSelSecondTauEcalIsoLoose ],
      [ evtSelSecondTauProng, evtSelSecondTauProngLoose ],
      [ evtSelSecondTauCharge, evtSelSecondTauChargeLoose ],
      [ evtSelSecondTauMuonVeto, evtSelSecondTauMuonVetoLoose ],
      [ evtSelSecondTauElectronVeto, evtSelSecondTauElectronVetoLoose ],
      [ evtSelDiTauCandidateForDiTauAntiOverlapVeto, evtSelDiTauCandidateForDiTauAntiOverlapVetoLoose2ndTau ],
      [ evtSelDiTauCandidateForDiTauZeroCharge, evtSelDiTauCandidateForDiTauZeroChargeLoose2ndTau ],
      [ evtSelDiTauCandidateForDiTauAcoplanarity, evtSelDiTauCandidateForDiTauAcoplanarityLoose2ndTau ],
      [ evtSelDiTauCandidateForDiTauPzetaDiff, evtSelDiTauCandidateForDiTauPzetaDiffLoose2ndTau ] ]
      #[ evtSelCentralJetVeto, evtSelCentralJetVetoLoose2ndTau] ]
)
analyzeZtoDiTauEvents_factorizedLoose2ndTau.analysisSequence = diTauAnalysisSequence_factorizedLoose2ndTau
replaceAnalyzerModules(analyzeZtoDiTauEvents_factorizedLoose2ndTau,
    [ [ diTauCandidateNSVfitHistManagerForDiTau, diTauCandidateNSVfitHistManagerForDiTau_factorizedLoose2ndTau ] ]
)                       

analyzeZtoDiTauSequence_factorizedLoose2ndTau = cms.Sequence(analyzeZtoDiTauEvents_factorizedLoose2ndTau)
    analyzeZtoDiTauEvents_factorizedLoose2ndTau.eventDumps[
        0] = diTauEventDump_factorizedLoose2ndTau
replaceEventSelections(
    analyzeZtoDiTauEvents_factorizedLoose2ndTau,
    [[evtSelSecondTauLeadTrkPt, evtSelSecondTauLeadTrkPtLoose],
     [evtSelSecondTauTaNCdiscr, evtSelSecondTauTaNCdiscrLoose],
     [evtSelSecondTauTrkIso, evtSelSecondTauTrkIsoLoose],
     [evtSelSecondTauEcalIso, evtSelSecondTauEcalIsoLoose],
     [evtSelSecondTauProng, evtSelSecondTauProngLoose],
     [evtSelSecondTauCharge, evtSelSecondTauChargeLoose],
     [evtSelSecondTauMuonVeto, evtSelSecondTauMuonVetoLoose],
     [evtSelSecondTauElectronVeto, evtSelSecondTauElectronVetoLoose],
     [
         evtSelDiTauCandidateForDiTauAntiOverlapVeto,
         evtSelDiTauCandidateForDiTauAntiOverlapVetoLoose2ndTau
     ],
     [
         evtSelDiTauCandidateForDiTauZeroCharge,
         evtSelDiTauCandidateForDiTauZeroChargeLoose2ndTau
     ],
     [
         evtSelDiTauCandidateForDiTauAcoplanarity,
         evtSelDiTauCandidateForDiTauAcoplanarityLoose2ndTau
     ],
     [
         evtSelDiTauCandidateForDiTauPzetaDiff,
         evtSelDiTauCandidateForDiTauPzetaDiffLoose2ndTau
     ]]
    #[ evtSelCentralJetVeto, evtSelCentralJetVetoLoose2ndTau] ]
)
analyzeZtoDiTauEvents_factorizedLoose2ndTau.analysisSequence = diTauAnalysisSequence_factorizedLoose2ndTau
replaceAnalyzerModules(analyzeZtoDiTauEvents_factorizedLoose2ndTau, [[
#--------------------------------------------------------------------------------

analyzeZtoElecMuEvents_factorizedWithElectronIsolation = copy.deepcopy(analyzeZtoElecMuEvents)
analyzeZtoElecMuEvents_factorizedWithElectronIsolation.name = cms.string('zElecMuAnalyzer_factorizedWithElectronIsolation')
analyzeZtoElecMuEvents_factorizedWithElectronIsolation.eventDumps[0] = elecMuEventDump_factorizedWithElectronIsolation
analyzeZtoElecMuEvents_factorizedWithElectronIsolation.analysisSequence = elecMuAnalysisSequence_factorizedWithElectronIsolation

#--------------------------------------------------------------------------------
# define Z --> mu + electron analysis module
# for the path with "loose" muon isolation criteria applied
#
# NOTE: modifications to analyzeZtoElecMuEvents_factorizedWithoutElectronIsolation
#       modify the original analyzeZtoElecMuEvents sequence
#
#      --> analyzeZtoElecMuEvents_factorizedWithElectronIsolation needs to be defined
#          before analyzeZtoElecMuEvents_factorizedWithoutElectronIsolation !!
#
#--------------------------------------------------------------------------------

analyzeZtoElecMuEvents_factorizedWithoutElectronIsolation = copy.copy(analyzeZtoElecMuEvents)
analyzeZtoElecMuEvents_factorizedWithoutElectronIsolation.name = cms.string('zElecMuAnalyzer_factorizedWithoutElectronIsolation')
replaceEventSelections(analyzeZtoElecMuEvents_factorizedWithoutElectronIsolation,
    [ [ evtSelElectronIso, evtSelElectronIsoLooseIsolation ],
      [ evtSelDiTauCandidateForElecMuZeroCharge, evtSelDiTauCandidateForElecMuZeroChargeLooseElectronIsolation ],
      [ evtSelDiTauCandidateForElecMuMt1MET, evtSelDiTauCandidateForElecMuMt1METlooseElectronIsolation ],
      [ evtSelDiTauCandidateForElecMuMt2MET, evtSelDiTauCandidateForElecMuMt2METlooseElectronIsolation ] ]
)                       
analyzeZtoElecMuEvents_factorizedWithoutElectronIsolation.eventDumps[0] = elecMuEventDump_factorizedWithoutElectronIsolation
analyzeZtoElecMuEvents_factorizedWithoutElectronIsolation.analysisSequence = elecMuAnalysisSequence_factorizedWithoutElectronIsolation

Exemple #7
0
# NOTE: modifications to analyzeZtoElecMuEvents_factorizedWithoutElectronIsolation
#       modify the original analyzeZtoElecMuEvents sequence
#
#      --> analyzeZtoElecMuEvents_factorizedWithElectronIsolation needs to be defined
#          before analyzeZtoElecMuEvents_factorizedWithoutElectronIsolation !!
#
#--------------------------------------------------------------------------------

analyzeZtoElecMuEvents_factorizedWithoutElectronIsolation = copy.copy(
    analyzeZtoElecMuEvents)
analyzeZtoElecMuEvents_factorizedWithoutElectronIsolation.name = cms.string(
    'zElecMuAnalyzer_factorizedWithoutElectronIsolation')
replaceEventSelections(
    analyzeZtoElecMuEvents_factorizedWithoutElectronIsolation,
    [[evtSelElectronIso, evtSelElectronIsoLooseIsolation],
     [
         evtSelDiTauCandidateForElecMuZeroCharge,
         evtSelDiTauCandidateForElecMuZeroChargeLooseElectronIsolation
     ],
     [
         evtSelDiTauCandidateForElecMuMt1MET,
         evtSelDiTauCandidateForElecMuMt1METlooseElectronIsolation
     ],
     [
         evtSelDiTauCandidateForElecMuMt2MET,
         evtSelDiTauCandidateForElecMuMt2METlooseElectronIsolation
     ]])
analyzeZtoElecMuEvents_factorizedWithoutElectronIsolation.eventDumps[
    0] = elecMuEventDump_factorizedWithoutElectronIsolation
analyzeZtoElecMuEvents_factorizedWithoutElectronIsolation.analysisSequence = elecMuAnalysisSequence_factorizedWithoutElectronIsolation
Exemple #8
0
        caloMEtHistManagerBgEstWplusJetsEnriched,
        caloMEtHistManagerBgEstWplusJetsEnrichedFRweighted
    ],
    [
        pfMEtHistManagerBgEstWplusJetsEnriched,
        pfMEtHistManagerBgEstWplusJetsEnrichedFRweighted
    ],
    [
        jetHistManagerBgEstWplusJetsEnriched,
        jetHistManagerBgEstWplusJetsEnrichedFRweighted
    ]
]

analyzeEventsBgEstWplusJetsEnrichedFRmcWeighted = analyzeEventsBgEstWplusJetsEnriched.clone(
    name=cms.string('BgEstTemplateAnalyzer_WplusJetsEnrichedFRmcWeighted'))
replaceEventSelections(analyzeEventsBgEstWplusJetsEnrichedFRmcWeighted,
                       eventSelectionReplacementsWplusJetsEnrichedFRweighted)
analyzerModuleReplacementsWplusJetsEnrichedFRmcWeighted = copy.deepcopy(
    analyzerModuleReplacementsWplusJetsEnrichedFRweighted)
analyzerModuleReplacementsWplusJetsEnrichedFRmcWeighted.extend([
    [
        tauHistManagerBgEstWplusJetsEnriched,
        tauHistManagerBgEstWplusJetsEnrichedFRmcWeighted
    ],
    [
        diTauCandidateHistManagerBgEstWplusJetsEnriched,
        diTauCandidateHistManagerBgEstWplusJetsEnrichedFRmcWeighted
    ],
    #[ diTauCandidateNSVfitHistManagerBgEstWplusJetsEnriched, diTauCandidateNSVfitHistManagerBgEstWplusJetsEnrichedFRmcWeighted ]
])
replaceAnalyzerModules(
    analyzeEventsBgEstWplusJetsEnrichedFRmcWeighted,
    evtSelDiTauCandidateForAHtoMuTauZeroCharge,
    evtSelDiTauCandidateForAHtoMuTauZeroChargeLooseMuonIsolation
])

analyzeAHtoMuTauEventsOS_woBtag_factorizedWithoutMuonIsolation = analyzeAHtoMuTauEventsOS_woBtag.clone(
    name=cms.string('ahMuTauAnalyzerOS_woBtag_factorizedWithoutMuonIsolation'))
replaceSysAnalyzerModules(
    analyzeAHtoMuTauEventsOS_woBtag_factorizedWithoutMuonIsolation, [[
        sysUncertaintyHistManagerForMuTau,
        sysUncertaintyHistManagerForMuTauLooseMuonIsolation
    ]])
if analyzeAHtoMuTauEventsOS_woBtag_factorizedWithoutMuonIsolation.eventDumps:
    analyzeAHtoMuTauEventsOS_woBtag_factorizedWithoutMuonIsolation.eventDumps[
        0] = muTauEventDump_factorizedWithoutMuonIsolation
replaceEventSelections(
    analyzeAHtoMuTauEventsOS_woBtag_factorizedWithoutMuonIsolation,
    eventSelectionReplacementsOS)
analyzeAHtoMuTauEventsOS_woBtag_factorizedWithoutMuonIsolation.analysisSequence = \
  muTauAnalysisSequenceOS_woBtag_factorizedWithoutMuonIsolation

analyzeAHtoMuTauEventsOS_wBtag_factorizedWithoutMuonIsolation = analyzeAHtoMuTauEventsOS_wBtag.clone(
    name=cms.string('ahMuTauAnalyzerOS_wBtag_factorizedWithoutMuonIsolation'))
replaceSysAnalyzerModules(
    analyzeAHtoMuTauEventsOS_wBtag_factorizedWithoutMuonIsolation, [[
        sysUncertaintyHistManagerForMuTau,
        sysUncertaintyHistManagerForMuTauLooseMuonIsolation
    ]])
if analyzeAHtoMuTauEventsOS_wBtag_factorizedWithoutMuonIsolation.eventDumps:
    analyzeAHtoMuTauEventsOS_wBtag_factorizedWithoutMuonIsolation.eventDumps[
        0] = muTauEventDump_factorizedWithoutMuonIsolation
replaceEventSelections(
    [ evtSelDiTauCandidateForMuTauMt1MET, evtSelDiTauCandidateForMuTauMt1METlooseMuonIsolation ],
    [ evtSelDiTauCandidateForMuTauPzetaDiff, evtSelDiTauCandidateForMuTauPzetaDiffLooseMuonIsolation ],
    [ evtSelPrimaryEventVertexForMuTau, evtSelPrimaryEventVertexForMuTauLooseMuonIsolation ],
    [ evtSelPrimaryEventVertexQualityForMuTau, evtSelPrimaryEventVertexQualityForMuTauLooseMuonIsolation ],
    [ evtSelPrimaryEventVertexPositionForMuTau, evtSelPrimaryEventVertexPositionForMuTauLooseMuonIsolation ]
]

analyzeZtoMuTauEventsOS_factorizedWithoutMuonIsolation = analyzeZtoMuTauEventsOS.clone(
    name = cms.string('zMuTauAnalyzerOS_factorizedWithoutMuonIsolation')
)
if len(analyzeZtoMuTauEventsOS_factorizedWithoutMuonIsolation.eventDumps) > 0:
    analyzeZtoMuTauEventsOS_factorizedWithoutMuonIsolation.eventDumps[0] = muTauEventDump_factorizedWithoutMuonIsolation
eventSelectionReplacementsOS = copy.deepcopy(eventSelectionReplacements)
eventSelectionReplacementsOS.append([ evtSelDiTauCandidateForMuTauZeroCharge,
                                      evtSelDiTauCandidateForMuTauZeroChargeLooseMuonIsolation ])
replaceEventSelections(analyzeZtoMuTauEventsOS_factorizedWithoutMuonIsolation, eventSelectionReplacementsOS)
analyzeZtoMuTauEventsOS_factorizedWithoutMuonIsolation.analysisSequence = muTauAnalysisSequenceOS_factorizedWithoutMuonIsolation

analyzeZtoMuTauEventsSS_factorizedWithoutMuonIsolation = analyzeZtoMuTauEventsSS.clone(
    name = cms.string('zMuTauAnalyzerSS_factorizedWithoutMuonIsolation')
)
if len(analyzeZtoMuTauEventsSS_factorizedWithoutMuonIsolation.eventDumps) > 0:
    analyzeZtoMuTauEventsSS_factorizedWithoutMuonIsolation.eventDumps[0] = muTauEventDump_factorizedWithoutMuonIsolation
eventSelectionReplacementsSS = copy.deepcopy(eventSelectionReplacements)
eventSelectionReplacementsSS.append([ evtSelDiTauCandidateForMuTauNonZeroCharge,
                                      evtSelDiTauCandidateForMuTauNonZeroChargeLooseMuonIsolation ])
replaceEventSelections(analyzeZtoMuTauEventsSS_factorizedWithoutMuonIsolation, eventSelectionReplacementsSS)
analyzeZtoMuTauEventsSS_factorizedWithoutMuonIsolation.analysisSequence = muTauAnalysisSequenceSS_factorizedWithoutMuonIsolation

analyzeZtoMuTauSequence_factorizedWithoutMuonIsolation = cms.Sequence(
    analyzeZtoMuTauEventsOS_factorizedWithoutMuonIsolation * analyzeZtoMuTauEventsSS_factorizedWithoutMuonIsolation