CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
hgcalTriggerChains.HGCalTriggerChains Class Reference

Public Member Functions

def __init__ (self)
 
def create_sequences (self, process)
 
def create_truth_sequences (self, process)
 
def register_backend1 (self, name, generator)
 
def register_backend2 (self, name, generator)
 
def register_chain (self, vfe, concentrator, backend1, backend2, selector='', ntuple='')
 
def register_concentrator (self, name, generator)
 
def register_ntuple (self, name, generator)
 
def register_selector (self, name, generator)
 
def register_truth_chain (self, vfe, truth_prod, backend1='', backend2='', selector='', ntuple='')
 
def register_truth_prod (self, name, generator)
 
def register_vfe (self, name, generator)
 

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

◆ __init__()

def hgcalTriggerChains.HGCalTriggerChains.__init__ (   self)

Definition at line 4 of file hgcalTriggerChains.py.

4  def __init__(self):
5  self.vfe = {}
6  self.concentrator = {}
7  self.truth_prod = {}
8  self.backend1 = {}
9  self.backend2 = {}
10  self.selector = {}
11  self.ntuple = {}
12  self.chain = []
13  self.truth_chain = []
14 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)

Member Function Documentation

◆ create_sequences()

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  def create_sequences(self, process):
67  if not hasattr(process, 'L1THGCalTriggerSelector'):
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)
102 
103  if selector=='':
104  ntuple_inputs = [
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()
108  ]
109  else:
110  ntuple_inputs = [
111  concentrator_name+':'+getattr(process, concentrator_name).ProcessorParameters.ProcessorName.value(),
112  backend1_name+':'+getattr(process, backend1_name).ProcessorParameters.ProcessorName.value(),
113  selector_name]
114 
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)
118  vfe_task.remove(tmp)
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('L1THGCalVFE', vfe_task)
125  process.globalReplace('L1THGCalConcentrator', concentrator_task)
126  if 'HGCalBackendStage1Processor' in backend1_processor:
127  process.globalReplace('L1THGCalBackEndStage1', backend1_task)
128  process.globalReplace('L1THGCalBackEndStage2', backend2_task)
129  else:
130  process.globalReplace('L1THGCalBackEndLayer1', backend1_task)
131  process.globalReplace('L1THGCalBackEndLayer2', backend2_task)
132  process.globalReplace('L1THGCalTriggerSelector', selector_sequence)
133  process.globalReplace('L1THGCalTriggerNtuples', ntuple_sequence)
134  return process
135 

◆ create_truth_sequences()

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.

136  def create_truth_sequences(self, process):
137  if not hasattr(process, 'caloTruthCellsProducer'):
138  from L1Trigger.L1THGCalUtilities.caloTruthCellsProducer_cfi import l1tCaloTruthCellsProducer
139  process.load('L1Trigger.L1THGCalUtilities.caloTruthCells_cff')
140  process.L1TTruthCellsProd = cms.Task(l1tCaloTruthCellsProducer)
141  L1THGCalTriggerPrimitivesTask = cms.Task(process.L1THGcalVFE, process.L1TTruthCellsProd, process.L1THGCalBackEndLayer1, process.L1THGCalBackEndLayer2, process.L1THGCalTowerMap, process.L1THGCalTower)
142  process.L1THGCalTriggerPrimitivesTruth = cms.Sequence(L1THGCalTriggerPrimitivesTask)
143  if not hasattr(process, 'L1THGCalTriggerSelector'):
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)
159  if selector=='':
160  if backend2=='':
161  if backend1=='':
162  ntuple_inputs = [
163  truth_prod_name,
164  truth_prod_name,
165  truth_prod_name
166  ]
167  else:
168  ntuple_inputs = [
169  truth_prod_name,
170  backend1_name+':HGCalBackendLayer1Processor2DClustering',
171  truth_prod_name
172  ]
173  else:
174  ntuple_inputs = [
175  truth_prod_name,
176  backend1_name+':HGCalBackendLayer1Processor2DClustering',
177  backend2_name+':HGCalBackendLayer2Processor3DClustering'
178  ]
179  else:
180  ntuple_inputs = [
181  truth_prod_name,
182  backend1_name+':HGCalBackendLayer1Processor2DClustering',
183  selector_name
184  ]
185 
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)
204  vfe_task.remove(tmp)
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('L1THGCalVFE', vfe_task)
211  process.globalReplace('L1TTruthCellsProd', truth_prod_task)
212  process.globalReplace('L1THGCalBackEndLayer1', backend1_task)
213  process.globalReplace('L1THGCalBackEndLayer2', backend2_task)
214  process.globalReplace('L1THGCalTriggerSelector', selector_sequence)
215  process.globalReplace('L1THGCalTriggerNtuples', ntuple_sequence)
216  return process
217 

