示例#1
0
def reEmulation(process, reEmulMuons=True, reEmulCalos=True, patchNtuple=True, runOnPostLS1 = False):

    print "[L1Menu]: Setting up overall re-emulation"        

    if patchNtuple and hasattr(process,'l1NtupleProducer') and hasattr(process,'l1ExtraTreeProducer') :
        print "[L1Menu]:\tConfiguring Ntuple to use re-emulated information"        
        ntuple        = getattr(process,'l1NtupleProducer')
        l1ExtraNtuple = getattr(process,'l1ExtraTreeProducer')
    elif patchNtuple :
        print "[L1Menu]:\tERROR: FAILED to find ntuple! switching patchNtuple to False"        
        patchNtuple=False

    process.l1ExtraReEmul = cms.EDProducer(
        "L1ExtraParticlesProd",
        muonSource = cms.InputTag("gtDigis"),
        isolatedEmSource    = cms.InputTag("gctDigis","isoEm"),
        nonIsolatedEmSource = cms.InputTag("gctDigis","nonIsoEm"),
        
        forwardJetSource = cms.InputTag("gctDigis","forJets"),
        centralJetSource = cms.InputTag("gctDigis","cenJets"),
        tauJetSource     = cms.InputTag("gctDigis","tauJets"),
        
        etTotalSource = cms.InputTag("gctDigis"),
        etHadSource   = cms.InputTag("gctDigis"),
        etMissSource  = cms.InputTag("gctDigis"),
        htMissSource  = cms.InputTag("gctDigis"),
        
        hfRingEtSumsSource    = cms.InputTag("gctDigis"),
        hfRingBitCountsSource = cms.InputTag("gctDigis"),
        
        produceMuonParticles = cms.bool(True),
        produceCaloParticles = cms.bool(True),
        centralBxOnly = cms.bool(True),
        ignoreHtMiss = cms.bool(False)
        )
        
    if reEmulMuons :
        print "[L1Menu]:\tSetting up muon re-emulation"        
        
        from L1Trigger.DTTrackFinder.dttfDigis_cfi import dttfDigis
        process.dttfReEmulDigis       = dttfDigis.clone()
        process.dttfReEmulDigis.DTDigi_Source  = cms.InputTag("dttfDigis")
        process.dttfReEmulDigis.CSCStub_Source = cms.InputTag("csctfReEmulTrackDigis")

        from L1Trigger.RPCTrigger.rpcTriggerDigis_cfi import rpcTriggerDigis
        process.rpcTriggerReEmulDigis = rpcTriggerDigis.clone()

        if not runOnPostLS1 :
            from L1Trigger.CSCTrackFinder.csctfTrackDigis_cfi import csctfTrackDigis
            from L1Trigger.CSCTrackFinder.csctfDigis_cfi import csctfDigis

        
            process.csctfReEmulTrackDigis = csctfTrackDigis.clone()
            process.csctfReEmulDigis      = csctfDigis.clone()
        
            process.csctfReEmulTrackDigis.readDtDirect        = True
            process.csctfReEmulTrackDigis.SectorReceiverInput = cms.untracked.InputTag("csctfDigis")
            process.csctfReEmulTrackDigis.DtDirectProd        = cms.untracked.InputTag("csctfDigis","DT")
            process.csctfReEmulDigis.CSCTrackProducer         = cms.untracked.InputTag("csctfReEmulTrackDigis")
            #process.csctfReEmulDigis.SectorProcessor.initializeFromPSet = True
            
            process.csctfReEmulSequence = cms.Sequence(
                process.csctfReEmulTrackDigis
                * process.csctfReEmulDigis
            )
        else :
            from SLHCUpgradeSimulations.Configuration.muonCustoms import customise_csc_L1Emulator
            from L1Trigger.CSCTrackFinder.csctfDigis_cfi import csctfDigis

            customise_csc_L1Emulator(process) 

            process.csctfReEmulTrackDigis = process.simCsctfTrackDigis.clone()
            process.csctfReEmulDigis      = csctfDigis.clone()

            process.csctfReEmulTrackDigis.DTproducer  = cms.untracked.InputTag("dttfDigis")
            process.csctfReEmulDigis.CSCTrackProducer = cms.untracked.InputTag("csctfReEmulTrackDigis")

            process.csctfReEmulTrackDigis.SectorProcessor.PTLUT.PtMethod = cms.untracked.uint32(33) # no triple ganging in ME11a
            process.csctfReEmulTrackDigis.SectorProcessor.gangedME1a = cms.untracked.bool(False)
            process.csctfReEmulTrackDigis.SectorProcessor.firmwareSP = cms.uint32(20120730) #core 20120730
            process.csctfReEmulTrackDigis.SectorProcessor.initializeFromPSet = cms.bool(True) 

            process.csctfReEmulSequence = cms.Sequence(
                process.simCscTriggerPrimitiveDigis
                * process.csctfReEmulTrackDigis
                * process.csctfReEmulDigis
            )

            process.load('L1TriggerConfig.GMTConfigProducers.L1MuGMTParameters_cfi')
            process.L1MuGMTParameters.MergeMethodPtBrl=cms.string("byCombi")
            process.L1MuGMTParameters.MergeMethodPtFwd=cms.string("byCombi")
            process.L1MuGMTParameters.VersionSortRankEtaQLUT = cms.uint32(1043)
            process.L1MuGMTParameters.VersionLUTs = cms.uint32(1)


        from L1Trigger.GlobalMuonTrigger.gmtDigis_cfi import gmtDigis
        process.gmtReEmulDigis  = gmtDigis.clone()

        process.gmtReEmulDigis.DTCandidates   = cms.InputTag("dttfReEmulDigis","DT")
        process.gmtReEmulDigis.CSCCandidates  = cms.InputTag("csctfReEmulDigis","CSC")
        process.gmtReEmulDigis.RPCbCandidates = cms.InputTag("rpcTriggerReEmulDigis","RPCb")
        process.gmtReEmulDigis.RPCfCandidates = cms.InputTag("rpcTriggerReEmulDigis","RPCf")
        process.gmtReEmulDigis.MipIsoData     = cms.InputTag("none")
        
        process.l1ExtraReEmul.muonSource = cms.InputTag("gmtReEmulDigis")            

        if patchNtuple :
            ntuple.gmtSource          = cms.InputTag("gmtReEmulDigis")
            ntuple.dttfSource         = cms.InputTag("dttfReEmulDigis")
            ntuple.csctfTrkSource     = cms.InputTag("csctfReEmulTrackDigis")
            ntuple.csctfStatusSource  = cms.InputTag("csctfReEmulTrackDigis")

            l1ExtraNtuple.muonLabel = cms.untracked.InputTag("l1ExtraReEmul")

        process.reEmulMuonChain = cms.Sequence(
            process.rpcTriggerReEmulDigis
            *process.csctfReEmulSequence
            *process.dttfReEmulDigis
            *process.gmtReEmulDigis
            )

    if reEmulCalos :
        print "[L1Menu]:\tSetting up calo re-emulation"        

        print "[L1Menu]:\tWARNING! Just patching GCT sequence, RCT can't be re-emulated after UCT2015 SW patches"        

        # Need to have RCT emulator configurable and not UCT 2015 patches
        # in order to run 2012 RCT emulator correctly
        
        #	# In MC HCAL need to be re-run as there is no TPG information stored
        #	process.load("SimCalorimetry.HcalSimProducers.hcalUnsuppressedDigis_cfi")
        #	process.load("SimCalorimetry.HcalTrigPrimProducers.hcaltpdigi_cff")
        #	
        #	from L1Trigger.RegionalCaloTrigger.rctDigis_cfi import rctDigis
        #	from L1Trigger.GlobalCaloTrigger.gctDigis_cfi import gctDigis
        #	
        #	process.hcalReEmulDigis = process.simHcalTriggerPrimitiveDigis.clone()
        #	process.rctReEmulDigis  = rctDigis.clone()
        #	process.gctReEmulDigis  = gctDigis.clone()
        #	
        #	process.hcalReEmulDigis.inputLabel = cms.VInputTag(cms.InputTag('hcalDigis'), cms.InputTag('hcalDigis'))
        #	#process.HcalTPGCoderULUT.LUTGenerationMode = cms.bool(False)
        #	
        #	process.rctReEmulDigis.ecalDigis = cms.VInputTag( cms.InputTag( 'ecalDigis:EcalTriggerPrimitives' ) )
        #	process.rctReEmulDigis.hcalDigis = cms.VInputTag( cms.InputTag( 'hcalReEmulDigis' ) )
        #	
        #	process.gctReEmulDigis.inputLabel  = cms.InputTag("rctReEmulDigis")

        from L1Trigger.GlobalCaloTrigger.gctDigis_cfi import gctDigis

        process.gctReEmulDigis = gctDigis.clone()        
        process.gctReEmulDigis.inputLabel = cms.InputTag("gctDigis")

        process.l1ExtraReEmul.isolatedEmSource    = cms.InputTag("gctReEmulDigis","isoEm")
        process.l1ExtraReEmul.nonIsolatedEmSource = cms.InputTag("gctReEmulDigis","nonIsoEm")

        process.l1ExtraReEmul.forwardJetSource = cms.InputTag("gctReEmulDigis","forJets")
        process.l1ExtraReEmul.centralJetSource = cms.InputTag("gctReEmulDigis","cenJets")
        process.l1ExtraReEmul.tauJetSource     = cms.InputTag("gctReEmulDigis","tauJets")
            
        process.l1ExtraReEmul.etTotalSource = cms.InputTag("gctDigis")
        process.l1ExtraReEmul.etHadSource   = cms.InputTag("gctReEmulDigis")
        process.l1ExtraReEmul.etMissSource  = cms.InputTag("gctReEmulDigis")
        process.l1ExtraReEmul.htMissSource  = cms.InputTag("gctReEmulDigis")

        process.l1ExtraReEmul.hfRingEtSumsSource    = cms.InputTag("gctReEmulDigis")
        process.l1ExtraReEmul.hfRingBitCountsSource = cms.InputTag("gctReEmulDigis")

        if patchNtuple :
            ntuple.gctCentralJetsSource = cms.InputTag("gctReEmulDigis","cenJets")
            ntuple.gctNonIsoEmSource    = cms.InputTag("gctReEmulDigis","nonIsoEm")
            ntuple.gctForwardJetsSource = cms.InputTag("gctReEmulDigis","forJets")
            ntuple.gctIsoEmSource       = cms.InputTag("gctReEmulDigis","isoEm")
            ntuple.gctEnergySumsSource  = cms.InputTag("gctReEmulDigis","")
            ntuple.gctTauJetsSource     = cms.InputTag("gctReEmulDigis","tauJets")

            l1ExtraNtuple.nonIsoEmLabel = cms.untracked.InputTag("l1ExtraReEmul:NonIsolated")
            l1ExtraNtuple.isoEmLabel    = cms.untracked.InputTag("l1ExtraReEmul:Isolated")
            l1ExtraNtuple.tauJetLabel   = cms.untracked.InputTag("l1ExtraReEmul:Tau")
            l1ExtraNtuple.cenJetLabel   = cms.untracked.InputTag("l1ExtraReEmul:Central")
            l1ExtraNtuple.fwdJetLabel   = cms.untracked.InputTag("l1ExtraReEmul:Forward")
            l1ExtraNtuple.metLabel      = cms.untracked.InputTag("l1ExtraReEmul:MET")
            l1ExtraNtuple.mhtLabel      = cms.untracked.InputTag("l1ExtraReEmul:MHT")

            # Need to have RCT emulator configurable and not UCT 2015 patches
            # in order to run 2012 RCT emulator correctly
            #    ntuple.rctSource            = cms.InputTag("rctReEmulDigis")

        process.reEmulCaloChain = cms.Sequence(
            # Need to have RCT emulator configurable and not UCT 2015 patches
            # in order to run 2012 RCT emulator correctly
        
            #process.hcalReEmulDigis
            #+ process.rctReEmulDigis
            process.gctReEmulDigis
        )


    from L1Trigger.GlobalTrigger.gtDigis_cfi import gtDigis
    process.gtReEmulDigis   = gtDigis.clone()

    if reEmulMuons :
        process.gtReEmulDigis.GmtInputTag  = cms.InputTag("gmtReEmulDigis")
    if reEmulCalos :
        process.gtReEmulDigis.GctInputTag  = cms.InputTag("gctReEmulDigis")

    if patchNtuple :
        ntuple.gtSource = cms.InputTag("gtReEmulDigis")
        
    if reEmulMuons and reEmulCalos :
        process.reEmul = cms.Sequence(process.reEmulCaloChain + process.reEmulMuonChain + process.gtReEmulDigis + process.l1ExtraReEmul)
    elif reEmulMuons :
        process.reEmul = cms.Sequence(process.reEmulMuonChain + process.gtReEmulDigis + process.l1ExtraReEmul)
    elif reEmulCalos :
        process.reEmul = cms.Sequence(process.reEmulCaloChain + process.gtReEmulDigis + process.l1ExtraReEmul)
    else :
        process.reEmul = cms.Sequence(process.gtReEmulDigis + process.l1ExtraReEmul)
