CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes
hgcalTriggerChains.HGCalTriggerChains Class Reference

Public Member Functions

def __init__
 
def create_sequences
 
def create_truth_sequences
 
def register_backend1
 
def register_backend2
 
def register_chain
 
def register_concentrator
 
def register_ntuple
 
def register_selector
 
def register_truth_chain
 
def register_truth_prod
 
def register_vfe
 

Public Attributes

 backend1
 
 backend2
 
 chain
 
 concentrator
 
 ntuple
 
 selector
 
 truth_chain
 
 truth_prod
 
 vfe
 

Detailed Description

Definition at line 3 of file hgcalTriggerChains.py.

Constructor & Destructor Documentation

def hgcalTriggerChains.HGCalTriggerChains.__init__ (   self)

Member Function Documentation

def hgcalTriggerChains.HGCalTriggerChains.create_sequences (   self,
  process 
)

Definition at line 66 of file hgcalTriggerChains.py.

References hgcalTriggerChains.HGCalTriggerChains.backend1, hgcalTriggerChains.HGCalTriggerChains.backend2, hgcalTriggerChains.HGCalTriggerChains.chain, edm::FileLocator::Rule.chain, hgcalTriggerChains.HGCalTriggerChains.concentrator, hgcalTriggerChains.HGCalTriggerChains.ntuple, DTOccupancyTest.ntuple, DTOccupancyTestML.ntuple, hgcalTriggerChains.HGCalTriggerChains.selector, RawDataSelector.selector, BPHMultiSelectBase< T >::SelectElement.selector, BPHRecoBuilder::BPHRecoSource.selector, and hgcalTriggerChains.HGCalTriggerChains.vfe.

66 
67  def create_sequences(self, process):
68  if not hasattr(process, 'hgcalTriggerSelector'):
69  process.load('L1Trigger.L1THGCalUtilities.HGC3DClusterGenMatchSelector_cff')
70  tmp = cms.TaskPlaceholder("tmp")
71  tmpseq = cms.SequencePlaceholder("tmp")
72  vfe_task = cms.Task(tmp)
73  concentrator_task = cms.Task(tmp)
74  backend1_task = cms.Task(tmp)
75  backend2_task = cms.Task(tmp)
76  selector_sequence = cms.Sequence(tmpseq)
77  ntuple_sequence = cms.Sequence(tmpseq)
78  for vfe,concentrator,backend1,backend2,selector,ntuple in self.chain:
79  concentrator_name = '{0}{1}'.format(vfe, concentrator)
80  backend1_name = '{0}{1}{2}'.format(vfe, concentrator, backend1)
81  backend2_name = '{0}{1}{2}{3}'.format(vfe, concentrator, backend1, backend2)
82  selector_name = '{0}{1}{2}{3}{4}'.format(vfe, concentrator, backend1, backend2, selector)
83  ntuple_name = '{0}{1}{2}{3}{4}{5}'.format(vfe, concentrator, backend1, backend2, selector, ntuple)
84  if not hasattr(process, vfe):
85  setattr(process, vfe, self.vfe[vfe](process))
86  vfe_task.add(getattr(process, vfe))
87  if not hasattr(process, concentrator_name):
88  vfe_processor = getattr(process, vfe).ProcessorParameters.ProcessorName.value()
89  setattr(process, concentrator_name, self.concentrator[concentrator](process, vfe+':'+vfe_processor))
90  concentrator_task.add(getattr(process, concentrator_name))
91  if not hasattr(process, backend1_name):
92  concentrator_processor = getattr(process, concentrator_name).ProcessorParameters.ProcessorName.value()
93  setattr(process, backend1_name, self.backend1[backend1](process, concentrator_name+':'+concentrator_processor))
94  backend1_task.add(getattr(process, backend1_name))
95  if not hasattr(process, backend2_name):
96  backend1_processor = getattr(process, backend1_name).ProcessorParameters.ProcessorName.value()
97  setattr(process, backend2_name, self.backend2[backend2](process, backend1_name+':'+backend1_processor))
98  backend2_task.add(getattr(process, backend2_name))
99  if selector!='' and not hasattr(process, selector_name):
100  backend2_processor = getattr(process, backend2_name).ProcessorParameters.ProcessorName.value()
101  setattr(process, selector_name, self.selector[selector](process, backend2_name+':'+backend2_processor))
102  selector_sequence *= getattr(process, selector_name)
103 
104  if selector=='':
105  ntuple_inputs = [
106  concentrator_name+':'+getattr(process, concentrator_name).ProcessorParameters.ProcessorName.value(),
107  backend1_name+':'+getattr(process, backend1_name).ProcessorParameters.ProcessorName.value(),
108  backend2_name+':'+getattr(process, backend2_name).ProcessorParameters.ProcessorName.value()
109  ]
110  else:
111  ntuple_inputs = [
112  concentrator_name+':'+getattr(process, concentrator_name).ProcessorParameters.ProcessorName.value(),
113  backend1_name+':'+getattr(process, backend1_name).ProcessorParameters.ProcessorName.value(),
114  selector_name]
115 
116  if ntuple!='' and not hasattr(process, ntuple_name):
117  setattr(process, ntuple_name, self.ntuple[ntuple](process, ntuple_inputs))
118  ntuple_sequence *= getattr(process, ntuple_name)
119  vfe_task.remove(tmp)
120  concentrator_task.remove(tmp)
121  backend1_task.remove(tmp)
122  backend2_task.remove(tmp)
123  selector_sequence.remove(tmpseq)
124  ntuple_sequence.remove(tmpseq)
125  process.globalReplace('hgcalVFE', vfe_task)
126  process.globalReplace('hgcalConcentrator', concentrator_task)
127  if 'HGCalBackendStage1Processor' in backend1_processor:
128  process.globalReplace('hgcalBackEndStage1', backend1_task)
129  process.globalReplace('hgcalBackEndStage2', backend2_task)
130  else:
131  process.globalReplace('hgcalBackEndLayer1', backend1_task)
132  process.globalReplace('hgcalBackEndLayer2', backend2_task)
133  process.globalReplace('hgcalTriggerSelector', selector_sequence)
134  process.globalReplace('hgcalTriggerNtuples', ntuple_sequence)
135  return process
def hgcalTriggerChains.HGCalTriggerChains.create_truth_sequences (   self,
  process 
)

