from ZInvisibleBkgds.Photons.photonmap_cfi import *
process.rhoToPhotonMap = photonmap.clone(photonSrc = cms.InputTag("patPhotons"))
from ZInvisibleBkgds.Photons.addphotonuserdata_cfi import *
process.patPhotonsUser1 = addphotonuserdata1.clone()
process.patPhotonsUser1.photonLabel = cms.InputTag("patPhotons")
process.patPhotonsUser1.candidateLabel   = cms.InputTag("pfNoPileUpPFchs")
process.patPhotonsUser1.userData.userFloats = cms.PSet(
    src = cms.VInputTag(
        cms.InputTag("rhoToPhotonMap")
    )
)
process.patPhotonsUserData = addphotonuserdata2.clone()
process.patPhotonsUserData.photonLabel = cms.InputTag("patPhotonsUser1")
from ZInvisibleBkgds.Photons.specialMETCleaner_cff import specialPhotonCleanedMET
process.pfType1MetNoPhotonIDPFIso = specialPhotonCleanedMET.clone()
process.pfType1MetNoPhotonIDPFIso.inputObjects = cms.InputTag("patPhotonsIDPFIso")
process.pfType1MetNoPhotonID = specialPhotonCleanedMET.clone()
process.pfType1MetNoPhotonID.inputObjects = cms.InputTag("patPhotonsID")
#process.countPhotonsID     = countPhotonsIDPFIso.clone()
#process.countPhotonsIDISO  = countPhotonsIDPFIso.clone()

##top tagger
from UserCode.TopTagger.topTagger_cfi import *
process.load("UserCode.TopTagger.topTagger_cfi")

process.myTopTaggerID4M = topTagger4M.clone()
process.myTopTaggerID4M.jetSrc = cms.InputTag("patJetsPFNoPhotonIDSpecialPt30")
process.myTopTaggerID4M.metSrc = cms.InputTag("pfType1MetNoPhotonID","selected")
process.myTopTaggerID5M = topTagger5M.clone()
process.myTopTaggerID5M.jetSrc = cms.InputTag("patJetsPFNoPhotonIDSpecialPt30")
process.rhoToPhotonMap = photonmap.clone(photonSrc = cms.InputTag("patPhotonsRA2"))
from ZInvisibleBkgds.Photons.addphotonuserdata_cfi import *
process.patPhotonsUser1 = addphotonuserdata1.clone()
process.patPhotonsUser1.photonLabel = cms.InputTag("patPhotonsRA2")
process.patPhotonsUser1.userData.userFloats = cms.PSet(
    src = cms.VInputTag(
        cms.InputTag("rhoToPhotonMap")
    )
)
process.patPhotonsUserData = addphotonuserdata2.clone()
process.patPhotonsUserData.photonLabel = cms.InputTag("patPhotonsUser1")

from ZInvisibleBkgds.Photons.specialMETCleaner_cff import specialPhotonCleanedMET
process.pfType1MetNoPhotonIDPFIso              = specialPhotonCleanedMET.clone(
    inputObjects = cms.InputTag("patPhotonsIDPFIso"),
    inputMET     = cms.InputTag("patMETsPF"),
    inputJets    = cms.InputTag("patJetsPF"),
    inputPFCands = cms.InputTag("particleFlow"),
)
process.pfType1MetNoPhotonID = process.pfType1MetNoPhotonIDPFIso.clone(
    inputObjects = cms.InputTag("patPhotonsID"),
)

process.patJetsPFNoPhotonID.checkOverlaps.electrons.src = cms.InputTag('patElectrons')
process.patJetsPFNoPhotonID.checkOverlaps.tkIsoElectrons.src = cms.InputTag('patElectrons')
process.patJetsPFNoPhotonID.checkOverlaps.muons.src = cms.InputTag('patMuonsPF')
process.patJetsPFNoPhotonID.checkOverlaps.taus.src = cms.InputTag('selectedPatTausPF')

process.patJetsPFNoPhotonIDPt30.checkOverlaps.electrons.src = cms.InputTag('patElectrons')
process.patJetsPFNoPhotonIDPt30.checkOverlaps.tkIsoElectrons.src = cms.InputTag('patElectrons')
process.patJetsPFNoPhotonIDPt30.checkOverlaps.muons.src = cms.InputTag('patMuonsPF')
process.patJetsPFNoPhotonIDPt30.checkOverlaps.taus.src = cms.InputTag('selectedPatTausPF')