CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Attributes
EgammaHLTValidationUtils.EgammaDQMModuleMaker Class Reference

Public Member Functions

def __init__ (self, process, pathName, pdgGen, requiredNumberOfGeneratedObjects, cutCollection=None)
 

Public Attributes

 path
 
 pathName
 
 process
 
 processName
 

Private Attributes

 __result
 

Detailed Description

a class which can be used to produce an analysis path
    for the EmDQM analyzer 

Definition at line 125 of file EgammaHLTValidationUtils.py.

Constructor & Destructor Documentation

def EgammaHLTValidationUtils.EgammaDQMModuleMaker.__init__ (   self,
  process,
  pathName,
  pdgGen,
  requiredNumberOfGeneratedObjects,
  cutCollection = None 
)
pathName is the HLT path to be validated.

pdgGen is the PDG id of the corersponding generated particles
  (11 for electrons, 22 for photons)

requiredNumberOfGeneratedObjects should be 1 for single triggers,
and 2 for double triggers (e.g. double photon triggers)

cutCollection is the name of the collection which should be used
  to define the acceptance region (at reconstruction level ?).
  typical values are 'fiducialZee'. If this is set to None,
  will be determined automatically from pdgGen and requiredNumberOfGeneratedObjects

Definition at line 131 of file EgammaHLTValidationUtils.py.