Definition at line 136 of file hgcalTriggerChains.py.

References hgcalTriggerChains.HGCalTriggerChains.backend1, hgcalTriggerChains.HGCalTriggerChains.backend2, hgcalTriggerChains.HGCalTriggerChains.ntuple, DTOccupancyTest.ntuple, DTOccupancyTestML.ntuple, hgcalTriggerChains.HGCalTriggerChains.selector, RawDataSelector.selector, BPHMultiSelectBase< T >::SelectElement.selector, BPHRecoBuilder::BPHRecoSource.selector, hgcalTriggerChains.HGCalTriggerChains.truth_chain, hgcalTriggerChains.HGCalTriggerChains.truth_prod, and hgcalTriggerChains.HGCalTriggerChains.vfe.

137  def create_truth_sequences(self, process):
138  if not hasattr(process, 'caloTruthCellsProducer'):
139  from L1Trigger.L1THGCalUtilities.caloTruthCellsProducer_cfi import caloTruthCellsProducer
140  process.load('L1Trigger.L1THGCalUtilities.caloTruthCells_cff')
141  process.truthCellsProd = cms.Task(caloTruthCellsProducer)
142  hgcalTriggerPrimitivesTask = cms.Task(process.hgcalVFE, process.truthCellsProd, process.hgcalBackEndLayer1, process.hgcalBackEndLayer2, process.hgcalTowerMap, process.hgcalTower)
143  process.hgcalTriggerPrimitivesTruth = cms.Sequence(hgcalTriggerPrimitivesTask)
144  if not hasattr(process, 'hgcalTriggerSelector'):
145  process.load('L1Trigger.L1THGCalUtilities.HGC3DClusterGenMatchSelector_cff')
146  tmp = cms.TaskPlaceholder("tmp")
147  tmpseq = cms.SequencePlaceholder("tmp")
148  vfe_task = cms.Task(tmp)
149  truth_prod_task = cms.Task(tmp)
150  backend1_task = cms.Task(tmp)
151  backend2_task = cms.Task(tmp)
152  selector_sequence = cms.Sequence(tmpseq)
153  ntuple_sequence = cms.Sequence(tmpseq)
154  for vfe,truth_prod,backend1,backend2,selector,ntuple in self.truth_chain:
155  truth_prod_name = '{0}{1}'.format(vfe, truth_prod)
156  backend1_name = truth_prod_name + '{0}'.format(backend1)
157  backend2_name = backend1_name + '{0}'.format(backend2)
158  selector_name = backend2_name + '{0}'.format(selector)
159  ntuple_name = selector_name + '{0}'.format(ntuple)
160  if selector=='':
161  if backend2=='':
162  if backend1=='':
163  ntuple_inputs = [
164  truth_prod_name,
165  truth_prod_name,
166  truth_prod_name
167  ]
168  else:
169  ntuple_inputs = [
170  truth_prod_name,
171  backend1_name+':HGCalBackendLayer1Processor2DClustering',
172  truth_prod_name
173  ]
174  else:
175  ntuple_inputs = [
176  truth_prod_name,
177  backend1_name+':HGCalBackendLayer1Processor2DClustering',
178  backend2_name+':HGCalBackendLayer2Processor3DClustering'
179  ]
180  else:
181  ntuple_inputs = [
182  truth_prod_name,
183  backend1_name+':HGCalBackendLayer1Processor2DClustering',
184  selector_name
185  ]
186 
187  if not hasattr(process, vfe):
188  setattr(process, vfe, self.vfe[vfe](process))
189  vfe_task.add(getattr(process, vfe))
190  if not hasattr(process, truth_prod_name):
191  setattr(process, truth_prod_name, self.truth_prod[truth_prod](process, vfe))
192  truth_prod_task.add(getattr(process, truth_prod_name))
193  if not hasattr(process, backend1_name):
194  setattr(process, backend1_name, self.backend1[backend1](process, truth_prod_name))
195  backend1_task.add(getattr(process, backend1_name))
196  if backend2!='' and not hasattr(process, backend2_name):
197  setattr(process, backend2_name, self.backend2[backend2](process, backend1_name))
198  backend2_task.add(getattr(process, backend2_name))
199  if selector!='' and not hasattr(process, selector_name):
200  setattr(process, selector_name, self.selector[selector](process, backend2_name))
201  selector_sequence *= getattr(process, selector_name)
202  if ntuple!='' and not hasattr(process, ntuple_name):
203  setattr(process, ntuple_name, self.ntuple[ntuple](process, ntuple_inputs))
204  ntuple_sequence *= getattr(process, ntuple_name)
205  vfe_task.remove(tmp)
206  truth_prod_task.remove(tmp)
207  backend1_task.remove(tmp)
208  backend2_task.remove(tmp)
209  selector_sequence.remove(tmpseq)
210  ntuple_sequence.remove(tmpseq)
211  process.globalReplace('hgcalVFE', vfe_task)
212  process.globalReplace('truthCellsProd', truth_prod_task)
213  process.globalReplace('hgcalBackEndLayer1', backend1_task)
214  process.globalReplace('hgcalBackEndLayer2', backend2_task)
215  process.globalReplace('hgcalTriggerSelector', selector_sequence)
216  process.globalReplace('hgcalTriggerNtuples', ntuple_sequence)
217  return process
def hgcalTriggerChains.HGCalTriggerChains.register_backend1 (   self,
  name,
  generator 
)

