1 import FWCore.ParameterSet.Config
as cms
16 self.
vfe[name] = generator
34 self.
ntuple[name] = generator
36 def register_chain(self, vfe, concentrator, backend1, backend2, selector='', ntuple=''):
37 if not vfe
in self.
vfe:
38 raise KeyError(
'{} not registered as VFE producer'.
format(vfe))
40 raise KeyError(
'{} not registered as concentrator producer'.
format(concentrator))
42 raise KeyError(
'{} not registered as backend1 producer'.
format(backend1))
44 raise KeyError(
'{} not registered as backend2 producer'.
format(backend2))
45 if selector!=
'' and not selector
in self.
selector:
46 raise KeyError(
'{} not registered as selector'.
format(selector))
47 if ntuple!=
'' and not ntuple
in self.
ntuple:
48 raise KeyError(
'{} not registered as ntuplizer'.
format(ntuple))
49 self.
chain.
append( (vfe, concentrator, backend1, backend2, selector, ntuple) )
52 if not vfe
in self.
vfe:
53 raise KeyError(
'{} not registered as VFE producer'.
format(vfe))
55 raise KeyError(
'{} not registered as truth producer'.
format(truth_prod))
56 if backend1!=
'' and not backend1
in self.
backend1:
57 raise KeyError(
'{} not registered as backend1 producer'.
format(backend1))
58 if backend2!=
'' and not backend2
in self.
backend2:
59 raise KeyError(
'{} not registered as backend2 producer'.
format(backend2))
60 if selector!=
'' and not selector
in self.
selector:
61 raise KeyError(
'{} not registered as selector'.
format(selector))
62 if ntuple!=
'' and not ntuple
in self.
ntuple:
63 raise KeyError(
'{} not registered as ntuplizer'.
format(ntuple))
64 self.
truth_chain.
append( (vfe, truth_prod, backend1, backend2, selector, ntuple) )
67 if not hasattr(process,
'hgcalTriggerSelector'):
68 process.load(
'L1Trigger.L1THGCalUtilities.HGC3DClusterGenMatchSelector_cff')
69 tmp = cms.TaskPlaceholder(
"tmp")
70 tmpseq = cms.SequencePlaceholder(
"tmp")
71 vfe_task = cms.Task(tmp)
72 concentrator_task = cms.Task(tmp)
73 backend1_task = cms.Task(tmp)
74 backend2_task = cms.Task(tmp)
75 selector_sequence = cms.Sequence(tmpseq)
76 ntuple_sequence = cms.Sequence(tmpseq)
77 for vfe,concentrator,backend1,backend2,selector,ntuple
in self.
chain:
78 concentrator_name =
'{0}{1}'.
format(vfe, concentrator)
79 backend1_name =
'{0}{1}{2}'.
format(vfe, concentrator, backend1)
80 backend2_name =
'{0}{1}{2}{3}'.
format(vfe, concentrator, backend1, backend2)
81 selector_name =
'{0}{1}{2}{3}{4}'.
format(vfe, concentrator, backend1, backend2, selector)
82 ntuple_name =
'{0}{1}{2}{3}{4}{5}'.
format(vfe, concentrator, backend1, backend2, selector, ntuple)
85 concentrator_name+
':HGCalConcentratorProcessorSelection',
86 backend1_name+
':HGCalBackendLayer1Processor2DClustering',
87 backend2_name+
':HGCalBackendLayer2Processor3DClustering'
91 concentrator_name+
':HGCalConcentratorProcessorSelection',
92 backend1_name+
':HGCalBackendLayer1Processor2DClustering',
94 if not hasattr(process, vfe):
95 setattr(process, vfe, self.
vfe[vfe](process))
96 vfe_task.add(getattr(process, vfe))
97 if not hasattr(process, concentrator_name):
98 setattr(process, concentrator_name, self.
concentrator[concentrator](process, vfe))
99 concentrator_task.add(getattr(process, concentrator_name))
100 if not hasattr(process, backend1_name):
101 setattr(process, backend1_name, self.
backend1[backend1](process, concentrator_name))
102 backend1_task.add(getattr(process, backend1_name))
103 if not hasattr(process, backend2_name):
104 setattr(process, backend2_name, self.
backend2[backend2](process, backend1_name))
105 backend2_task.add(getattr(process, backend2_name))
106 if selector!=
'' and not hasattr(process, selector_name):
107 setattr(process, selector_name, self.
selector[selector](process, backend2_name))
108 selector_sequence *= getattr(process, selector_name)
109 if ntuple!=
'' and not hasattr(process, ntuple_name):
110 setattr(process, ntuple_name, self.
ntuple[ntuple](process, ntuple_inputs))
111 ntuple_sequence *= getattr(process, ntuple_name)
113 concentrator_task.remove(tmp)
114 backend1_task.remove(tmp)
115 backend2_task.remove(tmp)
116 selector_sequence.remove(tmpseq)
117 ntuple_sequence.remove(tmpseq)
118 process.globalReplace(
'hgcalVFE', vfe_task)
119 process.globalReplace(
'hgcalConcentrator', concentrator_task)
120 process.globalReplace(
'hgcalBackEndLayer1', backend1_task)
121 process.globalReplace(
'hgcalBackEndLayer2', backend2_task)
122 process.globalReplace(
'hgcalTriggerSelector', selector_sequence)
123 process.globalReplace(
'hgcalTriggerNtuples', ntuple_sequence)
127 if not hasattr(process,
'caloTruthCellsProducer'):
128 from L1Trigger.L1THGCalUtilities.caloTruthCellsProducer_cfi
import caloTruthCellsProducer
129 process.load(
'L1Trigger.L1THGCalUtilities.caloTruthCells_cff')
130 process.truthCellsProd = cms.Task(caloTruthCellsProducer)
131 hgcalTriggerPrimitivesTask = cms.Task(process.hgcalVFE, process.truthCellsProd, process.hgcalBackEndLayer1, process.hgcalBackEndLayer2, process.hgcalTowerMap, process.hgcalTower)
132 process.hgcalTriggerPrimitivesTruth = cms.Sequence(hgcalTriggerPrimitivesTask)
133 if not hasattr(process,
'hgcalTriggerSelector'):
134 process.load(
'L1Trigger.L1THGCalUtilities.HGC3DClusterGenMatchSelector_cff')
135 tmp = cms.TaskPlaceholder(
"tmp")
136 tmpseq = cms.SequencePlaceholder(
"tmp")
137 vfe_task = cms.Task(tmp)
138 truth_prod_task = cms.Task(tmp)
139 backend1_task = cms.Task(tmp)
140 backend2_task = cms.Task(tmp)
141 selector_sequence = cms.Sequence(tmpseq)
142 ntuple_sequence = cms.Sequence(tmpseq)
143 for vfe,truth_prod,backend1,backend2,selector,ntuple
in self.
truth_chain:
144 truth_prod_name =
'{0}{1}'.
format(vfe, truth_prod)
145 backend1_name = truth_prod_name +
'{0}'.
format(backend1)
146 backend2_name = backend1_name +
'{0}'.
format(backend2)
147 selector_name = backend2_name +
'{0}'.
format(selector)
148 ntuple_name = selector_name +
'{0}'.
format(ntuple)
160 backend1_name+
':HGCalBackendLayer1Processor2DClustering',
166 backend1_name+
':HGCalBackendLayer1Processor2DClustering',
167 backend2_name+
':HGCalBackendLayer2Processor3DClustering'
172 backend1_name+
':HGCalBackendLayer1Processor2DClustering',
176 if not hasattr(process, vfe):
177 setattr(process, vfe, self.
vfe[vfe](process))
178 vfe_task.add(getattr(process, vfe))
179 if not hasattr(process, truth_prod_name):
180 setattr(process, truth_prod_name, self.
truth_prod[truth_prod](process, vfe))
181 truth_prod_task.add(getattr(process, truth_prod_name))
182 if not hasattr(process, backend1_name):
183 setattr(process, backend1_name, self.
backend1[backend1](process, truth_prod_name))
184 backend1_task.add(getattr(process, backend1_name))
185 if backend2!=
'' and not hasattr(process, backend2_name):
186 setattr(process, backend2_name, self.
backend2[backend2](process, backend1_name))
187 backend2_task.add(getattr(process, backend2_name))
188 if selector!=
'' and not hasattr(process, selector_name):
189 setattr(process, selector_name, self.
selector[selector](process, backend2_name))
190 selector_sequence *= getattr(process, selector_name)
191 if ntuple!=
'' and not hasattr(process, ntuple_name):
192 setattr(process, ntuple_name, self.
ntuple[ntuple](process, ntuple_inputs))
193 ntuple_sequence *= getattr(process, ntuple_name)
195 truth_prod_task.remove(tmp)
196 backend1_task.remove(tmp)
197 backend2_task.remove(tmp)
198 selector_sequence.remove(tmpseq)
199 ntuple_sequence.remove(tmpseq)
200 process.globalReplace(
'hgcalVFE', vfe_task)
201 process.globalReplace(
'truthCellsProd', truth_prod_task)
202 process.globalReplace(
'hgcalBackEndLayer1', backend1_task)
203 process.globalReplace(
'hgcalBackEndLayer2', backend2_task)
204 process.globalReplace(
'hgcalTriggerSelector', selector_sequence)
205 process.globalReplace(
'hgcalTriggerNtuples', ntuple_sequence)