示例#2
0
def customiseL1EmulatorFromRaw(process):
    # customization fragment to run full emulator chain (TPGs and L1 Muon,Calo and GT emulators)
    # starting from a RAW file assuming that "RawToDigi_cff" and "SimL1Emulator_cff"
    # have already been loaded

    # (GMT digis produced by same module as the GT digis, as GT and GMT have common unpacker)
    ## process.simRpcTechTrigDigis.RPCDigiLabel = 'muonRPCDigis'

    ## 2015 L1 Calo Emulator
    process.load('L1Trigger.L1TCalorimeter.L1TCaloStage1_PPFromRaw_cff')

    ### 2015 L1 Muon Emulator
    from L1Trigger.DTTrackFinder.dttfDigis_cfi import dttfDigis
    process.dttfReEmulDigis = dttfDigis.clone()
    process.dttfReEmulDigis.DTDigi_Source = cms.InputTag("dttfDigis")
    process.dttfReEmulDigis.CSCStub_Source = cms.InputTag(
        "csctfReEmulTrackDigis")

    from L1Trigger.RPCTrigger.rpcTriggerDigis_cfi import rpcTriggerDigis
    process.rpcTriggerReEmulDigis = rpcTriggerDigis.clone()

    process.load("L1TriggerConfig.RPCTriggerConfig.RPCConeDefinition_cff")
    process.load("L1Trigger.RPCTrigger.RPCConeConfig_cff")

    from SLHCUpgradeSimulations.Configuration.muonCustoms import customise_csc_L1Emulator_sim
    from L1Trigger.CSCTrackFinder.csctfDigis_cfi import csctfDigis
    customise_csc_L1Emulator_sim(process)

    process.csctfReEmulTrackDigis = process.simCsctfTrackDigis.clone()
    process.csctfReEmulDigis = csctfDigis.clone()

    process.csctfReEmulTrackDigis.DTproducer = cms.untracked.InputTag(
        "dttfDigis")
    process.csctfReEmulDigis.CSCTrackProducer = cms.untracked.InputTag(
        "csctfReEmulTrackDigis")

    process.csctfReEmulTrackDigis.SectorProcessor.PTLUT.PtMethod = cms.untracked.uint32(
        34)  # no triple ganging in ME11a
    process.csctfReEmulTrackDigis.SectorProcessor.gangedME1a = cms.untracked.bool(
        False)
    process.csctfReEmulTrackDigis.SectorProcessor.firmwareSP = cms.uint32(
        20140515)  #core 20120730
    process.csctfReEmulTrackDigis.SectorProcessor.initializeFromPSet = cms.bool(
        True)
    process.csctfReEmulTrackDigis.SectorReceiverInput = cms.untracked.InputTag(
        "cscReEmulTriggerPrimitiveDigis", "MPCSORTED")

    process.cscReEmulTriggerPrimitiveDigis = process.simCscTriggerPrimitiveDigis.clone(
    )
    process.cscReEmulTriggerPrimitiveDigis.CSCComparatorDigiProducer = cms.InputTag(
        "muonCSCDigis", "MuonCSCComparatorDigi")
    process.cscReEmulTriggerPrimitiveDigis.CSCWireDigiProducer = cms.InputTag(
        "muonCSCDigis", "MuonCSCWireDigi")

    process.csctfReEmulSequence = cms.Sequence(
        process.cscReEmulTriggerPrimitiveDigis *
        process.csctfReEmulTrackDigis * process.csctfReEmulDigis)

    from L1Trigger.GlobalMuonTrigger.gmtDigis_cfi import gmtDigis
    process.gmtReEmulDigis = gmtDigis.clone()

    process.gmtReEmulDigis.DTCandidates = cms.InputTag("dttfReEmulDigis", "DT")
    process.gmtReEmulDigis.CSCCandidates = cms.InputTag(
        "csctfReEmulDigis", "CSC")
    process.gmtReEmulDigis.RPCbCandidates = cms.InputTag(
        "rpcTriggerReEmulDigis", "RPCb")
    process.gmtReEmulDigis.RPCfCandidates = cms.InputTag(
        "rpcTriggerReEmulDigis", "RPCf")
    process.gmtReEmulDigis.MipIsoData = cms.InputTag("none")

    process.load('L1TriggerConfig.GMTConfigProducers.L1MuGMTParameters_cfi')
    process.L1MuGMTParameters.MergeMethodPtBrl = cms.string("byMinPt")
    process.L1MuGMTParameters.MergeMethodPtFwd = cms.string("byMinPt")
    process.L1MuGMTParameters.VersionSortRankEtaQLUT = cms.uint32(275)
    process.L1MuGMTParameters.VersionLUTs = cms.uint32(1)
    process.es_prefer_gmtConfig = cms.ESPrefer("L1MuGMTParametersProducer",
                                               "L1MuGMTParameters")

    process.reEmulMuonChain = cms.Sequence(
        process.rpcTriggerReEmulDigis * process.csctfReEmulSequence *
        process.dttfReEmulDigis * process.gmtReEmulDigis)

    ## remove for 720pre7 and beyond
    ## use new muon LUTs
    ## dttfFile='sqlite:dttf_config.db'
    ## process.GlobalTag.toGet.extend(
    ##     cms.VPSet(cms.PSet(record = cms.string("L1MuDTEtaPatternLutRcd"),
    ##                        tag = cms.string("L1MuDTEtaPatternLut_CRAFT09_hlt"),
    ##                        connect = cms.untracked.string(dttfFile)
    ##                    ),
    ##               cms.PSet(record = cms.string("L1MuDTExtLutRcd"),
    ##                        tag = cms.string("L1MuDTExtLut_CRAFT09_hlt"),
    ##                        connect = cms.untracked.string(dttfFile)
    ##                    ),
    ##               cms.PSet(record = cms.string("L1MuDTPhiLutRcd"),
    ##                        tag = cms.string("L1MuDTPhiLut_CRAFT09_hlt"),
    ##                        connect = cms.untracked.string(dttfFile)
    ##                    ),
    ##               cms.PSet(record = cms.string("L1MuDTPtaLutRcd"),
    ##                        tag = cms.string("L1MuDTPtaLut_CRAFT09_hlt"),
    ##                        connect = cms.untracked.string(dttfFile)
    ##                    ),
    ##               cms.PSet(record = cms.string("L1MuDTQualPatternLutRcd"),
    ##                        tag = cms.string("L1MuDTQualPatternLut_CRAFT09_hlt"),
    ##                        connect = cms.untracked.string(dttfFile)
    ##                    )
    ##          )
    ## )
    ## end

    # GT
    from L1Trigger.Configuration.SimL1Emulator_cff import simGtDigis
    simGtDigis.GmtInputTag = 'gmtReEmulDigis'
    simGtDigis.GctInputTag = 'simCaloStage1LegacyFormatDigis'
    simGtDigis.TechnicalTriggersInputTags = cms.VInputTag()

    # run Calo TPGs, L1 GCT, technical triggers, L1 GT
    SimL1Emulator = cms.Sequence(
        ## process.reEmulCaloChain +
        process.L1TCaloStage1_PPFromRaw + process.reEmulMuonChain +
        process.simGtDigis)

    # replace the SimL1Emulator in all paths and sequences
    for iterable in six.itervalues(process.sequences):
        iterable.replace(process.SimL1Emulator, SimL1Emulator)
    for iterable in six.itervalues(process.paths):
        iterable.replace(process.SimL1Emulator, SimL1Emulator)
    for iterable in six.itervalues(process.endpaths):
        iterable.replace(process.SimL1Emulator, SimL1Emulator)
    process.SimL1Emulator = SimL1Emulator

    return process
