Classes | |
class | EgammaDQMModuleMaker |
Functions | |
def | findEgammaPaths |
def | getCXXTypesOfPath |
def | getModuleNamesOfPath |
def | getModulesOfSequence |
def | getPathsOfDataSet |
def | getProcessName |
def | getResult |
def | makeGeneratedParticleAndFiducialVolumeFilter |
def | makePSetForEgammaGenericFilter |
def | makePSetForElectronGenericFilter |
def | makePSetForEtFilter |
def | makePSetForL1SeedFilter |
print >> sys.stderr,msgPrefix,"WARNING: unknown module type", module.type_(), " with name " + moduleName + " in path " + pathName | |
def | makePSetForL1SeedToSuperClusterMatchFilter |
def | makePSetForOneOEMinusOneOPFilter |
def | makePSetForPixelMatchFilter |
Variables | |
module_names_found | |
tuple | moduleMaker = EgammaDQMModuleMaker(process, "HLT_Ele17_SW_TighterEleIdIsol_L1R_v3", 11, 1) |
modules_found | |
string | msgPrefix = "[" |
tuple | process = cms.Process("MYTEST") |
def EgammaHLTValidationUtils::findEgammaPaths | ( | process | ) |
returns a dict: { "singleElectron": [ list of single electron path objects ], "doubleElectron": [ list of double electron path objects ], "singlePhoton": [ list of single photon path objects ], "doublePhoton": [ list of double photon path objects ], } Note that the elements in the lists are path objects, not path names. Note also that this is based on the name of the paths using some heuristics.
Definition at line 558 of file EgammaHLTValidationUtils.py.
00559 : 00560 """ 00561 returns a dict: 00562 00563 { 00564 "singleElectron": [ list of single electron path objects ], 00565 "doubleElectron": [ list of double electron path objects ], 00566 "singlePhoton": [ list of single photon path objects ], 00567 "doublePhoton": [ list of double photon path objects ], 00568 } 00569 00570 Note that the elements in the lists are path objects, not path names. 00571 00572 Note also that this is based on the name of the paths using some 00573 heuristics. 00574 """ 00575 00576 retval = { "singleElectron": [], 00577 "doubleElectron": [], 00578 "singlePhoton": [], 00579 "doublePhoton": [], 00580 } 00581 00582 for path_name, path in process.paths.items(): 00583 00584 # print "XX",path_name.__class__,path.__class__ 00585 00586 if path_name.startswith("AlCa_"): 00587 continue 00588 00589 if path_name.startswith("DQM_"): 00590 continue 00591 00592 if not path_name.startswith("HLT_"): 00593 continue 00594 00595 if path_name.startswith("HLT_Ele"): 00596 retval['singleElectron'].append(path) 00597 continue 00598 00599 if path_name.startswith("HLT_Photon"): 00600 retval['singlePhoton'].append(path) 00601 continue 00602 00603 if path_name.startswith("HLT_DoublePhoton"): 00604 retval['doublePhoton'].append(path) 00605 continue 00606 00607 if path_name.startswith("HLT_DoubleEle"): 00608 retval['doubleElectron'].append(path) 00609 continue 00610 00611 # end of loop over paths 00612 return retval 00613 00614 #----------------------------------------------------------------------
def EgammaHLTValidationUtils::getCXXTypesOfPath | ( | process, | |
path | |||
) |
returns the names of (classes) of the C++ types of the modules found in the given path (in no particular order)
Definition at line 652 of file EgammaHLTValidationUtils.py.
00653 : 00654 """ returns the names of (classes) of the C++ types of the modules 00655 found in the given path (in no particular order) """ 00656 00657 moduleNames = getModuleNamesOfPath(path) 00658 00659 retval = set() 00660 00661 for name in moduleNames: 00662 00663 # skip those modules which are in the path 00664 # but not in the process object. 00665 # not understood why we need to do this 00666 # but seems to cause problems in practice... 00667 if not hasattr(process,name): 00668 continue 00669 00670 module = getattr(process, name) 00671 00672 retval.add(module.type_()) 00673 00674 return retval 00675 00676 #----------------------------------------------------------------------
def EgammaHLTValidationUtils::getModuleNamesOfPath | ( | path | ) |
returns the names of the modules found in the given path. Note that these are not guaranteed to be in any particular order.
Definition at line 615 of file EgammaHLTValidationUtils.py.
00616 : 00617 """ returns the names of the modules found in the given path. 00618 00619 Note that these are not guaranteed to be in any particular 00620 order. 00621 """ 00622 00623 # this function could actually call getModulesOfSequence(..) 00624 # and then produce a set with the unique names of 00625 # the modules 00626 00627 import FWCore.ParameterSet.Modules 00628 class Visitor: 00629 00630 #---------------------------------------- 00631 def __init__(self): 00632 self.module_names_found = set() 00633 00634 #---------------------------------------- 00635 def enter(self,visitee): 00636 00637 if isinstance(visitee, FWCore.ParameterSet.Modules._Module): 00638 self.module_names_found.add(visitee.label_()) 00639 00640 #---------------------------------------- 00641 def leave(self,visitee): 00642 pass 00643 00644 #---------------------------------------- 00645 00646 visitor = Visitor() 00647 path.visit(visitor) 00648 00649 return visitor.module_names_found 00650 00651 #----------------------------------------------------------------------
def EgammaHLTValidationUtils::getModulesOfSequence | ( | sequence | ) |
returns the modules found in a sequence. Note that a module can appear more than once.
Definition at line 677 of file EgammaHLTValidationUtils.py.
00678 : 00679 """ returns the modules found in a sequence. 00680 00681 Note that a module can appear more than once. 00682 """ 00683 00684 import FWCore.ParameterSet.Modules 00685 class Visitor: 00686 00687 #---------------------------------------- 00688 def __init__(self): 00689 self.modules_found = [] 00690 00691 #---------------------------------------- 00692 def enter(self,visitee): 00693 00694 if isinstance(visitee, FWCore.ParameterSet.Modules._Module): 00695 self.modules_found.append(visitee) 00696 00697 #---------------------------------------- 00698 def leave(self,visitee): 00699 pass 00700 00701 #---------------------------------------- 00702 00703 visitor = Visitor() 00704 sequence.visitNode(visitor) 00705 00706 return visitor.modules_found 00707 00708 00709 #----------------------------------------------------------------------
def EgammaHLTValidationUtils::getPathsOfDataSet | ( | process, | |
datasetName | |||
) |
returns the names of the trigger paths contained in the given (primary) dataset
Definition at line 11 of file EgammaHLTValidationUtils.py.
def EgammaHLTValidationUtils::getProcessName | ( | pdgGen, | |
requiredNumberOfGeneratedObjects | |||
) |
returns a process name (such as 'Zee') which can be used in various places (e.g. module names etc.)
Definition at line 20 of file EgammaHLTValidationUtils.py.
Referenced by edm::MixingModule::branchesActivate(), and edm::CFWriter::branchesActivate().
00021 : 00022 """ returns a process name (such as 'Zee') which can be 00023 used in various places (e.g. module names etc.) """ 00024 00025 if pdgGen == 11: 00026 00027 # electron paths 00028 if requiredNumberOfGeneratedObjects == 1: 00029 return "Wenu" 00030 elif requiredNumberOfGeneratedObjects == 2: 00031 return "Zee" 00032 else: 00033 raise Exception("unsupported case, can't guess type of process") 00034 00035 elif pdgGen == 22: 00036 00037 # photon paths 00038 if requiredNumberOfGeneratedObjects == 1: 00039 return 'GammaJet' 00040 elif requiredNumberOfGeneratedObjects == 2: 00041 return 'DiGamma' 00042 else: 00043 raise Exception("unsupported case, can't guess type of process") 00044 else: 00045 raise Exception("unsupported case, can't guess type of process") 00046 00047 00048 #----------------------------------------------------------------------
def EgammaHLTValidationUtils::getResult | ( | self | ) |
returns the composed analyzer module
Definition at line 535 of file EgammaHLTValidationUtils.py.
def EgammaHLTValidationUtils::makeGeneratedParticleAndFiducialVolumeFilter | ( | process, | |
pdgGen, | |||
requiredNumberOfGeneratedObjects | |||
) |
adds the needed modules to the process object and returns a sequence made of the two filters. returns the name of the created module if process is not None, are added to the process. When using this function from a _cff file, one has to manually add the modules of the returned sequence to globals() (in the calling module, not here, globals() live in a different name space here)
Definition at line 49 of file EgammaHLTValidationUtils.py.
00050 : 00051 """ 00052 adds the needed modules to the process object and 00053 returns a sequence made of the two filters. 00054 00055 returns the name of the created module 00056 00057 if process is not None, are added to the process. 00058 00059 When using this function from a _cff file, one 00060 has to manually add the modules of the returned 00061 sequence to globals() (in the calling module, not 00062 here, globals() live in a different name space here) 00063 00064 """ 00065 00066 # name of the physics process 00067 procName = getProcessName(pdgGen, requiredNumberOfGeneratedObjects) 00068 00069 #-------------------- 00070 # create a module producing a collection with the 00071 # desired generated particles 00072 #-------------------- 00073 00074 genPartModuleName = 'genpart' + procName 00075 00076 00077 genPartModule = cms.EDFilter("PdgIdAndStatusCandViewSelector", 00078 status = cms.vint32(3), 00079 src = cms.InputTag("genParticles"), 00080 pdgId = cms.vint32(pdgGen), 00081 ) 00082 00083 # genPartModule.setLabel(genPartModuleName) 00084 if process != None: 00085 setattr(process, genPartModuleName, genPartModule) 00086 00087 genPartModule.setLabel(genPartModuleName) 00088 00089 #-------------------- 00090 # create a module requiring the number 00091 # of generated particles 00092 #-------------------- 00093 00094 selectorModuleName = "fiducial" + procName 00095 00096 selectorModule = cms.EDFilter("EtaPtMinCandViewSelector", 00097 src = cms.InputTag(genPartModuleName), 00098 etaMin = cms.double(-2.5), 00099 etaMax = cms.double(2.5), 00100 ptMin = cms.double(2.0) 00101 ) 00102 00103 if process != None: 00104 setattr(process, selectorModuleName, selectorModule) 00105 00106 # this is needed if we don't have a process to attach this module to 00107 selectorModule.setLabel(selectorModuleName) 00108 00109 #-------------------- 00110 # create the sequence 00111 #-------------------- 00112 00113 return cms.Sequence( 00114 # getattr(process, genPartModuleName) 00115 genPartModule 00116 00117 * 00118 00119 # getattr(process, selectorModuleName) 00120 selectorModule 00121 ) 00122 #----------------------------------------------------------------------
def EgammaHLTValidationUtils::makePSetForEgammaGenericFilter | ( | self, | |
module, | |||
moduleName | |||
) |
Definition at line 394 of file EgammaHLTValidationUtils.py.
00395 : 00396 00397 # example usages of HLTEgammaGenericFilter are: 00398 # R9 shape filter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolR9ShapeFilter 00399 # cluster shape filter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolClusterShapeFilter 00400 # Ecal isolation filter hltL1NonIsoHLTNonIsoSingleElectronEt17TIghterEleIdIsolEcalIsolFilter 00401 # H/E filter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolHEFilter 00402 # HCAL isolation filter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolHcalIsolFilter 00403 00404 # the type of object to look for seems to be the 00405 # same for all uses of HLTEgammaGenericFilter 00406 theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerCluster) 00407 00408 # infer the type of filter by the type of the producer which 00409 # generates the collection used to cut on this 00410 inputCollectionLabel = module.isoTag.moduleLabel 00411 00412 inputType = getattr(self.process, inputCollectionLabel).type_() 00413 # print >> sys.stderr, "inputType=",inputType,moduleName 00414 00415 #-------------------- 00416 # sanity check: non-isolated path should be produced by the 00417 # same type of module 00418 # 00419 # first check that the non-iso tag is non-empty 00420 assert(module.nonIsoTag.moduleLabel != "") 00421 00422 assert(inputType == getattr(self.process, module.nonIsoTag.moduleLabel).type_()) 00423 00424 #-------------------- 00425 00426 00427 # the following cases seem to have identical PSets ? 00428 00429 #-------------------- 00430 # R9 shape 00431 #-------------------- 00432 00433 if inputType == 'EgammaHLTR9Producer': 00434 return cms.PSet( 00435 PlotBounds = cms.vdouble(0.0, 0.0), 00436 HLTCollectionLabels = cms.InputTag(moduleName,"",self.processName), 00437 IsoCollections = cms.VInputTag(module.isoTag, module.nonIsoTag), 00438 theHLTOutputTypes = theHLTOutputTypes 00439 ) 00440 00441 #-------------------- 00442 # cluster shape 00443 #-------------------- 00444 if inputType == 'EgammaHLTClusterShapeProducer': 00445 return cms.PSet( 00446 PlotBounds = cms.vdouble(0.0, 0.0), 00447 HLTCollectionLabels = cms.InputTag(moduleName,"",self.processName), 00448 IsoCollections = cms.VInputTag(module.isoTag, module.nonIsoTag), 00449 theHLTOutputTypes = theHLTOutputTypes 00450 ) 00451 00452 #-------------------- 00453 # ecal isolation 00454 #-------------------- 00455 if inputType == 'EgammaHLTEcalRecIsolationProducer': 00456 return cms.PSet( 00457 PlotBounds = cms.vdouble(0.0, 0.0), 00458 HLTCollectionLabels = cms.InputTag(moduleName,"",self.processName), 00459 IsoCollections = cms.VInputTag(module.isoTag, module.nonIsoTag), 00460 theHLTOutputTypes = theHLTOutputTypes 00461 ) 00462 00463 #-------------------- 00464 # HCAL isolation and HE 00465 #-------------------- 00466 00467 if inputType == 'EgammaHLTHcalIsolationProducersRegional': 00468 return cms.PSet( 00469 PlotBounds = cms.vdouble(0.0, 0.0), 00470 HLTCollectionLabels = cms.InputTag(moduleName,"",self.processName), 00471 IsoCollections = cms.VInputTag(module.isoTag, module.nonIsoTag), 00472 theHLTOutputTypes = theHLTOutputTypes 00473 ) 00474 00475 00476 raise Exception("can't determine what the HLTEgammaGenericFilter '" + moduleName + "' should do: uses a collection produced by a module of C++ type '" + inputType + "'")
def EgammaHLTValidationUtils::makePSetForElectronGenericFilter | ( | self, | |
module, | |||
moduleName | |||
) |
Definition at line 479 of file EgammaHLTValidationUtils.py.
00480 : 00481 00482 # example usages of HLTElectronGenericFilter are: 00483 00484 # deta filter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolDetaFilter 00485 # dphi filter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolDphiFilter 00486 # track isolation hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolTrackIsolFilter 00487 00488 # the type of object to look for seems to be the 00489 # same for all uses of HLTEgammaGenericFilter 00490 theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerElectron) 00491 00492 # infer the type of filter by the type of the producer which 00493 # generates the collection used to cut on this 00494 inputCollectionLabel = module.isoTag.moduleLabel 00495 00496 inputType = getattr(self.process, inputCollectionLabel).type_() 00497 # print >> sys.stderr, "inputType=",inputType,moduleName 00498 00499 # sanity check: non-isolated path should be produced by the 00500 # same type of module 00501 assert(inputType == getattr(self.process, module.nonIsoTag.moduleLabel).type_()) 00502 00503 # the following cases seem to have identical PSets ? 00504 00505 #-------------------- 00506 # deta and dphi filter 00507 #-------------------- 00508 00509 # note that whether deta or dphi is used is determined from 00510 # the product instance (not the module label) 00511 if inputType == 'EgammaHLTElectronDetaDphiProducer': 00512 00513 return cms.PSet( 00514 PlotBounds = cms.vdouble(0.0, 0.0), 00515 HLTCollectionLabels = cms.InputTag(moduleName,"",self.processName), 00516 IsoCollections = cms.VInputTag(module.isoTag, module.nonIsoTag), 00517 theHLTOutputTypes = theHLTOutputTypes 00518 ) 00519 00520 #-------------------- 00521 # track isolation 00522 #-------------------- 00523 00524 if inputType == 'EgammaHLTElectronTrackIsolationProducers': 00525 00526 return cms.PSet( 00527 PlotBounds = cms.vdouble(0.0, 0.0), 00528 HLTCollectionLabels = cms.InputTag(moduleName,"",self.processName), 00529 IsoCollections = cms.VInputTag(module.isoTag, module.nonIsoTag), 00530 theHLTOutputTypes = theHLTOutputTypes 00531 ) 00532 raise Exception("can't determine what the HLTElectronGenericFilter '" + moduleName + "' should do: uses a collection produced by a module of C++ type '" + inputType + "'")
def EgammaHLTValidationUtils::makePSetForEtFilter | ( | self, | |
moduleName | |||
) |
generates a PSet for the Egamma DQM analyzer for the Et filter
Definition at line 361 of file EgammaHLTValidationUtils.py.
00362 : 00363 """ generates a PSet for the Egamma DQM analyzer for the Et filter """ 00364 00365 return cms.PSet( 00366 PlotBounds = cms.vdouble(0.0, 0.0), 00367 HLTCollectionLabels = cms.InputTag(moduleName,"",self.processName), 00368 IsoCollections = cms.VInputTag(cms.InputTag("none")), 00369 theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerCluster) 00370 )
def EgammaHLTValidationUtils::makePSetForL1SeedFilter | ( | self, | |
moduleName | |||
) |
print >> sys.stderr,msgPrefix,"WARNING: unknown module type", module.type_(), " with name " + moduleName + " in path " + pathName
generates a PSet to analyze the behaviour of an L1 seed. moduleName is the name of the HLT module which filters on the L1 seed.
Definition at line 329 of file EgammaHLTValidationUtils.py.
00330 : 00331 """ generates a PSet to analyze the behaviour of an L1 seed. 00332 00333 moduleName is the name of the HLT module which filters 00334 on the L1 seed. 00335 """ 00336 00337 return cms.PSet( 00338 PlotBounds = cms.vdouble(0.0, 0.0), 00339 HLTCollectionLabels = cms.InputTag(moduleName,"",self.processName), 00340 IsoCollections = cms.VInputTag(cms.InputTag("none")), 00341 theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerL1NoIsoEG) 00342 )
def EgammaHLTValidationUtils::makePSetForL1SeedToSuperClusterMatchFilter | ( | self, | |
moduleName | |||
) |
generates a PSet to analyze the behaviour of L1 to supercluster match filter. moduleName is the name of the HLT module which requires the match between supercluster and L1 seed.
Definition at line 345 of file EgammaHLTValidationUtils.py.
00346 : 00347 """ generates a PSet to analyze the behaviour of L1 to supercluster match filter. 00348 00349 moduleName is the name of the HLT module which requires the match 00350 between supercluster and L1 seed. 00351 """ 00352 00353 return cms.PSet( 00354 PlotBounds = cms.vdouble(0.0, 0.0), 00355 HLTCollectionLabels = cms.InputTag(moduleName,"",self.processName), 00356 IsoCollections = cms.VInputTag(cms.InputTag("none")), 00357 theHLTOutputTypes = cms.int32(TriggerTypeDefs_cfi.TriggerCluster) 00358 )
def EgammaHLTValidationUtils::makePSetForOneOEMinusOneOPFilter | ( | self, | |
moduleName | |||
) |
Definition at line 373 of file EgammaHLTValidationUtils.py.
def EgammaHLTValidationUtils::makePSetForPixelMatchFilter | ( | self, | |
moduleName | |||
) |
Definition at line 384 of file EgammaHLTValidationUtils.py.
Definition at line 619 of file EgammaHLTValidationUtils.py.
tuple EgammaHLTValidationUtils::moduleMaker = EgammaDQMModuleMaker(process, "HLT_Ele17_SW_TighterEleIdIsol_L1R_v3", 11, 1) |
Definition at line 550 of file EgammaHLTValidationUtils.py.
Definition at line 680 of file EgammaHLTValidationUtils.py.
string EgammaHLTValidationUtils::msgPrefix = "[" |
Definition at line 6 of file EgammaHLTValidationUtils.py.
tuple EgammaHLTValidationUtils::process = cms.Process("MYTEST") |
Definition at line 547 of file EgammaHLTValidationUtils.py.