2 from __future__
import print_function
3 import FWCore.ParameterSet.Config
as cms
7 msgPrefix =
"[" + os.path.basename(__file__) +
"]" 13 """ returns the names of the trigger paths contained in the 14 given (primary) dataset """ 16 return list(getattr(process.datasets, datasetName))
22 """ returns a process name (such as 'Zee') which can be 23 used in various places (e.g. module names etc.) """ 28 if requiredNumberOfGeneratedObjects == 1:
30 elif requiredNumberOfGeneratedObjects == 2:
33 raise Exception(
"unsupported case, can't guess type of process")
38 if requiredNumberOfGeneratedObjects == 1:
40 elif requiredNumberOfGeneratedObjects == 2:
43 raise Exception(
"unsupported case, can't guess type of process")
45 raise Exception(
"unsupported case, can't guess type of process")
52 adds the needed modules to the process object and 53 returns a sequence made of the two filters. 55 returns the name of the created module 57 if process is not None, are added to the process. 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) 67 procName =
getProcessName(pdgGen, requiredNumberOfGeneratedObjects)
74 genPartModuleName =
'genpart' + procName
77 genPartModule = cms.EDFilter(
"PdgIdAndStatusCandViewSelector",
78 status = cms.vint32(3),
79 src = cms.InputTag(
"genParticles"),
80 pdgId = cms.vint32(pdgGen),
85 setattr(process, genPartModuleName, genPartModule)
87 genPartModule.setLabel(genPartModuleName)
94 selectorModuleName =
"fiducial" + procName
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)
104 setattr(process, selectorModuleName, selectorModule)
107 selectorModule.setLabel(selectorModuleName)
124 import HLTriggerOffline.Egamma.TriggerTypeDefs_cfi
as TriggerTypeDefs_cfi
127 """ a class which can be used to produce an analysis path 128 for the EmDQM analyzer """ 132 def __init__(self, process, pathName, pdgGen, requiredNumberOfGeneratedObjects, cutCollection = None):
134 pathName is the HLT path to be validated. 136 pdgGen is the PDG id of the corersponding generated particles 137 (11 for electrons, 22 for photons) 139 requiredNumberOfGeneratedObjects should be 1 for single triggers, 140 and 2 for double triggers (e.g. double photon triggers) 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 152 self.
path = getattr(process,pathName)
161 if cutCollection ==
None:
162 cutCollection =
"fiducial" +
getProcessName(pdgGen, requiredNumberOfGeneratedObjects)
167 mo = re.match(
"HLT_.*?(\d+).*",pathName)
170 etThreshold =
float(mo.group(1))
177 from DQMServices.Core.DQMEDAnalyzer
import DQMEDAnalyzer
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(),
184 PtMax = cms.untracked.double(100.0),
185 genEtMin = cms.untracked.double(etThreshold),
186 pdgGen = cms.int32(pdgGen),
187 cutcollection = cms.InputTag(cutCollection),
190 cutnum = cms.int32(requiredNumberOfGeneratedObjects),
232 import FWCore.ParameterSet.Modules
234 for moduleName
in moduleNames:
243 if not hasattr(self.
process, moduleName):
253 if moduleName
in (
'simulation',
260 module = getattr(self.
process,moduleName)
262 if not isinstance(module, FWCore.ParameterSet.Modules.EDFilter):
266 if module.type_()
in (
'HLTTriggerTypeFilter',
274 if module.type_() ==
'HLTLevel1GTSeed':
276 self.__result.filters.append(self.makePSetForL1SeedFilter(moduleName))
280 if module.type_() ==
'HLTEgammaL1MatchFilterRegional':
282 self.__result.filters.append(self.makePSetForL1SeedToSuperClusterMatchFilter(moduleName))
287 if module.type_() ==
"HLTEgammaEtFilter":
289 self.__result.filters.append(self.makePSetForEtFilter(moduleName))
294 if module.type_() ==
"HLTElectronOneOEMinusOneOPFilterRegional":
295 self.__result.filters.append(self.makePSetForOneOEMinusOneOPFilter(moduleName))
299 if module.type_() ==
"HLTElectronPixelMatchFilter":
300 self.__result.filters.append(self.makePSetForPixelMatchFilter(moduleName))
309 if module.type_() ==
"HLTEgammaGenericFilter":
311 pset = self.makePSetForEgammaGenericFilter(module, moduleName)
313 self.__result.filters.append(pset)
318 if module.type_() ==
"HLTElectronGenericFilter":
320 pset = self.makePSetForElectronGenericFilter(module, moduleName)
322 self.__result.filters.append(pset)
332 """ generates a PSet to analyze the behaviour of an L1 seed. 334 moduleName is the name of the HLT module which filters 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)
348 """ generates a PSet to analyze the behaviour of L1 to supercluster match filter. 350 moduleName is the name of the HLT module which requires the match 351 between supercluster and L1 seed. 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)
364 """ generates a PSet for the Egamma DQM analyzer for the Et filter """ 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)
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)
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)
407 theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerCluster)
411 inputCollectionLabel = module.isoTag.moduleLabel
413 inputType = getattr(self.process, inputCollectionLabel).type_()
421 assert(module.nonIsoTag.moduleLabel !=
"")
423 assert(inputType == getattr(self.process, module.nonIsoTag.moduleLabel).type_())
434 if inputType ==
'EgammaHLTR9Producer':
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
445 if inputType ==
'EgammaHLTClusterShapeProducer':
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
456 if inputType ==
'EgammaHLTEcalRecIsolationProducer':
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
468 if inputType ==
'EgammaHLTHcalIsolationProducersRegional':
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
477 raise Exception(
"can't determine what the HLTEgammaGenericFilter '" + moduleName +
"' should do: uses a collection produced by a module of C++ type '" + inputType +
"'")
491 theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerElectron)
495 inputCollectionLabel = module.isoTag.moduleLabel
497 inputType = getattr(self.process, inputCollectionLabel).type_()
502 assert(inputType == getattr(self.process, module.nonIsoTag.moduleLabel).type_())
512 if inputType ==
'EgammaHLTElectronDetaDphiProducer':
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
525 if inputType ==
'EgammaHLTElectronTrackIsolationProducers':
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
533 raise Exception(
"can't determine what the HLTElectronGenericFilter '" + moduleName +
"' should do: uses a collection produced by a module of C++ type '" + inputType +
"'")
538 """ returns the composed analyzer module """ 546 if __name__ ==
"__main__":
548 import FWCore.ParameterSet.Config
as cms
549 process = cms.Process(
"MYTEST")
550 process.load(
"HLTrigger.Configuration.HLT_GRun_cff")
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 ], 571 Note that the elements in the lists are path objects, not path names. 573 Note also that this is based on the name of the paths using some 577 retval = {
"singleElectron": [],
578 "doubleElectron": [],
583 for path_name, path
in process.paths.items():
587 if path_name.startswith(
"AlCa_"):
590 if path_name.startswith(
"DQM_"):
593 if not path_name.startswith(
"HLT_"):
596 if path_name.startswith(
"HLT_Ele"):
597 retval[
'singleElectron'].
append(path)
600 if path_name.startswith(
"HLT_Photon"):
601 retval[
'singlePhoton'].
append(path)
604 if path_name.startswith(
"HLT_DoublePhoton"):
605 retval[
'doublePhoton'].
append(path)
608 if path_name.startswith(
"HLT_DoubleEle"):
609 retval[
'doubleElectron'].
append(path)
618 """ returns the names of the modules found in the given path. 620 Note that these are not guaranteed to be in any particular 628 import FWCore.ParameterSet.Modules
633 self.module_names_found = set()
636 def enter(self,visitee):
638 if isinstance(visitee, FWCore.ParameterSet.Modules._Module):
639 self.module_names_found.add(visitee.label_())
642 def leave(self,visitee):
650 return visitor.module_names_found
655 """ returns the names of (classes) of the C++ types of the modules 656 found in the given path (in no particular order) """ 662 for name
in moduleNames:
668 if not hasattr(process,name):
671 module = getattr(process, name)
673 retval.add(module.type_())
680 """ returns the modules found in a sequence. 682 Note that a module can appear more than once. 685 import FWCore.ParameterSet.Modules
690 self.modules_found = []
693 def enter(self,visitee):
695 if isinstance(visitee, FWCore.ParameterSet.Modules._Module):
696 self.modules_found.append(visitee)
699 def leave(self,visitee):
705 sequence.visitNode(visitor)
707 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)
S & print(S &os, JobReport::InputFile const &f)
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