Definition at line 24 of file hgcalTriggerChains.py.

References hgcalTriggerChains.HGCalTriggerChains.backend1.

24 
25  def register_backend1(self, name, generator):
26  self.backend1[name] = generator
def hgcalTriggerChains.HGCalTriggerChains.register_backend2 (   self,
  name,
  generator 
)

Definition at line 27 of file hgcalTriggerChains.py.

References hgcalTriggerChains.HGCalTriggerChains.backend2.

27 
28  def register_backend2(self, name, generator):
29  self.backend2[name] = generator
def hgcalTriggerChains.HGCalTriggerChains.register_chain (   self,
  vfe,
  concentrator,
  backend1,
  backend2,
  selector = '',
  ntuple = '' 
)

Definition at line 36 of file hgcalTriggerChains.py.

References hgcalTriggerChains.HGCalTriggerChains.backend1, hgcalTriggerChains.HGCalTriggerChains.backend2, hgcalTriggerChains.HGCalTriggerChains.concentrator, hgcalTriggerChains.HGCalTriggerChains.ntuple, DTOccupancyTest.ntuple, DTOccupancyTestML.ntuple, hgcalTriggerChains.HGCalTriggerChains.selector, RawDataSelector.selector, BPHMultiSelectBase< T >::SelectElement.selector, BPHRecoBuilder::BPHRecoSource.selector, and hgcalTriggerChains.HGCalTriggerChains.vfe.

