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))
176 from DQMServices.Core.DQMEDAnalyzer
import DQMEDAnalyzer
178 triggerobject = cms.InputTag(
"hltTriggerSummaryRAW",
"",
"HLT"),
179 genEtaAcc = cms.double(2.5),
180 genEtAcc = cms.double(2.0),
181 reqNum = cms.uint32(requiredNumberOfGeneratedObjects),
182 filters = cms.VPSet(),
183 PtMax = cms.untracked.double(100.0),
184 genEtMin = cms.untracked.double(etThreshold),
185 pdgGen = cms.int32(pdgGen),
186 cutcollection = cms.InputTag(cutCollection),
189 cutnum = cms.int32(requiredNumberOfGeneratedObjects),
231 import FWCore.ParameterSet.Modules
233 for moduleName
in moduleNames:
242 if not hasattr(self.
process, moduleName):
252 if moduleName
in (
'simulation',
259 module = getattr(self.
process,moduleName)
261 if not isinstance(module, FWCore.ParameterSet.Modules.EDFilter):
265 if module.type_()
in (
'HLTTriggerTypeFilter',
273 if module.type_() ==
'HLTLevel1GTSeed':
275 self.__result.filters.append(self.makePSetForL1SeedFilter(moduleName))
279 if module.type_() ==
'HLTEgammaL1MatchFilterRegional':
281 self.__result.filters.append(self.makePSetForL1SeedToSuperClusterMatchFilter(moduleName))
286 if module.type_() ==
"HLTEgammaEtFilter":
288 self.__result.filters.append(self.makePSetForEtFilter(moduleName))
293 if module.type_() ==
"HLTElectronOneOEMinusOneOPFilterRegional":
294 self.__result.filters.append(self.makePSetForOneOEMinusOneOPFilter(moduleName))
298 if module.type_() ==
"HLTElectronPixelMatchFilter":
299 self.__result.filters.append(self.makePSetForPixelMatchFilter(moduleName))
308 if module.type_() ==
"HLTEgammaGenericFilter":
310 pset = self.makePSetForEgammaGenericFilter(module, moduleName)
312 self.__result.filters.append(pset)
317 if module.type_() ==
"HLTElectronGenericFilter":
319 pset = self.makePSetForElectronGenericFilter(module, moduleName)
321 self.__result.filters.append(pset)
331 """ generates a PSet to analyze the behaviour of an L1 seed. 333 moduleName is the name of the HLT module which filters 338 PlotBounds = cms.vdouble(0.0, 0.0),
339 HLTCollectionLabels = cms.InputTag(moduleName,
"",self.processName),
340 IsoCollections = cms.VInputTag(cms.InputTag(
"none")),
341 theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerL1NoIsoEG)
347 """ generates a PSet to analyze the behaviour of L1 to supercluster match filter. 349 moduleName is the name of the HLT module which requires the match 350 between supercluster and L1 seed. 354 PlotBounds = cms.vdouble(0.0, 0.0),
355 HLTCollectionLabels = cms.InputTag(moduleName,
"",self.processName),
356 IsoCollections = cms.VInputTag(cms.InputTag(
"none")),
357 theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerCluster)
363 """ generates a PSet for the Egamma DQM analyzer for the Et filter """ 366 PlotBounds = cms.vdouble(0.0, 0.0),
367 HLTCollectionLabels = cms.InputTag(moduleName,
"",self.processName),
368 IsoCollections = cms.VInputTag(cms.InputTag(
"none")),
369 theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerCluster)
377 PlotBounds = cms.vdouble(0.0, 0.0),
378 HLTCollectionLabels = cms.InputTag(moduleName,
"",self.processName),
379 IsoCollections = cms.VInputTag(cms.InputTag(
"none")),
380 theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerElectron)
387 PlotBounds = cms.vdouble(0.0, 0.0),
388 HLTCollectionLabels = cms.InputTag(moduleName,
"",self.processName),
389 IsoCollections = cms.VInputTag(cms.InputTag(
"none")),
390 theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerCluster)
406 theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerCluster)
410 inputCollectionLabel = module.isoTag.moduleLabel
412 inputType = getattr(self.process, inputCollectionLabel).type_()
420 assert(module.nonIsoTag.moduleLabel !=
"")
422 assert(inputType == getattr(self.process, module.nonIsoTag.moduleLabel).type_())
433 if inputType ==
'EgammaHLTR9Producer':
435 PlotBounds = cms.vdouble(0.0, 0.0),
436 HLTCollectionLabels = cms.InputTag(moduleName,
"",self.processName),
437 IsoCollections = cms.VInputTag(module.isoTag, module.nonIsoTag),
438 theHLTOutputTypes = theHLTOutputTypes
444 if inputType ==
'EgammaHLTClusterShapeProducer':
446 PlotBounds = cms.vdouble(0.0, 0.0),
447 HLTCollectionLabels = cms.InputTag(moduleName,
"",self.processName),
448 IsoCollections = cms.VInputTag(module.isoTag, module.nonIsoTag),
449 theHLTOutputTypes = theHLTOutputTypes
455 if inputType ==
'EgammaHLTEcalRecIsolationProducer':
457 PlotBounds = cms.vdouble(0.0, 0.0),
458 HLTCollectionLabels = cms.InputTag(moduleName,
"",self.processName),
459 IsoCollections = cms.VInputTag(module.isoTag, module.nonIsoTag),
460 theHLTOutputTypes = theHLTOutputTypes
467 if inputType ==
'EgammaHLTHcalIsolationProducersRegional':
469 PlotBounds = cms.vdouble(0.0, 0.0),
470 HLTCollectionLabels = cms.InputTag(moduleName,
"",self.processName),
471 IsoCollections = cms.VInputTag(module.isoTag, module.nonIsoTag),
472 theHLTOutputTypes = theHLTOutputTypes
476 raise Exception(
"can't determine what the HLTEgammaGenericFilter '" + moduleName +
"' should do: uses a collection produced by a module of C++ type '" + inputType +
"'")
490 theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerElectron)
494 inputCollectionLabel = module.isoTag.moduleLabel
496 inputType = getattr(self.process, inputCollectionLabel).type_()
501 assert(inputType == getattr(self.process, module.nonIsoTag.moduleLabel).type_())
511 if inputType ==
'EgammaHLTElectronDetaDphiProducer':
514 PlotBounds = cms.vdouble(0.0, 0.0),
515 HLTCollectionLabels = cms.InputTag(moduleName,
"",self.processName),
516 IsoCollections = cms.VInputTag(module.isoTag, module.nonIsoTag),
517 theHLTOutputTypes = theHLTOutputTypes
524 if inputType ==
'EgammaHLTElectronTrackIsolationProducers':
527 PlotBounds = cms.vdouble(0.0, 0.0),
528 HLTCollectionLabels = cms.InputTag(moduleName,
"",self.processName),
529 IsoCollections = cms.VInputTag(module.isoTag, module.nonIsoTag),
530 theHLTOutputTypes = theHLTOutputTypes
532 raise Exception(
"can't determine what the HLTElectronGenericFilter '" + moduleName +
"' should do: uses a collection produced by a module of C++ type '" + inputType +
"'")
537 """ returns the composed analyzer module """ 545 if __name__ ==
"__main__":
547 import FWCore.ParameterSet.Config
as cms
548 process = cms.Process(
"MYTEST")
549 process.load(
"HLTrigger.Configuration.HLT_GRun_cff")
564 "singleElectron": [ list of single electron path objects ], 565 "doubleElectron": [ list of double electron path objects ], 566 "singlePhoton": [ list of single photon path objects ], 567 "doublePhoton": [ list of double photon path objects ], 570 Note that the elements in the lists are path objects, not path names. 572 Note also that this is based on the name of the paths using some 576 retval = {
"singleElectron": [],
577 "doubleElectron": [],
582 for path_name, path
in process.paths.items():
586 if path_name.startswith(
"AlCa_"):
589 if path_name.startswith(
"DQM_"):
592 if not path_name.startswith(
"HLT_"):
595 if path_name.startswith(
"HLT_Ele"):
596 retval[
'singleElectron'].
append(path)
599 if path_name.startswith(
"HLT_Photon"):
600 retval[
'singlePhoton'].
append(path)
603 if path_name.startswith(
"HLT_DoublePhoton"):
604 retval[
'doublePhoton'].
append(path)
607 if path_name.startswith(
"HLT_DoubleEle"):
608 retval[
'doubleElectron'].
append(path)
617 """ returns the names of the modules found in the given path. 619 Note that these are not guaranteed to be in any particular 627 import FWCore.ParameterSet.Modules
632 self.module_names_found = set()
635 def enter(self,visitee):
637 if isinstance(visitee, FWCore.ParameterSet.Modules._Module):
638 self.module_names_found.add(visitee.label_())
641 def leave(self,visitee):
649 return visitor.module_names_found
654 """ returns the names of (classes) of the C++ types of the modules 655 found in the given path (in no particular order) """ 661 for name
in moduleNames:
667 if not hasattr(process,name):
670 module = getattr(process, name)
672 retval.add(module.type_())
679 """ returns the modules found in a sequence. 681 Note that a module can appear more than once. 684 import FWCore.ParameterSet.Modules
689 self.modules_found = []
692 def enter(self,visitee):
694 if isinstance(visitee, FWCore.ParameterSet.Modules._Module):
695 self.modules_found.append(visitee)
698 def leave(self,visitee):
704 sequence.visitNode(visitor)
706 return visitor.modules_found
def makePSetForL1SeedToSuperClusterMatchFilter(self, moduleName)
def makeGeneratedParticleAndFiducialVolumeFilter(process, pdgGen, requiredNumberOfGeneratedObjects)
def makePSetForEtFilter(self, moduleName)
def __init__(self, process, pathName, pdgGen, requiredNumberOfGeneratedObjects, cutCollection=None)
def findEgammaPaths(process)
def getCXXTypesOfPath(process, path)
def makePSetForOneOEMinusOneOPFilter(self, moduleName)
def makePSetForEgammaGenericFilter(self, module, moduleName)
def getModuleNamesOfPath(path)
def getProcessName(pdgGen, requiredNumberOfGeneratedObjects)
def makePSetForPixelMatchFilter(self, moduleName)
def getPathsOfDataSet(process, datasetName)
def dumpPython(process, name)
def makePSetForElectronGenericFilter(self, module, moduleName)
def makePSetForL1SeedFilter(self, moduleName)
print >> sys.stderr,msgPrefix,"WARNING: unknown module type", module.type_(), " with name " + moduleN...
def getModulesOfSequence(sequence)
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