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)
83 if not hasattr(process, vfe):
84 setattr(process, vfe, self.
vfe[vfe](process))
85 vfe_task.add(getattr(process, vfe))
86 if not hasattr(process, concentrator_name):
87 vfe_processor = getattr(process, vfe).ProcessorParameters.ProcessorName.value()
88 setattr(process, concentrator_name, self.
concentrator[concentrator](process, vfe+
':'+vfe_processor))
89 concentrator_task.add(getattr(process, concentrator_name))
90 if not hasattr(process, backend1_name):
91 concentrator_processor = getattr(process, concentrator_name).ProcessorParameters.ProcessorName.value()
92 setattr(process, backend1_name, self.
backend1[backend1](process, concentrator_name+
':'+concentrator_processor))
93 backend1_task.add(getattr(process, backend1_name))
94 if not hasattr(process, backend2_name):
95 backend1_processor = getattr(process, backend1_name).ProcessorParameters.ProcessorName.value()
96 setattr(process, backend2_name, self.
backend2[backend2](process, backend1_name+
':'+backend1_processor))
97 backend2_task.add(getattr(process, backend2_name))
98 if selector!=
'' and not hasattr(process, selector_name):
99 backend2_processor = getattr(process, backend2_name).ProcessorParameters.ProcessorName.value()
100 setattr(process, selector_name, self.
selector[selector](process, backend2_name+
':'+backend2_processor))
101 selector_sequence *= getattr(process, selector_name)
105 concentrator_name+
':'+getattr(process, concentrator_name).ProcessorParameters.ProcessorName.value(),
106 backend1_name+
':'+getattr(process, backend1_name).ProcessorParameters.ProcessorName.value(),
107 backend2_name+
':'+getattr(process, backend2_name).ProcessorParameters.ProcessorName.value()
111 concentrator_name+
':'+getattr(process, concentrator_name).ProcessorParameters.ProcessorName.value(),
112 backend1_name+
':'+getattr(process, backend1_name).ProcessorParameters.ProcessorName.value(),
115 if ntuple!=
'' and not hasattr(process, ntuple_name):
116 setattr(process, ntuple_name, self.
ntuple[ntuple](process, ntuple_inputs))
117 ntuple_sequence *= getattr(process, ntuple_name)
119 concentrator_task.remove(tmp)
120 backend1_task.remove(tmp)
121 backend2_task.remove(tmp)
122 selector_sequence.remove(tmpseq)
123 ntuple_sequence.remove(tmpseq)
124 process.globalReplace(
'hgcalVFE', vfe_task)
125 process.globalReplace(
'hgcalConcentrator', concentrator_task)
126 if 'HGCalBackendStage1Processor' in backend1_processor:
127 process.globalReplace(
'hgcalBackEndStage1', backend1_task)
128 process.globalReplace(
'hgcalBackEndStage2', backend2_task)
130 process.globalReplace(
'hgcalBackEndLayer1', backend1_task)
131 process.globalReplace(
'hgcalBackEndLayer2', backend2_task)
132 process.globalReplace(
'hgcalTriggerSelector', selector_sequence)
133 process.globalReplace(
'hgcalTriggerNtuples', ntuple_sequence)
137 if not hasattr(process,
'caloTruthCellsProducer'):
138 from L1Trigger.L1THGCalUtilities.caloTruthCellsProducer_cfi
import caloTruthCellsProducer
139 process.load(
'L1Trigger.L1THGCalUtilities.caloTruthCells_cff')
140 process.truthCellsProd = cms.Task(caloTruthCellsProducer)
141 hgcalTriggerPrimitivesTask = cms.Task(process.hgcalVFE, process.truthCellsProd, process.hgcalBackEndLayer1, process.hgcalBackEndLayer2, process.hgcalTowerMap, process.hgcalTower)
142 process.hgcalTriggerPrimitivesTruth = cms.Sequence(hgcalTriggerPrimitivesTask)
143 if not hasattr(process,
'hgcalTriggerSelector'):
144 process.load(
'L1Trigger.L1THGCalUtilities.HGC3DClusterGenMatchSelector_cff')
145 tmp = cms.TaskPlaceholder(
"tmp")
146 tmpseq = cms.SequencePlaceholder(
"tmp")
147 vfe_task = cms.Task(tmp)
148 truth_prod_task = cms.Task(tmp)
149 backend1_task = cms.Task(tmp)
150 backend2_task = cms.Task(tmp)
151 selector_sequence = cms.Sequence(tmpseq)
152 ntuple_sequence = cms.Sequence(tmpseq)
153 for vfe,truth_prod,backend1,backend2,selector,ntuple
in self.
truth_chain:
154 truth_prod_name =
'{0}{1}'.
format(vfe, truth_prod)
155 backend1_name = truth_prod_name +
'{0}'.
format(backend1)
156 backend2_name = backend1_name +
'{0}'.
format(backend2)
157 selector_name = backend2_name +
'{0}'.
format(selector)
158 ntuple_name = selector_name +
'{0}'.
format(ntuple)
170 backend1_name+
':HGCalBackendLayer1Processor2DClustering',
176 backend1_name+
':HGCalBackendLayer1Processor2DClustering',
177 backend2_name+
':HGCalBackendLayer2Processor3DClustering'
182 backend1_name+
':HGCalBackendLayer1Processor2DClustering',
186 if not hasattr(process, vfe):
187 setattr(process, vfe, self.
vfe[vfe](process))
188 vfe_task.add(getattr(process, vfe))
189 if not hasattr(process, truth_prod_name):
190 setattr(process, truth_prod_name, self.
truth_prod[truth_prod](process, vfe))
191 truth_prod_task.add(getattr(process, truth_prod_name))
192 if not hasattr(process, backend1_name):
193 setattr(process, backend1_name, self.
backend1[backend1](process, truth_prod_name))
194 backend1_task.add(getattr(process, backend1_name))
195 if backend2!=
'' and not hasattr(process, backend2_name):
196 setattr(process, backend2_name, self.
backend2[backend2](process, backend1_name))
197 backend2_task.add(getattr(process, backend2_name))
198 if selector!=
'' and not hasattr(process, selector_name):
199 setattr(process, selector_name, self.
selector[selector](process, backend2_name))
200 selector_sequence *= getattr(process, selector_name)
201 if ntuple!=
'' and not hasattr(process, ntuple_name):
202 setattr(process, ntuple_name, self.
ntuple[ntuple](process, ntuple_inputs))
203 ntuple_sequence *= getattr(process, ntuple_name)
205 truth_prod_task.remove(tmp)
206 backend1_task.remove(tmp)
207 backend2_task.remove(tmp)
208 selector_sequence.remove(tmpseq)
209 ntuple_sequence.remove(tmpseq)
210 process.globalReplace(
'hgcalVFE', vfe_task)
211 process.globalReplace(
'truthCellsProd', truth_prod_task)
212 process.globalReplace(
'hgcalBackEndLayer1', backend1_task)
213 process.globalReplace(
'hgcalBackEndLayer2', backend2_task)
214 process.globalReplace(
'hgcalTriggerSelector', selector_sequence)
215 process.globalReplace(
'hgcalTriggerNtuples', ntuple_sequence)
def register_concentrator
def create_truth_sequences