1 import FWCore.ParameterSet.Config
as cms
14 self.
vfe[name] = generator
29 self.
ntuple[name] = generator
31 def register_chain(self, vfe, concentrator, backend1, backend2, selector='', ntuple=''):
32 if not vfe
in self.
vfe:
33 raise KeyError(
'{} not registered as VFE producer'.
format(vfe))
35 raise KeyError(
'{} not registered as concentrator producer'.
format(concentrator))
37 raise KeyError(
'{} not registered as backend1 producer'.
format(backend1))
39 raise KeyError(
'{} not registered as backend2 producer'.
format(backend2))
40 if selector!=
'' and not selector
in self.
selector:
41 raise KeyError(
'{} not registered as selector'.
format(selector))
42 if ntuple!=
'' and not ntuple
in self.
ntuple:
43 raise KeyError(
'{} not registered as ntuplizer'.
format(ntuple))
44 self.chain.append( (vfe, concentrator, backend1, backend2, selector, ntuple) )
48 if not hasattr(process,
'hgcalTriggerSelector'):
49 process.load(
'L1Trigger.L1THGCalUtilities.HGC3DClusterGenMatchSelector_cff')
50 tmp = cms.TaskPlaceholder(
"tmp")
51 tmpseq = cms.SequencePlaceholder(
"tmp")
52 vfe_task = cms.Task(tmp)
53 concentrator_task = cms.Task(tmp)
54 backend1_task = cms.Task(tmp)
55 backend2_task = cms.Task(tmp)
56 selector_sequence = cms.Sequence(tmpseq)
57 ntuple_sequence = cms.Sequence(tmpseq)
58 for vfe,concentrator,backend1,backend2,selector,ntuple
in self.
chain:
59 concentrator_name =
'{0}{1}'.
format(vfe, concentrator)
60 backend1_name =
'{0}{1}{2}'.
format(vfe, concentrator, backend1)
61 backend2_name =
'{0}{1}{2}{3}'.
format(vfe, concentrator, backend1, backend2)
62 selector_name =
'{0}{1}{2}{3}{4}'.
format(vfe, concentrator, backend1, backend2, selector)
63 ntuple_name =
'{0}{1}{2}{3}{4}{5}'.
format(vfe, concentrator, backend1, backend2, selector, ntuple)
66 concentrator_name+
':HGCalConcentratorProcessorSelection',
67 backend1_name+
':HGCalBackendLayer1Processor2DClustering',
68 backend2_name+
':HGCalBackendLayer2Processor3DClustering' 72 concentrator_name+
':HGCalConcentratorProcessorSelection',
73 backend1_name+
':HGCalBackendLayer1Processor2DClustering',
75 if not hasattr(process, vfe):
76 setattr(process, vfe, self.
vfe[vfe](process))
77 vfe_task.add(getattr(process, vfe))
78 if not hasattr(process, concentrator_name):
79 setattr(process, concentrator_name, self.
concentrator[concentrator](process, vfe))
80 concentrator_task.add(getattr(process, concentrator_name))
81 if not hasattr(process, backend1_name):
82 setattr(process, backend1_name, self.
backend1[backend1](process, concentrator_name))
83 backend1_task.add(getattr(process, backend1_name))
84 if not hasattr(process, backend2_name):
85 setattr(process, backend2_name, self.
backend2[backend2](process, backend1_name))
86 backend2_task.add(getattr(process, backend2_name))
87 if selector!=
'' and not hasattr(process, selector_name):
88 setattr(process, selector_name, self.
selector[selector](process, backend2_name))
89 selector_sequence *= getattr(process, selector_name)
90 if ntuple!=
'' and not hasattr(process, ntuple_name):
91 setattr(process, ntuple_name, self.
ntuple[ntuple](process, ntuple_inputs))
92 ntuple_sequence *= getattr(process, ntuple_name)
94 concentrator_task.remove(tmp)
95 backend1_task.remove(tmp)
96 backend2_task.remove(tmp)
97 selector_sequence.remove(tmpseq)
98 ntuple_sequence.remove(tmpseq)
99 process.globalReplace(
'hgcalVFE', vfe_task)
100 process.globalReplace(
'hgcalConcentrator', concentrator_task)
101 process.globalReplace(
'hgcalBackEndLayer1', backend1_task)
102 process.globalReplace(
'hgcalBackEndLayer2', backend2_task)
103 process.globalReplace(
'hgcalTriggerSelector', selector_sequence)
104 process.globalReplace(
'hgcalTriggerNtuples', ntuple_sequence)
def register_vfe(self, name, generator)
def register_ntuple(self, name, generator)
def register_backend1(self, name, generator)
def create_sequences(self, process)
def register_selector(self, name, generator)
def register_chain(self, vfe, concentrator, backend1, backend2, selector='', ntuple='')
def register_concentrator(self, name, generator)
def register_backend2(self, name, generator)