diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastCaloHypoTool.py b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastCaloHypoTool.py index 8b3f6db65182330c421c0b4afa6204251aa9820e..957f91f20e6f675700a4dd5f83d136e1aea59f50 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastCaloHypoTool.py +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastCaloHypoTool.py @@ -4,65 +4,7 @@ from AthenaCommon.SystemOfUnits import GeV from AthenaCommon.AthenaCommonFlags import athenaCommonFlags from TriggerJobOpts.TriggerFlags import TriggerFlags -from AthOnnxruntimeService.AthOnnxruntimeServiceConf import AthONNX__ONNXRuntimeSvc -from AthenaCommon.AppMgr import ServiceMgr - -# add ONNX into app service mgr -ServiceMgr += AthONNX__ONNXRuntimeSvc() - - -def TrigEgammaFastCaloSelectors(sel, doPhotons=False, ConfigFilePath='RingerSelectorTools/TrigL2_20210227_r3'): - from RingerSelectorTools.RingerSelectorToolsConf import Ringer__AsgRingerSelectorTool - from AthenaCommon.Logging import logging - log = logging.getLogger('TrigEgammaFastCaloSelectors') - SelectorNames = { - "Electrons": { - 'lhvloose' : 'AsgElectronFastCaloRingerVeryLooseSelectorTool', - 'lhloose' : 'AsgElectronFastCaloRingerLooseSelectorTool', - 'lhmedium' : 'AsgElectronFastCaloRingerMediumSelectorTool', - 'lhtight' : 'AsgElectronFastCaloRingerTightSelectorTool', - 'vloose' : 'AsgElectronFastCaloRingerVeryLooseSelectorTool', - 'loose' : 'AsgElectronFastCaloRingerLooseSelectorTool', - 'medium' : 'AsgElectronFastCaloRingerMediumSelectorTool', - 'tight' : 'AsgElectronFastCaloRingerTightSelectorTool', - }, - "Photons": { - 'loose' : 'AsgPhotonFastCaloRingerLooseSelectorTool', - 'medium' : 'AsgPhotonFastCaloRingerMediumSelectorTool', - 'tight' : 'AsgPhotonFastCaloRingerTightSelectorTool', - } - } - - ToolConfigFile = { - "Electrons" : { - 'lhvloose':'ElectronRingerVeryLooseTriggerConfig.conf', - 'lhloose' :'ElectronRingerLooseTriggerConfig.conf', - 'lhmedium':'ElectronRingerMediumTriggerConfig.conf', - 'lhtight' :'ElectronRingerTightTriggerConfig.conf', - 'vloose' :'ElectronRingerVeryLooseTriggerConfig.conf', - 'loose' :'ElectronRingerLooseTriggerConfig.conf', - 'medium' :'ElectronRingerMediumTriggerConfig.conf', - 'tight' :'ElectronRingerTightTriggerConfig.conf', - }, - "Photons" : { - 'loose' :'PhotonRingerLooseTriggerConfig.conf', - 'medium':'PhotonRingerMediumTriggerConfig.conf', - 'tight' :'PhotonRingerTightTriggerConfig.conf', - } - } - - cand = 'Photons' if doPhotons else 'Electrons' - if sel not in SelectorNames[cand]: - log.fatal('No selector defined for working point %s for electrons ringer :-( ', sel) - else: - log.debug('Configuring electron ringer PID for %s', sel) - SelectorTool=Ringer__AsgRingerSelectorTool(SelectorNames[cand][sel]) - SelectorTool.ConfigFile = ConfigFilePath + '/' + ToolConfigFile[cand][sel] - return SelectorTool - - - - +#from AthenaCommon.AppMgr import ServiceMgr def same( val , tool): @@ -81,7 +23,6 @@ class TrigEgammaFastCaloHypoToolConfig: 'lhvloose' ] - def __init__(self, name, cand, threshold, sel, trackinfo, noringerinfo): from AthenaCommon.Logging import logging @@ -112,6 +53,11 @@ class TrigEgammaFastCaloHypoToolConfig: tool.F3thr = same( 99999. , tool) tool.CARCOREthr = same( -9999. , tool) tool.CAERATIOthr = same( -9999. , tool) + tool.vLoose = False + tool.Loose = False + tool.Medium = False + tool.Tight = False + self.__tool = tool self.__log.debug( 'Chain :%s', name ) @@ -192,7 +138,6 @@ class TrigEgammaFastCaloHypoToolConfig: self.__setupRingerConfiguration() - def compile(self): if 'etcut' == self.pidname(): @@ -221,13 +166,9 @@ class TrigEgammaFastCaloHypoToolConfig: if self.tool().UseRinger: monTool = GenericMonitoringTool('MonTool'+self.__name) monTool.Histograms = [ - defineHistogram( "TIME_total", path='EXPERT',title="Total Time;time[us]",xbins=50, xmin=0,xmax=100,type='TH1F'), - defineHistogram( "TIME_preproc", path='EXPERT',title="Total Time;time[us]",xbins=50, xmin=0,xmax=5,type='TH1F'), - defineHistogram( "TIME_propagate",path='EXPERT', title="Total Time;time[us]",xbins=50, xmin=0,xmax=100,type='TH1F'), defineHistogram('Eta', type='TH1F', path='EXPERT',title="#eta of Clusters; #eta; number of RoIs", xbins=50,xmin=-2.5,xmax=2.5), defineHistogram('Phi',type='TH1F', path='EXPERT',title="#phi of Clusters; #phi; number of RoIs", xbins=64,xmin=-3.2,xmax=3.2), defineHistogram('Et',type='TH1F', path='EXPERT',title="E_{T} of Clusters; E_{T} [MeV]; number of RoIs", xbins=60,xmin=0,xmax=5e4), - defineHistogram('RnnOut',type='TH1F', path='EXPERT',title="Neural Network output; NN output; number of RoIs", xbins=20,xmin=-10,xmax=10), ] monTool.HistPath='L2CaloHypo_Ringer/MonTool'+self.__name @@ -275,29 +216,18 @@ class TrigEgammaFastCaloHypoToolConfig: def __setupRingerConfiguration(self): - possibleSel = { 'tight':'Tight', 'medium':'Medium', 'loose':'Loose', 'vloose':'VeryLoose', - 'lhtight':'Tight', 'lhmedium':'Medium', 'lhloose':'Loose', 'lhvloose':'VeryLoose'} + possibleSel = { 'tight':'Tight', 'medium':'Medium', 'loose':'Loose', 'vloose':'vLoose', + 'lhtight':'Tight', 'lhmedium':'Medium', 'lhloose':'Loose', 'lhvloose':'vLoose'} + possibleTune = { 'Tight':False, 'Medium':False, 'Loose':False, 'vLoose':False} if not self.pidname() in possibleSel.keys(): raise RuntimeError( "Bad selection name: %s" % self.pidname() ) - - if self.__useRun3: # new ringer selector - basepath = 'RingerSelectorTools/TrigL2_20210227_r3' - self.tool().UseRun3 = True - self.tool().RingerSelector = TrigEgammaFastCaloSelectors( self.pidname(), doPhotons=self.isPhoton(), ConfigFilePath=basepath ) - else: - basepath = 'RingerSelectorTools/TrigL2_20180903_v9' - if self.isElectron(): - constant = basepath+'/'+ 'TrigL2CaloRingerElectron{OP}Constants.root'.format(OP=possibleSel[self.pidname()]) - threshold = basepath+'/'+ 'TrigL2CaloRingerElectron{OP}Thresholds.root'.format(OP=possibleSel[self.pidname()]) - elif self.isPhoton(): - constant = basepath+'/'+ 'TrigL2CaloRingerPhoton{OP}Constants.root'.format(OP=possibleSel[self.pidname()]) - threshold = basepath+'/'+ 'TrigL2CaloRingerPhoton{OP}Thresholds.root'.format(OP=possibleSel[self.pidname()]) - else: - raise RuntimeError( "Bad signature %s" % self.__cand ) - self.tool().UseRun3 = False - self.tool().ConstantsCalibPath = constant - self.tool().ThresholdsCalibPath = threshold + possibleTune[possibleSel[self.pidname()]] = True + + self.tool().vLoose = possibleTune['vLoose'] + self.tool().Loose = possibleTune['Loose'] + self.tool().Medium = possibleTune['Medium'] + self.tool().Tight = possibleTune['Tight'] diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaPrecisionElectronHypoTool.py b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaPrecisionElectronHypoTool.py index 2d606e035e4607d23c3b9f207d39ca5273f3af5a..72be27be7f4a35c76789fcff8d1deddeb4395350 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaPrecisionElectronHypoTool.py +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaPrecisionElectronHypoTool.py @@ -1,31 +1,138 @@ # # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration # - -from AthenaCommon.Logging import logging -logging.getLogger().info("Importing %s",__name__) -log = logging.getLogger("TrigEgammaHypo.TrigEgammaPrecisionElectronHypoTool") + from AthenaCommon.SystemOfUnits import GeV -from TriggerMenuMT.HLTMenuConfig.Egamma.EgammaDefs import TrigElectronSelectors -# isolation cuts -IsolationCut = { +def same( val , tool): + return [val]*( len( tool.EtaBins ) - 1 ) + +class TrigEgammaPrecisionElectronHypoToolConfig: + + + __operation_points = [ 'tight' , + 'medium' , + 'loose' , + 'vloose' , + 'lhtight' , + 'lhmedium' , + 'lhloose' , + 'lhvloose' ] + + # isolation cuts + __isolationCut = { None: None, 'ivarloose': 0.1, 'ivarmedium': 0.065, 'ivartight': 0.05 } -def _IncTool(name, threshold, sel, iso): - log.debug('TrigEgammaPrecisionElectronHypoTool _IncTool("'+name+'", threshold = '+str(threshold) + ', sel = '+str(sel)) + def __init__(self, name, threshold, sel, iso): + + from AthenaCommon.Logging import logging + self.__log = logging.getLogger('TrigEgammaPrecisionElectronHypoTool') + self.__name = name + self.__threshold = float(threshold) + self.__sel = sel + self.__iso = iso + + from TrigEgammaHypo.TrigEgammaHypoConf import TrigEgammaPrecisionElectronHypoToolInc + tool = TrigEgammaPrecisionElectronHypoToolInc( name ) + + tool.EtaBins = [0.0, 0.6, 0.8, 1.15, 1.37, 1.52, 1.81, 2.01, 2.37, 2.47] + tool.ETthr = same( self.__threshold*GeV, tool ) + tool.dETACLUSTERthr = 0.1 + tool.dPHICLUSTERthr = 0.1 + tool.vLoose = False + tool.Loose = False + tool.Medium = False + tool.Tight = False + + self.__tool = tool + + self.__log.debug( 'Electron_Chain :%s', name ) + self.__log.debug( 'Electron_Threshold :%s', threshold ) + self.__log.debug( 'Electron_Pidname :%s', sel ) + self.__log.debug( 'Electron_iso :%s', iso ) + + def chain(self): + return self.__name + + def pidname( self ): + return self.__sel + + def etthr(self): + return self.__threshold + + def isoInfo(self): + return self.__iso + + def tool(self): + return self.__tool + + def nocut(self): + + self.__log.debug( 'Configure nocut' ) + #self.tool().AcceptAll = True + self.tool().ETthr = same( self.etthr()*GeV, self.tool()) + self.tool().dETACLUSTERthr = 9999. + self.tool().dPHICLUSTERthr = 9999. + + def etcut(self): + self.__log.debug( 'Configure etcut' ) + self.tool().ETthr = same( ( self.etthr() - 3 )*GeV ) + # No other cuts applied + self.tool().dETACLUSTERthr = 9999. + self.tool().dPHICLUSTERthr = 9999. - from TrigEgammaHypo.TrigEgammaHypoConf import TrigEgammaPrecisionElectronHypoToolInc + def isoCut(self): - tool = TrigEgammaPrecisionElectronHypoToolInc( name ) + self.tool().RelPtConeCut = self.__isolationCut[self.isoInfo()] + self.__setupLHConfiguration() + + def nominal(self): + self.__setupLHConfiguration() + + def compile(self): + + if 'etcut' == self.pidname(): + self.etcut() + + elif 'nocut' == self.pidname(): + self.nocut() + + elif self.isoInfo() and self.isoInfo() != '': + if self.isoInfo() not in self.__isolationCut.keys(): + self.__log.error('Isolation cut %s not defined!', self.isoInfo()) + self.__log.debug('Configuring Isolation cut %s with value %d',self.isoInfo(),self.__isolationCut[self.isoInfo()]) + self.isoCut() + + else: + self.nominal() + + self.addMonitoring() + + def __setupLHConfiguration(self): + + possibleSel = { 'tight':'Tight', 'medium':'Medium', 'loose':'Loose', 'vloose':'vLoose', + 'lhtight':'Tight', 'lhmedium':'Medium', 'lhloose':'Loose', 'lhvloose':'vLoose'} + + possibleTune = { 'Tight':False, 'Medium':False, 'Loose':False, 'vLoose':False} + if not self.pidname() in possibleSel.keys(): + raise RuntimeError( "Bad selection name: %s" % self.pidname() ) + possibleTune[possibleSel[self.pidname()]] = True + + self.tool().vLoose = possibleTune['vLoose'] + self.tool().Loose = possibleTune['Loose'] + self.tool().Medium = possibleTune['Medium'] + self.tool().Tight = possibleTune['Tight'] + + + def addMonitoring(self): from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool, defineHistogram - monTool = GenericMonitoringTool("MonTool_"+name) + monTool = GenericMonitoringTool("MonTool_"+self.chain()) monTool.Histograms = [ defineHistogram('dEta', type='TH1F', path='EXPERT', title="PrecisionElectron Hypo #Delta#eta_{EF L1}; #Delta#eta_{EF L1}", xbins=80, xmin=-0.01, xmax=0.01), defineHistogram('dPhi', type='TH1F', path='EXPERT', title="PrecisionElectron Hypo #Delta#phi_{EF L1}; #Delta#phi_{EF L1}", xbins=80, xmin=-0.01, xmax=0.01), defineHistogram('Et_em', type='TH1F', path='EXPERT', title="PrecisionElectron Hypo cluster E_{T}^{EM};E_{T}^{EM} [MeV]", xbins=50, xmin=-2000, xmax=100000), @@ -40,42 +147,13 @@ def _IncTool(name, threshold, sel, iso): monTool.Histograms += [ defineHistogram('CutCounter', type='TH1I', path='EXPERT', title="PrecisionElectron Hypo Passed Cuts;Cut", xbins=13, xmin=-1.5, xmax=12.5, opt="kCumulative", xlabels=cuts) ] - monTool.HistPath = 'PrecisionElectronHypo/'+tool.name() - tool.MonTool = monTool - - - tool.EtaBins = [0.0, 0.6, 0.8, 1.15, 1.37, 1.52, 1.81, 2.01, 2.37, 2.47] - def same( val ): - return [val]*( len( tool.EtaBins ) - 1 ) - - tool.ETthr = same( float(threshold) ) - tool.dETACLUSTERthr = 0.1 - tool.dPHICLUSTERthr = 0.1 - - tool.ElectronLHSelector = TrigElectronSelectors(sel) - #tool.ET2thr = same( 90.0*GeV ) - - if sel == 'nocut': - tool.AcceptAll = True - tool.ETthr = same( float( threshold )*GeV ) - tool.dETACLUSTERthr = 9999. - tool.dPHICLUSTERthr = 9999. - - elif sel == "etcut": - tool.ETthr = same( ( float( threshold ) - 3 )*GeV ) - # No other cuts applied - tool.dETACLUSTERthr = 9999. - tool.dPHICLUSTERthr = 9999. - - - if iso and iso != '': - if iso not in IsolationCut: - log.error('Isolation cut %s not defined!', iso) - log.debug('Configuring Isolation cut %s with value %d',iso,IsolationCut[iso]) - tool.RelPtConeCut = IsolationCut[iso] - - return tool + monTool.HistPath = 'PrecisionElectronHypo/'+self.chain() + self.tool().MonTool = monTool +def _IncTool( name, threshold, sel, iso ): + config = TrigEgammaPrecisionElectronHypoToolConfig(name, threshold, sel, iso) + config.compile() + return config.tool() def TrigEgammaPrecisionElectronHypoToolFromDict( d ): """ Use menu decoded chain dictionary to configure the tool """ @@ -99,4 +177,8 @@ def TrigEgammaPrecisionElectronHypoToolFromDict( d ): return _IncTool( name, __th( cparts[0]), __sel( cparts[0] ), __iso ( cparts[0]) ) +def TrigEgammaPrecisionElectronHypoToolFromName(name, conf): + from TriggerMenuMT.HLTMenuConfig.Menu.DictFromChainName import dictFromChainName + decodedDict = dictFromChainName(conf) + return TrigEgammaPrecisionElectronHypoToolFromDict( decodedDict ) diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/ITrigEgammaFastCaloHypoTool.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/ITrigEgammaFastCaloHypoTool.h index d22c25d5eec6a4d4449386d99e815bfbf1520aea..8014536d54bfe0e4c90e39c23870bf8db4574c24 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/ITrigEgammaFastCaloHypoTool.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/ITrigEgammaFastCaloHypoTool.h @@ -12,8 +12,6 @@ - - /** * @class Base for tools dooing Egamma Fast Calo Hypo selection * @brief @@ -32,11 +30,19 @@ class ITrigEgammaFastCaloHypoTool const TrigRoiDescriptor* r, const xAOD::TrigEMCluster* c, const xAOD::TrigRingerRings* ring, + bool vl_acc, + bool l_acc, + bool m_acc, + bool t_acc, const TrigCompositeUtils::Decision* previousDecision ) : decision( d ), roi( r ), cluster(c), ringerShape(ring), + vloose_accept(vl_acc), + loose_accept(l_acc), + medium_accept(m_acc), + tight_accept(t_acc), previousDecisionIDs( TrigCompositeUtils::decisionIDs( previousDecision ).begin(), TrigCompositeUtils::decisionIDs( previousDecision ).end() ) {} @@ -45,6 +51,10 @@ class ITrigEgammaFastCaloHypoTool const TrigRoiDescriptor* roi; const xAOD::TrigEMCluster* cluster; const xAOD::TrigRingerRings* ringerShape; + bool vloose_accept; + bool loose_accept; + bool medium_accept; + bool tight_accept; const TrigCompositeUtils::DecisionIDContainer previousDecisionIDs; }; diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/ITrigEgammaPrecisionElectronHypoTool.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/ITrigEgammaPrecisionElectronHypoTool.h index 4ccc848b6409672f7033d25d3d0847680e13670d..3c90d529a36312c4b866ee77b6ffe10c0f63aaa4 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/ITrigEgammaPrecisionElectronHypoTool.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/ITrigEgammaPrecisionElectronHypoTool.h @@ -23,10 +23,28 @@ class ITrigEgammaPrecisionElectronHypoTool struct ElectronInfo { ElectronInfo( TrigCompositeUtils::Decision* d, const TrigRoiDescriptor* r, const xAOD::Electron_v1* c, + bool pass_vl, + bool pass_l, + bool pass_m, + bool pass_t, + float lhval_vl, + float lhval_l, + float lhval_m, + float lhval_t, + float avg_mu, const TrigCompositeUtils::Decision* previousDecision ) : decision( d ), roi( r ), electron(c), + accept_vl(pass_vl), + accept_l(pass_l), + accept_m(pass_m), + accept_t(pass_t), + LHValue_vl(lhval_vl), + LHValue_l(lhval_l), + LHValue_m(lhval_m), + LHValue_t(lhval_t), + avgMu (avg_mu), previousDecisionIDs( TrigCompositeUtils::decisionIDs( previousDecision ).begin(), TrigCompositeUtils::decisionIDs( previousDecision ).end() ) {} @@ -34,6 +52,15 @@ class ITrigEgammaPrecisionElectronHypoTool TrigCompositeUtils::Decision* decision; const TrigRoiDescriptor* roi; const xAOD::Electron_v1* electron; + bool accept_vl; + bool accept_l; + bool accept_m; + bool accept_t; + float LHValue_vl; + float LHValue_l; + float LHValue_m; + float LHValue_t; + float avgMu; const TrigCompositeUtils::DecisionIDContainer previousDecisionIDs; }; @@ -44,13 +71,13 @@ class ITrigEgammaPrecisionElectronHypoTool * There will be many tools called often to perform this quick operation and we do not want to pay for polymorphism which we do not need to use. * Will actually see when N obj hypos will enter the scene **/ - virtual StatusCode decide( std::vector<ElectronInfo>& input, const EventContext& ) const = 0; + virtual StatusCode decide( std::vector<ElectronInfo>& input ) const = 0; /** * @brief Makes a decision for a single object * The decision needs to be returned **/ - virtual bool decide( const ElectronInfo& i,const EventContext& ) const = 0; + virtual bool decide( const ElectronInfo& i ) const = 0; diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoAlgMT.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoAlgMT.cxx index dc9aea0d162290d3f635e27d3d2c20312c79d89f..3382f2db51902ba244e21da40c1a8518e6386739 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoAlgMT.cxx +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoAlgMT.cxx @@ -2,41 +2,60 @@ Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ +#include <algorithm> #include "TrigEgammaFastCaloHypoAlgMT.h" #include "TrigCompositeUtils/HLTIdentifier.h" #include "TrigCompositeUtils/TrigCompositeUtils.h" #include "TrigSteeringEvent/TrigRoiDescriptorCollection.h" #include "AthViews/ViewHelper.h" #include "xAODTrigger/TrigCompositeContainer.h" +#include "GaudiKernel/SystemOfUnits.h" namespace TCU = TrigCompositeUtils; TrigEgammaFastCaloHypoAlgMT::TrigEgammaFastCaloHypoAlgMT( const std::string& name, ISvcLocator* pSvcLocator ) : - ::HypoBase( name, pSvcLocator ) {} + ::HypoBase( name, pSvcLocator ), + m_lumiBlockMuTool("LumiBlockMuTool/LumiBlockMuTool") + { + declareProperty("LumiBlockMuTool", m_lumiBlockMuTool, "Luminosity Tool" ); + } StatusCode TrigEgammaFastCaloHypoAlgMT::initialize() { ATH_CHECK( m_hypoTools.retrieve() ); - + + m_ringerTool_vLoose.setConstantsCalibPath( m_constantsCalibPath_vLoose ); + m_ringerTool_vLoose.setThresholdsCalibPath( m_thresholdsCalibPath_vLoose ); + m_ringerTool_Loose.setConstantsCalibPath( m_constantsCalibPath_Loose ); + m_ringerTool_Loose.setThresholdsCalibPath( m_thresholdsCalibPath_Loose ); + m_ringerTool_Medium.setConstantsCalibPath( m_constantsCalibPath_Medium ); + m_ringerTool_Medium.setThresholdsCalibPath( m_thresholdsCalibPath_Medium ); + m_ringerTool_Tight.setConstantsCalibPath( m_constantsCalibPath_Tight ); + m_ringerTool_Tight.setThresholdsCalibPath( m_thresholdsCalibPath_Tight ); + + if(m_ringerTool_vLoose.initialize().isFailure()||m_ringerTool_Loose.initialize().isFailure()||m_ringerTool_Medium.initialize().isFailure()||m_ringerTool_Tight.initialize().isFailure()) + return StatusCode::FAILURE; + else + ATH_MSG_DEBUG( "Initialization of RingerTool completed successfully" ); + ATH_CHECK( m_clustersKey.initialize() ); ATH_CHECK( m_ringsKey.initialize(SG::AllowEmpty)); renounce( m_clustersKey );// clusters are made in views, so they are not in the EvtStore: hide them renounce( m_ringsKey ); + ATH_MSG_DEBUG( "Initialization of FastCaloHypoAlg completed successfully"); return StatusCode::SUCCESS; } - StatusCode TrigEgammaFastCaloHypoAlgMT::execute( const EventContext& context ) const { ATH_MSG_DEBUG ( "Executing " << name() << "..." ); auto previousDecisionsHandle = SG::makeHandle( decisionInput(), context ); ATH_CHECK( previousDecisionsHandle.isValid() ); ATH_MSG_DEBUG( "Running with "<< previousDecisionsHandle->size() <<" previous decisions"); - - + // new decisions // new output decisions @@ -66,37 +85,79 @@ StatusCode TrigEgammaFastCaloHypoAlgMT::execute( const EventContext& context ) c auto d = TCU::newDecisionIn( decisions, TCU::hypoAlgNodeName() ); + // get Rings - const xAOD::TrigRingerRingsContainer* rings = nullptr; + bool accept_vLoose, accept_Loose, accept_Medium, accept_Tight; + accept_vLoose = false; + accept_Loose = false; + accept_Medium = false; + accept_Tight = false; + + const xAOD::TrigRingerRingsContainer* ringHandle = nullptr; if ( not m_ringsKey.empty() ) { auto ringerShapeHandle = ViewHelper::makeHandle( *viewEL, m_ringsKey, context); ATH_CHECK( ringerShapeHandle.isValid()); - rings = ringerShapeHandle.cptr(); + ringHandle = ringerShapeHandle.cptr(); ATH_MSG_DEBUG ( "Ringer handle size: " << ringerShapeHandle->size() << "..." ); // link the rings auto el = ViewHelper::makeLink( *viewEL, ringerShapeHandle, 0 ); ATH_CHECK( el.isValid() ); d->setObjectLink( "ringer", el ); + auto ringerShape = ringHandle->at(0); + const xAOD::TrigEMCluster *emCluster = 0; - } - - // create new decision - toolInput.emplace_back( d, roi, clusterHandle.cptr()->at(0), (rings ? rings->at(0) : nullptr) , previousDecision ); + if(ringerShape){ + emCluster = ringerShape->emCluster(); + if(emCluster){ + float avgmu = m_lumiBlockMuTool->averageInteractionsPerCrossing(); + float output_vLoose, output_Loose, output_Medium, output_Tight; + const std::vector<float> rings = ringerShape->rings(); + std::vector<float> refRings(rings.size()); + refRings.assign(rings.begin(), rings.end()); + output_vLoose = m_ringerTool_vLoose.calculate( refRings, emCluster->et(), emCluster->eta(), avgmu ); + output_Loose = m_ringerTool_Loose.calculate( refRings, emCluster->et(), emCluster->eta(), avgmu ); + output_Medium = m_ringerTool_Medium.calculate( refRings, emCluster->et(), emCluster->eta(), avgmu ); + output_Tight = m_ringerTool_Tight.calculate( refRings, emCluster->et(), emCluster->eta(), avgmu ); + + ATH_MSG_DEBUG(name()<< " generate as NN output_vLoose " << output_vLoose ); + ATH_MSG_DEBUG(name()<< " generate as NN output_Loose " << output_Loose ); + ATH_MSG_DEBUG(name()<< " generate as NN output_Medium " << output_Medium ); + ATH_MSG_DEBUG(name()<< " generate as NN output_Tight " << output_Tight ); + + accept_vLoose = m_ringerTool_vLoose.accept(output_vLoose, emCluster->et(),emCluster->eta(),avgmu) ; + accept_Loose = m_ringerTool_Loose.accept(output_Loose, emCluster->et(),emCluster->eta(),avgmu) ; + accept_Medium = m_ringerTool_Medium.accept(output_Medium, emCluster->et(),emCluster->eta(),avgmu) ; + accept_Tight = m_ringerTool_Tight.accept(output_Tight, emCluster->et(),emCluster->eta(),avgmu) ; + } + } + } + bool const accept_vLoose_const = accept_vLoose; + bool const accept_Loose_const = accept_Loose; + bool const accept_Medium_const = accept_Medium; + bool const accept_Tight_const = accept_Tight; + + ATH_MSG_DEBUG("accept_vLoose_const: "<<accept_vLoose_const); + ATH_MSG_DEBUG("accept_Loose_const: "<<accept_Loose_const); + ATH_MSG_DEBUG("accept_Medium_const: "<<accept_Medium_const); + ATH_MSG_DEBUG("accept_Tight_const: "<<accept_Tight_const); + + // create new decision + toolInput.emplace_back( d, roi, clusterHandle.cptr()->at(0), ringHandle->at(0), accept_vLoose_const, accept_Loose_const, accept_Medium_const, accept_Tight_const, previousDecision ); - // link the cluster - { - auto clus = ViewHelper::makeLink( *viewEL, clusterHandle, 0 ); - ATH_CHECK( clus.isValid() ); - d->setObjectLink( TCU::featureString(), clus ); - } + // link the cluster + { + auto clus = ViewHelper::makeLink( *viewEL, clusterHandle, 0 ); + ATH_CHECK( clus.isValid() ); + d->setObjectLink( TCU::featureString(), clus ); + } - d->setObjectLink( TCU::roiString(), roiELInfo.link ); + d->setObjectLink( TCU::roiString(), roiELInfo.link ); - TCU::linkToPrevious( d, previousDecision, context ); - ATH_MSG_DEBUG( "Added view, roi, cluster, previous decision to new decision " << counter << " for view " << (*viewEL)->name() ); - counter++; + TCU::linkToPrevious( d, previousDecision, context ); + ATH_MSG_DEBUG( "Added view, roi, cluster, previous decision to new decision " << counter << " for view " << (*viewEL)->name() ); + counter++; } diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoAlgMT.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoAlgMT.h index 303df3cc1051f68c9f2d843d502b90400b4b7979..8abbf31f9422f2e11ceacda53ba0c208bbe8350f 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoAlgMT.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoAlgMT.h @@ -7,10 +7,17 @@ #include <string> #include "DecisionHandling/HypoBase.h" + +#include "xAODTrigCalo/TrigEMCluster.h" +#include "TrigSteeringEvent/TrigRoiDescriptor.h" #include "xAODTrigCalo/TrigEMClusterContainer.h" #include "xAODTrigRinger/TrigRingerRings.h" #include "xAODTrigRinger/TrigRingerRingsContainer.h" +#include "TrigMultiVarHypo/tools/RingerSelectorTool.h" +#include "RingerSelectorTools/IAsgRingerSelectorTool.h" +#include "LumiBlockComps/ILumiBlockMuTool.h" + #include "ITrigEgammaFastCaloHypoTool.h" /** @@ -25,9 +32,34 @@ class TrigEgammaFastCaloHypoAlgMT : public ::HypoBase { virtual StatusCode initialize() override; virtual StatusCode execute( const EventContext& context ) const override; - private: + private: + + Ringer::RingerSelectorTool m_ringerTool_vLoose; + Ringer::RingerSelectorTool m_ringerTool_Loose; + Ringer::RingerSelectorTool m_ringerTool_Medium; + Ringer::RingerSelectorTool m_ringerTool_Tight; + + ToolHandle<ILumiBlockMuTool> m_lumiBlockMuTool; ToolHandleArray< ITrigEgammaFastCaloHypoTool > m_hypoTools { this, "HypoTools", {}, "Hypo tools" }; - + + Gaudi::Property<std::string> m_constantsCalibPath_vLoose{this, "ConstantsCalibPath_vLoose", "RingerSelectorTools/TrigL2_20180903_v9/TrigL2CaloRingerElectronVeryLooseConstants.root", + "Ringer Run2 Constants Calib Path for vLoose tune"}; + Gaudi::Property<std::string> m_constantsCalibPath_Loose{this, "ConstantsCalibPath_Loose", "RingerSelectorTools/TrigL2_20180903_v9/TrigL2CaloRingerElectronLooseConstants.root", + "Ringer Run2 Constants Calib Path for Loose tune"}; + Gaudi::Property<std::string> m_constantsCalibPath_Medium{this, "ConstantsCalibPath_Medium", "RingerSelectorTools/TrigL2_20180903_v9/TrigL2CaloRingerElectronMediumConstants.root", + "Ringer Run2 Constants Calib Path for Medium tune"}; + Gaudi::Property<std::string> m_constantsCalibPath_Tight{this, "ConstantsCalibPath_Tight", "RingerSelectorTools/TrigL2_20180903_v9/TrigL2CaloRingerElectronTightConstants.root", + "Ringer Run2 Constants Calib Path for Tight tune"}; + + Gaudi::Property<std::string> m_thresholdsCalibPath_vLoose{this, "ThresholdsCalibPath_vLoose", "RingerSelectorTools/TrigL2_20180903_v9/TrigL2CaloRingerElectronVeryLooseThresholds.root", + "Ringer Run2 Thresholds Calib Path for vLoose tune"}; + Gaudi::Property<std::string> m_thresholdsCalibPath_Loose{this, "ThresholdsCalibPath_Loose", "RingerSelectorTools/TrigL2_20180903_v9/TrigL2CaloRingerElectronLooseThresholds.root", + "Ringer Run2 Thresholds Calib Path for Loose tune"}; + Gaudi::Property<std::string> m_thresholdsCalibPath_Medium{this, "ThresholdsCalibPath_Medium", "RingerSelectorTools/TrigL2_20180903_v9/TrigL2CaloRingerElectronMediumThresholds.root", + "Ringer Run2 Thresholds Calib Path for Medium tune"}; + Gaudi::Property<std::string> m_thresholdsCalibPath_Tight{this, "ThresholdsCalibPath_Tight", "RingerSelectorTools/TrigL2_20180903_v9/TrigL2CaloRingerElectronTightThresholds.root", + "Ringer Run2 Thresholds Calib Path for Tight tune"}; + SG::ReadHandleKey< xAOD::TrigEMClusterContainer > m_clustersKey { this, "CaloClusters", "CaloClusters", "CaloClusters in view" }; SG::ReadHandleKey<xAOD::TrigRingerRingsContainer> m_ringsKey { this, "RingerKey","HLT_FastCaloRinger","Point to RingerKey"}; }; diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolInc.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolInc.cxx index 435234bb5c7e72191d3cb481c8c8dccb6bf2f8f5..f69865d52183173ad265973d97bdc98f463e4ca6 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolInc.cxx +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolInc.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include <algorithm> @@ -17,12 +17,8 @@ TrigEgammaFastCaloHypoToolInc::TrigEgammaFastCaloHypoToolInc( const std::string& const std::string& name, const IInterface* parent ) : base_class( type, name, parent ), - m_decisionId( HLT::Identifier::fromToolName( name ) ) , - m_selectorTool(), - m_lumiBlockMuTool("LumiBlockMuTool/LumiBlockMuTool") -{ - declareProperty("LumiBlockMuTool", m_lumiBlockMuTool, "Luminosity Tool" ); -} + m_decisionId( HLT::Identifier::fromToolName( name ) ) +{ } TrigEgammaFastCaloHypoToolInc::~TrigEgammaFastCaloHypoToolInc(){} @@ -72,27 +68,15 @@ StatusCode TrigEgammaFastCaloHypoToolInc::initialize() { if ( not m_monTool.name().empty() ) CHECK( m_monTool.retrieve() ); + + if (m_useRinger) { + if (m_vloose + m_loose + m_medium + m_tight != 1) { + ATH_MSG_ERROR("Ringer mode requires exactly one of the vloose, loose, medium or tight flags to be set."); + return StatusCode::FAILURE; + } + }// Use ringer - if (m_useRinger){ - - if( m_useRun3 ){ - ATH_MSG_INFO( "Using the new Onnx ringer selector for Run3" ); - CHECK( m_ringerTool.retrieve() ); - - }else{// Run2 - m_selectorTool.setConstantsCalibPath( m_constantsCalibPath ); - m_selectorTool.setThresholdsCalibPath( m_thresholdsCalibPath ); - if(m_selectorTool.initialize().isFailure()) - return StatusCode::FAILURE; - } - - if (m_lumiBlockMuTool.retrieve().isFailure()) - return StatusCode::FAILURE; - ATH_MSG_INFO("Ringer selector initialization completed successfully."); - - } // Use ringer - ATH_MSG_DEBUG( "Initialization completed successfully" ); return StatusCode::SUCCESS; @@ -337,28 +321,21 @@ bool TrigEgammaFastCaloHypoToolInc::decide_ringer ( const ITrigEgammaFastCaloHyp auto etMon = Monitored::Scalar("Et",-100); auto monEta = Monitored::Scalar("Eta",-100); auto monPhi = Monitored::Scalar("Phi",-100); - auto rnnOutMon = Monitored::Scalar("RnnOut",-100); - auto total_time = Monitored::Timer("TIME_total"); - auto propagate_time = Monitored::Timer("TIME_propagate"); - auto preproc_time = Monitored::Timer("TIME_preproc"); - auto decide_time = Monitored::Timer("TIME_decide"); - - auto mon = Monitored::Group(m_monTool,etMon,monEta,monPhi,rnnOutMon, - total_time,propagate_time,preproc_time,decide_time); + auto mon = Monitored::Group(m_monTool,etMon,monEta,monPhi); + if ( m_acceptAll ) { ATH_MSG_DEBUG( "AcceptAll property is set: taking all events" ); return true; } else { ATH_MSG_DEBUG( "AcceptAll property not set: applying selection" ); } - - total_time.start(); + auto ringerShape = input.ringerShape; const xAOD::TrigEMCluster *emCluster = 0; + if(ringerShape){ emCluster = ringerShape->emCluster(); - //emCluster= input.cluster; if(!emCluster){ ATH_MSG_DEBUG("There is no link to xAOD::TrigEMCluster into the Ringer object."); return false; @@ -369,11 +346,8 @@ bool TrigEgammaFastCaloHypoToolInc::decide_ringer ( const ITrigEgammaFastCaloHyp return false; } - float et = emCluster->et() / Gaudi::Units::GeV; - float avgmu = m_lumiBlockMuTool->averageInteractionsPerCrossing(); - - // make sure that monitoring histogram will plotting only the events of chain. - ///Et threshold + float et = emCluster->et() / Gaudi::Units::GeV; + if(et < m_emEtCut/Gaudi::Units::GeV){ ATH_MSG_DEBUG( "Event reproved by Et threshold. Et = " << et << ", EtCut = " << m_emEtCut/Gaudi::Units::GeV); return false; @@ -382,42 +356,28 @@ bool TrigEgammaFastCaloHypoToolInc::decide_ringer ( const ITrigEgammaFastCaloHyp monEta = emCluster->eta(); etMon = emCluster->et(); monPhi = emCluster->phi(); - float output; - - if (m_useRun3){ - - preproc_time.start(); - auto inputs = m_ringerTool->prepare_inputs( ringerShape , nullptr); - preproc_time.stop(); - - propagate_time.start(); - output = m_ringerTool->predict( ringerShape, inputs ); - propagate_time.stop(); - - }else{ - const std::vector<float> rings = ringerShape->rings(); - std::vector<float> refRings(rings.size()); - refRings.assign(rings.begin(), rings.end()); - output = m_selectorTool.calculate( refRings, emCluster->et(), emCluster->eta(), avgmu, propagate_time, preproc_time ); - } - rnnOutMon = output; - ATH_MSG_DEBUG(name()<< " generate as NN output " << output ); - - bool accept=false; - - decide_time.start(); - if (m_useRun3){ - accept = bool( m_ringerTool->accept(ringerShape, output, avgmu) ); - ATH_MSG_DEBUG(name()<< " Accept? " << (accept?"Yes":"No") ); - }else{ - accept = m_selectorTool.accept(output, emCluster->et(),emCluster->eta(),avgmu) ; - } - decide_time.stop(); + ATH_MSG_DEBUG("m_vloose: "<<m_vloose); + ATH_MSG_DEBUG("m_loose: "<<m_loose); + ATH_MSG_DEBUG("m_medium: "<<m_medium); + ATH_MSG_DEBUG("m_tight: "<<m_tight); - - total_time.stop(); - return accept; + if(m_vloose == true){ + ATH_MSG_DEBUG("input.vloose_accept: "<<input.vloose_accept); + return input.vloose_accept; + } + else if(m_loose == true){ + ATH_MSG_DEBUG("input.loose_accept: "<<input.loose_accept); + return input.loose_accept; + } + else if(m_medium == true){ + ATH_MSG_DEBUG("input.medium_accept: "<<input.medium_accept); + return input.medium_accept; + } + else{ + ATH_MSG_DEBUG("input.tight_accept: "<<input.tight_accept); + return input.tight_accept; + } } diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolInc.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolInc.h index be3c92d9b4dfe1f653c95aa8e85b572ce1502abf..9137eea48957ffed042b1ca1e5a28943771fb09e 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolInc.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolInc.h @@ -8,8 +8,6 @@ #include "xAODTrigRinger/TrigRingerRings.h" #include "TrigSteeringEvent/TrigRoiDescriptor.h" -#include "TrigMultiVarHypo/tools/RingerSelectorTool.h" -#include "RingerSelectorTools/IAsgRingerSelectorTool.h" #include "LumiBlockComps/ILumiBlockMuTool.h" #include "AthenaBaseComps/AthAlgTool.h" @@ -36,27 +34,18 @@ class TrigEgammaFastCaloHypoToolInc : public extends<AthAlgTool, ITrigEgammaFast virtual StatusCode decide( std::vector<ITrigEgammaFastCaloHypoTool::FastClusterInfo>& input ) const override; virtual bool decide( const ITrigEgammaFastCaloHypoTool::FastClusterInfo& i ) const override; - - private: bool decide_cutbased( const ITrigEgammaFastCaloHypoTool::FastClusterInfo& i ) const; bool decide_ringer( const ITrigEgammaFastCaloHypoTool::FastClusterInfo& i ) const; int findCutIndex( float eta ) const; - HLT::Identifier m_decisionId; - Ringer::RingerSelectorTool m_selectorTool; - ToolHandle<ILumiBlockMuTool> m_lumiBlockMuTool; - - Gaudi::Property<std::string> m_constantsCalibPath{this, "ConstantsCalibPath", "", "Ringer Run2 Constants Calib Path"}; - Gaudi::Property<std::string> m_thresholdsCalibPath{this, "ThresholdsCalibPath", "", "Ringer Run2 Thresholds Calib Path"}; + Gaudi::Property< bool > m_useRinger { this, "UseRinger", false , "Use Ringer Selection" }; - Gaudi::Property< bool > m_useRun3 { this, "UseRun3" , false , "Use Ringer Onnx Selection (for Run3)" }; - //Calorimeter electron ID cuts Gaudi::Property< std::vector<float> > m_etabin { this, "EtaBins", {} , "Bins of eta" }; //!< selection variable for L2 calo selection:eta bins @@ -73,11 +62,13 @@ class TrigEgammaFastCaloHypoToolInc : public extends<AthAlgTool, ITrigEgammaFast Gaudi::Property< float > m_detacluster { this, "dETACLUSTERthr", 0. , "" }; Gaudi::Property< float > m_dphicluster { this, "dPHICLUSTERthr", 0. , "" }; Gaudi::Property< bool > m_acceptAll { this, "AcceptAll", false , "Ignore selection" }; - Gaudi::Property<float> m_emEtCut{this,"EtCut", 0.0, "Et threshold"}; - + Gaudi::Property<float> m_emEtCut{this,"EtCut", 0.0, "Et threshold"}; + Gaudi::Property<bool> m_loose{this,"Loose", false, "Decision for Loose tune"}; + Gaudi::Property<bool> m_vloose{this,"vLoose", false, "Decision for vLoose tune"}; + Gaudi::Property<bool> m_tight{this,"Tight", false, "Decision for tight tune"}; + Gaudi::Property<bool> m_medium{this,"Medium", false, "Decision for medium tune"}; ToolHandle< GenericMonitoringTool > m_monTool{ this, "MonTool", "", "Monitoring tool" }; - ToolHandle<Ringer::IAsgRingerSelectorTool>m_ringerTool{ this, "RingerSelector", "", "Ringer tool" }; }; diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaPrecisionElectronHypoAlgMT.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaPrecisionElectronHypoAlgMT.cxx index e1ff61dcc4bc6a347153115e1843ecaa69a2e0fb..0018def2debfa861453894661a3e424487b3efc8 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaPrecisionElectronHypoAlgMT.cxx +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaPrecisionElectronHypoAlgMT.cxx @@ -20,6 +20,18 @@ StatusCode TrigEgammaPrecisionElectronHypoAlgMT::initialize() { ATH_CHECK( m_hypoTools.retrieve() ); + + // Now we try to retrieve the ElectronPhotonSelectorTools that we will use to apply the electron Identification. This is a *must* + ATH_MSG_DEBUG( "Retrieving egammaElectronLHTool..." ); + ATH_CHECK(m_egammaElectronLHTool_vloose.retrieve()); + ATH_CHECK(m_egammaElectronLHTool_loose.retrieve()); + ATH_CHECK(m_egammaElectronLHTool_medium.retrieve()); + ATH_CHECK(m_egammaElectronLHTool_tight.retrieve()); + + // Retrieving Luminosity info + ATH_MSG_DEBUG( "Retrieving luminosityCondData..." ); + ATH_CHECK( m_avgMuKey.initialize() ); + ATH_CHECK( m_electronsKey.initialize() ); renounce( m_electronsKey );// electrons are made in views, so they are not in the EvtStore: hide them @@ -73,7 +85,76 @@ StatusCode TrigEgammaPrecisionElectronHypoAlgMT::execute( const EventContext& co auto d = TCU::newDecisionIn( decisions, TCU::hypoAlgNodeName() ); d->setObjectLink( TCU::featureString(), ph ); TCU::linkToPrevious( d, decisionInput().key(), counter ); - toolInput.emplace_back( d, roi, electronHandle.cptr()->at(cl), previousDecision ); + + ///////LHTool//////////// + float avg_mu = 0; + float lhval_vloose=0; + float lhval_loose=0; + float lhval_medium=0; + float lhval_tight=0; + + bool pass_vloose = false; + bool pass_loose = false; + bool pass_medium = false; + bool pass_tight = false; + + SG::ReadDecorHandle<xAOD::EventInfo,float> eventInfoDecor(m_avgMuKey, context); + if(eventInfoDecor.isPresent()) { + avg_mu = eventInfoDecor(0); + ATH_MSG_DEBUG("Average mu " << avg_mu); + asg::AcceptData accept_vloose = m_egammaElectronLHTool_vloose->accept(context, electronHandle.cptr()->at(cl),avg_mu); + asg::AcceptData accept_loose = m_egammaElectronLHTool_loose->accept(context, electronHandle.cptr()->at(cl),avg_mu); + asg::AcceptData accept_medium = m_egammaElectronLHTool_medium->accept(context, electronHandle.cptr()->at(cl),avg_mu); + asg::AcceptData accept_tight = m_egammaElectronLHTool_tight->accept(context, electronHandle.cptr()->at(cl),avg_mu); + pass_vloose = (bool) accept_vloose; + pass_loose = (bool) accept_loose; + pass_medium = (bool) accept_medium; + pass_tight = (bool) accept_tight; + + // Monitor the LH value + lhval_vloose = m_egammaElectronLHTool_vloose->calculate(context, electronHandle.cptr()->at(cl),avg_mu); + lhval_loose = m_egammaElectronLHTool_loose->calculate(context, electronHandle.cptr()->at(cl),avg_mu); + lhval_medium = m_egammaElectronLHTool_medium->calculate(context, electronHandle.cptr()->at(cl),avg_mu); + lhval_tight = m_egammaElectronLHTool_tight->calculate(context, electronHandle.cptr()->at(cl),avg_mu); + ATH_MSG_DEBUG("LHValue_vloose with avgmu " << lhval_vloose); + ATH_MSG_DEBUG("LHValue_loose with avgmu " << lhval_loose); + ATH_MSG_DEBUG("LHValue_medium with avgmu " << lhval_medium); + ATH_MSG_DEBUG("LHValue_tight with avgmu " << lhval_tight); + } + else{ + ATH_MSG_WARNING("EventInfo decoration not available!"); + asg::AcceptData accept_vloose = m_egammaElectronLHTool_vloose->accept(context, electronHandle.cptr()->at(cl)); + asg::AcceptData accept_loose = m_egammaElectronLHTool_loose->accept(context, electronHandle.cptr()->at(cl)); + asg::AcceptData accept_medium = m_egammaElectronLHTool_medium->accept(context, electronHandle.cptr()->at(cl)); + asg::AcceptData accept_tight = m_egammaElectronLHTool_tight->accept(context, electronHandle.cptr()->at(cl)); + pass_vloose = (bool) accept_vloose; + pass_loose = (bool) accept_loose; + pass_medium = (bool) accept_medium; + pass_tight = (bool) accept_tight; + + // Monitor the LH value + lhval_vloose = m_egammaElectronLHTool_vloose->calculate(context, electronHandle.cptr()->at(cl)); + lhval_loose = m_egammaElectronLHTool_loose->calculate(context, electronHandle.cptr()->at(cl)); + lhval_medium = m_egammaElectronLHTool_medium->calculate(context, electronHandle.cptr()->at(cl)); + lhval_tight = m_egammaElectronLHTool_tight->calculate(context, electronHandle.cptr()->at(cl)); + ATH_MSG_DEBUG("LHValue_vloose without avgmu " << lhval_vloose); + ATH_MSG_DEBUG("LHValue_loose without avgmu " << lhval_loose); + ATH_MSG_DEBUG("LHValue_medium without avgmu " << lhval_medium); + ATH_MSG_DEBUG("LHValue_tight without avgmu " << lhval_tight); + } + const float avg_mu_const = avg_mu; + const float lhval_const_vloose = lhval_vloose; + const float lhval_const_loose = lhval_loose; + const float lhval_const_medium = lhval_medium; + const float lhval_const_tight = lhval_tight; + + const bool pass_const_vloose = pass_vloose; + const bool pass_const_loose = pass_loose; + const bool pass_const_medium = pass_medium; + const bool pass_const_tight = pass_tight; + + toolInput.emplace_back( d, roi, electronHandle.cptr()->at(cl), pass_const_vloose, pass_const_loose, pass_const_medium, pass_const_tight, + lhval_const_vloose,lhval_const_loose, lhval_const_medium, lhval_const_tight, avg_mu_const, previousDecision ); validelectrons++; @@ -90,7 +171,7 @@ StatusCode TrigEgammaPrecisionElectronHypoAlgMT::execute( const EventContext& co for ( auto& tool: m_hypoTools ) { - ATH_CHECK( tool->decide( toolInput, context ) ); + ATH_CHECK( tool->decide( toolInput ) ); } ATH_CHECK( hypoBaseOutputProcessing(outputHandle) ); diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaPrecisionElectronHypoAlgMT.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaPrecisionElectronHypoAlgMT.h index 889e8c64f344cc14b2c829cdfe93319d25935fe4..39183bf56dfdd8662423a1cf6029720803c5e4bb 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaPrecisionElectronHypoAlgMT.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaPrecisionElectronHypoAlgMT.h @@ -10,8 +10,11 @@ #include "xAODEgamma/ElectronContainer.h" #include "xAODEgamma/Electron.h" #include "TrigCompositeUtils/TrigCompositeUtils.h" - #include "ITrigEgammaPrecisionElectronHypoTool.h" +#include "EgammaAnalysisInterfaces/IAsgElectronLikelihoodTool.h" +#include "StoreGate/ReadDecorHandle.h" +#include "xAODEventInfo/EventInfo.h" + /** * @class TrigEgammaPrecisionElectronHypoAlgMT @@ -31,6 +34,14 @@ class TrigEgammaPrecisionElectronHypoAlgMT : public ::HypoBase { Gaudi::Property< bool > m_runInView { this, "RunInView", false , "Set input DH for running in views" }; SG::ReadHandleKey< xAOD::ElectronContainer > m_electronsKey { this, "Electrons", "Electrons", "Electrons in roi" }; + ToolHandle<IAsgElectronLikelihoodTool> m_egammaElectronLHTool_vloose { this, "ElectronLHSelector_vLoose", "AsgElectronLHVLooseSelector","Likelihood tool vloose tune" }; + ToolHandle<IAsgElectronLikelihoodTool> m_egammaElectronLHTool_loose { this, "ElectronLHSelector_Loose", "AsgElectronLHLooseSelector", "Likelihood tool loose tune" }; + ToolHandle<IAsgElectronLikelihoodTool> m_egammaElectronLHTool_medium { this, "ElectronLHSelector_Medium", "AsgElectronLHMediumSelector", "Likelihood tool medium tune" }; + ToolHandle<IAsgElectronLikelihoodTool> m_egammaElectronLHTool_tight { this, "ElectronLHSelector_Tight", "AsgElectronLHTightSelector", "Likelihood tool tight tune" }; + + /*Luminosity info*/ + SG::ReadDecorHandleKey<xAOD::EventInfo> m_avgMuKey { this, "averageInteractionsPerCrossingKey", "EventInfo.averageInteractionsPerCrossing", "Decoration for Average Interaction Per Crossing" }; + }; diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaPrecisionElectronHypoToolInc.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaPrecisionElectronHypoToolInc.cxx index a2481c028e971ae125ca7502b544ad42fa31e6ed..f26222dbdd0941ef8c40bb960da6c10091a510a0 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaPrecisionElectronHypoToolInc.cxx +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaPrecisionElectronHypoToolInc.cxx @@ -34,19 +34,16 @@ StatusCode TrigEgammaPrecisionElectronHypoToolInc::initialize() { return StatusCode::FAILURE; } - // Now we try to retrieve the ElectronPhotonSelectorTools that we will use to apply the electron Identification. This is a *must* - ATH_MSG_DEBUG( "Retrieving egammaElectronLHTool..." ); - CHECK( m_egammaElectronLHTool.retrieve() ); - - // Retrieving Luminosity info - ATH_MSG_DEBUG( "Retrieving luminosityCondData..." ); - ATH_CHECK( m_avgMuKey.initialize() ); - unsigned int nEtaBin = m_etabin.size(); ATH_CHECK( m_eTthr.size() == nEtaBin-1 ); ATH_MSG_DEBUG( "Tool configured for chain/id: " << m_decisionId ); + if (m_vloose + m_loose + m_medium + m_tight != 1) { + ATH_MSG_ERROR("LHTool requires exactly one of the vloose, loose, medium or tight flags to be set."); + return StatusCode::FAILURE; + } + if ( not m_monTool.name().empty() ) CHECK( m_monTool.retrieve() ); @@ -54,7 +51,7 @@ StatusCode TrigEgammaPrecisionElectronHypoToolInc::initialize() { } -bool TrigEgammaPrecisionElectronHypoToolInc::decide( const ITrigEgammaPrecisionElectronHypoTool::ElectronInfo& input,const EventContext& ctx) const { +bool TrigEgammaPrecisionElectronHypoToolInc::decide( const ITrigEgammaPrecisionElectronHypoTool::ElectronInfo& input) const { bool pass = false; @@ -155,30 +152,13 @@ bool TrigEgammaPrecisionElectronHypoToolInc::decide( const ITrigEgammaPrecisionE // get average luminosity information to calculate LH - float avg_mu = 0; - float lhval=0; - SG::ReadDecorHandle<xAOD::EventInfo,float> eventInfoDecor(m_avgMuKey, ctx); - if(eventInfoDecor.isPresent()) { - avg_mu = eventInfoDecor(0); - ATH_MSG_DEBUG("Average mu " << avg_mu); - mon_mu = avg_mu; - asg::AcceptData accept = m_egammaElectronLHTool->accept(ctx,input.electron,avg_mu); - pass = (bool) accept; - - // Monitor the LH value - lhval=m_egammaElectronLHTool->calculate(ctx, input.electron,avg_mu); - ATH_MSG_DEBUG("LHValue with avgmu " << lhval); - mon_lhval = lhval; - } - else{ - ATH_MSG_WARNING("EventInfo decoration not available!"); - asg::AcceptData accept = m_egammaElectronLHTool->accept(ctx,input.electron); - pass = (bool) accept; - // Monitor the LH value - lhval=m_egammaElectronLHTool->calculate(ctx, input.electron); - ATH_MSG_DEBUG("LHValue without avgmu " << lhval); - mon_lhval = lhval; - } + mon_mu = input.avgMu; + + ATH_MSG_DEBUG("m_vloose_Electron: "<<m_vloose); + ATH_MSG_DEBUG("m_loose_Electron: "<<m_loose); + ATH_MSG_DEBUG("m_medium_Electron: "<<m_medium); + ATH_MSG_DEBUG("m_tight_Electron: "<<m_tight); + float Rhad1(0), Rhad(0), Reta(0), Rphi(0), e277(0), weta2c(0), //emax2(0), Eratio(0), DeltaE(0), f1(0), weta1c(0), wtot(0), fracm(0); @@ -266,6 +246,27 @@ bool TrigEgammaPrecisionElectronHypoToolInc::decide( const ITrigEgammaPrecisionE ATH_MSG_DEBUG("relptcone20 = " <<relptcone20 ); mon_relptcone20 = relptcone20; ATH_MSG_DEBUG("m_RelPtConeCut = " << m_RelPtConeCut ); + + if(m_vloose == true){ + ATH_MSG_DEBUG("input.vloose_accept_Electron: "<<input.accept_vl); + mon_lhval = input.LHValue_vl; + pass = input.accept_vl; + } + else if(m_loose == true){ + ATH_MSG_DEBUG("input.loose_accept_Electron: "<<input.accept_l); + mon_lhval = input.LHValue_l; + pass = input.accept_l; + } + else if(m_medium == true){ + ATH_MSG_DEBUG("input.medium_accept_Electron: "<<input.accept_m); + mon_lhval = input.LHValue_m; + pass = input.accept_m; + } + else{ + ATH_MSG_DEBUG("input.tight_accept_Electron: "<<input.accept_t); + mon_lhval = input.LHValue_t; + pass = input.accept_t; + } // Evaluating lh *after* retrieving variables for monitoing and debuging purposes ATH_MSG_DEBUG("AthenaLHSelectorTool: TAccept = " << pass); @@ -304,10 +305,10 @@ int TrigEgammaPrecisionElectronHypoToolInc::findCutIndex( float eta ) const { } -StatusCode TrigEgammaPrecisionElectronHypoToolInc::decide( std::vector<ElectronInfo>& input,const EventContext& ctx ) const { +StatusCode TrigEgammaPrecisionElectronHypoToolInc::decide( std::vector<ElectronInfo>& input) const { for ( auto& i: input ) { if ( TCU::passed ( m_decisionId.numeric(), i.previousDecisionIDs ) ) { - if ( decide( i, ctx ) ) { + if ( decide( i ) ) { TCU::addDecisionID( m_decisionId, i.decision ); } } diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaPrecisionElectronHypoToolInc.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaPrecisionElectronHypoToolInc.h index 53652b9b9569e39b67d97ec0b73d0052291e1e94..7d606501391bba93c6258a94d96f30479b09398e 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaPrecisionElectronHypoToolInc.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaPrecisionElectronHypoToolInc.h @@ -25,8 +25,8 @@ class TrigEgammaPrecisionElectronHypoToolInc : public extends<AthAlgTool, ITrigE virtual StatusCode initialize() override; - virtual StatusCode decide( std::vector<ITrigEgammaPrecisionElectronHypoTool::ElectronInfo>& input, const EventContext& ctx) const override; - virtual bool decide( const ITrigEgammaPrecisionElectronHypoTool::ElectronInfo& i, const EventContext& ctx) const override; + virtual StatusCode decide( std::vector<ITrigEgammaPrecisionElectronHypoTool::ElectronInfo>& input) const override; + virtual bool decide( const ITrigEgammaPrecisionElectronHypoTool::ElectronInfo& i) const override; private: HLT::Identifier m_decisionId; @@ -37,12 +37,12 @@ class TrigEgammaPrecisionElectronHypoToolInc : public extends<AthAlgTool, ITrigE Gaudi::Property< float > m_detacluster { this, "dETACLUSTERthr", 0. , "" }; Gaudi::Property< float > m_dphicluster { this, "dPHICLUSTERthr", 0. , "" }; Gaudi::Property< float > m_RelPtConeCut { this, "RelPtConeCut", -999., "Track isolation cut" }; + Gaudi::Property<bool> m_loose{this,"Loose", false, "Decision for Loose tune"}; + Gaudi::Property<bool> m_vloose{this,"vLoose", false, "Decision for vLoose tune"}; + Gaudi::Property<bool> m_tight{this,"Tight", false, "Decision for tight tune"}; + Gaudi::Property<bool> m_medium{this,"Medium", false, "Decision for medium tune"}; ToolHandle< GenericMonitoringTool > m_monTool { this, "MonTool", "", "Monitoring tool" }; - ToolHandle<IAsgElectronLikelihoodTool> m_egammaElectronLHTool{ this, "ElectronLHSelector", "", "Likelihood tool" }; - - /*Luminosity info*/ - SG::ReadDecorHandleKey<xAOD::EventInfo> m_avgMuKey { this, "averageInteractionsPerCrossingKey", "EventInfo.averageInteractionsPerCrossing", "Decoration for Average Interaction Per Crossing" }; int findCutIndex( float eta ) const; }; diff --git a/Trigger/TrigHypothesis/TrigMultiVarHypo/src/tools/RingerSelectorTool.cxx b/Trigger/TrigHypothesis/TrigMultiVarHypo/src/tools/RingerSelectorTool.cxx index f92506809a52c8edb5f54defe490725405d9ff67..c78700595f450d21864b7233f58611207826de08 100644 --- a/Trigger/TrigHypothesis/TrigMultiVarHypo/src/tools/RingerSelectorTool.cxx +++ b/Trigger/TrigHypothesis/TrigMultiVarHypo/src/tools/RingerSelectorTool.cxx @@ -31,6 +31,7 @@ StatusCode RingerSelectorTool::initialize() m_doPileupCorrection = m_reader.doPileupCorrection(); m_lumiCut = m_reader.lumiCut(); + ATH_MSG_DEBUG("m_thresholdsCalibPath: "<<m_thresholdsCalibPath); } // Retrieve the NeuralNetwork list @@ -39,7 +40,8 @@ StatusCode RingerSelectorTool::initialize() ATH_MSG_ERROR("Can not retrieve all information from " << m_constantsCalibPath ); return StatusCode::FAILURE; } - + ATH_MSG_DEBUG("m_constantsCalibPath: "<<m_constantsCalibPath); + //ATH_MSG_DEBUG("m_discriminators: "<<m_discriminators); m_removeOutputTansigTF=m_reader.removeOutputTansigTF(); } diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/EgammaDefs.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/EgammaDefs.py index 58392cf43a9e055f27ca8d0c7d7e6e4acdea2ebe..da8881d2aaa7c1dc92e3dcf013b2d01df4c8b0e5 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/EgammaDefs.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/EgammaDefs.py @@ -32,10 +32,10 @@ class TrigEgammaKeys_GSF(object): outputTrackKey_GSF = 'HLT_IDTrkTrack_Electron_GSF' outputTrackParticleKey_GSF = recordable('HLT_IDTrack_Electron_GSF') -# Print configuration once: -mlog.info("TrigEgammaPidTools version %s", TrigEgammaKeys.pidVersion) + # Print configuration once: + mlog.info("TrigEgammaPidTools version %s", TrigEgammaKeys.pidVersion) -def TrigElectronSelectors(sel): +def TrigElectronSelectors(): # Configure the LH selectors #TrigEgammaKeys.pidVersion.set_On() @@ -55,17 +55,28 @@ def TrigElectronSelectors(sel): 'lhtight':'ElectronLikelihoodTightTriggerConfig.conf', } - if sel not in SelectorNames: - mlog.error('No selector defined for working point %s for electrons :-( ', sel) - return - else: - mlog.debug('Configuring electron PID for %s', sel) - SelectorTool=CfgMgr.AsgElectronLikelihoodTool(SelectorNames[sel]) - SelectorTool.ConfigFile = ConfigFilePath + '/' + ElectronToolConfigFile[sel] - SelectorTool.usePVContainer = False - SelectorTool.skipDeltaPoverP = True + mlog.debug('Configuring electron PID' ) + SelectorTool_vloose=CfgMgr.AsgElectronLikelihoodTool(SelectorNames['lhvloose']) + SelectorTool_vloose.ConfigFile = ConfigFilePath + '/' + ElectronToolConfigFile['lhvloose'] + SelectorTool_vloose.usePVContainer = False + SelectorTool_vloose.skipDeltaPoverP = True - return SelectorTool + SelectorTool_loose=CfgMgr.AsgElectronLikelihoodTool(SelectorNames['lhloose']) + SelectorTool_loose.ConfigFile = ConfigFilePath + '/' + ElectronToolConfigFile['lhloose'] + SelectorTool_loose.usePVContainer = False + SelectorTool_loose.skipDeltaPoverP = True + + SelectorTool_medium=CfgMgr.AsgElectronLikelihoodTool(SelectorNames['lhmedium']) + SelectorTool_medium.ConfigFile = ConfigFilePath + '/' + ElectronToolConfigFile['lhmedium'] + SelectorTool_medium.usePVContainer = False + SelectorTool_medium.skipDeltaPoverP = True + + SelectorTool_tight=CfgMgr.AsgElectronLikelihoodTool(SelectorNames['lhtight']) + SelectorTool_tight.ConfigFile = ConfigFilePath + '/' + ElectronToolConfigFile['lhtight'] + SelectorTool_tight.usePVContainer = False + SelectorTool_tight.skipDeltaPoverP = True + + return SelectorTool_vloose, SelectorTool_loose, SelectorTool_medium, SelectorTool_tight def TrigPhotonSelectors(sel): diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PrecisionElectronSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PrecisionElectronSequenceSetup.py index ef7b200b835d8a56bfff17a7aa4056754336f45a..b934dcd12f451e45730c6cc28c21b5bad3891b35 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PrecisionElectronSequenceSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PrecisionElectronSequenceSetup.py @@ -39,10 +39,16 @@ def precisionElectronMenuSequence(): (electronPrecisionAthSequence, precisionElectronViewsMaker, sequenceOut) = RecoFragmentsPool.retrieve(precisionElectronSequence, ConfigFlags) # make the Hypo + from TriggerMenuMT.HLTMenuConfig.Egamma.EgammaDefs import TrigElectronSelectors + SelectorTool_vloose, SelectorTool_loose, SelectorTool_medium, SelectorTool_tight = TrigElectronSelectors() from TrigEgammaHypo.TrigEgammaHypoConf import TrigEgammaPrecisionElectronHypoAlgMT thePrecisionElectronHypo = TrigEgammaPrecisionElectronHypoAlgMT("TrigEgammaPrecisionElectronHypoAlgMT_noGSF") thePrecisionElectronHypo.Electrons = sequenceOut thePrecisionElectronHypo.RunInView = True + thePrecisionElectronHypo.ElectronLHSelector_vLoose = SelectorTool_vloose + thePrecisionElectronHypo.ElectronLHSelector_Loose = SelectorTool_loose + thePrecisionElectronHypo.ElectronLHSelector_Medium = SelectorTool_medium + thePrecisionElectronHypo.ElectronLHSelector_Tight = SelectorTool_tight from TrigEgammaHypo.TrigEgammaPrecisionElectronHypoTool import TrigEgammaPrecisionElectronHypoToolFromDict diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PrecisionElectronSequenceSetup_GSF.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PrecisionElectronSequenceSetup_GSF.py index 7f39e31df3ac1707d0588042622862e68fadf19b..b3ec43d36f5090b3b18f4f140add4d15c87ce562 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PrecisionElectronSequenceSetup_GSF.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PrecisionElectronSequenceSetup_GSF.py @@ -41,10 +41,16 @@ def precisionElectronMenuSequence_GSF(): (electronPrecisionAthSequence, precisionElectronViewsMaker, sequenceOut) = RecoFragmentsPool.retrieve(precisionElectronSequence_GSF, ConfigFlags) # make the Hypo + from TriggerMenuMT.HLTMenuConfig.Egamma.EgammaDefs import TrigElectronSelectors + SelectorTool_vloose, SelectorTool_loose, SelectorTool_medium, SelectorTool_tight = TrigElectronSelectors() from TrigEgammaHypo.TrigEgammaHypoConf import TrigEgammaPrecisionElectronHypoAlgMT thePrecisionElectronHypo = TrigEgammaPrecisionElectronHypoAlgMT("TrigEgammaPrecisionElectronHypoAlgMT_GSF") thePrecisionElectronHypo.Electrons = sequenceOut thePrecisionElectronHypo.RunInView = True + thePrecisionElectronHypo.ElectronLHSelector_vLoose = SelectorTool_vloose + thePrecisionElectronHypo.ElectronLHSelector_Loose = SelectorTool_loose + thePrecisionElectronHypo.ElectronLHSelector_Medium = SelectorTool_medium + thePrecisionElectronHypo.ElectronLHSelector_Tight = SelectorTool_tight from TrigEgammaHypo.TrigEgammaPrecisionElectronHypoTool import TrigEgammaPrecisionElectronHypoToolFromDict