示例#3
0
def reEmulation(process, reEmulMuons=True, reEmulCalos=True, patchNtuple=True, runOnPostLS1 = False, useStage1Layer2=False):

    print "[L1Menu]: Setting up overall re-emulation"        

    if patchNtuple and hasattr(process,'l1NtupleProducer') and hasattr(process,'l1ExtraTreeProducer') :
        print "[L1Menu]:\tConfiguring Ntuple to use re-emulated information"        
        ntuple        = getattr(process,'l1NtupleProducer')
        l1ExtraNtuple = getattr(process,'l1ExtraTreeProducer')
    elif patchNtuple :
        print "[L1Menu]:\tERROR: FAILED to find ntuple! switching patchNtuple to False"        
        patchNtuple=False

    process.l1ExtraReEmul = cms.EDProducer(
        "L1ExtraParticlesProd",
        muonSource = cms.InputTag("gtDigis"),
        isolatedEmSource    = cms.InputTag("gctDigis","isoEm"),
        nonIsolatedEmSource = cms.InputTag("gctDigis","nonIsoEm"),
        
        forwardJetSource = cms.InputTag("gctDigis","forJets"),
        centralJetSource = cms.InputTag("gctDigis","cenJets"),
        tauJetSource     = cms.InputTag("gctDigis","tauJets"),
        isoTauJetSource  = cms.InputTag("gctDigis","isoTauJets"),
        
        etTotalSource = cms.InputTag("gctDigis"),
        etHadSource   = cms.InputTag("gctDigis"),
        etMissSource  = cms.InputTag("gctDigis"),
        htMissSource  = cms.InputTag("gctDigis"),
        
        hfRingEtSumsSource    = cms.InputTag("gctDigis"),
        hfRingBitCountsSource = cms.InputTag("gctDigis"),
        
        produceMuonParticles = cms.bool(True),
        produceCaloParticles = cms.bool(True),
        centralBxOnly = cms.bool(True),
        ignoreHtMiss = cms.bool(False)
        )
        
    if reEmulMuons :
        print "[L1Menu]:\tSetting up muon re-emulation"        
        
        from L1Trigger.DTTrackFinder.dttfDigis_cfi import dttfDigis
        process.dttfReEmulDigis       = dttfDigis.clone()
        process.dttfReEmulDigis.DTDigi_Source  = cms.InputTag("dttfDigis")
        process.dttfReEmulDigis.CSCStub_Source = cms.InputTag("csctfReEmulTrackDigis")

        from L1Trigger.RPCTrigger.rpcTriggerDigis_cfi import rpcTriggerDigis
        process.rpcTriggerReEmulDigis = rpcTriggerDigis.clone()

        if not runOnPostLS1 :
            from L1Trigger.CSCTrackFinder.csctfTrackDigis_cfi import csctfTrackDigis
            from L1Trigger.CSCTrackFinder.csctfDigis_cfi import csctfDigis

        
            process.csctfReEmulTrackDigis = csctfTrackDigis.clone()
            process.csctfReEmulDigis      = csctfDigis.clone()
        
            process.csctfReEmulTrackDigis.readDtDirect        = True
            process.csctfReEmulTrackDigis.SectorReceiverInput = cms.untracked.InputTag("csctfDigis")
            process.csctfReEmulTrackDigis.DtDirectProd        = cms.untracked.InputTag("csctfDigis","DT")
            process.csctfReEmulDigis.CSCTrackProducer         = cms.untracked.InputTag("csctfReEmulTrackDigis")
            #process.csctfReEmulDigis.SectorProcessor.initializeFromPSet = True
            
            process.csctfReEmulSequence = cms.Sequence(
                process.csctfReEmulTrackDigis
                * process.csctfReEmulDigis
            )
        else :
            from SLHCUpgradeSimulations.Configuration.muonCustoms import customise_csc_L1Emulator_sim
            from L1Trigger.CSCTrackFinder.csctfDigis_cfi import csctfDigis

            customise_csc_L1Emulator_sim(process) 

            process.csctfReEmulTrackDigis = process.simCsctfTrackDigis.clone()
            process.csctfReEmulDigis      = csctfDigis.clone()

            process.csctfReEmulTrackDigis.DTproducer  = cms.untracked.InputTag("dttfDigis")
            process.csctfReEmulDigis.CSCTrackProducer = cms.untracked.InputTag("csctfReEmulTrackDigis")

            process.csctfReEmulTrackDigis.SectorProcessor.PTLUT.PtMethod = cms.untracked.uint32(34) # no triple ganging in ME11a
            process.csctfReEmulTrackDigis.SectorProcessor.gangedME1a = cms.untracked.bool(False)
            process.csctfReEmulTrackDigis.SectorProcessor.firmwareSP = cms.uint32(20140515) #core 20120730
            process.csctfReEmulTrackDigis.SectorProcessor.initializeFromPSet = cms.bool(True) 

            process.csctfReEmulSequence = cms.Sequence(
                process.simCscTriggerPrimitiveDigis
                * process.csctfReEmulTrackDigis
                * process.csctfReEmulDigis
            )

            process.load('L1TriggerConfig.GMTConfigProducers.L1MuGMTParameters_cfi')
            process.L1MuGMTParameters.MergeMethodPtBrl=cms.string("byCombi")
            process.L1MuGMTParameters.MergeMethodPtFwd=cms.string("byCombi")
            process.L1MuGMTParameters.VersionSortRankEtaQLUT = cms.uint32(1043)
            process.L1MuGMTParameters.VersionLUTs = cms.uint32(1)


        from L1Trigger.GlobalMuonTrigger.gmtDigis_cfi import gmtDigis
        process.gmtReEmulDigis  = gmtDigis.clone()

        process.gmtReEmulDigis.DTCandidates   = cms.InputTag("dttfReEmulDigis","DT")
        process.gmtReEmulDigis.CSCCandidates  = cms.InputTag("csctfReEmulDigis","CSC")
        process.gmtReEmulDigis.RPCbCandidates = cms.InputTag("rpcTriggerReEmulDigis","RPCb")
        process.gmtReEmulDigis.RPCfCandidates = cms.InputTag("rpcTriggerReEmulDigis","RPCf")
        process.gmtReEmulDigis.MipIsoData     = cms.InputTag("none")
        
        process.l1ExtraReEmul.muonSource = cms.InputTag("gmtReEmulDigis")            

        if patchNtuple :
            ntuple.gmtSource          = cms.InputTag("gmtReEmulDigis")
            ntuple.dttfSource         = cms.InputTag("dttfReEmulDigis")
            ntuple.csctfTrkSource     = cms.InputTag("csctfReEmulTrackDigis")
            ntuple.csctfStatusSource  = cms.InputTag("csctfReEmulTrackDigis")

            l1ExtraNtuple.muonLabel = cms.untracked.InputTag("l1ExtraReEmul")

        process.reEmulMuonChain = cms.Sequence(
            process.rpcTriggerReEmulDigis
            *process.csctfReEmulSequence
            *process.dttfReEmulDigis
            *process.gmtReEmulDigis
            )

    if reEmulCalos :
        print "[L1Menu]:\tSetting up calo re-emulation"        

        ## redo ECAL TP's
        ##
        #from SimCalorimetry.EcalTrigPrimProducers.ecalTriggerPrimitiveDigis_cff import simEcalTriggerPrimitiveDigis
        #process.ecalReEmulDigis = simEcalTriggerPrimitiveDigis.clone()
        #process.ecalReEmulDigis.InstanceEB = cms.string('ebDigis')
        #process.ecalReEmulDigis.InstanceEE = cms.string('eeDigis')
        #process.ecalReEmulDigis.Label = cms.string('ecalDigis')
        
        ###
        
        from L1Trigger.Configuration.SimL1Emulator_cff import simRctDigis
        process.rctReEmulDigis = process.simRctDigis.clone()
        process.rctReEmulDigis.ecalDigis = cms.VInputTag( cms.InputTag( 'ecalDigis:EcalTriggerPrimitives' ) )
        #process.rctReEmulDigis.ecalDigis = cms.VInputTag( cms.InputTag( 'ecalReEmulDigis' ) )
        process.rctReEmulDigis.hcalDigis = cms.VInputTag( cms.InputTag( 'hcalDigis' ) )

        from L1Trigger.GlobalCaloTrigger.gctDigis_cfi import gctDigis

        process.gctReEmulDigis = gctDigis.clone()        
        process.gctReEmulDigis.inputLabel = cms.InputTag("gctDigis")

        process.l1ExtraReEmul.isolatedEmSource    = cms.InputTag("gctReEmulDigis","isoEm")
        process.l1ExtraReEmul.nonIsolatedEmSource = cms.InputTag("gctReEmulDigis","nonIsoEm")

        process.l1ExtraReEmul.forwardJetSource = cms.InputTag("gctReEmulDigis","forJets")
        process.l1ExtraReEmul.centralJetSource = cms.InputTag("gctReEmulDigis","cenJets")
        process.l1ExtraReEmul.tauJetSource     = cms.InputTag("gctReEmulDigis","tauJets")
        process.l1ExtraReEmul.isoTauJetSource  = cms.InputTag("gctReEmulDigis","isoTauJets")            

        process.l1ExtraReEmul.etTotalSource = cms.InputTag("gctReEmulDigis")
        process.l1ExtraReEmul.etHadSource   = cms.InputTag("gctReEmulDigis")
        process.l1ExtraReEmul.etMissSource  = cms.InputTag("gctReEmulDigis")
        process.l1ExtraReEmul.htMissSource  = cms.InputTag("gctReEmulDigis")

        process.l1ExtraReEmul.hfRingEtSumsSource    = cms.InputTag("gctReEmulDigis")
        process.l1ExtraReEmul.hfRingBitCountsSource = cms.InputTag("gctReEmulDigis")

        if patchNtuple :
            ntuple.gctCentralJetsSource = cms.InputTag("gctReEmulDigis","cenJets")
            ntuple.gctNonIsoEmSource    = cms.InputTag("gctReEmulDigis","nonIsoEm")
            ntuple.gctForwardJetsSource = cms.InputTag("gctReEmulDigis","forJets")
            ntuple.gctIsoEmSource       = cms.InputTag("gctReEmulDigis","isoEm")
            ntuple.gctEnergySumsSource  = cms.InputTag("gctReEmulDigis","")
            ntuple.gctTauJetsSource     = cms.InputTag("gctReEmulDigis","tauJets")
            if useStage1Layer2:
                ntuple.gctIsoTauJetsSource  = cms.InputTag("gctReEmulDigis","isoTauJets")
            else:
                ntuple.gctIsoTauJetsSource  = cms.InputTag("none","isoTauJets")

            l1ExtraNtuple.nonIsoEmLabel = cms.untracked.InputTag("l1ExtraReEmul:NonIsolated")
            l1ExtraNtuple.isoEmLabel    = cms.untracked.InputTag("l1ExtraReEmul:Isolated")
            l1ExtraNtuple.tauJetLabel   = cms.untracked.InputTag("l1ExtraReEmul:Tau")
            l1ExtraNtuple.isoTauJetLabel   = cms.untracked.InputTag("l1ExtraReEmul:IsoTau")
            l1ExtraNtuple.cenJetLabel   = cms.untracked.InputTag("l1ExtraReEmul:Central")
            l1ExtraNtuple.fwdJetLabel   = cms.untracked.InputTag("l1ExtraReEmul:Forward")
            l1ExtraNtuple.metLabel      = cms.untracked.InputTag("l1ExtraReEmul:MET")
            l1ExtraNtuple.mhtLabel      = cms.untracked.InputTag("l1ExtraReEmul:MHT")

            # Need to have RCT emulator configurable and not UCT 2015 patches
            # in order to run 2012 RCT emulator correctly
            #    ntuple.rctSource            = cms.InputTag("rctReEmulDigis")

        process.reEmulCaloChain = cms.Sequence(
            # Need to have RCT emulator configurable and not UCT 2015 patches
            # in order to run 2012 RCT emulator correctly
        
            #process.hcalReEmulDigis
            #process.ecalReEmulDigis
            process.rctReEmulDigis
            +process.gctReEmulDigis
        )


    from L1Trigger.GlobalTrigger.gtDigis_cfi import gtDigis
    process.gtReEmulDigis   = gtDigis.clone()

    if reEmulMuons :
        process.gtReEmulDigis.GmtInputTag  = cms.InputTag("gmtReEmulDigis")
    if reEmulCalos :
        process.gctReEmulDigis.inputLabel  = cms.InputTag("rctReEmulDigis")
        process.gtReEmulDigis.GctInputTag  = cms.InputTag("gctReEmulDigis")

    if patchNtuple :
        ntuple.gtSource = cms.InputTag("gtReEmulDigis")
        
    if reEmulMuons and reEmulCalos :
        process.reEmul = cms.Sequence(process.reEmulCaloChain + process.reEmulMuonChain + process.gtReEmulDigis + process.l1ExtraReEmul)
    elif reEmulMuons :
        process.reEmul = cms.Sequence(process.reEmulMuonChain + process.gtReEmulDigis + process.l1ExtraReEmul)
    elif reEmulCalos :
        process.reEmul = cms.Sequence(process.reEmulCaloChain + process.gtReEmulDigis + process.l1ExtraReEmul)
    else :
        process.reEmul = cms.Sequence(process.gtReEmulDigis + process.l1ExtraReEmul)
