2 import FWCore.ParameterSet.Config
as cms
6 msgPrefix =
"[" + os.path.basename(__file__) +
"]"
12 """ returns the names of the trigger paths contained in the
13 given (primary) dataset """
15 return list(getattr(process.datasets, datasetName))
21 """ returns a process name (such as 'Zee') which can be
22 used in various places (e.g. module names etc.) """
27 if requiredNumberOfGeneratedObjects == 1:
29 elif requiredNumberOfGeneratedObjects == 2:
32 raise Exception(
"unsupported case, can't guess type of process")
37 if requiredNumberOfGeneratedObjects == 1:
39 elif requiredNumberOfGeneratedObjects == 2:
42 raise Exception(
"unsupported case, can't guess type of process")
44 raise Exception(
"unsupported case, can't guess type of process")
51 adds the needed modules to the process object and
52 returns a sequence made of the two filters.
54 returns the name of the created module
56 if process is not None, are added to the process.
58 When using this function from a _cff file, one
59 has to manually add the modules of the returned
60 sequence to globals() (in the calling module, not
61 here, globals() live in a different name space here)
66 procName =
getProcessName(pdgGen, requiredNumberOfGeneratedObjects)
73 genPartModuleName =
'genpart' + procName
76 genPartModule = cms.EDFilter(
"PdgIdAndStatusCandViewSelector",
77 status = cms.vint32(3),
78 src = cms.InputTag(
"genParticles"),
79 pdgId = cms.vint32(pdgGen),
84 setattr(process, genPartModuleName, genPartModule)
86 genPartModule.setLabel(genPartModuleName)
93 selectorModuleName =
"fiducial" + procName
95 selectorModule = cms.EDFilter(
"EtaPtMinCandViewSelector",
96 src = cms.InputTag(genPartModuleName),
97 etaMin = cms.double(-2.5),
98 etaMax = cms.double(2.5),
99 ptMin = cms.double(2.0)
103 setattr(process, selectorModuleName, selectorModule)
106 selectorModule.setLabel(selectorModuleName)
123 import HLTriggerOffline.Egamma.TriggerTypeDefs_cfi
as TriggerTypeDefs_cfi
126 """ a class which can be used to produce an analysis path
127 for the EmDQM analyzer """
131 def __init__(self, process, pathName, pdgGen, requiredNumberOfGeneratedObjects, cutCollection = None):
133 pathName is the HLT path to be validated.
135 pdgGen is the PDG id of the corersponding generated particles
136 (11 for electrons, 22 for photons)
138 requiredNumberOfGeneratedObjects should be 1 for single triggers,
139 and 2 for double triggers (e.g. double photon triggers)
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
151 self.
path = getattr(process,pathName)
160 if cutCollection ==
None:
161 cutCollection =
"fiducial" +
getProcessName(pdgGen, requiredNumberOfGeneratedObjects)
166 mo = re.match(
"HLT_.*?(\d+).*",pathName)
169 etThreshold = float(mo.group(1))
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(),
182 PtMax = cms.untracked.double(100.0),
183 genEtMin = cms.untracked.double(etThreshold),
184 pdgGen = cms.int32(pdgGen),
185 cutcollection = cms.InputTag(cutCollection),
188 cutnum = cms.int32(requiredNumberOfGeneratedObjects),
230 import FWCore.ParameterSet.Modules
232 for moduleName
in moduleNames:
241 if not hasattr(self.
process, moduleName):
251 if moduleName
in (
'simulation',
258 module = getattr(self.
process,moduleName)
260 if not isinstance(module, FWCore.ParameterSet.Modules.EDFilter):
264 if module.type_()
in (
'HLTTriggerTypeFilter',
272 if module.type_() ==
'HLTLevel1GTSeed':
274 self.__result.filters.append(self.makePSetForL1SeedFilter(moduleName))
278 if module.type_() ==
'HLTEgammaL1MatchFilterRegional':
280 self.__result.filters.append(self.makePSetForL1SeedToSuperClusterMatchFilter(moduleName))
285 if module.type_() ==
"HLTEgammaEtFilter":
287 self.__result.filters.append(self.makePSetForEtFilter(moduleName))
292 if module.type_() ==
"HLTElectronOneOEMinusOneOPFilterRegional":
293 self.__result.filters.append(self.makePSetForOneOEMinusOneOPFilter(moduleName))
297 if module.type_() ==
"HLTElectronPixelMatchFilter":
298 self.__result.filters.append(self.makePSetForPixelMatchFilter(moduleName))
307 if module.type_() ==
"HLTEgammaGenericFilter":
309 pset = self.makePSetForEgammaGenericFilter(module, moduleName)
311 self.__result.filters.append(pset)
316 if module.type_() ==
"HLTElectronGenericFilter":
318 pset = self.makePSetForElectronGenericFilter(module, moduleName)
320 self.__result.filters.append(pset)
330 """ generates a PSet to analyze the behaviour of an L1 seed.
332 moduleName is the name of the HLT module which filters
337 PlotBounds = cms.vdouble(0.0, 0.0),
338 HLTCollectionLabels = cms.InputTag(moduleName,
"",self.processName),
339 IsoCollections = cms.VInputTag(cms.InputTag(
"none")),
340 theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerL1NoIsoEG)
346 """ generates a PSet to analyze the behaviour of L1 to supercluster match filter.
348 moduleName is the name of the HLT module which requires the match
349 between supercluster and L1 seed.
353 PlotBounds = cms.vdouble(0.0, 0.0),
354 HLTCollectionLabels = cms.InputTag(moduleName,
"",self.processName),
355 IsoCollections = cms.VInputTag(cms.InputTag(
"none")),
356 theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerCluster)
362 """ generates a PSet for the Egamma DQM analyzer for the Et filter """
365 PlotBounds = cms.vdouble(0.0, 0.0),
366 HLTCollectionLabels = cms.InputTag(moduleName,
"",self.processName),
367 IsoCollections = cms.VInputTag(cms.InputTag(
"none")),
368 theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerCluster)
376 PlotBounds = cms.vdouble(0.0, 0.0),
377 HLTCollectionLabels = cms.InputTag(moduleName,
"",self.processName),
378 IsoCollections = cms.VInputTag(cms.InputTag(
"none")),
379 theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerElectron)
386 PlotBounds = cms.vdouble(0.0, 0.0),
387 HLTCollectionLabels = cms.InputTag(moduleName,
"",self.processName),
388 IsoCollections = cms.VInputTag(cms.InputTag(
"none")),
389 theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerCluster)
405 theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerCluster)
409 inputCollectionLabel = module.isoTag.moduleLabel
411 inputType = getattr(self.process, inputCollectionLabel).type_()
419 assert(module.nonIsoTag.moduleLabel !=
"")
421 assert(inputType == getattr(self.process, module.nonIsoTag.moduleLabel).type_())
432 if inputType ==
'EgammaHLTR9Producer':
434 PlotBounds = cms.vdouble(0.0, 0.0),
435 HLTCollectionLabels = cms.InputTag(moduleName,
"",self.processName),
436 IsoCollections = cms.VInputTag(module.isoTag, module.nonIsoTag),
437 theHLTOutputTypes = theHLTOutputTypes
443 if inputType ==
'EgammaHLTClusterShapeProducer':
445 PlotBounds = cms.vdouble(0.0, 0.0),
446 HLTCollectionLabels = cms.InputTag(moduleName,
"",self.processName),
447 IsoCollections = cms.VInputTag(module.isoTag, module.nonIsoTag),
448 theHLTOutputTypes = theHLTOutputTypes
454 if inputType ==
'EgammaHLTEcalRecIsolationProducer':
456 PlotBounds = cms.vdouble(0.0, 0.0),
457 HLTCollectionLabels = cms.InputTag(moduleName,
"",self.processName),
458 IsoCollections = cms.VInputTag(module.isoTag, module.nonIsoTag),
459 theHLTOutputTypes = theHLTOutputTypes
466 if inputType ==
'EgammaHLTHcalIsolationProducersRegional':
468 PlotBounds = cms.vdouble(0.0, 0.0),
469 HLTCollectionLabels = cms.InputTag(moduleName,
"",self.processName),
470 IsoCollections = cms.VInputTag(module.isoTag, module.nonIsoTag),
471 theHLTOutputTypes = theHLTOutputTypes
475 raise Exception(
"can't determine what the HLTEgammaGenericFilter '" + moduleName +
"' should do: uses a collection produced by a module of C++ type '" + inputType +
"'")
489 theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerElectron)
493 inputCollectionLabel = module.isoTag.moduleLabel
495 inputType = getattr(self.process, inputCollectionLabel).type_()
500 assert(inputType == getattr(self.process, module.nonIsoTag.moduleLabel).type_())
510 if inputType ==
'EgammaHLTElectronDetaDphiProducer':
513 PlotBounds = cms.vdouble(0.0, 0.0),
514 HLTCollectionLabels = cms.InputTag(moduleName,
"",self.processName),
515 IsoCollections = cms.VInputTag(module.isoTag, module.nonIsoTag),
516 theHLTOutputTypes = theHLTOutputTypes
523 if inputType ==
'EgammaHLTElectronTrackIsolationProducers':
526 PlotBounds = cms.vdouble(0.0, 0.0),
527 HLTCollectionLabels = cms.InputTag(moduleName,
"",self.processName),
528 IsoCollections = cms.VInputTag(module.isoTag, module.nonIsoTag),
529 theHLTOutputTypes = theHLTOutputTypes
531 raise Exception(
"can't determine what the HLTElectronGenericFilter '" + moduleName +
"' should do: uses a collection produced by a module of C++ type '" + inputType +
"'")
536 """ returns the composed analyzer module """
544 if __name__ ==
"__main__":
546 import FWCore.ParameterSet.Config
as cms
547 process = cms.Process(
"MYTEST")
548 process.load(
"HLTrigger.Configuration.HLT_GRun_cff")
563 "singleElectron": [ list of single electron path objects ],
564 "doubleElectron": [ list of double electron path objects ],
565 "singlePhoton": [ list of single photon path objects ],
566 "doublePhoton": [ list of double photon path objects ],
569 Note that the elements in the lists are path objects, not path names.
571 Note also that this is based on the name of the paths using some
575 retval = {
"singleElectron": [],
576 "doubleElectron": [],
581 for path_name, path
in process.paths.items():
585 if path_name.startswith(
"AlCa_"):
588 if path_name.startswith(
"DQM_"):
591 if not path_name.startswith(
"HLT_"):
594 if path_name.startswith(
"HLT_Ele"):
595 retval[
'singleElectron'].
append(path)
598 if path_name.startswith(
"HLT_Photon"):
599 retval[
'singlePhoton'].
append(path)
602 if path_name.startswith(
"HLT_DoublePhoton"):
603 retval[
'doublePhoton'].
append(path)
606 if path_name.startswith(
"HLT_DoubleEle"):
607 retval[
'doubleElectron'].
append(path)
616 """ returns the names of the modules found in the given path.
618 Note that these are not guaranteed to be in any particular
626 import FWCore.ParameterSet.Modules
631 self.module_names_found = set()
634 def enter(self,visitee):
636 if isinstance(visitee, FWCore.ParameterSet.Modules._Module):
637 self.module_names_found.add(visitee.label_())
640 def leave(self,visitee):
648 return visitor.module_names_found
653 """ returns the names of (classes) of the C++ types of the modules
654 found in the given path (in no particular order) """
660 for name
in moduleNames:
666 if not hasattr(process,name):
669 module = getattr(process, name)
671 retval.add(module.type_())
678 """ returns the modules found in a sequence.
680 Note that a module can appear more than once.
683 import FWCore.ParameterSet.Modules
688 self.modules_found = []
691 def enter(self,visitee):
693 if isinstance(visitee, FWCore.ParameterSet.Modules._Module):
694 self.modules_found.append(visitee)
697 def leave(self,visitee):
703 sequence.visitNode(visitor)
705 return visitor.modules_found
def makePSetForL1SeedFilter
print >> sys.stderr,msgPrefix,"WARNING: unknown module type", module.type_(), " with name " + moduleN...
def makePSetForPixelMatchFilter
def makeGeneratedParticleAndFiducialVolumeFilter
def makePSetForL1SeedToSuperClusterMatchFilter
def makePSetForOneOEMinusOneOPFilter
def makePSetForElectronGenericFilter
def makePSetForEgammaGenericFilter
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