36 
37  def register_chain(self, vfe, concentrator, backend1, backend2, selector='', ntuple=''):
38  if not vfe in self.vfe:
39  raise KeyError('{} not registered as VFE producer'.format(vfe))
40  if not concentrator in self.concentrator:
41  raise KeyError('{} not registered as concentrator producer'.format(concentrator))
42  if not backend1 in self.backend1:
43  raise KeyError('{} not registered as backend1 producer'.format(backend1))
44  if not backend2 in self.backend2:
45  raise KeyError('{} not registered as backend2 producer'.format(backend2))
46  if selector!='' and not selector in self.selector:
47  raise KeyError('{} not registered as selector'.format(selector))
48  if ntuple!='' and not ntuple in self.ntuple:
49  raise KeyError('{} not registered as ntuplizer'.format(ntuple))
50  self.chain.append( (vfe, concentrator, backend1, backend2, selector, ntuple) )
def hgcalTriggerChains.HGCalTriggerChains.register_concentrator (   self,
  name,
  generator 
)

Definition at line 18 of file hgcalTriggerChains.py.

References hgcalTriggerChains.HGCalTriggerChains.concentrator.

18 
19  def register_concentrator(self, name, generator):
20  self.concentrator[name] = generator
def hgcalTriggerChains.HGCalTriggerChains.register_ntuple (   self,
  name,
  generator 
)

Definition at line 33 of file hgcalTriggerChains.py.

References hgcalTriggerChains.HGCalTriggerChains.ntuple, DTOccupancyTest.ntuple, and DTOccupancyTestML.ntuple.

33 
34  def register_ntuple(self, name, generator):
35  self.ntuple[name] = generator
def hgcalTriggerChains.HGCalTriggerChains.register_selector (   self,
  name,
  generator 
)

Definition at line 30 of file hgcalTriggerChains.py.

References hgcalTriggerChains.HGCalTriggerChains.selector, RawDataSelector.selector, BPHMultiSelectBase< T >::SelectElement.selector, and BPHRecoBuilder::BPHRecoSource.selector.

30 
31  def register_selector(self, name, generator):
32  self.selector[name] = generator
def hgcalTriggerChains.HGCalTriggerChains.register_truth_chain (   self,
  vfe,
  truth_prod,
  backend1 = '',
  backend2 = '',
  selector = '',
  ntuple = '' 
)

Definition at line 51 of file hgcalTriggerChains.py.

References hgcalTriggerChains.HGCalTriggerChains.backend1, hgcalTriggerChains.HGCalTriggerChains.backend2, hgcalTriggerChains.HGCalTriggerChains.ntuple, DTOccupancyTest.ntuple, DTOccupancyTestML.ntuple, hgcalTriggerChains.HGCalTriggerChains.selector, RawDataSelector.selector, BPHMultiSelectBase< T >::SelectElement.selector, BPHRecoBuilder::BPHRecoSource.selector, hgcalTriggerChains.HGCalTriggerChains.truth_prod, and hgcalTriggerChains.HGCalTriggerChains.vfe.

51 
52  def register_truth_chain(self, vfe, truth_prod, backend1='', backend2='', selector='', ntuple=''):
53  if not vfe in self.vfe:
54  raise KeyError('{} not registered as VFE producer'.format(vfe))
55  if not truth_prod in self.truth_prod:
56  raise KeyError('{} not registered as truth producer'.format(truth_prod))
57  if backend1!='' and not backend1 in self.backend1:
58  raise KeyError('{} not registered as backend1 producer'.format(backend1))
59  if backend2!='' and not backend2 in self.backend2:
60  raise KeyError('{} not registered as backend2 producer'.format(backend2))
61  if selector!='' and not selector in self.selector:
62  raise KeyError('{} not registered as selector'.format(selector))
63  if ntuple!='' and not ntuple in self.ntuple:
64  raise KeyError('{} not registered as ntuplizer'.format(ntuple))
65  self.truth_chain.append( (vfe, truth_prod, backend1, backend2, selector, ntuple) )
def hgcalTriggerChains.HGCalTriggerChains.register_truth_prod (   self,
  name,
  generator 
)

Definition at line 21 of file hgcalTriggerChains.py.

References hgcalTriggerChains.HGCalTriggerChains.truth_prod.

21 
22  def register_truth_prod(self, name, generator): # for truth-matched trigger cells
23  self.truth_prod[name] = generator
def hgcalTriggerChains.HGCalTriggerChains.register_vfe (   self,
  name,
  generator 
)