def customiseL1EmulatorFromRaw(process):
    # customization fragment to run full emulator chain (TPGs and L1 Muon,Calo and GT emulators) 
    # starting from a RAW file assuming that "RawToDigi_cff" and "SimL1Emulator_cff" 
    # have already been loaded
    
    # (GMT digis produced by same module as the GT digis, as GT and GMT have common unpacker)
    ## process.simRpcTechTrigDigis.RPCDigiLabel = 'muonRPCDigis'

    ## 2015 L1 Calo Emulator
    process.load('L1Trigger.L1TCalorimeter.L1TCaloStage1_PPFromRaw_cff')

    ### 2015 L1 Muon Emulator
    from L1Trigger.DTTrackFinder.dttfDigis_cfi import dttfDigis
    process.dttfReEmulDigis       = dttfDigis.clone()
    process.dttfReEmulDigis.DTDigi_Source  = cms.InputTag("dttfDigis")
    process.dttfReEmulDigis.CSCStub_Source = cms.InputTag("csctfReEmulTrackDigis")

    from L1Trigger.RPCTrigger.rpcTriggerDigis_cfi import rpcTriggerDigis
    process.rpcTriggerReEmulDigis = rpcTriggerDigis.clone()

    process.load("L1TriggerConfig.RPCTriggerConfig.RPCConeDefinition_cff")
    process.load("L1Trigger.RPCTrigger.RPCConeConfig_cff")

    from SLHCUpgradeSimulations.Configuration.muonCustoms import customise_csc_L1Emulator_sim
    from L1Trigger.CSCTrackFinder.csctfDigis_cfi import csctfDigis
    customise_csc_L1Emulator_sim(process) 

    process.csctfReEmulTrackDigis = process.simCsctfTrackDigis.clone()
    process.csctfReEmulDigis      = csctfDigis.clone()

    process.csctfReEmulTrackDigis.DTproducer  = cms.untracked.InputTag("dttfDigis")
    process.csctfReEmulDigis.CSCTrackProducer = cms.untracked.InputTag("csctfReEmulTrackDigis")

    process.csctfReEmulTrackDigis.SectorProcessor.PTLUT.PtMethod = cms.untracked.uint32(34) # no triple ganging in ME11a
    process.csctfReEmulTrackDigis.SectorProcessor.gangedME1a = cms.untracked.bool(False)
    process.csctfReEmulTrackDigis.SectorProcessor.firmwareSP = cms.uint32(20140515) #core 20120730
    process.csctfReEmulTrackDigis.SectorProcessor.initializeFromPSet = cms.bool(True) 
    process.csctfReEmulTrackDigis.SectorReceiverInput = cms.untracked.InputTag("cscReEmulTriggerPrimitiveDigis","MPCSORTED")

    process.cscReEmulTriggerPrimitiveDigis = process.simCscTriggerPrimitiveDigis.clone()
    process.cscReEmulTriggerPrimitiveDigis.CSCComparatorDigiProducer = cms.InputTag("muonCSCDigis","MuonCSCComparatorDigi")
    process.cscReEmulTriggerPrimitiveDigis.CSCWireDigiProducer = cms.InputTag("muonCSCDigis","MuonCSCWireDigi")

    process.csctfReEmulSequence = cms.Sequence(
        process.cscReEmulTriggerPrimitiveDigis
        * process.csctfReEmulTrackDigis
        * process.csctfReEmulDigis
    )

    from L1Trigger.GlobalMuonTrigger.gmtDigis_cfi import gmtDigis
    process.gmtReEmulDigis  = gmtDigis.clone()

    process.gmtReEmulDigis.DTCandidates   = cms.InputTag("dttfReEmulDigis","DT")
    process.gmtReEmulDigis.CSCCandidates  = cms.InputTag("csctfReEmulDigis","CSC")
    process.gmtReEmulDigis.RPCbCandidates = cms.InputTag("rpcTriggerReEmulDigis","RPCb")
    process.gmtReEmulDigis.RPCfCandidates = cms.InputTag("rpcTriggerReEmulDigis","RPCf")
    process.gmtReEmulDigis.MipIsoData     = cms.InputTag("none")
    
    process.load('L1TriggerConfig.GMTConfigProducers.L1MuGMTParameters_cfi')
    process.L1MuGMTParameters.MergeMethodPtBrl=cms.string("byMinPt")
    process.L1MuGMTParameters.MergeMethodPtFwd=cms.string("byMinPt")
    process.L1MuGMTParameters.VersionSortRankEtaQLUT = cms.uint32(275)
    process.L1MuGMTParameters.VersionLUTs = cms.uint32(1) 
    process.es_prefer_gmtConfig = cms.ESPrefer("L1MuGMTParametersProducer","L1MuGMTParameters")

    process.reEmulMuonChain = cms.Sequence(
        process.rpcTriggerReEmulDigis
        *process.csctfReEmulSequence
        *process.dttfReEmulDigis
        *process.gmtReEmulDigis
        )

    ## remove for 720pre7 and beyond
    ## use new muon LUTs
    ## dttfFile='sqlite:dttf_config.db'
    ## process.GlobalTag.toGet.extend(
    ##     cms.VPSet(cms.PSet(record = cms.string("L1MuDTEtaPatternLutRcd"),
    ##                        tag = cms.string("L1MuDTEtaPatternLut_CRAFT09_hlt"),
    ##                        connect = cms.untracked.string(dttfFile)
    ##                    ),
    ##               cms.PSet(record = cms.string("L1MuDTExtLutRcd"),
    ##                        tag = cms.string("L1MuDTExtLut_CRAFT09_hlt"),
    ##                        connect = cms.untracked.string(dttfFile)
    ##                    ),
    ##               cms.PSet(record = cms.string("L1MuDTPhiLutRcd"),
    ##                        tag = cms.string("L1MuDTPhiLut_CRAFT09_hlt"),
    ##                        connect = cms.untracked.string(dttfFile)
    ##                    ),
    ##               cms.PSet(record = cms.string("L1MuDTPtaLutRcd"),
    ##                        tag = cms.string("L1MuDTPtaLut_CRAFT09_hlt"),
    ##                        connect = cms.untracked.string(dttfFile)
    ##                    ),
    ##               cms.PSet(record = cms.string("L1MuDTQualPatternLutRcd"),
    ##                        tag = cms.string("L1MuDTQualPatternLut_CRAFT09_hlt"),
    ##                        connect = cms.untracked.string(dttfFile)
    ##                    )
    ##          )
    ## )
    ## end

    # GT
    from L1Trigger.Configuration.SimL1Emulator_cff import simGtDigis
    simGtDigis.GmtInputTag = 'gmtReEmulDigis'
    simGtDigis.GctInputTag = 'simCaloStage1LegacyFormatDigis'
    simGtDigis.TechnicalTriggersInputTags = cms.VInputTag( )

    # run Calo TPGs, L1 GCT, technical triggers, L1 GT
    SimL1Emulator = cms.Sequence(
        ## process.reEmulCaloChain +
        process.L1TCaloStage1_PPFromRaw +
        process.reEmulMuonChain +
        process.simGtDigis )

    # replace the SimL1Emulator in all paths and sequences
    for iterable in process.sequences.itervalues():
        iterable.replace( process.SimL1Emulator, SimL1Emulator)
    for iterable in process.paths.itervalues():
        iterable.replace( process.SimL1Emulator, SimL1Emulator)
    for iterable in process.endpaths.itervalues():
        iterable.replace( process.SimL1Emulator, SimL1Emulator)
    process.SimL1Emulator = SimL1Emulator

    return process
