-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathSimL1EmulatorRepack_Full_cff.py
172 lines (134 loc) · 7.79 KB
/
SimL1EmulatorRepack_Full_cff.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
from __future__ import print_function
import FWCore.ParameterSet.Config as cms
## L1REPACK FULL: Re-Emulate all of L1 and repack into RAW
from Configuration.Eras.Modifier_stage2L1Trigger_cff import stage2L1Trigger
from Configuration.Eras.Modifier_stage2L1Trigger_2017_cff import stage2L1Trigger_2017
from Configuration.Eras.Modifier_run3_GEM_cff import run3_GEM
def _print(ignored):
print("# L1T WARN: L1REPACK:Full (intended for 2016 data) only supports Stage 2 eras for now.")
print("# L1T WARN: Use a legacy version of L1REPACK for now.")
stage2L1Trigger.toModify(None, _print)
(~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."))
# First, Unpack all inputs to L1:
import EventFilter.OnlineMetaDataRawToDigi.tcdsRawToDigi_cfi
unpackTcds = EventFilter.OnlineMetaDataRawToDigi.tcdsRawToDigi_cfi.tcdsRawToDigi.clone(
InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
import EventFilter.L1TRawToDigi.bmtfDigis_cfi
unpackBmtf = EventFilter.L1TRawToDigi.bmtfDigis_cfi.bmtfDigis.clone(
InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
import EventFilter.DTTFRawToDigi.dttfunpacker_cfi
unpackDttf = EventFilter.DTTFRawToDigi.dttfunpacker_cfi.dttfunpacker.clone(
DTTF_FED_Source = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
import EventFilter.L1TRawToDigi.omtfStage2Digis_cfi
unpackOmtf = EventFilter.L1TRawToDigi.omtfStage2Digis_cfi.omtfStage2Digis.clone(
inputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
import EventFilter.L1TRawToDigi.emtfStage2Digis_cfi
unpackEmtf = EventFilter.L1TRawToDigi.emtfStage2Digis_cfi.emtfStage2Digis.clone(
InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
import EventFilter.CSCTFRawToDigi.csctfunpacker_cfi
unpackCsctf = EventFilter.CSCTFRawToDigi.csctfunpacker_cfi.csctfunpacker.clone(
producer = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
import EventFilter.CSCRawToDigi.cscUnpacker_cfi
unpackCSC = EventFilter.CSCRawToDigi.cscUnpacker_cfi.muonCSCDigis.clone(
InputObjects = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
import EventFilter.DTRawToDigi.dtunpacker_cfi
unpackDT = EventFilter.DTRawToDigi.dtunpacker_cfi.muonDTDigis.clone(
inputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
import EventFilter.RPCRawToDigi.rpcUnpacker_cfi
unpackRPC = EventFilter.RPCRawToDigi.rpcUnpacker_cfi.rpcunpacker.clone(
InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
import EventFilter.RPCRawToDigi.rpcTwinMuxRawToDigi_cfi
unpackRPCTwinMux = EventFilter.RPCRawToDigi.rpcTwinMuxRawToDigi_cfi.rpcTwinMuxRawToDigi.clone(
inputTag = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
import EventFilter.L1TXRawToDigi.twinMuxStage2Digis_cfi
unpackTwinMux = EventFilter.L1TXRawToDigi.twinMuxStage2Digis_cfi.twinMuxStage2Digis.clone(
DTTM7_FED_Source = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
import EventFilter.GEMRawToDigi.muonGEMDigis_cfi
unpackGEM = EventFilter.GEMRawToDigi.muonGEMDigis_cfi.muonGEMDigis.clone(
InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
import EventFilter.EcalRawToDigi.EcalUnpackerData_cfi
unpackEcal = EventFilter.EcalRawToDigi.EcalUnpackerData_cfi.ecalEBunpacker.clone(
InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
import EventFilter.HcalRawToDigi.HcalRawToDigi_cfi
unpackHcal = EventFilter.HcalRawToDigi.HcalRawToDigi_cfi.hcalDigis.clone(
InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
import EventFilter.L1TXRawToDigi.caloLayer1Stage2Digis_cfi
unpackLayer1 = EventFilter.L1TXRawToDigi.caloLayer1Stage2Digis_cfi.l1tCaloLayer1Digis.clone(
fedRawDataLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
# Second, Re-Emulate the entire L1T
from SimCalorimetry.HcalTrigPrimProducers.hcaltpdigi_cff import *
simHcalTriggerPrimitiveDigis.inputLabel = [
'unpackHcal',
'unpackHcal'
]
simHcalTriggerPrimitiveDigis.inputUpgradeLabel = [
'unpackHcal', # upgrade HBHE
'unpackHcal' # upgrade HF
]
from L1Trigger.Configuration.SimL1Emulator_cff import *
simDtTriggerPrimitiveDigis.digiTag = 'unpackDT'
simCscTriggerPrimitiveDigis.CSCComparatorDigiProducer = 'unpackCSC:MuonCSCComparatorDigi'
simCscTriggerPrimitiveDigis.CSCWireDigiProducer = 'unpackCSC:MuonCSCWireDigi'
simTwinMuxDigis.RPC_Source = 'unpackRPCTwinMux'
simTwinMuxDigis.DTDigi_Source = "unpackTwinMux:PhIn"
simTwinMuxDigis.DTThetaDigi_Source = "unpackTwinMux:ThIn"
run3_GEM.toModify(simMuonGEMPadDigis,
InputCollection = 'unpackGEM'
)
# -----------------------------------------------------------
# change when availalbe simTwinMux and reliable DTTPs, CSCTPs
cutlist=['simDtTriggerPrimitiveDigis','simCscTriggerPrimitiveDigis']
for b in cutlist:
SimL1EmulatorCore.remove(b)
# -----------------------------------------------------------
# BMTF
simBmtfDigis.DTDigi_Source = "simTwinMuxDigis"
simBmtfDigis.DTDigi_Theta_Source = "unpackBmtf"
# OMTF
simOmtfDigis.srcRPC = 'unpackRPC'
simOmtfDigis.srcDTPh = "unpackBmtf"
simOmtfDigis.srcDTTh = "unpackBmtf"
simOmtfDigis.srcCSC = "unpackCsctf"
stage2L1Trigger_2017.toModify(simOmtfDigis,
srcRPC = 'unpackOmtf',
srcCSC = 'unpackOmtf',
srcDTPh = 'unpackOmtf',
srcDTTh = 'unpackOmtf'
)
# EMTF
simEmtfDigis.CSCInput = "unpackEmtf"
simEmtfDigis.RPCInput = 'unpackRPC'
simCaloStage2Layer1Digis.ecalToken = 'unpackEcal:EcalTriggerPrimitives'
simCaloStage2Layer1Digis.hcalToken = 'unpackLayer1'
## GT
stage2L1Trigger_2017.toModify(simGtExtFakeStage2Digis,
tcdsRecordLabel= cms.InputTag("unpackTcds","tcdsRecord")
)
stage2L1Trigger.toModify(simGtExtFakeStage2Digis,
tcdsRecordLabel= cms.InputTag("unpackTcds","tcdsRecord")
)
# Finally, pack the new L1T output back into RAW
from EventFilter.L1TRawToDigi.caloStage2Raw_cfi import caloStage2Raw as packCaloStage2
from EventFilter.L1TRawToDigi.gmtStage2Raw_cfi import gmtStage2Raw as packGmtStage2
from EventFilter.L1TRawToDigi.gtStage2Raw_cfi import gtStage2Raw as packGtStage2
# combine the new L1 RAW with existing RAW for other FEDs
import EventFilter.RawDataCollector.rawDataCollectorByLabel_cfi
rawDataCollector = EventFilter.RawDataCollector.rawDataCollectorByLabel_cfi.rawDataCollector.clone(
verbose = 0,
RawCollectionList = [
'packCaloStage2',
'packGmtStage2',
'packGtStage2',
cms.InputTag('rawDataCollector', processName=cms.InputTag.skipCurrentProcess()),
]
)
SimL1EmulatorTask = cms.Task()
stage2L1Trigger.toReplaceWith(SimL1EmulatorTask, cms.Task(unpackEcal,unpackHcal,unpackCSC,unpackDT,unpackRPC,unpackRPCTwinMux,unpackTwinMux,unpackOmtf,unpackEmtf,unpackCsctf,unpackBmtf
,unpackLayer1
,unpackTcds
,SimL1EmulatorCoreTask,packCaloStage2
,packGmtStage2,packGtStage2,rawDataCollector))
_SimL1EmulatorTaskWithGEM = SimL1EmulatorTask.copy()
_SimL1EmulatorTaskWithGEM.add(unpackGEM)
(stage2L1Trigger & run3_GEM).toReplaceWith(SimL1EmulatorTask, _SimL1EmulatorTaskWithGEM)
SimL1Emulator = cms.Sequence(SimL1EmulatorTask)