Definition at line 15 of file hgcalTriggerChains.py.

References hgcalTriggerChains.HGCalTriggerChains.vfe.

15 
16  def register_vfe(self, name, generator):
17  self.vfe[name] = generator

Member Data Documentation

hgcalTriggerChains.HGCalTriggerChains.backend1

Definition at line 8 of file hgcalTriggerChains.py.

Referenced by hgcalTriggerChains.HGCalTriggerChains.create_sequences(), hgcalTriggerChains.HGCalTriggerChains.create_truth_sequences(), hgcalTriggerChains.HGCalTriggerChains.register_backend1(), hgcalTriggerChains.HGCalTriggerChains.register_chain(), and hgcalTriggerChains.HGCalTriggerChains.register_truth_chain().

hgcalTriggerChains.HGCalTriggerChains.backend2

Definition at line 9 of file hgcalTriggerChains.py.

Referenced by hgcalTriggerChains.HGCalTriggerChains.create_sequences(), hgcalTriggerChains.HGCalTriggerChains.create_truth_sequences(), hgcalTriggerChains.HGCalTriggerChains.register_backend2(), hgcalTriggerChains.HGCalTriggerChains.register_chain(), and hgcalTriggerChains.HGCalTriggerChains.register_truth_chain().

hgcalTriggerChains.HGCalTriggerChains.chain

Definition at line 12 of file hgcalTriggerChains.py.

Referenced by chain.Chain.__getattr__(), chain.Chain.__getitem__(), chain.Chain.__iter__(), hgcalTriggerChains.HGCalTriggerChains.create_sequences(), chain_test.ChainTestCase.test_get(), chain_test.ChainTestCase.test_guess_treename(), chain_test.ChainTestCase.test_iterate(), and chain_test.ChainTestCase.test_load_1().

hgcalTriggerChains.HGCalTriggerChains.concentrator

Definition at line 6 of file hgcalTriggerChains.py.

Referenced by hgcalTriggerChains.HGCalTriggerChains.create_sequences(), hgcalTriggerChains.HGCalTriggerChains.register_chain(), and hgcalTriggerChains.HGCalTriggerChains.register_concentrator().

hgcalTriggerChains.HGCalTriggerChains.ntuple

Definition at line 11 of file hgcalTriggerChains.py.

Referenced by hgcalTriggerChains.HGCalTriggerChains.create_sequences(), hgcalTriggerChains.HGCalTriggerChains.create_truth_sequences(), hgcalTriggerChains.HGCalTriggerChains.register_chain(), hgcalTriggerChains.HGCalTriggerChains.register_ntuple(), and hgcalTriggerChains.HGCalTriggerChains.register_truth_chain().

hgcalTriggerChains.HGCalTriggerChains.selector

Definition at line 10 of file hgcalTriggerChains.py.

Referenced by hgcalTriggerChains.HGCalTriggerChains.create_sequences(), hgcalTriggerChains.HGCalTriggerChains.create_truth_sequences(), hgcalTriggerChains.HGCalTriggerChains.register_chain(), hgcalTriggerChains.HGCalTriggerChains.register_selector(), and hgcalTriggerChains.HGCalTriggerChains.register_truth_chain().

hgcalTriggerChains.HGCalTriggerChains.truth_chain

Definition at line 13 of file hgcalTriggerChains.py.

Referenced by hgcalTriggerChains.HGCalTriggerChains.create_truth_sequences().

hgcalTriggerChains.HGCalTriggerChains.truth_prod

Definition at line 7 of file hgcalTriggerChains.py.

Referenced by hgcalTriggerChains.HGCalTriggerChains.create_truth_sequences(), hgcalTriggerChains.HGCalTriggerChains.register_truth_chain(), and hgcalTriggerChains.HGCalTriggerChains.register_truth_prod().

hgcalTriggerChains.HGCalTriggerChains.vfe

Definition at line 5 of file hgcalTriggerChains.py.

Referenced by hgcalTriggerChains.HGCalTriggerChains.create_sequences(), hgcalTriggerChains.HGCalTriggerChains.create_truth_sequences(), hgcalTriggerChains.HGCalTriggerChains.register_chain(), hgcalTriggerChains.HGCalTriggerChains.register_truth_chain(), and hgcalTriggerChains.HGCalTriggerChains.register_vfe().