示例#5
0
def reEmulation(process, reEmulMuons=True, reEmulCalos=True, patchNtuple=True, runOnPostLS1 = True, useStage1Layer2=True, reEmulRCT = True):

    print "[L1Menu]: Setting up overall re-emulation"        

    if patchNtuple and hasattr(process,'l1NtupleProducer') and hasattr(process,'l1ExtraTreeProducer') :
        print "[L1Menu]:\tConfiguring Ntuple to use re-emulated information"        
        ntuple        = getattr(process,'l1NtupleProducer')
        l1ExtraNtuple = getattr(process,'l1ExtraTreeProducer')
    elif patchNtuple :
        print "[L1Menu]:\tERROR: FAILED to find ntuple! switching patchNtuple to False"        
        patchNtuple=False

    process.l1ExtraReEmul = cms.EDProducer(
        "L1ExtraParticlesProd",
        muonSource = cms.InputTag("gtDigis"),
        isolatedEmSource    = cms.InputTag("gctDigis","isoEm"),
        nonIsolatedEmSource = cms.InputTag("gctDigis","nonIsoEm"),
        
        forwardJetSource = cms.InputTag("gctDigis","forJets"),
        centralJetSource = cms.InputTag("gctDigis","cenJets"),
        tauJetSource     = cms.InputTag("gctDigis","tauJets"),
        isoTauJetSource  = cms.InputTag("gctDigis","isoTauJets"),
        
        etTotalSource = cms.InputTag("gctDigis"),
        etHadSource   = cms.InputTag("gctDigis"),
        etMissSource  = cms.InputTag("gctDigis"),
        htMissSource  = cms.InputTag("gctDigis"),
        
        hfRingEtSumsSource    = cms.InputTag("gctDigis"),
        hfRingBitCountsSource = cms.InputTag("gctDigis"),
        
        produceMuonParticles = cms.bool(True),
        produceCaloParticles = cms.bool(True),
        centralBxOnly = cms.bool(True),
        ignoreHtMiss = cms.bool(False)
        )
        
    if reEmulMuons :
        print "[L1Menu]:\tSetting up muon re-emulation"        
        
        from L1Trigger.DTTrackFinder.dttfDigis_cfi import dttfDigis
        process.dttfReEmulDigis                = dttfDigis.clone()
        process.dttfReEmulDigis.DTDigi_Source  = cms.InputTag("dttfDigis")
        process.dttfReEmulDigis.CSCStub_Source = cms.InputTag("csctfReEmulTrackDigis")

        from L1Trigger.RPCTrigger.rpcTriggerDigis_cfi import rpcTriggerDigis
        process.rpcTriggerReEmulDigis = rpcTriggerDigis.clone()

        if not runOnPostLS1 :
            from L1Trigger.CSCTrackFinder.csctfTrackDigis_cfi import csctfTrackDigis
            from L1Trigger.CSCTrackFinder.csctfDigis_cfi import csctfDigis
        
            process.csctfReEmulTrackDigis = csctfTrackDigis.clone()
            process.csctfReEmulDigis      = csctfDigis.clone()
        
            process.csctfReEmulTrackDigis.readDtDirect        = True
            process.csctfReEmulTrackDigis.SectorReceiverInput = cms.untracked.InputTag("csctfDigis")
            process.csctfReEmulTrackDigis.DtDirectProd        = cms.untracked.InputTag("csctfDigis","DT")
            process.csctfReEmulDigis.CSCTrackProducer         = cms.untracked.InputTag("csctfReEmulTrackDigis")
            
            process.csctfReEmulSequence = cms.Sequence(
                process.csctfReEmulTrackDigis
                * process.csctfReEmulDigis
            )
        else :
            from SLHCUpgradeSimulations.Configuration.muonCustoms import customise_csc_L1Emulator_sim
            from L1Trigger.CSCTrackFinder.csctfDigis_cfi import csctfDigis

            customise_csc_L1Emulator_sim(process) 

            process.csctfReEmulTrackDigis = process.simCsctfTrackDigis.clone()
            process.csctfReEmulDigis      = csctfDigis.clone()

            process.csctfReEmulTrackDigis.DTproducer  = cms.untracked.InputTag("dttfDigis")
            process.csctfReEmulDigis.CSCTrackProducer = cms.untracked.InputTag("csctfReEmulTrackDigis")

            process.csctfReEmulTrackDigis.SectorProcessor.PTLUT.PtMethod = cms.untracked.uint32(34) # no triple ganging in ME11a
            process.csctfReEmulTrackDigis.SectorProcessor.gangedME1a = cms.untracked.bool(False)
            process.csctfReEmulTrackDigis.SectorProcessor.firmwareSP = cms.uint32(20140515) #core 20120730
            process.csctfReEmulTrackDigis.SectorProcessor.initializeFromPSet = cms.bool(True) 

            process.csctfReEmulSequence = cms.Sequence(
                process.simCscTriggerPrimitiveDigis
                * process.csctfReEmulTrackDigis
                * process.csctfReEmulDigis
            )

            process.load('L1TriggerConfig.GMTConfigProducers.L1MuGMTParameters_cfi')
            process.L1MuGMTParameters.MergeMethodPtBrl=cms.string("byCombi")
            process.L1MuGMTParameters.MergeMethodPtFwd=cms.string("byCombi")
            process.L1MuGMTParameters.VersionSortRankEtaQLUT = cms.uint32(1043)
            process.L1MuGMTParameters.VersionLUTs = cms.uint32(1)


        from L1Trigger.GlobalMuonTrigger.gmtDigis_cfi import gmtDigis
        process.gmtReEmulDigis  = gmtDigis.clone()

        process.gmtReEmulDigis.DTCandidates   = cms.InputTag("dttfReEmulDigis","DT")
        process.gmtReEmulDigis.CSCCandidates  = cms.InputTag("csctfReEmulDigis","CSC")
        process.gmtReEmulDigis.RPCbCandidates = cms.InputTag("rpcTriggerReEmulDigis","RPCb")
        process.gmtReEmulDigis.RPCfCandidates = cms.InputTag("rpcTriggerReEmulDigis","RPCf")
        process.gmtReEmulDigis.MipIsoData     = cms.InputTag("none")
        
        process.l1ExtraReEmul.muonSource = cms.InputTag("gmtReEmulDigis")            

        if patchNtuple :
            ntuple.gmtSource          = cms.InputTag("gmtReEmulDigis")
            ntuple.dttfSource         = cms.InputTag("dttfReEmulDigis")
            ntuple.csctfTrkSource     = cms.InputTag("csctfReEmulTrackDigis")
            ntuple.csctfStatusSource  = cms.InputTag("csctfReEmulTrackDigis")

            l1ExtraNtuple.muonLabel = cms.untracked.InputTag("l1ExtraReEmul")

        process.reEmulMuonChain = cms.Sequence(
            process.rpcTriggerReEmulDigis
            *process.csctfReEmulSequence
            *process.dttfReEmulDigis
            *process.gmtReEmulDigis
            )

    if reEmulCalos :
        print "[L1Menu]:\tSetting up calo re-emulation"        

        ## redo ECAL TP's
        ##
        #from SimCalorimetry.EcalTrigPrimProducers.ecalTriggerPrimitiveDigis_cff import simEcalTriggerPrimitiveDigis
        #process.ecalReEmulDigis = simEcalTriggerPrimitiveDigis.clone()
        #process.ecalReEmulDigis.InstanceEB = cms.string('ebDigis')
        #process.ecalReEmulDigis.InstanceEE = cms.string('eeDigis')
        #process.ecalReEmulDigis.Label = cms.string('ecalDigis')
        
        if reEmulRCT :
            from L1Trigger.Configuration.SimL1Emulator_cff import simRctDigis
            process.rctReEmulDigis = process.simRctDigis.clone()
            process.rctReEmulDigis.ecalDigis = cms.VInputTag( cms.InputTag( 'ecalDigis:EcalTriggerPrimitives' ) )
            ##process.rctReEmulDigis.ecalDigis = cms.VInputTag( cms.InputTag( 'ecalReEmulDigis' ) )
            process.rctReEmulDigis.hcalDigis = cms.VInputTag( cms.InputTag( 'hcalDigis' ) )

        from L1Trigger.GlobalCaloTrigger.gctDigis_cfi import gctDigis

        process.gctReEmulDigis = gctDigis.clone()        
        process.gctReEmulDigis.inputLabel = cms.InputTag("gctDigis")

        process.l1ExtraReEmul.isolatedEmSource    = cms.InputTag("gctReEmulDigis","isoEm")
        process.l1ExtraReEmul.nonIsolatedEmSource = cms.InputTag("gctReEmulDigis","nonIsoEm")

        process.l1ExtraReEmul.forwardJetSource = cms.InputTag("gctReEmulDigis","forJets")
        process.l1ExtraReEmul.centralJetSource = cms.InputTag("gctReEmulDigis","cenJets")
        process.l1ExtraReEmul.tauJetSource     = cms.InputTag("gctReEmulDigis","tauJets")
        process.l1ExtraReEmul.isoTauJetSource  = cms.InputTag("gctReEmulDigis","isoTauJets")            

        process.l1ExtraReEmul.etTotalSource = cms.InputTag("gctReEmulDigis")
        process.l1ExtraReEmul.etHadSource   = cms.InputTag("gctReEmulDigis")
        process.l1ExtraReEmul.etMissSource  = cms.InputTag("gctReEmulDigis")
        process.l1ExtraReEmul.htMissSource  = cms.InputTag("gctReEmulDigis")

        process.l1ExtraReEmul.hfRingEtSumsSource    = cms.InputTag("gctReEmulDigis")
        process.l1ExtraReEmul.hfRingBitCountsSource = cms.InputTag("gctReEmulDigis")

        if patchNtuple :
            ntuple.gctCentralJetsSource = cms.InputTag("gctReEmulDigis","cenJets")
            ntuple.gctNonIsoEmSource    = cms.InputTag("gctReEmulDigis","nonIsoEm")
            ntuple.gctForwardJetsSource = cms.InputTag("gctReEmulDigis","forJets")
            ntuple.gctIsoEmSource       = cms.InputTag("gctReEmulDigis","isoEm")
            ntuple.gctEnergySumsSource  = cms.InputTag("gctReEmulDigis","")
            ntuple.gctTauJetsSource     = cms.InputTag("gctReEmulDigis","tauJets")
            if useStage1Layer2:
                ntuple.gctIsoTauJetsSource  = cms.InputTag("gctReEmulDigis","isoTauJets")
            else:
                ntuple.gctIsoTauJetsSource  = cms.InputTag("none","isoTauJets")

            l1ExtraNtuple.nonIsoEmLabel = cms.untracked.InputTag("l1ExtraReEmul:NonIsolated")
            l1ExtraNtuple.isoEmLabel    = cms.untracked.InputTag("l1ExtraReEmul:Isolated")
            l1ExtraNtuple.tauJetLabel   = cms.untracked.InputTag("l1ExtraReEmul:Tau")
            l1ExtraNtuple.isoTauJetLabel   = cms.untracked.InputTag("l1ExtraReEmul:IsoTau")
            l1ExtraNtuple.cenJetLabel   = cms.untracked.InputTag("l1ExtraReEmul:Central")
            l1ExtraNtuple.fwdJetLabel   = cms.untracked.InputTag("l1ExtraReEmul:Forward")
            l1ExtraNtuple.metLabel      = cms.untracked.InputTag("l1ExtraReEmul:MET")
            l1ExtraNtuple.mhtLabel      = cms.untracked.InputTag("l1ExtraReEmul:MHT")


        if reEmulRCT :
            process.gctReEmulDigis.inputLabel  = cms.InputTag("rctReEmulDigis")
            process.reEmulCaloChain = cms.Sequence(
                #process.hcalReEmulDigis
                #process.ecalReEmulDigis
                process.rctReEmulDigis
                *process.gctReEmulDigis
                )
        else :
            process.reEmulCaloChain = cms.Sequence(
            process.gctReEmulDigis
        )

    from L1Trigger.GlobalTrigger.gtDigis_cfi import gtDigis
    process.gtReEmulDigis   = gtDigis.clone()

    if reEmulMuons :
        process.gtReEmulDigis.GmtInputTag  = cms.InputTag("gmtReEmulDigis")

    if reEmulCalos :
        process.gtReEmulDigis.GctInputTag  = cms.InputTag("gctReEmulDigis")

    if patchNtuple :
        ntuple.gtSource = cms.InputTag("gtReEmulDigis")
        
    if reEmulMuons and reEmulCalos :
        process.reEmul = cms.Sequence(process.reEmulCaloChain + process.reEmulMuonChain + process.gtReEmulDigis + process.l1ExtraReEmul)
    elif reEmulMuons :
        process.reEmul = cms.Sequence(process.reEmulMuonChain + process.gtReEmulDigis + process.l1ExtraReEmul)
    elif reEmulCalos :
        process.reEmul = cms.Sequence(process.reEmulCaloChain + process.gtReEmulDigis + process.l1ExtraReEmul)
    else :
        process.reEmul = cms.Sequence(process.gtReEmulDigis + process.l1ExtraReEmul)
