Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-11-23 23:24:08

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 
0007 from Configuration.Eras.Modifier_stage2L1Trigger_cff import stage2L1Trigger
0008 def _print(ignored):
0009     print("# L1T WARN:  L1REPACK:CalouGT (intended for 2016/2017 data) only supports Stage 2 eras for now.")
0010     print("# L1T WARN:  Use a legacy version of L1REPACK for now.")
0011 stage2L1Trigger.toModify(None, _print)
0012 (~stage2L1Trigger).toModify(None, lambda x: print("# L1T INFO:  L1REPACK:CalouGT (intended for 2016/2017 data), reemulates the Calo part, uses unpacked Muons, and reemulates uGT."))
0013 
0014 # First, Unpack all inputs to L1:
0015 import EventFilter.L1TRawToDigi.bmtfDigis_cfi
0016 unpackBmtf = EventFilter.L1TRawToDigi.bmtfDigis_cfi.bmtfDigis.clone(
0017     InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0018 
0019 import EventFilter.DTTFRawToDigi.dttfunpacker_cfi
0020 unpackDttf = EventFilter.DTTFRawToDigi.dttfunpacker_cfi.dttfunpacker.clone(
0021     DTTF_FED_Source = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0022         
0023 import EventFilter.L1TRawToDigi.emtfStage2Digis_cfi
0024 unpackEmtf = EventFilter.L1TRawToDigi.emtfStage2Digis_cfi.emtfStage2Digis.clone(
0025     InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0026         
0027 import EventFilter.CSCTFRawToDigi.csctfunpacker_cfi
0028 unpackCsctf = EventFilter.CSCTFRawToDigi.csctfunpacker_cfi.csctfunpacker.clone(
0029     producer = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0030 
0031 import EventFilter.CSCRawToDigi.cscUnpacker_cfi
0032 unpackCSC = EventFilter.CSCRawToDigi.cscUnpacker_cfi.muonCSCDigis.clone(
0033     InputObjects = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0034 
0035 import EventFilter.DTRawToDigi.dtunpacker_cfi
0036 unpackDT = EventFilter.DTRawToDigi.dtunpacker_cfi.muonDTDigis.clone(
0037     inputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0038 
0039 import EventFilter.RPCRawToDigi.rpcUnpacker_cfi
0040 unpackRPC = EventFilter.RPCRawToDigi.rpcUnpacker_cfi.rpcunpacker.clone(
0041     InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0042 
0043 import EventFilter.EcalRawToDigi.EcalUnpackerData_cfi
0044 unpackEcal = EventFilter.EcalRawToDigi.EcalUnpackerData_cfi.ecalEBunpacker.clone(
0045     InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0046 
0047 import EventFilter.HcalRawToDigi.HcalRawToDigi_cfi
0048 unpackHcal = EventFilter.HcalRawToDigi.HcalRawToDigi_cfi.hcalDigis.clone(
0049     InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0050 
0051 # Second, unpacker of inputs to uGT:
0052 # #################################
0053 import EventFilter.L1TRawToDigi.gtStage2Digis_cfi
0054 unpackGtStage2 = EventFilter.L1TRawToDigi.gtStage2Digis_cfi.gtStage2Digis.clone(
0055     InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0056 
0057 # For simplicity, re-emulate the entire L1T (will not use Muon part)
0058 # ################################################################
0059 
0060 from SimCalorimetry.HcalTrigPrimProducers.hcaltpdigi_cff import *
0061 simHcalTriggerPrimitiveDigis.inputLabel = [
0062     'unpackHcal',
0063     'unpackHcal'
0064 ]
0065 simHcalTriggerPrimitiveDigis.inputUpgradeLabel = [
0066     'unpackHcal',     # upgrade HBHE
0067     'unpackHcal'      # upgrade HF
0068 ]
0069 
0070 from L1Trigger.Configuration.SimL1Emulator_cff import *
0071     
0072 simDtTriggerPrimitiveDigis.digiTag = 'unpackDT'
0073 simCscTriggerPrimitiveDigis.CSCComparatorDigiProducer = 'unpackCSC:MuonCSCComparatorDigi'
0074 simCscTriggerPrimitiveDigis.CSCWireDigiProducer       = 'unpackCSC:MuonCSCWireDigi'
0075 
0076 simTwinMuxDigis.RPC_Source         = 'unpackRPC'
0077 simTwinMuxDigis.DTDigi_Source      = "simDtTriggerPrimitiveDigis"
0078 simTwinMuxDigis.DTThetaDigi_Source = "simDtTriggerPrimitiveDigis"
0079 
0080 # -----------------------------------------------------------
0081 # change when availalbe simTwinMux and reliable DTTPs, CSCTPs
0082 cutlist=['simDtTriggerPrimitiveDigis','simCscTriggerPrimitiveDigis','simTwinMuxDigis']
0083 for b in cutlist:
0084     SimL1EmulatorCore.remove(b)
0085 # -----------------------------------------------------------
0086 
0087 # BMTF
0088 simBmtfDigis.DTDigi_Source       = "unpackBmtf"
0089 simBmtfDigis.DTDigi_Theta_Source = "unpackBmtf"
0090 
0091 # OMTF
0092 simOmtfDigis.srcRPC              = 'unpackRPC'
0093 simOmtfDigis.srcDTPh             = "unpackBmtf"
0094 simOmtfDigis.srcDTTh             = "unpackBmtf"
0095 simOmtfDigis.srcCSC              = "unpackCsctf" ## Replace when emtfStage2Digis give equal data-emulator agreement
0096 
0097 # EMTF
0098 simEmtfDigis.CSCInput            = "unpackEmtf"
0099 simEmtfDigis.RPCInput            = 'unpackRPC'
0100 
0101 simCaloStage2Layer1Digis.ecalToken = 'unpackEcal:EcalTriggerPrimitives'
0102 simCaloStage2Layer1Digis.hcalToken = 'unpackHcal'
0103 
0104 # uGT inputs for Muons are from unpacked
0105 simGtStage2Digis.MuonInputTag   = "unpackGtStage2:Muon"
0106 
0107 # Finally, pack the newly re-emulated L1T parts back into RAW
0108 # Calo packer
0109 from EventFilter.L1TRawToDigi.caloStage2Raw_cfi import caloStage2Raw as packCaloStage2
0110 # uGT packer
0111 from EventFilter.L1TRawToDigi.gtStage2Raw_cfi import gtStage2Raw as packGtStage2
0112 
0113 # combine the new L1 RAW with existing RAW for other FEDs
0114 import EventFilter.RawDataCollector.rawDataCollectorByLabel_cfi
0115 rawDataCollector = EventFilter.RawDataCollector.rawDataCollectorByLabel_cfi.rawDataCollector.clone(
0116     verbose = 0,
0117     RawCollectionList = [
0118         'packCaloStage2',
0119         'packGtStage2',
0120         cms.InputTag('rawDataCollector', processName=cms.InputTag.skipCurrentProcess()),
0121         ]
0122     )
0123 
0124 
0125 SimL1EmulatorTask = cms.Task()
0126 stage2L1Trigger.toReplaceWith(SimL1EmulatorTask, cms.Task(unpackEcal,unpackHcal,unpackCSC,unpackDT,unpackRPC,unpackEmtf,unpackCsctf,unpackBmtf,unpackGtStage2
0127                                  ,SimL1EmulatorCoreTask,packCaloStage2
0128                                  ,packGtStage2,rawDataCollector))
0129 SimL1Emulator = cms.Sequence(SimL1EmulatorTask)