test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
customise_ReEmulateL1_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 from Configuration.StandardSequences.Eras import eras
4 
5 # this function expects an incomplete list of subsystems to emulate
6 # and returns a complete list, to ensure all required subsystems are emulated
8 
9  if not eras.stage2L1Trigger.isChosen():
10  if 'ECAL' in subsys:
11  subsys.append('RCT')
12  if 'HCAL' in subsys:
13  subsys.append('RCT')
14  if 'RCT' in subsys:
15  subsys.append('GCT')
16  if 'GCT' in subsys:
17  subsys.append('GT')
18  if 'CSC' in subsys:
19  subsys.append('CSCTF1')
20  if 'DT' in subsys:
21  subsys.append('DTTF')
22  if 'DTTF' in subsys:
23  subsys.append('CSCTF2')
24  subsys.append('GMT')
25  if 'CSCTF' in subsys:
26  subsys.append('CSCTF1')
27  subsys.append('CSCTF2')
28  subsys.append('GMT')
29  if 'CSCTF2' in subsys:
30  subsys.append('GMT')
31  if 'RPCTF' in subsys:
32  subsys.append('GMT')
33  if 'GMT' in subsys:
34  subsys.append('GT')
35 
36  if eras.stage1L1Trigger.isChosen():
37  if 'ECAL' in subsys:
38  subsys.append('RCT')
39  if 'HCAL' in subsys:
40  subsys.append('RCT')
41  if 'RCT' in subsys:
42  subsys.append('S1CALOL2')
43  if 'S1CALOL2' in subsys:
44  subsys.append('GT')
45  if 'CSC' in subsys:
46  subsys.append('CSCTF1')
47  if 'DT' in subsys:
48  subsys.append('DTTF')
49  if 'DTTF' in subsys:
50  subsys.append('CSCTF2')
51  subsys.append('GMT')
52  if 'CSCTF' in subsys:
53  subsys.append('CSCTF1')
54  subsys.append('CSCTF2')
55  subsys.append('GMT')
56  if 'CSCTF2' in subsys:
57  subsys.append('GMT')
58  if 'RPCTF' in subsys:
59  subsys.append('GMT')
60  if 'GMT' in subsys:
61  subsys.append('GT')
62 
63  if eras.stage2L1Trigger.isChosen():
64  if 'ECAL' in subsys:
65  subsys.append('CALOL1')
66  if 'HCAL' in subsys:
67  subsys.append('CALOL1')
68  if 'CALOL1' in subsys:
69  subsys.append('CALOL2')
70  if 'CALOL2' in subsys:
71  subsys.append('GT')
72  if 'CSC' in subsys:
73  subsys.append('EMTF')
74  subsys.append('OMTF')
75  if 'DT' in subsys:
76  subsys.append('BMTF')
77  subsys.append('OMTF')
78  if 'RPC' in subsys:
79  subsys.append('BMTF')
80  subsys.append('EMTF')
81  subsys.append('OMTF')
82  if 'BMTF' in subsys:
83  subsys.append('GMT')
84  if 'EMTF' in subsys:
85  subsys.append('GMT')
86  if 'OMTF' in subsys:
87  subsys.append('GMT')
88  if 'GMT' in subsys:
89  subsys.append('GT')
90 
91  out = []
92  for sys in subsys:
93  if sys not in out:
94  out.append(sys)
95 
96  return out
97 
98 
99 # this method sets the input tags of each system to be emulated
100 # depending on whether the upstream system is set to be emulated or not
101 # assumption is starting from RAW, not (SIM)DIGI !
102 # if starting from (SIM)DIGI, no changes in input tags required
103 def setInputTags(process, subsys):
104 
105  if 'ECAL' in subsys:
106  process.simEcalTriggerPrimitiveDigis.inputLabel = cms.InputTag( 'ecalDigis' )
107 
108  if 'HCAL' in subsys:
109  process.simHcalTriggerPrimitiveDigis.inputLabel = cms.InputTag( 'hcalDigis' )
110 
111  if 'RCT' in subsys:
112  if 'ECAL' not in subsys:
113  process.simRctDigis.ecalDigis = cms.VInputTag( cms.InputTag( 'ecalDigis:ECALTriggerPrimitives' ) )
114  if 'HCAL' not in subsys:
115  process.simRctDigis.ecalDigis = cms.VInputTag( cms.InputTag( 'hcalDigis' ) )
116 
117  if ('GCT' in subsys) and ('RCT' not in subsys):
118  process.simGctDigis.inputLabel = 'gctDigis'
119 
120  if 'DT' in subsys:
121  process.simDtTriggerPrimitiveDigis.digiTag = 'muonDTDigis'
122 
123  if 'CSC' in subsys:
124  process.simCscTriggerPrimitiveDigis.CSCComparatorDigiProducer = cms.InputTag( 'muonCSCDigis', 'MuonCSCComparatorDigi' )
125  process.simCscTriggerPrimitiveDigis.CSCWireDigiProducer = cms.InputTag( 'muonCSCDigis', 'MuonCSCWireDigi' )
126 
127  if 'DTTF' in subsys:
128  if 'DT' not in subsys:
129  process.simDttfDigis.DTDigi_Source = 'dtTriggerPrimitiveDigis'
130  if 'CSCTF1' not in subsys:
131  process.simDttfDigis.CSCStub_Source = 'csctfDigis'
132 
133  if 'CSCTF1' in subsys:
134  if 'CSC' not in subsys:
135  process.simCsctfTrackDigis.SectorReceiverInput = cms.untracked.InputTag( 'cscTriggerPrimitiveDigis', 'MPCSORTED' )
136  if 'DT' not in subsys:
137  process.simCsctfTrackDigis.DTproducer = 'dtTriggerPrimitiveDigis'
138 
139  if 'CSCTF2' in subsys and 'CSCTF1' not in subsys:
140  process.simCsctfDigis.CSCTrackProducer = 'csctfDigis'
141 
142  if 'RPCTF' in subsys:
143  process.simRpcTriggerDigis.label = 'muonRPCDigis'
144 
145  if 'GMT' in subsys:
146  if 'DTTF' not in subsys:
147  process.simGmtDigis.DTCandidates = cms.InputTag( 'dttfDigis', 'DT' )
148  if 'CSCTF2' not in subsys:
149  process.simGmtDigis.CSCCandidates = cms.InputTag( 'csctfDigis', 'CSC' )
150  if 'RPCTF' not in subsys:
151  process.simGmtDigis.RPCbCandidates = cms.InputTag( 'rpcTriggerDigis', 'RPCb' )
152  process.simGmtDigis.RPCfCandidates = cms.InputTag( 'rpcTriggerDigis', 'RPCf' )
153 
154  if 'S1CALOL2' in subsys:
155  if 'RCT' not in subsys:
156  process.simRctUpgradeFormatDigis.regionTag = cms.InputTag("caloStage1Digis")
157  process.simRctUpgradeFormatDigis.emTag = cms.InputTag("caloStage1Digis")
158 
159  if 'CALOL1' in subsys:
160  if 'ECAL' not in subsys:
161  process.ecalToken = cms.InputTag("ecalDigis:EcalTriggerPrimitiveDigis")
162  if 'HCAL' not in subsys:
163  process.hcalToken = cms.InputTag("hcalDigis")
164 
165  if 'CALOL2' in subsys:
166  if 'CALOL1' not in subsys:
167  process.simCaloStage2Digis.towerToken = cms.InputTag("caloStage2Digis", "CaloTower")
168 
169 
170 def modifySimL1EmulatorForReEmulation(SimL1Emulator_object, subsys=[]):
171 
172  if not eras.stage2L1Trigger.isChosen():
173 # if 'ECAL' not in subsys:
174 # digiSeq_object.remove(simEcalTriggerPrimitiveDigis)
175 # if 'HCAL' not in subsys:
176 # digiSeq_object.remove(simHcalTriggerPrimitiveDigis)
177  if 'RCT' not in subsys:
178  SimL1Emulator_object.remove(simRctDigis)
179  if 'GCT' not in subsys:
180  SimL1Emulator_object.remove(simGctDigis)
181  if 'CSC' not in subsys:
182  SimL1Emulator_object.remove(simCscTriggerPrimitiveDigis)
183  if 'DT' not in subsys:
184  SimL1Emulator_object.remove(simDtTriggerPrimitiveDigis)
185  if 'CSCTF1' not in subsys:
186  SimL1Emulator_object.remove(simCsctfTrackDigis)
187  if 'CSCTF2' not in subsys:
188  SimL1Emulator_object.remove(simCsctfDigis)
189  if 'DTTF' not in subsys:
190  SimL1Emulator_object.remove(simDttfDigis)
191  if 'RPCTF' not in subsys:
192  SimL1Emulator_object.remove(simRpcTriggerDigis)
193  if 'GMT' not in subsys:
194  SimL1Emulator_object.remove(simGmtDigis)
195  if 'GT' not in subsys:
196  SimL1Emulator_object.remove(simGtDigis)
197 
198  if eras.stage1L1Trigger.isChosen():
199  if 'S1CALOL2' not in subsys:
200  SimL1Emulator_object.remove(simRctUpgradeFormatDigis)
201  SimL1Emulator_object.remove(simCaloStage1Digis)
202  SimL1Emulator_object.remove(simCaloStage1FinalDigis)
203  SimL1Emulator_object.remove(simCaloStage1LegacyFormatDigis)
204 
205  if eras.stage1L1Trigger.isChosen():
206  if 'CALOL1' not in subsys:
207  SimL1Emulator_object.remove(simCaloStage2Layer1Digis)
208  if 'CALOL2' not in subsys:
209  SimL1Emulator_object.remove(simCaloStage2Digis)
210 
211 
212 def customise_ReEmulateL1(process, subsys=[]):
213 
214  subsysFull = getSubsystemsToEmulate(subsys)
215 
216  modifySimL1EmulatorForReEmulation(process.SimL1Emulator, subsysFull)
217 
218 
219 
220 def test():
221  print "Testing"
222  test = ['ECAL', 'DTTF']
223  print "Subsys in : ", test
224  print "Subsys out : ", getSubsystemsToEmulate(test, 'legacy')
225  test = ['ECAL', 'BMTF']
226  print "Subsys in : ", test
227  print "Subsys out : ", getSubsystemsToEmulate(test, 'stage2')