131  def __init__(self, process, pathName, pdgGen, requiredNumberOfGeneratedObjects, cutCollection = None):
132  """
133  pathName is the HLT path to be validated.
134 
135  pdgGen is the PDG id of the corersponding generated particles
136  (11 for electrons, 22 for photons)
137 
138  requiredNumberOfGeneratedObjects should be 1 for single triggers,
139  and 2 for double triggers (e.g. double photon triggers)
140 
141  cutCollection is the name of the collection which should be used
142  to define the acceptance region (at reconstruction level ?).
143  typical values are 'fiducialZee'. If this is set to None,
144  will be determined automatically from pdgGen and requiredNumberOfGeneratedObjects
145 
146  """
147 
148  self.process = process
149  self.pathName = pathName
150 
151  self.path = getattr(process,pathName)
152 
153  # the process whose products should be analyzed
154  self.processName = "HLT"
155 
156  #--------------------
157  # guess the collection for the fiducial volume cut
158  #--------------------
159 
160  if cutCollection == None:
161  cutCollection = "fiducial" + getProcessName(pdgGen, requiredNumberOfGeneratedObjects)
162 
163  #--------------------
164  # find Et threshold of primary object
165  #--------------------
166  mo = re.match("HLT_.*?(\d+).*",pathName)
167 
168  if mo != None:
169  etThreshold = float(mo.group(1))
170  else:
171  etThreshold = -1.0
172 
173  #--------------------
174  # initialize the analyzer we put together here
175  #--------------------
176  self.__result = cms.EDAnalyzer("EmDQM",
177  triggerobject = cms.InputTag("hltTriggerSummaryRAW","","HLT"),
178  genEtaAcc = cms.double(2.5),
179  genEtAcc = cms.double(2.0),
180  reqNum = cms.uint32(requiredNumberOfGeneratedObjects),
181  filters = cms.VPSet(), # will be added later
182  PtMax = cms.untracked.double(100.0),
183  genEtMin = cms.untracked.double(etThreshold),
184  pdgGen = cms.int32(pdgGen),
185  cutcollection = cms.InputTag(cutCollection),
186 
187  # is this a requirement on reconstructed or generated number of objects ?
188  cutnum = cms.int32(requiredNumberOfGeneratedObjects),
189 
190 
191 
192  )
193 
194  #--------------------
195  # get all modules of this path.
196  # dirty hack: assumes that all modules
197  # are concatenated by '+'
198  # but easier than to use a node visitor
199  # and order the modules ourselves afterwards..
200 
201  moduleNames = str(self.path).split('+')
202 
203  # now find out which of these are EDFilters
204  # and what CMSSW class type they are
205 
206  # example:
207  #
208  # CMSSW type module name
209  # --------------------------------------------------------------------------------------------------------------------
210  # HLTTriggerTypeFilter hltTriggerType
211  # HLTLevel1GTSeed hltL1sL1SingleEG8
212  # HLTPrescaler hltPreEle17SWTighterEleIdIsolL1R
213  # HLTEgammaL1MatchFilterRegional hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolL1MatchFilterRegional
214  # HLTEgammaEtFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolEtFilter
215  # HLTEgammaGenericFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolR9ShapeFilter
216  # HLTEgammaGenericFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolClusterShapeFilter
217  # HLTEgammaGenericFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TIghterEleIdIsolEcalIsolFilter
218  # HLTEgammaGenericFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolHEFilter
219  # HLTEgammaGenericFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolHcalIsolFilter
220  # HLTElectronPixelMatchFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolPixelMatchFilter
221  # HLTElectronOneOEMinusOneOPFilterRegional hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolOneOEMinusOneOPFilter
222  # HLTElectronGenericFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolDetaFilter
223  # HLTElectronGenericFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolDphiFilter
224  # HLTElectronGenericFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolTrackIsolFilter
225  # HLTBool hltBoolEnd
226 
227  # it looks like in the MC menu, all modules have a name containing 'L1NonIso' and then
228  # have a parameter IsoCollections (which is mostly cms.Input("none")...)
229 
230  import FWCore.ParameterSet.Modules
231 
232  for moduleName in moduleNames:
233 
234  # add protection to avoid accessing non-existing modules
235  # (not understood why this is needed but happens
236  # in some cases...).
237  #
238  # should also cover the special cases listed afterwards
239  # (i.e. the check after this one could be removed
240  # at some point)
241  if not hasattr(self.process, moduleName):
242  continue
243 
244  # protection for FastSim HLT menu
245  # which seems to reference certain modules in some
246  # paths but these modules are not defined when just
247  # loading the HLT menu into a process object.
248  #
249  # this seems not to happen for the fullsim menu for some
250  # reason...
251  if moduleName in ('simulation',
252  'offlineBeamSpot',
253  'HLTEndSequence'):
254  continue
255 
256 
257 
258  module = getattr(self.process,moduleName)
259 
260  if not isinstance(module, FWCore.ParameterSet.Modules.EDFilter):
261  continue
262 
263  # ignore certain EDFilters
264  if module.type_() in ('HLTTriggerTypeFilter',
265  'HLTPrescaler',
266  'HLTBool'):
267  continue
268 
269  # print "XX", module.type_(), moduleName
270 
271  #--------------------
272  if module.type_() == 'HLTLevel1GTSeed':
273  # L1 seed
274  self.__result.filters.append(self.makePSetForL1SeedFilter(moduleName))
275  continue
276 
277  #--------------------
278  if module.type_() == 'HLTEgammaL1MatchFilterRegional':
279  # L1 seed to supercluster match
280  self.__result.filters.append(self.makePSetForL1SeedToSuperClusterMatchFilter(moduleName))
281  continue
282 
283  #--------------------
284 
285  if module.type_() == "HLTEgammaEtFilter":
286  # minimum Et requirement
287  self.__result.filters.append(self.makePSetForEtFilter(moduleName))
288  continue
289 
290  #--------------------
291 
292  if module.type_() == "HLTElectronOneOEMinusOneOPFilterRegional":
293  self.__result.filters.append(self.makePSetForOneOEMinusOneOPFilter(moduleName))
294  continue
295 
296  #--------------------
297  if module.type_() == "HLTElectronPixelMatchFilter":
298  self.__result.filters.append(self.makePSetForPixelMatchFilter(moduleName))
299  continue
300 
301  #--------------------
302  # generic filters: the module types
303  # aren't enough, we must check on which
304  # input collections they filter on
305  #--------------------
306 
307  if module.type_() == "HLTEgammaGenericFilter":
308 
309  pset = self.makePSetForEgammaGenericFilter(module, moduleName)
310  if pset != None:
311  self.__result.filters.append(pset)
312  continue
313 
314  #--------------------
315 
316  if module.type_() == "HLTElectronGenericFilter":
317 
318  pset = self.makePSetForElectronGenericFilter(module, moduleName)
319  if pset != None:
320  self.__result.filters.append(pset)
321  continue
322 
323  #--------------------
324 
def __init__(self, process, pathName, pdgGen, requiredNumberOfGeneratedObjects, cutCollection=None)
def getProcessName(pdgGen, requiredNumberOfGeneratedObjects)
double split
Definition: MVATrainer.cc:139

Member Data Documentation

EgammaHLTValidationUtils.EgammaDQMModuleMaker.__result
private
EgammaHLTValidationUtils.EgammaDQMModuleMaker.path
EgammaHLTValidationUtils.EgammaDQMModuleMaker.pathName

Definition at line 149 of file EgammaHLTValidationUtils.py.

EgammaHLTValidationUtils.EgammaDQMModuleMaker.process
EgammaHLTValidationUtils.EgammaDQMModuleMaker.processName