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:FullMC (intended for MC events with RAW eventcontent) 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:FullMC  will unpack Calorimetry and Muon L1T inputs, re-emulate L1T (Stage-2), and pack uGT, uGMT, and Calo Stage-2 output."))
0013 
0014 # First, Unpack all inputs to L1:
0015 
0016 import EventFilter.RPCRawToDigi.rpcUnpacker_cfi
0017 unpackRPC = EventFilter.RPCRawToDigi.rpcUnpacker_cfi.rpcunpacker.clone(
0018     InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0019 
0020 import EventFilter.DTRawToDigi.dtunpacker_cfi
0021 unpackDT = EventFilter.DTRawToDigi.dtunpacker_cfi.muonDTDigis.clone(
0022     inputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0023 
0024 import EventFilter.CSCRawToDigi.cscUnpacker_cfi
0025 unpackCSC = EventFilter.CSCRawToDigi.cscUnpacker_cfi.muonCSCDigis.clone(
0026     InputObjects = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0027 
0028 import EventFilter.EcalRawToDigi.EcalUnpackerData_cfi
0029 unpackEcal = EventFilter.EcalRawToDigi.EcalUnpackerData_cfi.ecalEBunpacker.clone(
0030     InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0031 
0032 import EventFilter.HcalRawToDigi.HcalRawToDigi_cfi
0033 unpackHcal = EventFilter.HcalRawToDigi.HcalRawToDigi_cfi.hcalDigis.clone(
0034     InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
0035 
0036 # Second, Re-Emulate the entire L1T
0037 #
0038 # Legacy trigger primitive emulations still running in 2016 trigger:
0039 #
0040 from SimCalorimetry.Configuration.SimCalorimetry_cff import *
0041 
0042 # Ecal TPs
0043 # cannot simulate EcalTPs, don't have EcalUnsuppressedDigis in RAW
0044 #     simEcalTriggerPrimitiveDigis.Label = 'unpackEcal'
0045 # further downstream, use unpacked EcalTPs
0046 
0047 # Hcal TPs
0048 simHcalTriggerPrimitiveDigis.inputLabel = [
0049     'unpackHcal',
0050     'unpackHcal'
0051 ]
0052 simHcalTriggerPrimitiveDigis.inputUpgradeLabel = [
0053     'unpackHcal',     # upgrade HBHE
0054     'unpackHcal'      # upgrade HF
0055 ]
0056 
0057 from L1Trigger.Configuration.SimL1Emulator_cff import *
0058 # DT TPs
0059 simDtTriggerPrimitiveDigis.digiTag                    = 'unpackDT'
0060 # CSC TPs
0061 simCscTriggerPrimitiveDigis.CSCComparatorDigiProducer = 'unpackCSC:MuonCSCComparatorDigi'
0062 simCscTriggerPrimitiveDigis.CSCWireDigiProducer       = 'unpackCSC:MuonCSCWireDigi'
0063 
0064 # TWIN-MUX
0065 simTwinMuxDigis.RPC_Source         = 'unpackRPC'
0066 simTwinMuxDigis.DTDigi_Source      = "simDtTriggerPrimitiveDigis"
0067 simTwinMuxDigis.DTThetaDigi_Source = "simDtTriggerPrimitiveDigis"
0068 
0069 # BMTF
0070 simBmtfDigis.DTDigi_Source       = "simTwinMuxDigis"
0071 simBmtfDigis.DTDigi_Theta_Source = "simDtTriggerPrimitiveDigis"
0072 
0073 # OMTF
0074 simOmtfDigis.srcRPC              = 'unpackRPC'
0075 simOmtfDigis.srcDTPh             = "simDtTriggerPrimitiveDigis"
0076 simOmtfDigis.srcDTTh             = "simDtTriggerPrimitiveDigis"
0077 simOmtfDigis.srcCSC              = 'simCscTriggerPrimitiveDigis:MPCSORTED'
0078 
0079 # EMTF
0080 simEmtfDigis.CSCInput            = 'simCscTriggerPrimitiveDigis:MPCSORTED'
0081 simEmtfDigis.RPCInput            = 'unpackRPC'
0082 
0083 # CALO Layer1
0084 simCaloStage2Layer1Digis.ecalToken = 'unpackEcal:EcalTriggerPrimitives'
0085 simCaloStage2Layer1Digis.hcalToken = 'simHcalTriggerPrimitiveDigis'
0086 
0087 # Finally, pack the new L1T output back into RAW
0088 from EventFilter.L1TRawToDigi.caloStage2Raw_cfi import caloStage2Raw as packCaloStage2
0089 from EventFilter.L1TRawToDigi.gmtStage2Raw_cfi import gmtStage2Raw as packGmtStage2
0090 from EventFilter.L1TRawToDigi.gtStage2Raw_cfi import gtStage2Raw as packGtStage2
0091 
0092 # combine the new L1 RAW with existing RAW for other FEDs
0093 import EventFilter.RawDataCollector.rawDataCollectorByLabel_cfi
0094 rawDataCollector = EventFilter.RawDataCollector.rawDataCollectorByLabel_cfi.rawDataCollector.clone(
0095     verbose = 0,
0096         RawCollectionList = [
0097             'packCaloStage2',
0098             'packGmtStage2',
0099             'packGtStage2',
0100             cms.InputTag('rawDataCollector', processName=cms.InputTag.skipCurrentProcess()),
0101         ]
0102     )
0103 
0104 SimL1EmulatorTask = cms.Task()
0105 stage2L1Trigger.toReplaceWith(SimL1EmulatorTask, cms.Task(unpackRPC
0106                                                           , unpackDT
0107                                                           , unpackCSC
0108                                                           , unpackEcal
0109                                                           , unpackHcal
0110                                                           #, simEcalTriggerPrimitiveDigis
0111                                                           , simHcalTriggerPrimitiveDigis
0112                                                           , SimL1EmulatorCoreTask
0113                                                           , packCaloStage2
0114                                                           , packGmtStage2
0115                                                           , packGtStage2
0116                                                           , rawDataCollector))
0117 SimL1Emulator = cms.Sequence(SimL1EmulatorTask)