CMS 3D CMS Logo

EgammaHLTValidationUtils.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 from __future__ import print_function
3 import FWCore.ParameterSet.Config as cms
4 import sys, os, re
5 
6 # prefix for printouts
7 msgPrefix = "[" + os.path.basename(__file__) + "]"
8 
9 
10 #----------------------------------------------------------------------
11 
12 def getPathsOfDataSet(process, datasetName):
13  """ returns the names of the trigger paths contained in the
14  given (primary) dataset """
15 
16  return list(getattr(process.datasets, datasetName))
17 
18 #----------------------------------------------------------------------
19 
20 
21 def getProcessName(pdgGen, requiredNumberOfGeneratedObjects):
22  """ returns a process name (such as 'Zee') which can be
23  used in various places (e.g. module names etc.) """
24 
25  if pdgGen == 11:
26 
27  # electron paths
28  if requiredNumberOfGeneratedObjects == 1:
29  return "Wenu"
30  elif requiredNumberOfGeneratedObjects == 2:
31  return "Zee"
32  else:
33  raise Exception("unsupported case, can't guess type of process")
34 
35  elif pdgGen == 22:
36 
37  # photon paths
38  if requiredNumberOfGeneratedObjects == 1:
39  return 'GammaJet'
40  elif requiredNumberOfGeneratedObjects == 2:
41  return 'DiGamma'
42  else:
43  raise Exception("unsupported case, can't guess type of process")
44  else:
45  raise Exception("unsupported case, can't guess type of process")
46 
47 
48 #----------------------------------------------------------------------
49 
50 def makeGeneratedParticleAndFiducialVolumeFilter(process, pdgGen, requiredNumberOfGeneratedObjects):
51  """
52  adds the needed modules to the process object and
53  returns a sequence made of the two filters.
54 
55  returns the name of the created module
56 
57  if process is not None, are added to the process.
58 
59  When using this function from a _cff file, one
60  has to manually add the modules of the returned
61  sequence to globals() (in the calling module, not
62  here, globals() live in a different name space here)
63 
64  """
65 
66  # name of the physics process
67  procName = getProcessName(pdgGen, requiredNumberOfGeneratedObjects)
68 
69  #--------------------
70  # create a module producing a collection with the
71  # desired generated particles
72  #--------------------
73 
74  genPartModuleName = 'genpart' + procName
75 
76 
77  genPartModule = cms.EDFilter("PdgIdAndStatusCandViewSelector",
78  status = cms.vint32(3),
79  src = cms.InputTag("genParticles"),
80  pdgId = cms.vint32(pdgGen),
81  )
82 
83  # genPartModule.setLabel(genPartModuleName)
84  if process != None:
85  setattr(process, genPartModuleName, genPartModule)
86 
87  genPartModule.setLabel(genPartModuleName)
88 
89  #--------------------
90  # create a module requiring the number
91  # of generated particles
92  #--------------------
93 
94  selectorModuleName = "fiducial" + procName
95 
96  selectorModule = cms.EDFilter("EtaPtMinCandViewSelector",
97  src = cms.InputTag(genPartModuleName),
98  etaMin = cms.double(-2.5),
99  etaMax = cms.double(2.5),
100  ptMin = cms.double(2.0)
101  )
102 
103  if process != None:
104  setattr(process, selectorModuleName, selectorModule)
105 
106  # this is needed if we don't have a process to attach this module to
107  selectorModule.setLabel(selectorModuleName)
108 
109  #--------------------
110  # create the sequence
111  #--------------------
112 
113  return cms.Sequence(
114  # getattr(process, genPartModuleName)
115  genPartModule
116 
117  *
118 
119  # getattr(process, selectorModuleName)
120  selectorModule
121  )
122 #----------------------------------------------------------------------
123 
124 import HLTriggerOffline.Egamma.TriggerTypeDefs_cfi as TriggerTypeDefs_cfi
125 
127  """ a class which can be used to produce an analysis path
128  for the EmDQM analyzer """
129 
130  #----------------------------------------
131 
132  def __init__(self, process, pathName, pdgGen, requiredNumberOfGeneratedObjects, cutCollection = None):
133  """
134  pathName is the HLT path to be validated.
135 
136  pdgGen is the PDG id of the corersponding generated particles
137  (11 for electrons, 22 for photons)
138 
139  requiredNumberOfGeneratedObjects should be 1 for single triggers,
140  and 2 for double triggers (e.g. double photon triggers)
141 
142  cutCollection is the name of the collection which should be used
143  to define the acceptance region (at reconstruction level ?).
144  typical values are 'fiducialZee'. If this is set to None,
145  will be determined automatically from pdgGen and requiredNumberOfGeneratedObjects
146 
147  """
148 
149  self.process = process
150  self.pathName = pathName
151 
152  self.path = getattr(process,pathName)
153 
154  # the process whose products should be analyzed
155  self.processName = "HLT"
156 
157  #--------------------
158  # guess the collection for the fiducial volume cut
159  #--------------------
160 
161  if cutCollection == None:
162  cutCollection = "fiducial" + getProcessName(pdgGen, requiredNumberOfGeneratedObjects)
163 
164  #--------------------
165  # find Et threshold of primary object
166  #--------------------
167  mo = re.match("HLT_.*?(\d+).*",pathName)
168 
169  if mo != None:
170  etThreshold = float(mo.group(1))
171  else:
172  etThreshold = -1.0
173 
174  #--------------------
175  # initialize the analyzer we put together here
176  #--------------------
177  from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
178  self.__result = DQMEDAnalyzer('EmDQM',
179  triggerobject = cms.InputTag("hltTriggerSummaryRAW","","HLT"),
180  genEtaAcc = cms.double(2.5),
181  genEtAcc = cms.double(2.0),
182  reqNum = cms.uint32(requiredNumberOfGeneratedObjects),
183  filters = cms.VPSet(), # will be added later
184  PtMax = cms.untracked.double(100.0),
185  genEtMin = cms.untracked.double(etThreshold),
186  pdgGen = cms.int32(pdgGen),
187  cutcollection = cms.InputTag(cutCollection),
188 
189  # is this a requirement on reconstructed or generated number of objects ?
190  cutnum = cms.int32(requiredNumberOfGeneratedObjects),
191 
192 
193 
194  )
195 
196  #--------------------
197  # get all modules of this path.
198  # dirty hack: assumes that all modules
199  # are concatenated by '+'
200  # but easier than to use a node visitor
201  # and order the modules ourselves afterwards..
202 
203  moduleNames = str(self.path).split('+')
204 
205  # now find out which of these are EDFilters
206  # and what CMSSW class type they are
207 
208  # example:
209  #
210  # CMSSW type module name
211  # --------------------------------------------------------------------------------------------------------------------
212  # HLTTriggerTypeFilter hltTriggerType
213  # HLTLevel1GTSeed hltL1sL1SingleEG8
214  # HLTPrescaler hltPreEle17SWTighterEleIdIsolL1R
215  # HLTEgammaL1MatchFilterRegional hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolL1MatchFilterRegional
216  # HLTEgammaEtFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolEtFilter
217  # HLTEgammaGenericFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolR9ShapeFilter
218  # HLTEgammaGenericFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolClusterShapeFilter
219  # HLTEgammaGenericFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TIghterEleIdIsolEcalIsolFilter
220  # HLTEgammaGenericFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolHEFilter
221  # HLTEgammaGenericFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolHcalIsolFilter
222  # HLTElectronPixelMatchFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolPixelMatchFilter
223  # HLTElectronOneOEMinusOneOPFilterRegional hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolOneOEMinusOneOPFilter
224  # HLTElectronGenericFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolDetaFilter
225  # HLTElectronGenericFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolDphiFilter
226  # HLTElectronGenericFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolTrackIsolFilter
227  # HLTBool hltBoolEnd
228 
229  # it looks like in the MC menu, all modules have a name containing 'L1NonIso' and then
230  # have a parameter IsoCollections (which is mostly cms.Input("none")...)
231 
232  import FWCore.ParameterSet.Modules
233 
234  for moduleName in moduleNames:
235 
236  # add protection to avoid accessing non-existing modules
237  # (not understood why this is needed but happens
238  # in some cases...).
239  #
240  # should also cover the special cases listed afterwards
241  # (i.e. the check after this one could be removed
242  # at some point)
243  if not hasattr(self.process, moduleName):
244  continue
245 
246  # protection for FastSim HLT menu
247  # which seems to reference certain modules in some
248  # paths but these modules are not defined when just
249  # loading the HLT menu into a process object.
250  #
251  # this seems not to happen for the fullsim menu for some
252  # reason...
253  if moduleName in ('simulation',
254  'offlineBeamSpot',
255  'HLTEndSequence'):
256  continue
257 
258 
259 
260  module = getattr(self.process,moduleName)
261 
262  if not isinstance(module, FWCore.ParameterSet.Modules.EDFilter):
263  continue
264 
265  # ignore certain EDFilters
266  if module.type_() in ('HLTTriggerTypeFilter',
267  'HLTPrescaler',
268  'HLTBool'):
269  continue
270 
271  # print "XX", module.type_(), moduleName
272 
273  #--------------------
274  if module.type_() == 'HLTLevel1GTSeed':
275  # L1 seed
276  self.__result.filters.append(self.makePSetForL1SeedFilter(moduleName))
277  continue
278 
279  #--------------------
280  if module.type_() == 'HLTEgammaL1MatchFilterRegional':
281  # L1 seed to supercluster match
282  self.__result.filters.append(self.makePSetForL1SeedToSuperClusterMatchFilter(moduleName))
283  continue
284 
285  #--------------------
286 
287  if module.type_() == "HLTEgammaEtFilter":
288  # minimum Et requirement
289  self.__result.filters.append(self.makePSetForEtFilter(moduleName))
290  continue
291 
292  #--------------------
293 
294  if module.type_() == "HLTElectronOneOEMinusOneOPFilterRegional":
295  self.__result.filters.append(self.makePSetForOneOEMinusOneOPFilter(moduleName))
296  continue
297 
298  #--------------------
299  if module.type_() == "HLTElectronPixelMatchFilter":
300  self.__result.filters.append(self.makePSetForPixelMatchFilter(moduleName))
301  continue
302 
303  #--------------------
304  # generic filters: the module types
305  # aren't enough, we must check on which
306  # input collections they filter on
307  #--------------------
308 
309  if module.type_() == "HLTEgammaGenericFilter":
310 
311  pset = self.makePSetForEgammaGenericFilter(module, moduleName)
312  if pset != None:
313  self.__result.filters.append(pset)
314  continue
315 
316  #--------------------
317 
318  if module.type_() == "HLTElectronGenericFilter":
319 
320  pset = self.makePSetForElectronGenericFilter(module, moduleName)
321  if pset != None:
322  self.__result.filters.append(pset)
323  continue
324 
325  #--------------------
326 
327 ## print >> sys.stderr,msgPrefix,"WARNING: unknown module type", module.type_(), " with name " + moduleName + " in path " + pathName
328 
329  #----------------------------------------
330 
331  def makePSetForL1SeedFilter(self,moduleName):
332  """ generates a PSet to analyze the behaviour of an L1 seed.
333 
334  moduleName is the name of the HLT module which filters
335  on the L1 seed.
336  """
337 
338  return cms.PSet(
339  PlotBounds = cms.vdouble(0.0, 0.0),
340  HLTCollectionLabels = cms.InputTag(moduleName,"",self.processName),
341  IsoCollections = cms.VInputTag(cms.InputTag("none")),
342  theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerL1NoIsoEG)
343  )
344 
345  #----------------------------------------
346 
348  """ generates a PSet to analyze the behaviour of L1 to supercluster match filter.
349 
350  moduleName is the name of the HLT module which requires the match
351  between supercluster and L1 seed.
352  """
353 
354  return cms.PSet(
355  PlotBounds = cms.vdouble(0.0, 0.0),
356  HLTCollectionLabels = cms.InputTag(moduleName,"",self.processName),
357  IsoCollections = cms.VInputTag(cms.InputTag("none")),
358  theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerCluster)
359  )
360 
361  #----------------------------------------
362 
363  def makePSetForEtFilter(self, moduleName):
364  """ generates a PSet for the Egamma DQM analyzer for the Et filter """
365 
366  return cms.PSet(
367  PlotBounds = cms.vdouble(0.0, 0.0),
368  HLTCollectionLabels = cms.InputTag(moduleName,"",self.processName),
369  IsoCollections = cms.VInputTag(cms.InputTag("none")),
370  theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerCluster)
371  )
372 
373  #----------------------------------------
374 
375  def makePSetForOneOEMinusOneOPFilter(self, moduleName):
376 
377  return cms.PSet(
378  PlotBounds = cms.vdouble(0.0, 0.0),
379  HLTCollectionLabels = cms.InputTag(moduleName,"",self.processName),
380  IsoCollections = cms.VInputTag(cms.InputTag("none")),
381  theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerElectron)
382  )
383 
384  #----------------------------------------
385 
386  def makePSetForPixelMatchFilter(self, moduleName):
387  return cms.PSet(
388  PlotBounds = cms.vdouble(0.0, 0.0),
389  HLTCollectionLabels = cms.InputTag(moduleName,"",self.processName),
390  IsoCollections = cms.VInputTag(cms.InputTag("none")),
391  theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerCluster)
392  )
393 
394  #----------------------------------------
395 
396  def makePSetForEgammaGenericFilter(self, module, moduleName):
397 
398  # example usages of HLTEgammaGenericFilter are:
399  # R9 shape filter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolR9ShapeFilter
400  # cluster shape filter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolClusterShapeFilter
401  # Ecal isolation filter hltL1NonIsoHLTNonIsoSingleElectronEt17TIghterEleIdIsolEcalIsolFilter
402  # H/E filter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolHEFilter
403  # HCAL isolation filter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolHcalIsolFilter
404 
405  # the type of object to look for seems to be the
406  # same for all uses of HLTEgammaGenericFilter
407  theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerCluster)
408 
409  # infer the type of filter by the type of the producer which
410  # generates the collection used to cut on this
411  inputCollectionLabel = module.isoTag.moduleLabel
412 
413  inputType = getattr(self.process, inputCollectionLabel).type_()
414  # print >> sys.stderr, "inputType=",inputType,moduleName
415 
416  #--------------------
417  # sanity check: non-isolated path should be produced by the
418  # same type of module
419  #
420  # first check that the non-iso tag is non-empty
421  assert(module.nonIsoTag.moduleLabel != "")
422 
423  assert(inputType == getattr(self.process, module.nonIsoTag.moduleLabel).type_())
424 
425  #--------------------
426 
427 
428  # the following cases seem to have identical PSets ?
429 
430  #--------------------
431  # R9 shape
432  #--------------------
433 
434  if inputType == 'EgammaHLTR9Producer':
435  return cms.PSet(
436  PlotBounds = cms.vdouble(0.0, 0.0),
437  HLTCollectionLabels = cms.InputTag(moduleName,"",self.processName),
438  IsoCollections = cms.VInputTag(module.isoTag, module.nonIsoTag),
439  theHLTOutputTypes = theHLTOutputTypes
440  )
441 
442  #--------------------
443  # cluster shape
444  #--------------------
445  if inputType == 'EgammaHLTClusterShapeProducer':
446  return cms.PSet(
447  PlotBounds = cms.vdouble(0.0, 0.0),
448  HLTCollectionLabels = cms.InputTag(moduleName,"",self.processName),
449  IsoCollections = cms.VInputTag(module.isoTag, module.nonIsoTag),
450  theHLTOutputTypes = theHLTOutputTypes
451  )
452 
453  #--------------------
454  # ecal isolation
455  #--------------------
456  if inputType == 'EgammaHLTEcalRecIsolationProducer':
457  return cms.PSet(
458  PlotBounds = cms.vdouble(0.0, 0.0),
459  HLTCollectionLabels = cms.InputTag(moduleName,"",self.processName),
460  IsoCollections = cms.VInputTag(module.isoTag, module.nonIsoTag),
461  theHLTOutputTypes = theHLTOutputTypes
462  )
463 
464  #--------------------
465  # HCAL isolation and HE
466  #--------------------
467 
468  if inputType == 'EgammaHLTHcalIsolationProducersRegional':
469  return cms.PSet(
470  PlotBounds = cms.vdouble(0.0, 0.0),
471  HLTCollectionLabels = cms.InputTag(moduleName,"",self.processName),
472  IsoCollections = cms.VInputTag(module.isoTag, module.nonIsoTag),
473  theHLTOutputTypes = theHLTOutputTypes
474  )
475 
476 
477  raise Exception("can't determine what the HLTEgammaGenericFilter '" + moduleName + "' should do: uses a collection produced by a module of C++ type '" + inputType + "'")
478 
479  #----------------------------------------
480 
481  def makePSetForElectronGenericFilter(self, module, moduleName):
482 
483  # example usages of HLTElectronGenericFilter are:
484 
485  # deta filter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolDetaFilter
486  # dphi filter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolDphiFilter
487  # track isolation hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolTrackIsolFilter
488 
489  # the type of object to look for seems to be the
490  # same for all uses of HLTEgammaGenericFilter
491  theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerElectron)
492 
493  # infer the type of filter by the type of the producer which
494  # generates the collection used to cut on this
495  inputCollectionLabel = module.isoTag.moduleLabel
496 
497  inputType = getattr(self.process, inputCollectionLabel).type_()
498  # print >> sys.stderr, "inputType=",inputType,moduleName
499 
500  # sanity check: non-isolated path should be produced by the
501  # same type of module
502  assert(inputType == getattr(self.process, module.nonIsoTag.moduleLabel).type_())
503 
504  # the following cases seem to have identical PSets ?
505 
506  #--------------------
507  # deta and dphi filter
508  #--------------------
509 
510  # note that whether deta or dphi is used is determined from
511  # the product instance (not the module label)
512  if inputType == 'EgammaHLTElectronDetaDphiProducer':
513 
514  return cms.PSet(
515  PlotBounds = cms.vdouble(0.0, 0.0),
516  HLTCollectionLabels = cms.InputTag(moduleName,"",self.processName),
517  IsoCollections = cms.VInputTag(module.isoTag, module.nonIsoTag),
518  theHLTOutputTypes = theHLTOutputTypes
519  )
520 
521  #--------------------
522  # track isolation
523  #--------------------
524 
525  if inputType == 'EgammaHLTElectronTrackIsolationProducers':
526 
527  return cms.PSet(
528  PlotBounds = cms.vdouble(0.0, 0.0),
529  HLTCollectionLabels = cms.InputTag(moduleName,"",self.processName),
530  IsoCollections = cms.VInputTag(module.isoTag, module.nonIsoTag),
531  theHLTOutputTypes = theHLTOutputTypes
532  )
533  raise Exception("can't determine what the HLTElectronGenericFilter '" + moduleName + "' should do: uses a collection produced by a module of C++ type '" + inputType + "'")
534 
535  #----------------------------------------
536 
537  def getResult(self):
538  """ returns the composed analyzer module """
539  return self.__result
540 
541  #----------------------------------------
542 
543 #----------------------------------------------------------------------
544 # main
545 #----------------------------------------------------------------------
546 if __name__ == "__main__":
547 
548  import FWCore.ParameterSet.Config as cms
549  process = cms.Process("MYTEST")
550  process.load("HLTrigger.Configuration.HLT_GRun_cff")
551 
552  moduleMaker = EgammaDQMModuleMaker(process, "HLT_Ele17_SW_TighterEleIdIsol_L1R_v3", 11, 1)
553 
554  # print "# ----------------------------------------------------------------------"
555 
556  print(moduleMaker.getResult().dumpPython())
557 
558 #----------------------------------------------------------------------
559 
560 def findEgammaPaths(process):
561  """
562  returns a dict:
563 
564  {
565  "singleElectron": [ list of single electron path objects ],
566  "doubleElectron": [ list of double electron path objects ],
567  "singlePhoton": [ list of single photon path objects ],
568  "doublePhoton": [ list of double photon path objects ],
569  }
570 
571  Note that the elements in the lists are path objects, not path names.
572 
573  Note also that this is based on the name of the paths using some
574  heuristics.
575  """
576 
577  retval = { "singleElectron": [],
578  "doubleElectron": [],
579  "singlePhoton": [],
580  "doublePhoton": [],
581  }
582 
583  for path_name, path in process.paths.items():
584 
585  # print "XX",path_name.__class__,path.__class__
586 
587  if path_name.startswith("AlCa_"):
588  continue
589 
590  if path_name.startswith("DQM_"):
591  continue
592 
593  if not path_name.startswith("HLT_"):
594  continue
595 
596  if path_name.startswith("HLT_Ele"):
597  retval['singleElectron'].append(path)
598  continue
599 
600  if path_name.startswith("HLT_Photon"):
601  retval['singlePhoton'].append(path)
602  continue
603 
604  if path_name.startswith("HLT_DoublePhoton"):
605  retval['doublePhoton'].append(path)
606  continue
607 
608  if path_name.startswith("HLT_DoubleEle"):
609  retval['doubleElectron'].append(path)
610  continue
611 
612  # end of loop over paths
613  return retval
614 
615 #----------------------------------------------------------------------
616 
618  """ returns the names of the modules found in the given path.
619 
620  Note that these are not guaranteed to be in any particular
621  order.
622  """
623 
624  # this function could actually call getModulesOfSequence(..)
625  # and then produce a set with the unique names of
626  # the modules
627 
628  import FWCore.ParameterSet.Modules
629  class Visitor:
630 
631  #----------------------------------------
632  def __init__(self):
633  self.module_names_found = set()
634 
635  #----------------------------------------
636  def enter(self,visitee):
637 
638  if isinstance(visitee, FWCore.ParameterSet.Modules._Module):
639  self.module_names_found.add(visitee.label_())
640 
641  #----------------------------------------
642  def leave(self,visitee):
643  pass
644 
645  #----------------------------------------
646 
647  visitor = Visitor()
648  path.visit(visitor)
649 
650  return visitor.module_names_found
651 
652 
653 #----------------------------------------------------------------------
654 def getCXXTypesOfPath(process, path):
655  """ returns the names of (classes) of the C++ types of the modules
656  found in the given path (in no particular order) """
657 
658  moduleNames = getModuleNamesOfPath(path)
659 
660  retval = set()
661 
662  for name in moduleNames:
663 
664  # skip those modules which are in the path
665  # but not in the process object.
666  # not understood why we need to do this
667  # but seems to cause problems in practice...
668  if not hasattr(process,name):
669  continue
670 
671  module = getattr(process, name)
672 
673  retval.add(module.type_())
674 
675  return retval
676 
677 #----------------------------------------------------------------------
678 
679 def getModulesOfSequence(sequence):
680  """ returns the modules found in a sequence.
681 
682  Note that a module can appear more than once.
683  """
684 
685  import FWCore.ParameterSet.Modules
686  class Visitor:
687 
688  #----------------------------------------
689  def __init__(self):
690  self.modules_found = []
691 
692  #----------------------------------------
693  def enter(self,visitee):
694 
695  if isinstance(visitee, FWCore.ParameterSet.Modules._Module):
696  self.modules_found.append(visitee)
697 
698  #----------------------------------------
699  def leave(self,visitee):
700  pass
701 
702  #----------------------------------------
703 
704  visitor = Visitor()
705  sequence.visitNode(visitor)
706 
707  return visitor.modules_found
708 
709 
710 #----------------------------------------------------------------------
std::vector< std::string_view > split(std::string_view, const char *)
def makePSetForL1SeedToSuperClusterMatchFilter(self, moduleName)
def makeGeneratedParticleAndFiducialVolumeFilter(process, pdgGen, requiredNumberOfGeneratedObjects)
def makePSetForEtFilter(self, moduleName)
def __init__(self, process, pathName, pdgGen, requiredNumberOfGeneratedObjects, cutCollection=None)
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def makePSetForOneOEMinusOneOPFilter(self, moduleName)
def makePSetForEgammaGenericFilter(self, module, moduleName)
def getProcessName(pdgGen, requiredNumberOfGeneratedObjects)
def makePSetForPixelMatchFilter(self, moduleName)
def getPathsOfDataSet(process, datasetName)
def dumpPython(process, name)
def makePSetForElectronGenericFilter(self, module, moduleName)
#define str(s)
def makePSetForL1SeedFilter(self, moduleName)
print >> sys.stderr,msgPrefix,"WARNING: unknown module type", module.type_(), " with name " + moduleN...
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run