◆ register_backend1()

def hgcalTriggerChains.HGCalTriggerChains.register_backend1 (   self,
  name,
  generator 
)

Definition at line 24 of file hgcalTriggerChains.py.

References hgcalTriggerChains.HGCalTriggerChains.backend1.

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

◆ register_backend2()

def hgcalTriggerChains.HGCalTriggerChains.register_backend2 (   self,
  name,
  generator 
)

Definition at line 27 of file hgcalTriggerChains.py.

References hgcalTriggerChains.HGCalTriggerChains.backend2.

27  def register_backend2(self, name, generator):
28  self.backend2[name] = generator
29 

◆ register_chain()

def hgcalTriggerChains.HGCalTriggerChains.register_chain (   self,
  vfe,
  concentrator,
  backend1,
  backend2,
  selector = '',
  ntuple = '' 
)

Definition at line 36 of file hgcalTriggerChains.py.

References mps_setup.append, 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.

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))
39  if not concentrator in self.concentrator:
40  raise KeyError('{} not registered as concentrator producer'.format(concentrator))
41  if not backend1 in self.backend1:
42  raise KeyError('{} not registered as backend1 producer'.format(backend1))
43  if not backend2 in self.backend2:
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) )
50 

◆ register_concentrator()

def hgcalTriggerChains.HGCalTriggerChains.register_concentrator (   self,
  name,
  generator 
)

Definition at line 18 of file hgcalTriggerChains.py.

References hgcalTriggerChains.HGCalTriggerChains.concentrator.

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

◆ register_ntuple()

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  def register_ntuple(self, name, generator):
34  self.ntuple[name] = generator
35 

◆ register_selector()

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  def register_selector(self, name, generator):
31  self.selector[name] = generator
32 

◆ register_truth_chain()

def hgcalTriggerChains.HGCalTriggerChains.register_truth_chain (   self,
  vfe,
  truth_prod,
  backend1 = '',
  backend2 = '',
  selector = '',
  ntuple = '' 
)

Definition at line 51 of file hgcalTriggerChains.py.

References mps_setup.append, 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.

51  def register_truth_chain(self, vfe, truth_prod, backend1='', backend2='', selector='', ntuple=''):
52  if not vfe in self.vfe:
53  raise KeyError('{} not registered as VFE producer'.format(vfe))
54  if not truth_prod in self.truth_prod:
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) )
65 

◆ register_truth_prod()

def hgcalTriggerChains.HGCalTriggerChains.register_truth_prod (   self,
  name,
  generator 
)

Definition at line 21 of file hgcalTriggerChains.py.

References hgcalTriggerChains.HGCalTriggerChains.truth_prod.

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

◆ register_vfe()

def hgcalTriggerChains.HGCalTriggerChains.register_vfe (   self,
  name,
  generator 
)

Definition at line 15 of file hgcalTriggerChains.py.

References hgcalTriggerChains.HGCalTriggerChains.vfe.

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

Member Data Documentation

◆ backend1

◆ backend2

◆ chain

◆ concentrator

◆ ntuple

◆ selector

◆ truth_chain

hgcalTriggerChains.HGCalTriggerChains.truth_chain

◆ truth_prod

◆ vfe