# tau pre-selection
tauPreSelectionTauMu = tauPreSelection.clone()
muonPreSelectionTauMu = muonPreSelection.clone()

# Correct tau pt (after MVA MET according to current baseline)
cmgTauMuCor = cmgTauMuCor.clone()

# This selector goes after the tau pt correction
cmgTauMuTauPtSel = cms.EDFilter("PATCompositeCandidateSelector",
                                src=cms.InputTag("cmgTauMuCor"),
                                cut=cms.string("daughter(0).pt()>18."))

cmgTauMuTauPtSel = cmgTauMuTauPtSel.clone()

# SVFit
cmgTauMuCorSVFitPreSel = tauMuSVFit.clone()

# If you want to apply some extra selection after SVFit, do it here
cmgTauMuCorSVFitFullSel = cmgTauMuSel.clone(src='cmgTauMuCorSVFitPreSel',
                                            cut='')

tauMuTauCounter = cms.EDFilter(
    "CandViewCountFilter",
    src=cms.InputTag("tauPreSelectionTauMu"),
    minNumber=cms.uint32(1),
)

tauMuMuonCounter = cms.EDFilter(
    "CandViewCountFilter",
    src=cms.InputTag("muonPreSelectionTauMu"),
    minNumber=cms.uint32(1),
cmgTauMuCorPreSel = cmgTauMuCor.clone()
cmgTauMuCorPreSel.cfg.metCollection = 'mvaBaseMETTauMu'
cmgTauMuCorPreSel.cfg.diObjectCollection = 'cmgTauMuPreSel'

mvaMETSequence = cms.Sequence( goodPVFilter + 
                               mvaMETTauMu +
                               recoilCorMETTauMu +
                               mvaBaseMETTauMu
                               #    # +
                               #    # cmgTauMuMVAPreSel
                               )

# SVFit

cmgTauMuCorSVFitPreSel = tauMuSVFit.clone()
cmgTauMuCorSVFitPreSel.diTauSrc = 'cmgTauMuCorPreSel'
cmgTauMuCorSVFitPreSel.metsigSrc = 'mvaMETTauMu'

# This module is not really necessary anymore
cmgTauMuCorSVFitFullSel = cmgTauMuSel.clone( src = 'cmgTauMuCorSVFitPreSel',
                                             cut = ''
                                             # WARNING!
                                             # cut = 'getSelection("cuts_baseline")'
                                             ) 

tauMuCorSVFitSequence = cms.Sequence( #
    mvaMETSequence +
    cmgTauMuCorPreSel +
    cmgTauMuCorSVFitPreSel +
    cmgTauMuCorSVFitFullSel