Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-09 00:44:54

0001 from __future__ import print_function
0002 import FWCore.ParameterSet.Config as cms
0003 
0004 ## L1REPACK FULL:  Re-Emulate all of L1 and repack into RAW
0005 
0006 from Configuration.Eras.Modifier_stage2L1Trigger_cff import stage2L1Trigger
0007 from Configuration.Eras.Modifier_stage2L1Trigger_2017_cff import stage2L1Trigger_2017
0008 from Configuration.Eras.Modifier_run3_GEM_cff import run3_GEM
0009 
0010 def _print(ignored):
0011     print("# L1T WARN:  L1REPACK:Full (intended for 2016 data) only supports Stage 2 eras for now.")
0012     print("# L1T WARN:  Use a legacy version of L1REPACK for now.")
0013 stage2L1Trigger.toModify(None, _print)
0014 (~stage2L1Trigger).toModify(None, lambda x: print("# L1T INFO:  L1REPACK:Full (intended for 2016 & 2017 data) will unpack all L1T inputs, re-emulated (Stage-2), and pack uGT, uGMT, and Calo Stage-2 output."))
0015 
0016 # First, Unpack all inputs to L1:
0017 
0018 import EventFilter.OnlineMetaDataRawToDigi.tcdsRawToDigi_cfi
0019 unpackTcds = EventFilter.OnlineMetaDataRawToDigi.tcdsRawToDigi_cfi.tcdsRawToDigi.clone(
0020     InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0021 
0022 import EventFilter.L1TRawToDigi.bmtfDigis_cfi
0023 unpackBmtf = EventFilter.L1TRawToDigi.bmtfDigis_cfi.bmtfDigis.clone(
0024     InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0025 
0026 import EventFilter.DTTFRawToDigi.dttfunpacker_cfi
0027 unpackDttf = EventFilter.DTTFRawToDigi.dttfunpacker_cfi.dttfunpacker.clone(
0028     DTTF_FED_Source = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0029         
0030 import EventFilter.L1TRawToDigi.omtfStage2Digis_cfi
0031 unpackOmtf = EventFilter.L1TRawToDigi.omtfStage2Digis_cfi.omtfStage2Digis.clone(
0032     inputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0033         
0034 import EventFilter.L1TRawToDigi.emtfStage2Digis_cfi
0035 unpackEmtf = EventFilter.L1TRawToDigi.emtfStage2Digis_cfi.emtfStage2Digis.clone(
0036     InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0037         
0038 import EventFilter.CSCTFRawToDigi.csctfunpacker_cfi
0039 unpackCsctf = EventFilter.CSCTFRawToDigi.csctfunpacker_cfi.csctfunpacker.clone(
0040     producer = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0041 
0042 import EventFilter.CSCRawToDigi.cscUnpacker_cfi
0043 unpackCSC = EventFilter.CSCRawToDigi.cscUnpacker_cfi.muonCSCDigis.clone(
0044     InputObjects = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0045 
0046 import EventFilter.DTRawToDigi.dtunpacker_cfi
0047 unpackDT = EventFilter.DTRawToDigi.dtunpacker_cfi.muonDTDigis.clone(
0048     inputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0049 
0050 import EventFilter.RPCRawToDigi.rpcUnpacker_cfi
0051 unpackRPC = EventFilter.RPCRawToDigi.rpcUnpacker_cfi.rpcunpacker.clone(
0052     InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0053 
0054 import EventFilter.RPCRawToDigi.rpcTwinMuxRawToDigi_cfi
0055 unpackRPCTwinMux = EventFilter.RPCRawToDigi.rpcTwinMuxRawToDigi_cfi.rpcTwinMuxRawToDigi.clone(
0056     inputTag = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0057 
0058 import EventFilter.L1TXRawToDigi.twinMuxStage2Digis_cfi
0059 unpackTwinMux = EventFilter.L1TXRawToDigi.twinMuxStage2Digis_cfi.twinMuxStage2Digis.clone(
0060     DTTM7_FED_Source = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0061 
0062 import EventFilter.GEMRawToDigi.muonGEMDigis_cfi
0063 unpackGEM = EventFilter.GEMRawToDigi.muonGEMDigis_cfi.muonGEMDigis.clone(
0064     InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0065 
0066 import EventFilter.EcalRawToDigi.EcalUnpackerData_cfi
0067 unpackEcal = EventFilter.EcalRawToDigi.EcalUnpackerData_cfi.ecalEBunpacker.clone(
0068     InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0069 
0070 import EventFilter.HcalRawToDigi.HcalRawToDigi_cfi
0071 unpackHcal = EventFilter.HcalRawToDigi.HcalRawToDigi_cfi.hcalDigis.clone(
0072     InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0073 
0074 import EventFilter.L1TXRawToDigi.caloLayer1Stage2Digis_cfi
0075 unpackLayer1 = EventFilter.L1TXRawToDigi.caloLayer1Stage2Digis_cfi.l1tCaloLayer1Digis.clone(
0076     fedRawDataLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0077 
0078 # Second, Re-Emulate the entire L1T
0079 
0080 from SimCalorimetry.HcalTrigPrimProducers.hcaltpdigi_cff import *
0081 simHcalTriggerPrimitiveDigis.inputLabel = [
0082     'unpackHcal',
0083     'unpackHcal'
0084 ]
0085 simHcalTriggerPrimitiveDigis.inputUpgradeLabel = [
0086     'unpackHcal',     # upgrade HBHE
0087     'unpackHcal'      # upgrade HF
0088 ]
0089 
0090 from L1Trigger.Configuration.SimL1Emulator_cff import *
0091     
0092 simDtTriggerPrimitiveDigis.digiTag = 'unpackDT'
0093 simCscTriggerPrimitiveDigis.CSCComparatorDigiProducer = 'unpackCSC:MuonCSCComparatorDigi'
0094 simCscTriggerPrimitiveDigis.CSCWireDigiProducer       = 'unpackCSC:MuonCSCWireDigi'
0095 
0096 simTwinMuxDigis.RPC_Source         = 'unpackRPCTwinMux'
0097 simTwinMuxDigis.DTDigi_Source      = "unpackTwinMux:PhIn"
0098 simTwinMuxDigis.DTThetaDigi_Source = "unpackTwinMux:ThIn"
0099 
0100 run3_GEM.toModify(simMuonGEMPadDigis,
0101     InputCollection = 'unpackGEM'
0102 )
0103 
0104 # -----------------------------------------------------------
0105 # change when availalbe simTwinMux and reliable DTTPs, CSCTPs
0106 cutlist=['simDtTriggerPrimitiveDigis','simCscTriggerPrimitiveDigis']
0107 for b in cutlist:
0108     SimL1EmulatorCore.remove(b)
0109 # -----------------------------------------------------------
0110 
0111 # BMTF
0112 simBmtfDigis.DTDigi_Source       = "simTwinMuxDigis"
0113 simBmtfDigis.DTDigi_Theta_Source = "unpackBmtf"
0114 
0115 # OMTF
0116 simOmtfDigis.srcRPC              = 'unpackRPC'
0117 simOmtfDigis.srcDTPh             = "unpackBmtf"
0118 simOmtfDigis.srcDTTh             = "unpackBmtf"
0119 simOmtfDigis.srcCSC              = "unpackCsctf"
0120 stage2L1Trigger_2017.toModify(simOmtfDigis,
0121     srcRPC  = 'unpackOmtf',
0122     srcCSC  = 'unpackOmtf',
0123     srcDTPh = 'unpackOmtf',
0124     srcDTTh = 'unpackOmtf'
0125 )
0126 
0127 # EMTF
0128 simEmtfDigis.CSCInput            = "unpackEmtf"
0129 simEmtfDigis.RPCInput            = 'unpackRPC'
0130 
0131 simCaloStage2Layer1Digis.ecalToken = 'unpackEcal:EcalTriggerPrimitives'
0132 simCaloStage2Layer1Digis.hcalToken = 'unpackLayer1'
0133 
0134 
0135 ## GT
0136 stage2L1Trigger_2017.toModify(simGtExtFakeStage2Digis,
0137     tcdsRecordLabel= cms.InputTag("unpackTcds","tcdsRecord")
0138 )
0139 stage2L1Trigger.toModify(simGtExtFakeStage2Digis,
0140     tcdsRecordLabel= cms.InputTag("unpackTcds","tcdsRecord")
0141 )
0142 
0143 # Finally, pack the new L1T output back into RAW
0144     
0145 from EventFilter.L1TRawToDigi.caloStage2Raw_cfi import caloStage2Raw as packCaloStage2
0146 from EventFilter.L1TRawToDigi.gmtStage2Raw_cfi import gmtStage2Raw as packGmtStage2
0147 from EventFilter.L1TRawToDigi.gtStage2Raw_cfi import gtStage2Raw as packGtStage2
0148 
0149 # combine the new L1 RAW with existing RAW for other FEDs
0150 import EventFilter.RawDataCollector.rawDataCollectorByLabel_cfi
0151 rawDataCollector = EventFilter.RawDataCollector.rawDataCollectorByLabel_cfi.rawDataCollector.clone(
0152     verbose = 0,
0153     RawCollectionList = [
0154         'packCaloStage2',
0155         'packGmtStage2',
0156         'packGtStage2',
0157         cms.InputTag('rawDataCollector', processName=cms.InputTag.skipCurrentProcess()),
0158         ]
0159     )
0160 
0161 SimL1EmulatorTask = cms.Task()
0162 stage2L1Trigger.toReplaceWith(SimL1EmulatorTask, cms.Task(unpackEcal,unpackHcal,unpackCSC,unpackDT,unpackRPC,unpackRPCTwinMux,unpackTwinMux,unpackOmtf,unpackEmtf,unpackCsctf,unpackBmtf
0163                                                           ,unpackLayer1
0164                                                           ,unpackTcds
0165                                                           ,SimL1EmulatorCoreTask,packCaloStage2
0166                                                           ,packGmtStage2,packGtStage2,rawDataCollector))
0167 
0168 _SimL1EmulatorTaskWithGEM = SimL1EmulatorTask.copy()
0169 _SimL1EmulatorTaskWithGEM.add(unpackGEM)
0170 (stage2L1Trigger & run3_GEM).toReplaceWith(SimL1EmulatorTask, _SimL1EmulatorTaskWithGEM)
0171 
0172 SimL1Emulator = cms.Sequence(SimL1EmulatorTask)