示例#6
0
def reEmulation(process,
                reEmulMuons=True,
                reEmulCalos=True,
                patchNtuple=True,
                runOnPostLS1=False):

    print "[L1Menu]: Setting up overall re-emulation"

    if patchNtuple and hasattr(process, 'l1NtupleProducer') and hasattr(
            process, 'l1ExtraTreeProducer'):
        print "[L1Menu]:\tConfiguring Ntuple to use re-emulated information"
        ntuple = getattr(process, 'l1NtupleProducer')
        l1ExtraNtuple = getattr(process, 'l1ExtraTreeProducer')
    elif patchNtuple:
        print "[L1Menu]:\tERROR: FAILED to find ntuple! switching patchNtuple to False"
        patchNtuple = False

    process.l1ExtraReEmul = cms.EDProducer(
        "L1ExtraParticlesProd",
        muonSource=cms.InputTag("gtDigis"),
        isolatedEmSource=cms.InputTag("gctDigis", "isoEm"),
        nonIsolatedEmSource=cms.InputTag("gctDigis", "nonIsoEm"),
        forwardJetSource=cms.InputTag("gctDigis", "forJets"),
        centralJetSource=cms.InputTag("gctDigis", "cenJets"),
        tauJetSource=cms.InputTag("gctDigis", "tauJets"),
        etTotalSource=cms.InputTag("gctDigis"),
        etHadSource=cms.InputTag("gctDigis"),
        etMissSource=cms.InputTag("gctDigis"),
        htMissSource=cms.InputTag("gctDigis"),
        hfRingEtSumsSource=cms.InputTag("gctDigis"),
        hfRingBitCountsSource=cms.InputTag("gctDigis"),
        produceMuonParticles=cms.bool(True),
        produceCaloParticles=cms.bool(True),
        centralBxOnly=cms.bool(True),
        ignoreHtMiss=cms.bool(False))

    if reEmulMuons:
        print "[L1Menu]:\tSetting up muon re-emulation"

        from L1Trigger.DTTrackFinder.dttfDigis_cfi import dttfDigis
        process.dttfReEmulDigis = dttfDigis.clone()
        process.dttfReEmulDigis.DTDigi_Source = cms.InputTag("dttfDigis")
        process.dttfReEmulDigis.CSCStub_Source = cms.InputTag(
            "csctfReEmulTrackDigis")

        from L1Trigger.RPCTrigger.rpcTriggerDigis_cfi import rpcTriggerDigis
        process.rpcTriggerReEmulDigis = rpcTriggerDigis.clone()

        if not runOnPostLS1:
            from L1Trigger.CSCTrackFinder.csctfTrackDigis_cfi import csctfTrackDigis
            from L1Trigger.CSCTrackFinder.csctfDigis_cfi import csctfDigis

            process.csctfReEmulTrackDigis = csctfTrackDigis.clone()
            process.csctfReEmulDigis = csctfDigis.clone()

            process.csctfReEmulTrackDigis.readDtDirect = True
            process.csctfReEmulTrackDigis.SectorReceiverInput = cms.untracked.InputTag(
                "csctfDigis")
            process.csctfReEmulTrackDigis.DtDirectProd = cms.untracked.InputTag(
                "csctfDigis", "DT")
            process.csctfReEmulDigis.CSCTrackProducer = cms.untracked.InputTag(
                "csctfReEmulTrackDigis")
            #process.csctfReEmulDigis.SectorProcessor.initializeFromPSet = True

            process.csctfReEmulSequence = cms.Sequence(
                process.csctfReEmulTrackDigis * process.csctfReEmulDigis)
        else:
            from SLHCUpgradeSimulations.Configuration.muonCustoms import customise_csc_L1Emulator
            from L1Trigger.CSCTrackFinder.csctfDigis_cfi import csctfDigis

            customise_csc_L1Emulator(process)

            process.csctfReEmulTrackDigis = process.simCsctfTrackDigis.clone()
            process.csctfReEmulDigis = csctfDigis.clone()

            process.csctfReEmulTrackDigis.DTproducer = cms.untracked.InputTag(
                "dttfDigis")
            process.csctfReEmulDigis.CSCTrackProducer = cms.untracked.InputTag(
                "csctfReEmulTrackDigis")

            process.csctfReEmulSequence = cms.Sequence(
                process.simCscTriggerPrimitiveDigis *
                process.csctfReEmulTrackDigis * process.csctfReEmulDigis)

        from L1Trigger.GlobalMuonTrigger.gmtDigis_cfi import gmtDigis
        process.gmtReEmulDigis = gmtDigis.clone()

        process.gmtReEmulDigis.DTCandidates = cms.InputTag(
            "dttfReEmulDigis", "DT")
        process.gmtReEmulDigis.CSCCandidates = cms.InputTag(
            "csctfReEmulDigis", "CSC")
        process.gmtReEmulDigis.RPCbCandidates = cms.InputTag(
            "rpcTriggerReEmulDigis", "RPCb")
        process.gmtReEmulDigis.RPCfCandidates = cms.InputTag(
            "rpcTriggerReEmulDigis", "RPCf")
        process.gmtReEmulDigis.MipIsoData = cms.InputTag("none")

        process.l1ExtraReEmul.muonSource = cms.InputTag("gmtReEmulDigis")

        if patchNtuple:
            ntuple.gmtSource = cms.InputTag("gmtReEmulDigis")
            ntuple.dttfSource = cms.InputTag("dttfReEmulDigis")
            ntuple.csctfTrkSource = cms.InputTag("csctfReEmulTrackDigis")
            ntuple.csctfStatusSource = cms.InputTag("csctfReEmulTrackDigis")

            l1ExtraNtuple.muonLabel = cms.untracked.InputTag("l1ExtraReEmul")

        process.reEmulMuonChain = cms.Sequence(
            process.rpcTriggerReEmulDigis * process.csctfReEmulSequence *
            process.dttfReEmulDigis * process.gmtReEmulDigis)

    if reEmulCalos:
        print "[L1Menu]:\tSetting up calo re-emulation"

        print "[L1Menu]:\tWARNING! Just patching GCT sequence, RCT can't be re-emulated after UCT2015 SW patches"

        # Need to have RCT emulator configurable and not UCT 2015 patches
        # in order to run 2012 RCT emulator correctly

        #	# In MC HCAL need to be re-run as there is no TPG information stored
        #	process.load("SimCalorimetry.HcalSimProducers.hcalUnsuppressedDigis_cfi")
        #	process.load("SimCalorimetry.HcalTrigPrimProducers.hcaltpdigi_cff")
        #
        #	from L1Trigger.RegionalCaloTrigger.rctDigis_cfi import rctDigis
        #	from L1Trigger.GlobalCaloTrigger.gctDigis_cfi import gctDigis
        #
        #	process.hcalReEmulDigis = process.simHcalTriggerPrimitiveDigis.clone()
        #	process.rctReEmulDigis  = rctDigis.clone()
        #	process.gctReEmulDigis  = gctDigis.clone()
        #
        #	process.hcalReEmulDigis.inputLabel = cms.VInputTag(cms.InputTag('hcalDigis'), cms.InputTag('hcalDigis'))
        #	#process.HcalTPGCoderULUT.LUTGenerationMode = cms.bool(False)
        #
        #	process.rctReEmulDigis.ecalDigis = cms.VInputTag( cms.InputTag( 'ecalDigis:EcalTriggerPrimitives' ) )
        #	process.rctReEmulDigis.hcalDigis = cms.VInputTag( cms.InputTag( 'hcalReEmulDigis' ) )
        #
        #	process.gctReEmulDigis.inputLabel  = cms.InputTag("rctReEmulDigis")

        from L1Trigger.GlobalCaloTrigger.gctDigis_cfi import gctDigis

        process.gctReEmulDigis = gctDigis.clone()
        process.gctReEmulDigis.inputLabel = cms.InputTag("gctDigis")

        process.l1ExtraReEmul.isolatedEmSource = cms.InputTag(
            "gctReEmulDigis", "isoEm")
        process.l1ExtraReEmul.nonIsolatedEmSource = cms.InputTag(
            "gctReEmulDigis", "nonIsoEm")

        process.l1ExtraReEmul.forwardJetSource = cms.InputTag(
            "gctReEmulDigis", "forJets")
        process.l1ExtraReEmul.centralJetSource = cms.InputTag(
            "gctReEmulDigis", "cenJets")
        process.l1ExtraReEmul.tauJetSource = cms.InputTag(
            "gctReEmulDigis", "tauJets")

        process.l1ExtraReEmul.etTotalSource = cms.InputTag("gctDigis")
        process.l1ExtraReEmul.etHadSource = cms.InputTag("gctReEmulDigis")
        process.l1ExtraReEmul.etMissSource = cms.InputTag("gctReEmulDigis")
        process.l1ExtraReEmul.htMissSource = cms.InputTag("gctReEmulDigis")

        process.l1ExtraReEmul.hfRingEtSumsSource = cms.InputTag(
            "gctReEmulDigis")
        process.l1ExtraReEmul.hfRingBitCountsSource = cms.InputTag(
            "gctReEmulDigis")

        if patchNtuple:
            ntuple.gctCentralJetsSource = cms.InputTag("gctReEmulDigis",
                                                       "cenJets")
            ntuple.gctNonIsoEmSource = cms.InputTag("gctReEmulDigis",
                                                    "nonIsoEm")
            ntuple.gctForwardJetsSource = cms.InputTag("gctReEmulDigis",
                                                       "forJets")
            ntuple.gctIsoEmSource = cms.InputTag("gctReEmulDigis", "isoEm")
            ntuple.gctEnergySumsSource = cms.InputTag("gctReEmulDigis", "")
            ntuple.gctTauJetsSource = cms.InputTag("gctReEmulDigis", "tauJets")

            l1ExtraNtuple.nonIsoEmLabel = cms.untracked.InputTag(
                "l1ExtraReEmul:NonIsolated")
            l1ExtraNtuple.isoEmLabel = cms.untracked.InputTag(
                "l1ExtraReEmul:Isolated")
            l1ExtraNtuple.tauJetLabel = cms.untracked.InputTag(
                "l1ExtraReEmul:Tau")
            l1ExtraNtuple.cenJetLabel = cms.untracked.InputTag(
                "l1ExtraReEmul:Central")
            l1ExtraNtuple.fwdJetLabel = cms.untracked.InputTag(
                "l1ExtraReEmul:Forward")
            l1ExtraNtuple.metLabel = cms.untracked.InputTag(
                "l1ExtraReEmul:MET")
            l1ExtraNtuple.mhtLabel = cms.untracked.InputTag(
                "l1ExtraReEmul:MHT")

            # Need to have RCT emulator configurable and not UCT 2015 patches
            # in order to run 2012 RCT emulator correctly
            #    ntuple.rctSource            = cms.InputTag("rctReEmulDigis")

        process.reEmulCaloChain = cms.Sequence(
            # Need to have RCT emulator configurable and not UCT 2015 patches
            # in order to run 2012 RCT emulator correctly

            #process.hcalReEmulDigis
            #+ process.rctReEmulDigis
            process.gctReEmulDigis)

    from L1Trigger.GlobalTrigger.gtDigis_cfi import gtDigis
    process.gtReEmulDigis = gtDigis.clone()

    if reEmulMuons:
        process.gtReEmulDigis.GmtInputTag = cms.InputTag("gmtReEmulDigis")
    if reEmulCalos:
        process.gtReEmulDigis.GctInputTag = cms.InputTag("gctReEmulDigis")

    if patchNtuple:
        ntuple.gtSource = cms.InputTag("gtReEmulDigis")

    if reEmulMuons and reEmulCalos:
        process.reEmul = cms.Sequence(process.reEmulCaloChain +
                                      process.reEmulMuonChain +
                                      process.gtReEmulDigis +
                                      process.l1ExtraReEmul)
    elif reEmulMuons:
        process.reEmul = cms.Sequence(process.reEmulMuonChain +
                                      process.gtReEmulDigis +
                                      process.l1ExtraReEmul)
    elif reEmulCalos:
        process.reEmul = cms.Sequence(process.reEmulCaloChain +
                                      process.gtReEmulDigis +
                                      process.l1ExtraReEmul)
    else:
        process.reEmul = cms.Sequence(process.gtReEmulDigis +
                                      process.l1ExtraReEmul)