def __init__(self, name="EMPIDBuilderElectronBase"): EMPIDBuilder.__init__(self, name) mlog = logging.getLogger(name + '::__init__') mlog.debug("entering") from AthenaCommon.AppMgr import ToolSvc # Electron Selectors try: # Cut based from ElectronPhotonSelectorTools.ConfiguredAsgElectronIsEMSelectors import ConfiguredAsgElectronIsEMSelector LooseElectronSelector = ConfiguredAsgElectronIsEMSelector( "LooseElectronSelector", egammaPID.ElectronIDLoosePP) ToolSvc += LooseElectronSelector MediumElectronSelector = ConfiguredAsgElectronIsEMSelector( "MediumElectronSelector", egammaPID.ElectronIDMediumPP) ToolSvc += MediumElectronSelector TightElectronSelector = ConfiguredAsgElectronIsEMSelector( "TightElectronSelector", egammaPID.ElectronIDTightPP) ToolSvc += TightElectronSelector # Likelihood from ElectronPhotonSelectorTools.ConfiguredAsgElectronLikelihoodTools import ConfiguredAsgElectronLikelihoodTool LooseLHSelector = ConfiguredAsgElectronLikelihoodTool( "LooseLHSelector", LikeEnum.Loose) LooseLHSelector.primaryVertexContainer = "PrimaryVertices" ToolSvc += LooseLHSelector MediumLHSelector = ConfiguredAsgElectronLikelihoodTool( "MediumLHSelector", LikeEnum.Medium) MediumLHSelector.primaryVertexContainer = "PrimaryVertices" ToolSvc += MediumLHSelector TightLHSelector = ConfiguredAsgElectronLikelihoodTool( "TightLHSelector", LikeEnum.Tight) TightLHSelector.primaryVertexContainer = "PrimaryVertices" ToolSvc += TightLHSelector # Multi Lepton from ElectronPhotonSelectorTools.ElectronPhotonSelectorToolsConf import AsgElectronMultiLeptonSelector MultiLeptonSelector = AsgElectronMultiLeptonSelector( "MultiLeptonSelector") ToolSvc += MultiLeptonSelector except: mlog.error("could not get configure tools") print traceback.format_exc() return False self.electronIsEMselectors = [ LooseElectronSelector, MediumElectronSelector, TightElectronSelector ] self.electronIsEMselectorResultNames = ["Loose", "Medium", "Tight"] self.electronLHselectors = [ LooseLHSelector, MediumLHSelector, TightLHSelector ] self.electronLHselectorResultNames = ["LHLoose", "LHMedium", "LHTight"] self.genericIsEMselectors = [MultiLeptonSelector] self.genericIsEMselectorResultNames = ["MultiLepton"]
def __init__(self, name="EMPIDBuilderElectronBase"): EMPIDBuilder.__init__(self, name) mlog = logging.getLogger(name + '::__init__') mlog.debug("entering") # Cut based from ElectronPhotonSelectorTools.ConfiguredAsgElectronIsEMSelectors \ import ConfiguredAsgElectronIsEMSelector LooseElectronSelector = ConfiguredAsgElectronIsEMSelector( "LooseElectronSelector", egammaPID.ElectronIDLoosePP) MediumElectronSelector = ConfiguredAsgElectronIsEMSelector( "MediumElectronSelector", egammaPID.ElectronIDMediumPP) TightElectronSelector = ConfiguredAsgElectronIsEMSelector( "TightElectronSelector", egammaPID.ElectronIDTightPP) # Likelihood from ElectronPhotonSelectorTools.ConfiguredAsgElectronLikelihoodTools \ import ConfiguredAsgElectronLikelihoodTool LooseLHSelector = ConfiguredAsgElectronLikelihoodTool( "LooseLHSelector", LikeEnum.Loose) LooseLHSelector.primaryVertexContainer = "PrimaryVertices" MediumLHSelector = ConfiguredAsgElectronLikelihoodTool( "MediumLHSelector", LikeEnum.Medium) MediumLHSelector.primaryVertexContainer = "PrimaryVertices" TightLHSelector = ConfiguredAsgElectronLikelihoodTool( "TightLHSelector", LikeEnum.Tight) TightLHSelector.primaryVertexContainer = "PrimaryVertices" self.electronIsEMselectors = [ LooseElectronSelector, MediumElectronSelector, TightElectronSelector ] self.electronIsEMselectorResultNames = ["Loose", "Medium", "Tight"] self.electronLHselectors = [ LooseLHSelector, MediumLHSelector, TightLHSelector ] self.electronLHselectorResultNames = ["LHLoose", "LHMedium", "LHTight"] self.LuminosityTool = None
def _setCutIDSelector(self,defaultName,quality,menu,**kwargs): """ Set the AsgElectronRingerSelector CutIDSelector to default or to the configuration available in the kwargs """ removeMask = False if not kwargs.has_key("cutIDConfDict") and not kwargs.has_key("CutIDSelector"): removeMask = True if not kwargs.has_key("CutIDSelector"): CutIDSelectorTool = ConfiguredAsgElectronIsEMSelector(defaultName, \ quality, \ menu, \ **kwargs.pop("cutIDConfDict",{})) from AthenaCommon.AppMgr import ToolSvc ToolSvc += CutIDSelectorTool self.CutIDSelector = CutIDSelectorTool else: self.CutIDSelector = kwargs.pop("CutIDSelector") if removeMask: removeClusterCutsFromIsEMMask(self.CutIDSelector.isEMMask)
def PhotonPidTools(): from AthenaCommon.AppMgr import ToolSvc # Run2 Photon trigger for key in PhotonToolName: if not ('1' in key): tool = CfgMgr.AsgPhotonIsEMSelector(PhotonToolName[key]) tool.ConfigFile = ConfigFilePath + PhotonToolConfigFile[key] tool.isEMMask = PhotonIsEMBits[key] tool.ForceConvertedPhotonPID = True addToToolSvc(tool) # Run1 Photon triggers PhotonLoose1Sel = ConfiguredAsgElectronIsEMSelector( "AsgPhotonIsEMLoose1Selector", egammaPID.PhotonIDLooseEF, electronPIDmenu.menuTrig2012) PhotonLoose1Sel.caloOnly = True PhotonMedium1Sel = ConfiguredAsgElectronIsEMSelector( "AsgPhotonIsEMMedium1Selector", egammaPID.PhotonIDMediumEF, electronPIDmenu.menuTrig2012) PhotonMedium1Sel.caloOnly = True PhotonTight1Sel = ConfiguredAsgPhotonIsEMSelector( "AsgPhotonIsEMTight1Selector", egammaPID.PhotonIDTight) PhotonTight1Sel.ConfigFile = 'ElectronPhotonSelectorTools/dc14b_20141031/PhotonIsEMTight8TeVSelectorCutDefs.conf' PhotonTight1Sel.ForceConvertedPhotonPID = True addToToolSvc(PhotonLoose1Sel) addToToolSvc(PhotonMedium1Sel) addToToolSvc(PhotonTight1Sel) print "==== PhotonLooseHLT: 0x%08x =====" % SelectionDefPhoton.PhotonLoose print "==== PhotonLoose: 0x%08x =====" % egammaPID.PhotonLoose print "==== PhotonMediumHLT: 0x%08x =====" % SelectionDefPhoton.PhotonMedium print "==== PhotonMedium: 0x%08x =====" % egammaPID.PhotonMedium print "==== PhotonTightHLT: 0x%08x =====" % SelectionDefPhoton.PhotonTight print "==== PhotonTight: 0x%08x =====" % egammaPID.PhotonTight
zee.IsEMmediumPP = egammaPID.ElectronMediumPP zee.IsEMtight = SelectionDefElectron.ElectronTight1 zee.IsEMtight1 = SelectionDefElectron.ElectronTight1 zee.IsEMtightPP = egammaPID.ElectronTightPP from ElectronPhotonSelectorTools.ElectronIsEMSelectorMapping import electronPIDmenu try: from ElectronPhotonSelectorTools.ConfiguredAsgElectronIsEMSelectors import ConfiguredAsgElectronIsEMSelector except: mlog = logging.getLogger(name + '::__init__') mlog.error("could not get handle to AthenaSelectorTool") # Offline ++ selectors theelectroncuttightid = ConfiguredAsgElectronIsEMSelector( "AsgElectronIsEMTightPPSelector", egammaPID.ElectronIDTightPP, electronPIDmenu.menu2012) ToolSvc += theelectroncuttightid zee.ElectronTightPPSelector = theelectroncuttightid theelectroncutmediumid = ConfiguredAsgElectronIsEMSelector( "AsgElectronIsEMMediumPPSelector", egammaPID.ElectronIDMediumPP, electronPIDmenu.menu2012) ToolSvc += theelectroncutmediumid zee.ElectronMediumPPSelector = theelectroncutmediumid theelectroncutlooseid = ConfiguredAsgElectronIsEMSelector( "AsgElectronIsEMLoosePPSelector", egammaPID.ElectronIDLoosePP, electronPIDmenu.menu2012) ToolSvc += theelectroncutlooseid zee.ElectronLoosePPSelector = theelectroncutlooseid
# Tight ElectronLHSelectorTight = ConfiguredAsgElectronLikelihoodTool( "ElectronLHSelectorTight", LikeEnum.Tight) ElectronLHSelectorTight.primaryVertexContainer = "PrimaryVertices" ToolSvc += ElectronLHSelectorTight #==================================================================== # ELECTRON SELECTION (loose, medium and tight cut-based) #==================================================================== from ROOT import egammaPID from ElectronPhotonSelectorTools.ConfiguredAsgElectronIsEMSelectors import ConfiguredAsgElectronIsEMSelector # Loose ElectronIsEMSelectorLoose = ConfiguredAsgElectronIsEMSelector( "ElectronIsEMSelectorLoose", egammaPID.ElectronIDLoosePP) ToolSvc += ElectronIsEMSelectorLoose # Medium ElectronIsEMSelectorMedium = ConfiguredAsgElectronIsEMSelector( "ElectronIsEMSelectorMedium", egammaPID.ElectronIDMediumPP) ToolSvc += ElectronIsEMSelectorMedium # Tight ElectronIsEMSelectorTight = ConfiguredAsgElectronIsEMSelector( "ElectronIsEMSelectorTight", egammaPID.ElectronIDTightPP) ToolSvc += ElectronIsEMSelectorTight #==================================================================== # ELECTRON SELECTION (multi lepton) #====================================================================
def ElectronPidTools(): #from AthenaCommon.AppMgr import ToolSvc # Run1 selectors -- added directly to ToolSvc from default config via mapping #print '=========== Run1 PID ============' for key in ElectronToolName: if not ('lh' in key): if ('1' in key): tool = ConfiguredAsgElectronIsEMSelector( ElectronToolName[key], ElectronPidName[key], electronPIDmenu.menuTrig2012) addToToolSvc(tool) # Trigger specific Run1 selectors for high pt triggers #print '=========== Run1 PID trigger specific ============' for key in ElectronHypoToolName: if not ('lh' in key): if ('1' in key): tool = ConfiguredAsgElectronIsEMSelector( ElectronHypoToolName[key], ElectronPidName[key], electronPIDmenu.menuTrig2012) tool.trigEtTh = 20000 addToToolSvc(tool) # Calo only Run1 selectors #print '=========== Run1 PID Calo============' for key in ElectronCaloToolName: if not ('lh' in key): if ('1' in key): tool = ConfiguredAsgElectronIsEMSelector( ElectronCaloToolName[key], ElectronPidName[key], electronPIDmenu.menuTrig2012) tool.caloOnly = True addToToolSvc(tool) # Calo-only Trigger specific with trigEtTh property set #print '=========== Run1 PID Calo trigger specific ============' for key in ElectronCaloHypoToolName: if not ('lh' in key): if ('1' in key): tool = ConfiguredAsgElectronIsEMSelector( ElectronCaloHypoToolName[key], ElectronPidName[key], electronPIDmenu.menuTrig2012) tool.caloOnly = True tool.trigEtTh = 20000 addToToolSvc(tool) # Versioned selectors for Run2 #print '=========== Run2 PID ============' for key in ElectronToolName: if not ('lh' in key): if not ('1' in key): tool = CfgMgr.AsgElectronIsEMSelector(ElectronToolName[key]) tool.ConfigFile = ConfigFilePath + ElectronToolConfigFile[key] tool.isEMMask = ElectronIsEMBits[key] addToToolSvc(tool) # Trigger specific Run2 selectors #print '=========== Run2 PID trigger specific ============' for key in ElectronHypoToolName: if not ('lh' in key): if not ('1' in key): tool = CfgMgr.AsgElectronIsEMSelector( ElectronHypoToolName[key]) tool.ConfigFile = ConfigFilePath + ElectronToolConfigFile[key] tool.isEMMask = ElectronIsEMBits[key] tool.trigEtTh = 20000 addToToolSvc(tool) # Calo-only selectors #print '=========== Run2 PID Calo============' for key in ElectronCaloToolName: if not ('lh' in key): if not ('1' in key): tool = CfgMgr.AsgElectronIsEMSelector( ElectronCaloToolName[key]) tool.ConfigFile = ConfigFilePath + ElectronCaloToolConfigFile[ key] tool.isEMMask = ElectronIsEMBits[key] tool.caloOnly = True addToToolSvc(tool) # Calo-only trigger specific selectors #print '=========== Run2 PID Calo trigger specific ============' for key in ElectronCaloHypoToolName: if not ('lh' in key): if not ('1' in key): tool = CfgMgr.AsgElectronIsEMSelector( ElectronCaloHypoToolName[key]) tool.ConfigFile = ConfigFilePath + ElectronCaloToolConfigFile[ key] tool.isEMMask = ElectronIsEMBits[key] tool.caloOnly = True tool.trigEtTh = 20000 addToToolSvc(tool) # LH selectors #print '======== LH selectors ===========' for key in ElectronToolName: if ('lh' in key): tool = CfgMgr.AsgElectronLikelihoodTool(ElectronToolName[key]) tool.ConfigFile = ConfigFilePath + ElectronToolConfigFile[key] tool.usePVContainer = False addToToolSvc(tool) # Special LH triggers for alignment / commisioning for key in ElectronLHVLooseToolName: tool = CfgMgr.AsgElectronLikelihoodTool(ElectronLHVLooseToolName[key]) tool.ConfigFile = ConfigFilePath + ElectronLHVLooseToolConfigFile[key] tool.usePVContainer = False addToToolSvc(tool) for key in ElectronLHLooseToolName: tool = CfgMgr.AsgElectronLikelihoodTool(ElectronLHLooseToolName[key]) tool.ConfigFile = ConfigFilePath + ElectronLHLooseToolConfigFile[key] tool.usePVContainer = False addToToolSvc(tool) for key in ElectronLHMediumToolName: tool = CfgMgr.AsgElectronLikelihoodTool(ElectronLHMediumToolName[key]) tool.ConfigFile = ConfigFilePath + ElectronLHMediumToolConfigFile[key] tool.usePVContainer = False addToToolSvc(tool) for key in ElectronLHTightToolName: tool = CfgMgr.AsgElectronLikelihoodTool(ElectronLHTightToolName[key]) tool.ConfigFile = ConfigFilePath + ElectronLHTightToolConfigFile[key] tool.usePVContainer = False addToToolSvc(tool) # Calo-only LH selectors #print '======== LH Calo selectors ===========' for key in ElectronCaloToolName: if ('lh' in key): tool = CfgMgr.AsgElectronLikelihoodTool(ElectronCaloToolName[key]) tool.ConfigFile = ConfigFilePath + ElectronCaloToolConfigFile[key] tool.usePVContainer = False tool.caloOnly = True addToToolSvc(tool)
#MCTruthClassifier.MCTruthClassifierBase.MCTruthClassifier.TrackParticleContainerName = "GSFTrackParticleCandidate" #MCTruthClassifier.MCTruthClassifierBase.MCTruthClassifier.TrackParticleTruthCollection = "GSFTrackParticleTruthCollection" #include ("RecExCommon/ContainerRemapping.py") print "ServiceMgr after:" print ServiceMgr print "end ServiceMgr after" import PyCintex PyCintex.loadDictionary('ElectronPhotonSelectorTools') from ROOT import egammaPID from ElectronPhotonSelectorTools.ConfiguredAsgElectronIsEMSelectors import ConfiguredAsgElectronIsEMSelector electronSelector = ConfiguredAsgElectronIsEMSelector( "myIsEmSelector", egammaPID.ElectronIDMediumPP, OutputLevel=DEBUG) ToolSvc += electronSelector from ElectronPhotonSelectorTools.ConfiguredAsgPhotonIsEMSelectors import ConfiguredAsgPhotonIsEMSelector photonSelector = ConfiguredAsgPhotonIsEMSelector("myPhotonSelector", egammaPID.PhotonIDTightAR, OutputLevel=DEBUG) ToolSvc += photonSelector # Add top algorithms to be run from simpleStudy.simpleStudyConf import TestAlg testAlg = TestAlg( name="TestAlg", ElectronSelector=electronSelector, PhotonSelector=photonSelector, # MCTruthClassifier = MCTruthClassifier.MCTruthClassifierBase.MCTruthClassifier,