mvaMETTauMu.recBosonSrc = 'cmgTauMuPreSel'

cmgTauMuMVAPreSel = cmgTauMuCor.clone()
cmgTauMuMVAPreSel.cfg.metCollection = 'mvaBaseMETTauMu'
cmgTauMuMVAPreSel.cfg.diObjectCollection = 'cmgTauMuPreSel'

# recoil correction

metForRecoil = 'mvaMETTauMu'
diTausForRecoil = 'cmgTauMuPreSel'
recoilCorMETTauMu =  recoilCorrectedMETTauMu.clone(
    recBosonSrc = diTausForRecoil,
    metSrc = metForRecoil
    )

mvaBaseMETTauMu = cmgBaseMETFromPFMET.clone()
mvaBaseMETTauMu.cfg.inputCollection = 'recoilCorMETTauMu'

cmgTauMuCorPreSel = cmgTauMuCor.clone()
cmgTauMuCorPreSel.cfg.metCollection = 'mvaBaseMETTauMu'
cmgTauMuCorPreSel.cfg.diObjectCollection = 'cmgTauMuPreSel'

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

# SVFit
mvaMETDiTau.recBosonSrc = 'cmgDiTauPreSel'

cmgDiTauMVAPreSel = cmgDiTauCor.clone()
cmgDiTauMVAPreSel.cfg.metCollection = 'mvaBaseMETDiTau'
cmgDiTauMVAPreSel.cfg.diObjectCollection = 'cmgDiTauPreSel'

# recoil correction

metForRecoil = 'mvaMETDiTau'
diTausForRecoil = 'cmgDiTauPreSel'
recoilCorMETDiTau =  recoilCorrectedMETDiTau.clone(
    recBosonSrc = diTausForRecoil,
    metSrc = metForRecoil
    )

mvaBaseMETDiTau = cmgBaseMETFromPFMET.clone()

# SWITCH OFF RECOIL CORRECTIONS HERE

mvaBaseMETDiTau.cfg.inputCollection = 'recoilCorMETDiTau'
#mvaBaseMETDiTau.cfg.inputCollection = 'mvaMETDiTau'

# sequence

mvaMETSequence = cms.Sequence( goodPVFilter + 
                               mvaMETDiTau +
                               recoilCorMETDiTau +
                               mvaBaseMETDiTau
                               #    # +
                               #    # cmgDiTauMVAPreSel
                               )
cmgTauEleMVAPreSel = cmgTauEleCor.clone()
cmgTauEleMVAPreSel.cfg.metCollection = 'mvaBaseMETTauEle'
cmgTauEleMVAPreSel.cfg.diObjectCollection = 'cmgTauElePreSel'

# recoil correction

#IN 52X: should be type1 MET. In 44X, should be raw MET
metForRecoil = 'mvaMETTauEle'
diTausForRecoil = 'cmgTauElePreSel'
recoilCorMETTauEle =  recoilCorrectedMETTauEle.clone(
    recBosonSrc = diTausForRecoil,
    metSrc = metForRecoil
    )

mvaBaseMETTauEle = cmgBaseMETFromPFMET.clone()
mvaBaseMETTauEle.cfg.inputCollection = 'recoilCorMETTauEle'

cmgTauEleCorPreSel = cmgTauEleCor.clone()
cmgTauEleCorPreSel.cfg.metCollection = 'mvaBaseMETTauEle'
cmgTauEleCorPreSel.cfg.diObjectCollection = 'cmgTauElePreSel'

mvaMETSequence = cms.Sequence( goodPVFilter + 
                               mvaMETTauEle +
                               recoilCorMETTauEle +
                               mvaBaseMETTauEle
                               #    # +
                               #    # cmgTauEleMVAPreSel
                               )

# SVFit