From 588f182be655b6fcde226d55d76d68070dfef40f Mon Sep 17 00:00:00 2001 From: Emmanuel Le Guirriec <emmanuel.le.guirriec@cern.ch> Date: Fri, 21 Sep 2018 09:37:22 +0200 Subject: [PATCH] Solve configuration issue to use JetTagCalibCondAlg in Trig scheme --- .../BTagging/python/BTaggingConfiguration.py | 31 +- .../python/BTaggingConfiguration_IP2DTag.py | 4 - .../BTaggingConfiguration_IP2DTrigTag.py | 226 +++++++++ .../python/BTaggingConfiguration_IP3DTag.py | 3 - .../BTaggingConfiguration_IP3DTrigTag.py | 229 +++++++++ ...gConfiguration_InDetVKalVxTrigInJetTool.py | 39 ++ .../python/BTaggingConfiguration_LoadTools.py | 234 +++++---- .../BTaggingConfiguration_MV2c10TrigTag.py | 49 ++ ...onfiguration_MultivariateTrigTagManager.py | 42 ++ ...onfiguration_NewJetFitterTrigCollection.py | 478 ++++++++++++++++++ .../BTaggingConfiguration_SV1TrigTag.py | 76 +++ 11 files changed, 1277 insertions(+), 134 deletions(-) create mode 100644 PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_IP2DTrigTag.py create mode 100644 PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_IP3DTrigTag.py create mode 100644 PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_InDetVKalVxTrigInJetTool.py create mode 100644 PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_MV2c10TrigTag.py create mode 100644 PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_MultivariateTrigTagManager.py create mode 100644 PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_NewJetFitterTrigCollection.py create mode 100644 PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_SV1TrigTag.py diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration.py index 0b68eb37beec..2c329e17d688 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration.py +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration.py @@ -14,6 +14,7 @@ from RecExConfig.RecFlags import rec # Common tools: from BTagging.BTaggingConfiguration_CommonTools import * from BTagging.BTaggingConfiguration_InDetVKalVxInJetTool import * +from BTagging.BTaggingConfiguration_InDetVKalVxTrigInJetTool import * from BTagging.BTaggingConfiguration_InDetVKalVxNegativeTagInJetTool import * from BTagging.BTaggingConfiguration_InDetVKalVxMultiVxInJetTool import * @@ -27,6 +28,7 @@ from BTagging.BTaggingConfiguration_IP2DNegTag import * #from BTagging.BTaggingConfiguration_IP2DSpcPosTag import * #from BTagging.BTaggingConfiguration_IP2DSpcTag import * from BTagging.BTaggingConfiguration_IP2DTag import * +from BTagging.BTaggingConfiguration_IP2DTrigTag import * #from BTagging.BTaggingConfiguration_IP3DFlipTag import * from BTagging.BTaggingConfiguration_IP3DNegTag import * #from BTagging.BTaggingConfiguration_IP3DPosTag import * @@ -35,6 +37,7 @@ from BTagging.BTaggingConfiguration_IP3DNegTag import * #from BTagging.BTaggingConfiguration_IP3DSpcPosTag import * #from BTagging.BTaggingConfiguration_IP3DSpcTag import * from BTagging.BTaggingConfiguration_IP3DTag import * +from BTagging.BTaggingConfiguration_IP3DTrigTag import * from BTagging.BTaggingConfiguration_RNNIPTag import * # Jet fitter taggers @@ -53,6 +56,7 @@ from BTagging.BTaggingConfiguration_RNNIPTag import * ##from BTagging.BTaggingConfiguration_NewJetFitterTag import * from BTagging.BTaggingConfiguration_NewJetFitterCollection import * #I collected all jetfitter functions currently needed for rel. 19 into here (Wouter) +from BTagging.BTaggingConfiguration_NewJetFitterTrigCollection import * #I collected all jetfitter functions currently needed for rel. 19 into here (Wouter) from BTagging.BTaggingConfiguration_NewJetFitterIP3DNegCollection import * # Lepton taggers @@ -67,6 +71,7 @@ from BTagging.BTaggingConfiguration_SoftMuonTag import * from BTagging.BTaggingConfiguration_SV0Tag import * from BTagging.BTaggingConfiguration_SV1FlipTag import * from BTagging.BTaggingConfiguration_SV1Tag import * +from BTagging.BTaggingConfiguration_SV1TrigTag import * #from BTagging.BTaggingConfiguration_SV2FlipTag import * from BTagging.BTaggingConfiguration_SV2Tag import * @@ -89,6 +94,7 @@ from BTagging.BTaggingConfiguration_MV1cFlipTag import * from BTagging.BTaggingConfiguration_MV2c00Tag import * from BTagging.BTaggingConfiguration_MV2c00FlipTag import * from BTagging.BTaggingConfiguration_MV2c10Tag import * +from BTagging.BTaggingConfiguration_MV2c10TrigTag import * from BTagging.BTaggingConfiguration_MV2c10FlipTag import * from BTagging.BTaggingConfiguration_MV2c20Tag import * from BTagging.BTaggingConfiguration_MV2c20FlipTag import * @@ -109,6 +115,7 @@ from BTagging.BTaggingConfiguration_ExKtbbTag import * # MultivariateTagManager from BTagging.BTaggingConfiguration_MultivariateTagManager import * +from BTagging.BTaggingConfiguration_MultivariateTrigTagManager import * from BTagging.BTaggingConfiguration_MultivariateFlipTagManager import * # DL1 tagger @@ -387,7 +394,7 @@ class Configuration: print str(tool)+': ',self._BTaggingConfig_InitializedTools[tool] def updateBTaggers(self, JetCollection): - """Updates the JetBTaggerTool for the selected JetCollection if they already exist. This is in order to keep + """Updates the JetBTaggerAlgs for the selected JetCollection if they already exist. This is in order to keep them up-to-date, as someone might set up a tool after these main tools already exist. And such a tool might require a new associator which we need to add to the main associator tool.""" if JetCollection in self._BTaggingConfig_JetBTaggerAlgs: @@ -409,10 +416,10 @@ class Configuration: return btagger[0] def setupJetBTaggerTool(self, ToolSvc=None, JetCollection="", TaggerList=[], SetupScheme="", topSequence=None, Verbose = None, AddToToolSvc = True, options={}, StripJetsSuffix = True): - """Convenience function which takes only a single jet collection and returns an instance instead - of a list; see setupJetBTaggerTools for more info. This function is mainly here for easy calling for BTagging from JetRec. - - This function also strips any trailing 'Jets' in the JetCollection if StripJetsSuffix=True (which is the default).""" + # """Convenience function which takes only a single jet collection and returns an instance instead + # of a list; see setupJetBTaggerTools for more info. This function is mainly here for easy calling for BTagging from JetRec. + + # This function also strips any trailing 'Jets' in the JetCollection if StripJetsSuffix=True (which is the default).""" if (JetCollection.lower()).endswith("jets"): if Verbose is None: if BTaggingFlags.OutputLevel < 3: @@ -550,6 +557,7 @@ class Configuration: output: List of JetBTaggerTools (this includes those for which no tool was set up because it already existed).""" if len(SetupScheme) == 0: SetupScheme = BTaggingFlags.ConfigurationScheme + from BTagging.BTaggingConfiguration_LoadTools import SetupJetCollection import sys if Verbose is None: @@ -765,9 +773,14 @@ class Configuration: track: The track association. jetcol: The jet collection. output: The name of the tool.""" + + #GeneralToolSuffix() can not be used here because now tagger in Trig scheme are added with the full name tagger_Trig + GeneralToolSuffix = '' + if 'Trig' in self._name and 'Trig' not in tool: + GeneralToolSuffix = '_Trig'; # Some tools only need exactly one in ToolSvc if getToolMetadata(tool, 'OneInTotal'): - return tool+self.GeneralToolSuffix() + return tool+GeneralToolSuffix # Some tools need one per track association if not getToolMetadata(tool, 'OnePerTrackAssociationAndJetCollection'): # Append track association if non-default @@ -775,10 +788,10 @@ class Configuration: if not defaulttracks: defaulttracks = 'BTagTrackToJetAssociator' if track == defaulttracks: - return tool+self.GeneralToolSuffix() - return tool+'_'+track+self.GeneralToolSuffix() + return tool+GeneralToolSuffix + return tool+'_'+track+GeneralToolSuffix # All others require one per track and per jet collection - return jetcol+'_'+tool+'_'+track+self.GeneralToolSuffix() + return jetcol+'_'+tool+'_'+track+GeneralToolSuffix def checkPrerequisites(self, tool_type, TrackCollection="", JetCollection="", CheckOnlyInsideToolCollection=False): """Checks whether all prerequisites are met for the tool/tagger. It returns a list of diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_IP2DTag.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_IP2DTag.py index 7f28b3a47d0e..7be972004859 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_IP2DTag.py +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_IP2DTag.py @@ -27,12 +27,8 @@ metaIP2DTag = { 'IsATagger' : True, 'PassByPointer' : {'SVForIPTool' : 'SVForIPTool_IP2D', 'trackSelectorTool' : 'IP2DTrackSelector', 'trackGradeFactory' : 'IP2DDetailedTrackGradeFactory', -# 'trackToVertexTool' : 'BTagTrackToVertexTool', 'TrackToVertexIPEstimator' : 'BTagTrackToVertexIPEstimator', 'LikelihoodTool' : 'IP2DNewLikelihoodTool'}, -# 'PassByName' : {'SecVxFinderNameForV0Removal' : 'InDetVKalVxInJetTool', -# 'SecVxFinderNameForIPSign' : 'InDetVKalVxInJetTool'}, -# 'PassTracksAs' : 'trackAssociation', 'PassTracksAs' : 'trackAssociationName', 'JetCollectionList' : 'jetCollectionList', 'ToolCollection' : 'IP2DTag' } diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_IP2DTrigTag.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_IP2DTrigTag.py new file mode 100644 index 000000000000..d980efd2f519 --- /dev/null +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_IP2DTrigTag.py @@ -0,0 +1,226 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + +# Configuration functions for IP2DTag_Trig +# Author: Wouter van den Wollenberg (2013-2014) +from BTagging.BTaggingFlags import BTaggingFlags +from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags +from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags +from IOVDbSvc.CondDB import conddb +btagrun1=False +if conddb.dbdata == 'COMP200': + btagrun1=True +elif conddb.isMC: + btagrun1 = (commonGeoFlags.Run() == "RUN1" or (commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isIBL() == False)) + +metaIP2DTag_Trig = { 'IsATagger' : True, + 'xAODBaseName' : 'IP2D', + 'DependsOn' : ['AtlasExtrapolator', + 'BTagTrackToVertexTool', + 'InDetVKalVxInJetTool_Trig', + 'BTagFullLinearizedTrackFactory', + 'BTagTrackToVertexIPEstimator', + 'IP2DNewLikelihoodTool_Trig', + 'IP2DTrackSelector_Trig', + 'SVForIPTool_IP2D_Trig', + 'IP2DBasicTrackGradeFactory_Trig', + 'IP2DDetailedTrackGradeFactory_Trig'], + 'PassByPointer' : {'SVForIPTool' : 'SVForIPTool_IP2D_Trig', + 'trackSelectorTool' : 'IP2DTrackSelector_Trig', + 'trackGradeFactory' : 'IP2DDetailedTrackGradeFactory_Trig', + 'TrackToVertexIPEstimator' : 'BTagTrackToVertexIPEstimator', + 'LikelihoodTool' : 'IP2DNewLikelihoodTool_Trig'}, + 'PassTracksAs' : 'trackAssociationName', + 'JetCollectionList' : 'jetCollectionList', + 'ToolCollection' : 'IP2DTag_Trig' } + +def toolIP2DTag_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a IP2DTag_Trig tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + Runmodus default: BTaggingFlags.Runmodus + referenceType default: BTaggingFlags.ReferenceType + impactParameterView default: "2D" + trackGradePartitions default: [ "Good", "BlaShared", "PixShared", "SctShared", "0HitBLayer" ] + RejectBadTracks default: False + originalTPCollectionName default: BTaggingFlags.TrackParticleCollectionName + jetCollectionList default: BTaggingFlags.Jets + unbiasIPEstimation default: False (switch to true (better!) when creating new PDFs) + UseCHypo default: True + SecVxFinderName default: "SV1" + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + grades= [ "0HitIn0HitNInExp2","0HitIn0HitNInExpIn","0HitIn0HitNInExpNIn","0HitIn0HitNIn", + "0HitInExp", "0HitIn", + "0HitNInExp", "0HitNIn", + "InANDNInShared", "PixShared", "SctShared", + "InANDNInSplit", "PixSplit", + "Good"] + if btagrun1: grades=[ "Good", "BlaShared", "PixShared", "SctShared", "0HitBLayer" ] + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, + 'Runmodus' : BTaggingFlags.Runmodus, + 'referenceType' : BTaggingFlags.ReferenceType, + 'jetPtMinRef' : BTaggingFlags.JetPtMinRef, + 'impactParameterView' : '2D', + 'trackGradePartitions' : grades, + 'RejectBadTracks' : True, + 'originalTPCollectionName' : BTaggingFlags.TrackParticleCollectionName, + 'jetCollectionList' : BTaggingFlags.Jets, + 'unbiasIPEstimation' : False, + 'UseCHypo' : True, + 'SecVxFinderName' : 'SV1', + 'storeTrackParticles': True, + 'storeTrackParameters': True, + 'storeIpValues': False, + } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from JetTagTools.JetTagToolsConf import Analysis__IPTag + return Analysis__IPTag(**options) + +#--------------------------------------------------------------------- + +metaIP2DDetailedTrackGradeFactory_Trig = { 'ToolCollection' : 'IP2DTag_Trig' } + +def toolIP2DDetailedTrackGradeFactory_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a IP2DTrigDetailedTrackGradeFactory tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + useSharedHitInfo default: True + useDetailSharedHitInfo default: True + useRun2TrackGrading default: False + hitBLayerGrade default: True + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, + 'useSharedHitInfo' : True, + 'useDetailSharedHitInfo' : True, + 'useRun2TrackGrading' : (btagrun1 == False), + 'useInnerLayers0HitInfo' : (btagrun1 == False), + 'useDetailSplitHitInfo' : (btagrun1 == False), + 'hitBLayerGrade' : True, + } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from JetTagTools.JetTagToolsConf import Analysis__DetailedTrackGradeFactory + return Analysis__DetailedTrackGradeFactory(**options) + +#--------------------------------------------------------------------- + +metaIP2DBasicTrackGradeFactory_Trig = { 'ToolCollection' : 'IP2DTag_Trig' } + +def toolIP2DBasicTrackGradeFactory_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a IP2DTrigBasicTrackGradeFactory tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + useSharedHitInfo default: True + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, +# 'TrackSummaryTool' : None, + 'useSharedHitInfo' : True } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from JetTagTools.JetTagToolsConf import Analysis__BasicTrackGradeFactory + return Analysis__BasicTrackGradeFactory(**options) + +#--------------------------------------------------------------------- + +metaSVForIPTool_IP2D_Trig = { 'ToolCollection' : 'IP2DTag_Trig' } + +def toolSVForIPTool_IP2D_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a SVForIPTool_IP2DTrig tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from JetTagTools.JetTagToolsConf import Analysis__SVForIPTool + return Analysis__SVForIPTool(**options) + +#--------------------------------------------------------------------- + +metaIP2DTrackSelector_Trig = { 'DependsOn' : ['BTagTrackToVertexTool',], + 'PassedByPointer' : {'trackToVertexTool' : 'BTagTrackToVertexTool'}, + 'ToolCollection' : 'IP2DTag_Trig' } + +def toolIP2DTrackSelector_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a IP2DTrigTrackSelector tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + useBLayerHitPrediction default: True + usepTDepTrackSel default: False + nHitBLayer default: 0 + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, + 'useBLayerHitPrediction' : True, + 'nHitBLayer' : 0, + 'usepTDepTrackSel' : False } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from JetTagTools.JetTagToolsConf import Analysis__TrackSelector + return Analysis__TrackSelector(**options) + +#--------------------------------------------------------------------- + +metaIP2DNewLikelihoodTool_Trig = { 'CalibrationTaggers' : ['IP2D',], + 'ToolCollection' : 'IP2DTag_Trig' } + +def toolIP2DNewLikelihoodTool_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a IP2DTrigNewLikelihoodTool tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + taggerName default: "IP2D" + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, + 'HistosKey' : 'TrigJetTagCalibHistosKey', + 'taggerName' : 'IP2D' } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from JetTagTools.JetTagToolsConf import Analysis__NewLikelihoodTool + return Analysis__NewLikelihoodTool(**options) diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_IP3DTag.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_IP3DTag.py index 9a4df7d95f98..7f6e109c628b 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_IP3DTag.py +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_IP3DTag.py @@ -32,11 +32,8 @@ metaIP3DTag = { 'IsATagger' : True, 'InDetTrackSelectionTool' : 'InDetTrackSelector', 'TrackVertexAssociationTool' : 'SpecialTrackAssociator', 'trackGradeFactory' : 'IP3DDetailedTrackGradeFactory', -# 'trackToVertexTool' : 'BTagTrackToVertexTool', 'TrackToVertexIPEstimator' : 'BTagTrackToVertexIPEstimator', 'LikelihoodTool' : 'IP3DNewLikelihoodTool'}, -# 'PassByName' : {'SecVxFinderNameForV0Removal' : 'InDetVKalVxInJetTool', -# 'SecVxFinderNameForIPSign' : 'InDetVKalVxInJetTool'}, 'PassTracksAs' : 'trackAssociationName', 'JetCollectionList' : 'jetCollectionList', 'ToolCollection' : 'IP3DTag' } diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_IP3DTrigTag.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_IP3DTrigTag.py new file mode 100644 index 000000000000..6953e8c374b1 --- /dev/null +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_IP3DTrigTag.py @@ -0,0 +1,229 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + +# Configuration functions for IP3DTrigTag +# Author: Wouter van den Wollenberg (2013-2014) +from BTagging.BTaggingFlags import BTaggingFlags +from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags +from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags +from IOVDbSvc.CondDB import conddb +btagrun1=False +if conddb.dbdata == 'COMP200': + btagrun1=True +elif conddb.isMC: + btagrun1 = (commonGeoFlags.Run() == "RUN1" or (commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isIBL() == False)) + +metaIP3DTag_Trig = { 'IsATagger' : True, + 'xAODBaseName' : 'IP3D', + 'DependsOn' : ['AtlasExtrapolator', + 'BTagTrackToVertexTool', + 'InDetVKalVxInJetTool_Trig', + 'BTagFullLinearizedTrackFactory', + 'BTagTrackToVertexIPEstimator', + 'IP3DNewLikelihoodTool_Trig', + 'IP3DTrackSelector_Trig', + 'InDetTrackSelector', + 'SpecialTrackAssociator', + 'SVForIPTool_IP3D_Trig', + 'IP3DBasicTrackGradeFactory_Trig', + 'IP3DDetailedTrackGradeFactory_Trig'], + 'PassByPointer' : {'SVForIPTool' : 'SVForIPTool_IP3D_Trig', + 'trackSelectorTool' : 'IP3DTrackSelector_Trig', + 'trackGradeFactory' : 'IP3DDetailedTrackGradeFactory_Trig', + 'TrackToVertexIPEstimator' : 'BTagTrackToVertexIPEstimator', + 'InDetTrackSelectionTool' : 'InDetTrackSelector', + 'TrackVertexAssociationTool' : 'SpecialTrackAssociator', + 'LikelihoodTool' : 'IP3DNewLikelihoodTool_Trig'}, + 'PassTracksAs' : 'trackAssociationName', + 'JetCollectionList' : 'jetCollectionList', + 'ToolCollection' : 'IP3DTag_Trig' } + +def toolIP3DTag_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a IP3DTrigTag tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + Runmodus default: BTaggingFlags.Runmodus + referenceType default: BTaggingFlags.ReferenceType + impactParameterView default: "3D" + trackGradePartitions default: [ "Good", "BlaShared", "PixShared", "SctShared", "0HitBLayer" ] + RejectBadTracks default: False + originalTPCollectionName default: BTaggingFlags.TrackParticleCollectionName + jetCollectionList default: BTaggingFlags.Jets + unbiasIPEstimation default: False (switch to true (better!) when creating new PDFs) + UseCHypo default: True + SecVxFinderName default: "SV1" + jetPtMinRef default: BTaggingFlags.JetPtMinRef + + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + grades= [ "0HitIn0HitNInExp2","0HitIn0HitNInExpIn","0HitIn0HitNInExpNIn","0HitIn0HitNIn", + "0HitInExp", "0HitIn", + "0HitNInExp", "0HitNIn", + "InANDNInShared", "PixShared", "SctShared", + "InANDNInSplit", "PixSplit", + "Good"] + if btagrun1: grades=[ "Good", "BlaShared", "PixShared", "SctShared", "0HitBLayer" ] + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, + 'Runmodus' : BTaggingFlags.Runmodus, + 'referenceType' : BTaggingFlags.ReferenceType, + 'impactParameterView' : '3D', + 'trackGradePartitions' : grades, + 'RejectBadTracks' : True, + 'originalTPCollectionName' : BTaggingFlags.TrackParticleCollectionName, + 'jetCollectionList' : BTaggingFlags.Jets, + 'unbiasIPEstimation' : False, + 'UseCHypo' : True, + 'SecVxFinderName' : 'SV1', + 'jetPtMinRef' : BTaggingFlags.JetPtMinRef, + } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from JetTagTools.JetTagToolsConf import Analysis__IPTag + return Analysis__IPTag(**options) + +#--------------------------------------------------------------------- + +metaIP3DDetailedTrackGradeFactory_Trig = { 'ToolCollection' : 'IP3DTag_Trig' } + +def toolIP3DDetailedTrackGradeFactory_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a IP3DTrigDetailedTrackGradeFactory tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + useSharedHitInfo default: True + useDetailSharedHitInfo default: True + hitBLayerGrade default: True + useRun2TrackGrading default: False + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, + 'useSharedHitInfo' : True, + 'useDetailSharedHitInfo' : True, + 'hitBLayerGrade' : True, + 'useRun2TrackGrading' : (btagrun1 == False), + 'useInnerLayers0HitInfo' : (btagrun1 == False), + 'useDetailSplitHitInfo' : (btagrun1 == False), + } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from JetTagTools.JetTagToolsConf import Analysis__DetailedTrackGradeFactory + return Analysis__DetailedTrackGradeFactory(**options) + +#--------------------------------------------------------------------- + +metaIP3DBasicTrackGradeFactory_Trig = { 'ToolCollection' : 'IP3DTag_Trig' } + +def toolIP3DBasicTrackGradeFactory_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a IP3DTrigBasicTrackGradeFactory tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + useSharedHitInfo default: True + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, + 'useSharedHitInfo' : True } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from JetTagTools.JetTagToolsConf import Analysis__BasicTrackGradeFactory + return Analysis__BasicTrackGradeFactory(**options) + +#--------------------------------------------------------------------- + +metaSVForIPTool_IP3D_Trig = { 'ToolCollection' : 'IP3DTag_Trig' } + +def toolSVForIPTool_IP3D_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a SVForIPTool_IP3DTrig tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from JetTagTools.JetTagToolsConf import Analysis__SVForIPTool + return Analysis__SVForIPTool(**options) + +#--------------------------------------------------------------------- + +metaIP3DTrackSelector_Trig = { 'DependsOn' : ['BTagTrackToVertexTool',], + 'PassByPointer' : {'trackToVertexTool' : 'BTagTrackToVertexTool'}, + 'ToolCollection' : 'IP3DTag_Trig' } + +def toolIP3DTrackSelector_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a IP3DTrigTrackSelector tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + useBLayerHitPrediction default: True + usepTDepTrackSel default: False + nHitBLayer default: 0 + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, + 'useBLayerHitPrediction' : True, + 'nHitBLayer' : 0 , + 'usepTDepTrackSel' : False } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from JetTagTools.JetTagToolsConf import Analysis__TrackSelector + return Analysis__TrackSelector(**options) + +#--------------------------------------------------------------------- + +metaIP3DNewLikelihoodTool_Trig = { 'CalibrationTaggers' : ['IP3D',], + 'ToolCollection' : 'IP3DTag_Trig' } + +def toolIP3DNewLikelihoodTool_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a IP3DTrigNewLikelihoodTool tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + taggerName default: "IP3D" + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, + 'HistosKey' : 'TrigJetTagCalibHistosKey', + 'taggerName' : 'IP3D' } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from JetTagTools.JetTagToolsConf import Analysis__NewLikelihoodTool + return Analysis__NewLikelihoodTool(**options) + diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_InDetVKalVxTrigInJetTool.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_InDetVKalVxTrigInJetTool.py new file mode 100644 index 000000000000..273d5616e2db --- /dev/null +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_InDetVKalVxTrigInJetTool.py @@ -0,0 +1,39 @@ +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + +# Configuration functions for InDetVKalVxInJetTool +# Author: Wouter van den Wollenberg (2013-2014) +# Note: This tool has its own file because it is common to many different taggers +# so deletion of the one tagger that has this function won't break the others. +from BTagging.BTaggingFlags import BTaggingFlags +from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags + +metaInDetVKalVxInJetTool_Trig = { 'IsAVertexFinder' : True, + 'VertexFinderxAODBaseName' : 'SV1', + 'OneInTotal' : True, + 'DependsOn' : ['BTagFullLinearizedTrackFactory', + 'BTagTrackToVertexIPEstimator', + 'BTagTrackToVertexTool', + 'AtlasExtrapolator'] } + +def toolInDetVKalVxInJetTool_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a InDetVKalVxInJetTool tool and returns it. + + The following options have BTaggingFlags defaults: + + TrackSummaryTool default: None (not needed for b-tagging) + OutputLevel default: BTaggingFlags.OutputLevel + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output. Note however + that this tool also needs to be added to the main B-tagging tool.""" + if useBTagFlagsDefaults: + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, + 'ExistIBL' : geoFlags.isIBL(), + } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from InDetVKalVxInJetTool.InDetVKalVxInJetToolConf import InDet__InDetVKalVxInJetTool + return InDet__InDetVKalVxInJetTool(**options) diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_LoadTools.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_LoadTools.py index 40e76806d8a2..7258f6fc9bb5 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_LoadTools.py +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_LoadTools.py @@ -45,10 +45,8 @@ def Initiate(ConfInstance=None): # Declare the COOL folder to the CondInputLoader btagrun1=False if conddb.dbdata == 'COMP200': - conddb.addFolder("GLOBAL_ONL", "/GLOBAL/Onl/BTagCalib/RUN12", className='CondAttrListCollection') btagrun1=True elif conddb.isMC: - conddb.addFolder("GLOBAL_OFL", "/GLOBAL/BTagCalib/RUN12", className='CondAttrListCollection') # The Run() parameter only exists for ATLAS-R1(...) and ATLAS-R2(...) geo tags, # not for ATLAS-GEO(...) and ATLAS-IBL(...) ones. Hence if Run() is undefined, # presence of IBL is used to switch between Run1/Run2 @@ -72,11 +70,6 @@ def Initiate(ConfInstance=None): if ConfInstance._name == "Trig": BTaggingFlags.MV2c20=True -# if ConfInstance.getTool("BTagCalibrationBrokerTool"): -# print ConfInstance.BTagTag()+' - INFO - BTagCalibrationBrokerTool already exists prior to default initialization; assuming user set up entire initialization him/herself. Note however that if parts of the initalization were not set up, and a later tool requires them, they will be set up at that point automatically with default settings.' -# ConfInstance._Initialized = True -# return True - print ConfInstance.BTagTag()+' - INFO - Initializing default basic tools' if ConfInstance.checkFlagsUsingBTaggingFlags(): @@ -127,41 +120,7 @@ def Initiate(ConfInstance=None): #Create and add our condition algorithm to the Condition Sequencer - #IP2D - grades= [ "0HitIn0HitNInExp2","0HitIn0HitNInExpIn","0HitIn0HitNInExpNIn","0HitIn0HitNIn", - "0HitInExp", "0HitIn", - "0HitNInExp", "0HitNIn", - "InANDNInShared", "PixShared", "SctShared", - "InANDNInSplit", "PixSplit", - "Good"] - - #IP3D - #Same as IP2D. Revisit JetTagCalibCondAlg.cxx if not. - - from AthenaCommon.GlobalFlags import globalflags - - Taggers = ['IP2D','IP3D','SV1','JetFitterNN','SoftMu', 'MV2c10', 'MV2c100', 'MV2c10mu', 'MV2c10rnn', 'MV2cl100','RNNIP', 'JetVertexCharge', 'MultiSVbb1', 'MultiSVbb2', 'DL1', 'DL1mu', 'DL1rnn'] - connSchema = "GLOBAL_OFL" - if ConfInstance._name == "": - readkeycalibpath = "/GLOBAL/BTagCalib/RUN12" - if globalflags.DataSource()=='data': - readkeycalibpath = readkeycalibpath.replace("/GLOBAL/BTagCalib","/GLOBAL/Onl/BTagCalib") - connSchema = "GLOBAL_ONL" - elif ConfInstance._name == "Trig": - Taggers = BTaggingFlags.TriggerTaggers - readkeycalibpath = "/GLOBAL/TrigBTagCalib/RUN12" - if globalflags.DataSource()=='data': - readkeycalibpath = readkeycalibpath.replace("/GLOBAL/TrigBTagCalib","/GLOBAL/Onl/TrigBTagCalib") - connSchema = "GLOBAL_ONL" - - conddb.addFolder(connSchema, readkeycalibpath, className='CondAttrListCollection') - - from JetTagCalibration.JetTagCalibrationConf import Analysis__JetTagCalibCondAlg as JetTagCalibCondAlg - JetTagCalib = JetTagCalibCondAlg("JetTagCalibCondAlg", ReadKeyCalibPath=readkeycalibpath, taggers = Taggers, channelAliases = BTaggingFlags.CalibrationChannelAliases, IP2D_TrackGradePartitions = grades, RNNIP_NetworkConfig = BTaggingFlags.RNNIPConfig) - #JetTagCalib.OutputLevel=2 - from AthenaCommon.AlgSequence import AthSequencer - condSeq = AthSequencer("AthCondSeq") - condSeq += JetTagCalib + SetupConditionAlgorithm(ConfInstance) # # ========== Add tools now @@ -191,36 +150,6 @@ def Initiate(ConfInstance=None): BTagLeptonTruthTool = None thisBTagLabeling = None - # -- to label jets with truth information - #from JetRec.JetRecFlags import jetFlags - #if jetFlags.useTruth(): - # # Jet Label - # if BTaggingFlags.jetTruthMatching == 'matchQuark' or BTaggingFlags.jetTruthMatching == 'jetTrackTruthMatching': - # BTagJetTruthMatching = addTool("BTagJetTruthMatching", - # ToolSvc = ToolSvc, - # Verbose = BTaggingFlags.OutputLevel < 3, - # options = {'subtype' : BTaggingFlags.jetTruthMatching}, - # SuppressNonCloneWarning=True) - # BTagJetTruthMatching.McEventCollection = TheTruthCollectionKey - # else: - # BTagJetTruthMatching = None - # print("#BTAG# - WARNING - BTaggingFlags.jetTruthMatching has unsupported value!") - # # Lepton Truth Match - # #BTagLeptonTruthTool = addTool('BTagLeptonTruthTool', ToolSvc = ToolSvc, Verbose = BTaggingFlags.OutputLevel < 3) - # #BTagLeptonTruthTool.McEventCollection = TheTruthCollectionKey - # BTagLeptonTruthTool = None # TEMPORARY: BTagLeptonTruthTool not implemented yet? - # # Labeling tool - # thisBTagLabeling = addTool("thisBTagLabeling", ToolSvc = ToolSvc, Verbose = BTaggingFlags.OutputLevel < 3, - # options = {'JetTruthMatchTool' : BTagJetTruthMatching, - # #'LeptonTruthTool' : BTagLeptonTruthTool}, TEMPORARY: BTagLeptonTruthTool not implemented yet? - # }, - # SuppressNonCloneWarning=True) - #else: - # BTagJetTruthMatching = None - # BTagLeptonTruthTool = None - # thisBTagLabeling = None - # NOTE: These variables no longer serve any purpose, since any tool can be retrieved using getTool - # -- for reference mode: if BTaggingFlags.Runmodus == 'reference': @@ -232,6 +161,72 @@ def Initiate(ConfInstance=None): print ConfInstance.BTagTag()+' - WARNING - Tool initialization requested but B-Tagging is not possible for the current dataset.' return False +def SetupConditionAlgorithm(ConfInstance=None): + """General function which can setup condition algorithm + Hack: In trigger mode, the online mode is automatically setup. + In online mode check that the condition algorithm is not already setup""" + + from AthenaCommon.AlgSequence import AthSequencer + condSeq = AthSequencer("AthCondSeq") + if hasattr(condSeq, "JetTagCalibHistosKey"): + if BTaggingFlags.OutputLevel < 3: + print(ConfInstance.BTagTag()+" - DEBUG Default key already defined, another scheme must have been setup before") + return True + + + from IOVDbSvc.CondDB import conddb + if conddb.dbdata == 'COMP200': + conddb.addFolder("GLOBAL_ONL", "/GLOBAL/Onl/BTagCalib/RUN12", className='CondAttrListCollection') + conddb.addFolder("GLOBAL_ONL", "/GLOBAL/Onl/TrigBTagCalib/RUN12", className='CondAttrListCollection') + elif conddb.isMC: + conddb.addFolder("GLOBAL_OFL", "/GLOBAL/BTagCalib/RUN12", className='CondAttrListCollection') + conddb.addFolder("GLOBAL_OFL", "/GLOBAL/TrigBTagCalib/RUN12", className='CondAttrListCollection') + + if ConfInstance.checkFlagsUsingBTaggingFlags(): + #IP2D + grades= [ "0HitIn0HitNInExp2","0HitIn0HitNInExpIn","0HitIn0HitNInExpNIn","0HitIn0HitNIn", + "0HitInExp", "0HitIn", + "0HitNInExp", "0HitNIn", + "InANDNInShared", "PixShared", "SctShared", + "InANDNInSplit", "PixSplit", + "Good"] + + #IP3D + #Same as IP2D. Revisit JetTagCalibCondAlg.cxx if not. + + from AthenaCommon.GlobalFlags import globalflags + + from JetTagCalibration.JetTagCalibrationConf import Analysis__JetTagCalibCondAlg as JetTagCalibCondAlg + readkeycalibpath = "/GLOBAL/BTagCalib/RUN12" + connSchema = "GLOBAL_OFL" + if globalflags.DataSource()=='data': + readkeycalibpath = readkeycalibpath.replace("/GLOBAL/BTagCalib","/GLOBAL/Onl/BTagCalib") + connSchema = "GLOBAL" + Taggers = ['IP2D','IP3D','SV1','JetFitterNN','SoftMu', 'MV2c10', 'MV2c100', 'MV2c10mu', 'MV2c10rnn', 'MV2cl100','RNNIP', 'JetVertexCharge', 'MultiSVbb1', 'MultiSVbb2', 'DL1', 'DL1mu', 'DL1rnn'] + jettagcalibcondalg = "JetTagCalibHistosKey" + histoskey = "JetTagCalibHistosKey" + conddb.addFolder(connSchema, readkeycalibpath, className='CondAttrListCollection') + JetTagCalib = JetTagCalibCondAlg(jettagcalibcondalg, ReadKeyCalibPath=readkeycalibpath, HistosKey = histoskey, taggers = Taggers, channelAliases = BTaggingFlags.CalibrationChannelAliases, IP2D_TrackGradePartitions = grades, RNNIP_NetworkConfig = BTaggingFlags.RNNIPConfig) + condSeq += JetTagCalib + + + if ConfInstance._name == "Trig": + readkeycalibpath = "/GLOBAL/TrigBTagCalib/RUN12" + connSchema = "GLOBAL_OFL" + if globalflags.DataSource()=='data': + connSchema = "GLOBAL" + readkeycalibpath = readkeycalibpath.replace("/GLOBAL/TrigBTagCalib","/GLOBAL/Onl/TrigBTagCalib") + Taggers = BTaggingFlags.TriggerTaggers + jettagcalibcondalg += "_Trig" + histoskey = "TrigJetTagCalibHistosKey" + conddb.addFolder(connSchema, readkeycalibpath, className='CondAttrListCollection') + JetTagCalib = JetTagCalibCondAlg(jettagcalibcondalg, ReadKeyCalibPath=readkeycalibpath, HistosKey = histoskey, taggers = Taggers, channelAliases = BTaggingFlags.CalibrationChannelAliases, IP2D_TrackGradePartitions = grades, RNNIP_NetworkConfig = BTaggingFlags.RNNIPConfig) + #JetTagCalib.OutputLevel=2 + condSeq += JetTagCalib + + return True + + def SetupJetCollection(JetCollection, TaggerList=[], SetupScheme="Default", ConfInstance=None): """General function which can setup up a default B-Tagging configuration. Returns True if successful. Returns False if B-Tagging has been disabled for some reason. Also calls Initiate if needed. The function does nothing (and returns True) if a configuration for a given @@ -664,7 +659,6 @@ def SetupJetCollectionTrig(JetCollection, TaggerList, ConfInstance = None): if ConfInstance is None: from BTagging.BTaggingConfiguration import getConfiguration ConfInstance = getConfiguration() - from AthenaCommon.AppMgr import ToolSvc # -- setup basic b-tagging tool for this jet collection @@ -696,46 +690,50 @@ def SetupJetCollectionTrig(JetCollection, TaggerList, ConfInstance = None): #Now the basic taggers: if 'IP2D' in TaggerList: - ConfInstance.addTool('IP2DTag', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) - if 'IP2DNeg' in TaggerList: - ConfInstance.addTool('IP2DNegTag', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) + ConfInstance.addTool("IP2DTag_Trig", ToolSvc, 'BTagTrackToJetAssociator', JetCollection) + #if 'IP2DNeg' in TaggerList: + #ConfInstance.addTool('IP2DNegTag', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) if 'IP3D' in TaggerList: - ConfInstance.addTool('IP3DTag', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) - if 'IP3DNeg' in TaggerList: - ConfInstance.addTool('IP3DNegTag', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) + ConfInstance.addTool('IP3DTag_Trig', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) + #if 'IP3DNeg' in TaggerList: + # ConfInstance.addTool('IP3DNegTag', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) if 'SV1' in TaggerList: - ConfInstance.addTool('SV1Tag', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) - if 'SV1Flip' in TaggerList: - ConfInstance.addTool('SV1FlipTag', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) - if 'SV0' in TaggerList: - ConfInstance.addTool('SV0Tag', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) - - if 'MultiSVbb1' in TaggerList: - ConfInstance.addTool('MultiSVbb1Tag', ToolSvc, 'BTagTrackToJetAssociatorBB', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) - if 'MultiSVbb2' in TaggerList: - ConfInstance.addTool('MultiSVbb2Tag', ToolSvc, 'BTagTrackToJetAssociatorBB', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) - - if 'JetFitterNN' in TaggerList: - ConfInstance.addTool('JetFitterTagNN', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) - - if 'JetFitterCOMBNN' in TaggerList: - ConfInstance.addTool('JetFitterTagCOMBNN', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) - - if 'JetFitterNNFlip' in TaggerList: - ConfInstance.addTool('JetFitterTagNNFlip', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) - if 'IP3DNeg' in TaggerList: - ConfInstance.addTool('JetFitterTagCOMBNNIP3DNeg', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) - - if 'MV1' in TaggerList: - ConfInstance.addTool('MV1Tag', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) - if 'MV1c' in TaggerList: - ConfInstance.addTool('MV1cTag', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) - if 'MV1cFlip' in TaggerList: - ConfInstance.addTool('MV1cFlipTag', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) - if 'MV1Flip' in TaggerList: - ConfInstance.addTool('MV1FlipTag', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) - if 'JetVertexCharge' in TaggerList: #LC FIXME - ConfInstance.addTool('JetVertexCharge', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) + ConfInstance.addTool('SV1Tag_Trig', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) + ConfInstance.addTool('JetFitterTagNN_Trig', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) + + #if 'JetFitterNN' in TaggerList: + # ConfInstance.addTool('JetFitterTagNN_Trig', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) + #if 'SV1Flip' in TaggerList: + # ConfInstance.addTool('SV1FlipTag', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) + #if 'SV0' in TaggerList: + # ConfInstance.addTool('SV0Tag', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) + + #if 'MultiSVbb1' in TaggerList: + # ConfInstance.addTool('MultiSVbb1Tag', ToolSvc, 'BTagTrackToJetAssociatorBB', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) + #if 'MultiSVbb2' in TaggerList: + # ConfInstance.addTool('MultiSVbb2Tag', ToolSvc, 'BTagTrackToJetAssociatorBB', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) + + #if 'JetFitterNN' in TaggerList: + # ConfInstance.addTool('JetFitterTagNN', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) + + #if 'JetFitterCOMBNN' in TaggerList: + # ConfInstance.addTool('JetFitterTagCOMBNN', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) + + #if 'JetFitterNNFlip' in TaggerList: + # ConfInstance.addTool('JetFitterTagNNFlip', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) + # if 'IP3DNeg' in TaggerList: + # ConfInstance.addTool('JetFitterTagCOMBNNIP3DNeg', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) + + #if 'MV1' in TaggerList: + # ConfInstance.addTool('MV1Tag', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) + #if 'MV1c' in TaggerList: + # ConfInstance.addTool('MV1cTag', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) + #if 'MV1cFlip' in TaggerList: + # ConfInstance.addTool('MV1cFlipTag', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) + #if 'MV1Flip' in TaggerList: + # ConfInstance.addTool('MV1FlipTag', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) + #if 'JetVertexCharge' in TaggerList: #LC FIXME + # ConfInstance.addTool('JetVertexCharge', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) # Activate MultivariateTagManager if any of its taggers are in TaggerList #list of mvtm taggers that are also in TaggerList @@ -744,7 +742,7 @@ def SetupJetCollectionTrig(JetCollection, TaggerList, ConfInstance = None): #set up MVTM if any of its taggers are active if (mvtm_active_taggers): - MVTM = ConfInstance.addTool('MultivariateTagManager', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) + MVTM = ConfInstance.addTool('MultivariateTagManager_Trig', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) if 'RNNIP' in TaggerList: MVTM.arbitraryAuxData = BTaggingFlags.MultivariateTagManagerAuxBranches else: @@ -752,21 +750,21 @@ def SetupJetCollectionTrig(JetCollection, TaggerList, ConfInstance = None): #set up MVTMFlip if (mvtm_active_flip_taggers): - MVTMFlip = ConfInstance.addTool('MultivariateFlipTagManager', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) + MVTMFlip = ConfInstance.addTool('MultivariateFlipTagManager_Trig', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) - if 'TagNtupleDumper' in TaggerList: - tag = ConfInstance.addTool('TagNtupleDumper', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) - MVTM.MVTagToolList.append(tag) + #if 'TagNtupleDumper' in TaggerList: + # tag = ConfInstance.addTool('TagNtupleDumper', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) + # MVTM.MVTagToolList.append(tag) #add all the taggers that use MVTM for mvtm_tagger in mvtm_active_taggers: - tag = ConfInstance.addTool(mvtm_tagger+'Tag', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) + tag = ConfInstance.addTool(mvtm_tagger+'Tag_Trig', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) if tag not in MVTM.MVTagToolList: MVTM.MVTagToolList.append(tag) #add all the flip taggers that use MVTM for mvtm_tagger in mvtm_active_flip_taggers: - tag = ConfInstance.addTool(mvtm_tagger+'Tag', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) + tag = ConfInstance.addTool(mvtm_tagger+'Tag_Trig', ToolSvc, 'BTagTrackToJetAssociator', JetCollection, Verbose = BTaggingFlags.OutputLevel < 3) if tag not in MVTMFlip.MVTagToolList: MVTMFlip.MVTagToolList.append(tag) diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_MV2c10TrigTag.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_MV2c10TrigTag.py new file mode 100644 index 000000000000..b4d2708d442b --- /dev/null +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_MV2c10TrigTag.py @@ -0,0 +1,49 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +# Configuration functions for MV2c10Tag +# Author: Wouter van den Wollenberg (2013-2014) +from BTagging.BTaggingFlags import BTaggingFlags + +metaMV2c10Tag_Trig = { 'IsATagger' : False,#True, + 'xAODBaseName' : 'MV2c10', + 'DependsOn' : ['AtlasExtrapolator', + 'BTagTrackToVertexTool'], + 'CalibrationTaggers' : ['MV2c10',], + 'ToolCollection' : 'MV2c10Tag_Trig'} + +def toolMV2c10Tag_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a MV2c10Tag tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + Runmodus default: BTaggingFlags.Runmodus + taggerName default: "MV2c10" + taggerNameBase default: "MV2c10" + forceMV2CalibrationAlias default: BTaggingFlags.ForceMV2CalibrationAlias + MV2CalibAlias default: BTaggingFlags.MV2CalibAlias + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + from BTagging.MV2defaultValues import default_values + from BTagging.MV2defaultValues import MVTM_varNames + + + if useBTagFlagsDefaults: + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, + 'Runmodus' : BTaggingFlags.Runmodus, + 'taggerName' : 'MV2c10', + 'taggerNameBase' : 'MV2c10', + 'forceMV2CalibrationAlias' : BTaggingFlags.ForceMV2CalibrationAlias, + 'MV2CalibAlias' : BTaggingFlags.MV2CalibAlias, + 'defaultvals' : default_values, + 'MVTMvariableNames' : MVTM_varNames, + 'HistosKey' : 'TrigJetTagCalibHistosKey', + } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from JetTagTools.JetTagToolsConf import Analysis__MV2Tag + return Analysis__MV2Tag(**options) diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_MultivariateTrigTagManager.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_MultivariateTrigTagManager.py new file mode 100644 index 000000000000..c450b5b4d5b0 --- /dev/null +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_MultivariateTrigTagManager.py @@ -0,0 +1,42 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +# Configuration functions for MultivariateTagManager +# Author: Marie Lanfermann (October 2015) +from BTagging.BTaggingFlags import BTaggingFlags + +metaMultivariateTagManager_Trig = { 'IsATagger' : True, + 'DependsOn' : ['AtlasExtrapolator', + 'BTagTrackToVertexTool', + 'IP2DTag_Trig', + 'IP3DTag_Trig', + 'NewJetFitterVxFinder', + 'SV1Tag_Trig'], + 'ToolCollection' : 'MultivariateTagManager_Trig' } + +def toolMultivariateTagManager_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a MultivariateTagManager tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + inputSV0SourceName default: "SV0" + inputSV1SourceName default: "SV1" + inputIP2DSourceName default: "IP2D" + inputIP3DSourceName default: "IP3D" + inputJFSourceName default: "JetFitter" + + input: name: The name of the tool (should be unique). + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, + 'inputSV0SourceName' : 'SV0', + 'inputSV1SourceName' : 'SV1', + 'inputIP2DSourceName' : 'IP2D', + 'inputIP3DSourceName' : 'IP3D', + 'inputJFSourceName' : 'JetFitter', + } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from JetTagTools.JetTagToolsConf import Analysis__MultivariateTagManager + return Analysis__MultivariateTagManager(**options) diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_NewJetFitterTrigCollection.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_NewJetFitterTrigCollection.py new file mode 100644 index 000000000000..c785a0bd656c --- /dev/null +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_NewJetFitterTrigCollection.py @@ -0,0 +1,478 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +# Configuration functions for NewJetFitterTag +# Author: Wouter van den Wollenberg (2013-2014) +# Because there are some many different JetFitter tools floating around +# now, this file was created to contain them all. +from BTagging.BTaggingFlags import BTaggingFlags + + +metaInDetImprovedJetFitterTrackSelectorTool_Trig = { 'DependsOn' : ['JetFitterExtrapolator',], + 'PassByPointer' : {'Extrapolator' : 'JetFitterExtrapolator'}, + 'ToolCollection' : 'JetFitterCollection_Trig' } + +def toolInDetImprovedJetFitterTrackSelectorTool_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a InDetImprovedJetFitterTrackSelectorTool tool and returns it. + + The following options have BTaggingFlags defaults: + + pTMin default: 500.0 + IPd0Max default: 7.0 + IPz0Max default: 10.0 + sigIPd0Max default: 0.35 + sigIPz0Max default: 2.5 + etaMax default: 9999.0 + useTrackSummaryInfo default: True + nHitBLayer default: 0 + nHitPix default: 1 + nHitSct default: 4 + nHitSi default: 7 + nHitTrt default: 0 + useSharedHitInfo default: False + useTrackQualityInfo default: True + fitChi2OnNdfMax default: 3.5 + TrackSummaryTool default: None + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + defaults = { 'pTMin' : 500.0, + 'IPd0Max' : 7.0, + 'IPz0Max' : 10.0, + 'sigIPd0Max' : 0.35, + 'sigIPz0Max' : 2.5, + 'etaMax' : 9999.0, + 'useTrackSummaryInfo' : True, + 'nHitBLayer' : 0, + 'nHitPix' : 1, + 'nHitSct' : 4, + 'nHitSi' : 7, + 'nHitTrt' : 0, + 'useSharedHitInfo' : False, + 'useTrackQualityInfo' : True, + 'fitChi2OnNdfMax' : 3.5, + 'TrackSummaryTool' : None } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetDetailedTrackSelectorTool + return InDet__InDetDetailedTrackSelectorTool(**options) + +#-------------------------------------------------------------------------- + +metaJetFitterFullLinearizedTrackFactory_Trig = {'DependsOn' : ['JetFitterExtrapolator',], + 'PassByPointer' : {'Extrapolator' : 'JetFitterExtrapolator' }, + 'ToolCollection': 'JetFitterCollection_Trig' } + +def toolJetFitterFullLinearizedTrackFactory_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a JetFitterFullLinearizedTrackFactory tool and returns it. + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + Note however that this tool has no BTaggingFlags defaults; the option is + here only for consistency. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + options['name'] = name + from TrkVertexFitterUtils.TrkVertexFitterUtilsConf import Trk__FullLinearizedTrackFactory + return Trk__FullLinearizedTrackFactory(**options) + +#-------------------------------------------------------------------------- + +metaJetFitterMode3dTo1dFinder_Trig = { 'ToolCollection' : 'JetFitterCollection_Trig' } + +def toolJetFitterMode3dTo1dFinder_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a JetFitterMode3dTo1dFinder tool and returns it. + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + Note however that this tool has no BTaggingFlags defaults; the option is + here only for consistency. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + options['name'] = name + from TrkVertexSeedFinderUtils.TrkVertexSeedFinderUtilsConf import Trk__Mode3dTo1dFinder + return Trk__Mode3dTo1dFinder(**options) + +#-------------------------------------------------------------------------- + +metaJetFitterSequentialVertexSmoother_Trig = { 'ToolCollection' : 'JetFitterCollection_Trig' } + +def toolJetFitterSequentialVertexSmoother_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a JetFitterSequentialVertexSmoother tool and returns it. + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + Note however that this tool has no BTaggingFlags defaults; the option is + here only for consistency. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + options['name'] = name + from TrkVertexFitters.TrkVertexFittersConf import Trk__SequentialVertexSmoother + return Trk__SequentialVertexSmoother(**options) + +#-------------------------------------------------------------------------- + +metaVxInternalEdmFactory_Trig = {'DependsOn' : ['JetFitterFullLinearizedTrackFactory_Trig',], + 'PassByPointer' : {'LinearizedTrackFactory' : 'JetFitterFullLinearizedTrackFactory_Trig' }, + 'ToolCollection': 'JetFitterCollection_Trig' } + +def toolVxInternalEdmFactory_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a VxInternalEdmFactory tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from TrkVxEdmCnv.TrkVxEdmCnvConf import Trk__VxCandidateXAODVertex + return Trk__VxCandidateXAODVertex(**options) + +#-------------------------------------------------------------------------- + +metaJetFitterSequentialVertexFitter_Trig = { 'DependsOn' : ['JetFitterSequentialVertexSmoother_Trig', + 'JetFitterFullLinearizedTrackFactory_Trig'] , + 'PassByPointer' : {'VertexSmoother' : 'JetFitterSequentialVertexSmoother', + 'LinearizedTrackFactory' : 'JetFitterFullLinearizedTrackFactory_Trig'}, + + 'ToolCollection' : 'JetFitterCollection_Trig' } + +def toolJetFitterSequentialVertexFitter_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a JetFitterSequentialVertexFitter tool and returns it. + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + Note however that this tool has no BTaggingFlags defaults; the option is + here only for consistency. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + options['name'] = name + from TrkVertexFitters.TrkVertexFittersConf import Trk__SequentialVertexFitter + return Trk__SequentialVertexFitter(**options) + +#-------------------------------------------------------------------------- + +metaImprovedJetFitterInitializationHelper_Trig = { 'DependsOn' : ['JetFitterFullLinearizedTrackFactory_Trig',], + 'PassByPointer' : {'LinearizedTrackFactory' : 'JetFitterFullLinearizedTrackFactory_Trig' }, + 'ToolCollection' : 'JetFitterCollection_Trig' } + +def toolImprovedJetFitterInitializationHelper_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a ImprovedJetFitterInitializationHelper tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from TrkJetVxFitter.TrkJetVxFitterConf import Trk__JetFitterInitializationHelper + return Trk__JetFitterInitializationHelper(**options) + +#-------------------------------------------------------------------------- + +metaTrkDistanceFinderNeutralNeutral_Trig = { 'ToolCollection' : 'JetFitterCollection_Trig' } + +def toolTrkDistanceFinderNeutralNeutral_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a TrkDistanceFinderNeutralNeutral tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from TrkJetVxFitter.TrkJetVxFitterConf import Trk__TrkDistanceFinderNeutralNeutral + return Trk__TrkDistanceFinderNeutralNeutral(**options) + +#-------------------------------------------------------------------------- + +metaTrkDistanceFinderNeutralCharged_Trig = { 'ToolCollection' : 'JetFitterCollection_Trig' } + +def toolTrkDistanceFinderNeutralCharged_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a TrkDistanceFinderNeutralCharged tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from TrkJetVxFitter.TrkJetVxFitterConf import Trk__TrkDistanceFinderNeutralCharged + return Trk__TrkDistanceFinderNeutralCharged(**options) + +#-------------------------------------------------------------------------- + +metaImprovedJetFitterRoutines_Trig = { 'DependsOn' : ['ImprovedJetFitterInitializationHelper_Trig', + 'TrkDistanceFinderNeutralNeutral_Trig', + 'TrkDistanceFinderNeutralCharged_Trig'], + 'PassByPointer' : {'JetFitterInitializationHelper' : 'ImprovedJetFitterInitializationHelper_Trig', + 'JetFitterMinimumDistanceFinderNeutral' : 'TrkDistanceFinderNeutralNeutral_Trig', + 'JetFitterMinimumDistanceFinder' : 'TrkDistanceFinderNeutralCharged_Trig' }, + 'ToolCollection' : 'JetFitterCollection_Trig' } + +def toolImprovedJetFitterRoutines_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a ImprovedJetFitterRoutines tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + BeFast default: False + maxDRshift default: 0.0 + noPrimaryVertexRefit default: False + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, + 'BeFast' : False, + 'maxDRshift' : 0.0, + 'noPrimaryVertexRefit' : False } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from TrkJetVxFitter.TrkJetVxFitterConf import Trk__JetFitterRoutines + return Trk__JetFitterRoutines(**options) + +#-------------------------------------------------------------------------- + +metaInDetJetFitterUtils_Trig = { 'DependsOn' : ['JetFitterFullLinearizedTrackFactory_Trig', + 'JetFitterExtrapolator'], + 'PassByPointer' : {'LinearizedTrackFactory' : 'JetFitterFullLinearizedTrackFactory_Trig', + 'Extrapolator' : 'JetFitterExtrapolator' }, + 'ToolCollection' : 'JetFitterCollection_Trig' } + +def toolInDetJetFitterUtils_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a InDetJetFitterUtils tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from InDetSecVxFinderTool.InDetSecVxFinderToolConf import InDet__InDetJetFitterUtils + return InDet__InDetJetFitterUtils(**options) + +#-------------------------------------------------------------------------- + +metaNewJetFitterVxFinder_Trig = { 'IsAVertexFinder' : True, + 'VertexFinderxAODBaseName' : 'JetFitter', + 'VertexFinderPassByPointer': {'JetFitterVariableFactory' : 'JetFitterVariablesFactory_Trig' }, + 'DependsOn' : ['BTagTrackToVertexTool', + 'InDetJetFitterUtils_Trig', + 'ImprovedJetFitterRoutines_Trig', + 'TrkDistanceFinderNeutralCharged_Trig', + 'TrkDistanceFinderNeutralNeutral_Trig', + 'ImprovedJetFitterInitializationHelper_Trig', + 'JetFitterSequentialVertexFitter_Trig', + 'JetFitterSequentialVertexSmoother_Trig', + 'JetFitterMode3dTo1dFinder_Trig', + 'InDetImprovedJetFitterTrackSelectorTool_Trig', + 'JetFitterExtrapolator', + 'JetFitterFullLinearizedTrackFactory_Trig', + 'JetFitterVariablesFactory_Trig', + 'VxInternalEdmFactory_Trig'], + 'PassByPointer' : { 'Mode3dFinder' : 'JetFitterMode3dTo1dFinder_Trig', + 'JetFitterInitializationHelper' : 'ImprovedJetFitterInitializationHelper_Trig', + 'TrackSelector' : 'InDetImprovedJetFitterTrackSelectorTool_Trig', + 'InDetJetFitterUtils' : 'InDetJetFitterUtils_Trig', + 'Extrapolator' : 'JetFitterExtrapolator', + 'SequentialVertexFitter' : 'JetFitterSequentialVertexFitter_Trig', + 'JetFitterRoutines' : 'ImprovedJetFitterRoutines_Trig', + 'VertexEdmFactory' : 'VxInternalEdmFactory_Trig' }, + 'ToolCollection' : 'JetFitterCollection_Trig' } + +def toolNewJetFitterVxFinder_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a NewJetFitterVxFinder tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + VxPrimaryContainer default: BTaggingFlags.PrimaryVertexCollectionName + MaxNumDeleteIterations default: 30 + VertexProbCut default: 0.001 + MaxClusteringIterations default: 30 + VertexClusteringProbabilityCut default: 0.005 + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + if not 'InDetKeys' in dir(): + from InDetRecExample.InDetKeys import InDetKeys + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, + 'VxPrimaryContainer' : BTaggingFlags.PrimaryVertexCollectionName, + 'MaxNumDeleteIterations' : 30, + 'VertexProbCut' : 0.001, + 'MaxClusteringIterations' : 30, + 'VertexClusteringProbabilityCut' : 0.005 } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from InDetSecVxFinderTool.InDetSecVxFinderToolConf import InDet__InDetImprovedJetFitterVxFinder + return InDet__InDetImprovedJetFitterVxFinder(**options) + +#-------------------------------------------------------------------------- + +metaJetFitterVariablesFactory_Trig = { #'PassByName' : {'JetFitterInstance' : 'JetFitterTag', + # 'secVxFinderName' : 'JetFitterVxFinder' }, + 'ToolCollection' : 'JetFitterCollection_Trig' } + +def toolJetFitterVariablesFactory_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a NewJetFitterVariablesFactory tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + JetFitterInstance default: "JetFitterTag" + secVxFinderName default: "JetFitterVxFinder" + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, + 'JetFitterInstance' : 'JetFitterTag', + 'secVxFinderName' : 'JetFitterVxFinder' } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from JetTagTools.JetTagToolsConf import Analysis__JetFitterVariablesFactory + return Analysis__JetFitterVariablesFactory(**options) + +#------------------------------------------------------------------------- + +metaJetFitterNNTool_Trig = { 'CalibrationTaggers' : ['JetFitter',], + 'DependsOn' : ['NeuralNetworkToHistoToolNN'], + 'PassByPointer' : {'NeuralNetworkToHistoTool' : 'NeuralNetworkToHistoToolNN'}, + 'ToolCollection' : 'JetFitterCollection_Trig' } + +def _slim_jf_options(options): + new_opts = {} + removed = set( + ['CalibrationDirectory', 'CalibrationSubDirectory', + 'NeuralNetworkToHistoTool']) + kept = set(options) - removed + for optname in kept: + new_opts[optname] = options[optname] + return new_opts + +def toolJetFitterNNTool_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a JetFitterNNTool tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + CalibrationDirectory default: "JetFitter" + CalibrationSubDirectory default: "NeuralNetwork" + useCombinedIPNN default: False + usePtCorrectedMass default: True + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, + 'useCombinedIPNN' : False, + 'CalibrationDirectory' : 'JetFitter', + 'CalibrationSubDirectory' : 'NeuralNetwork', + 'usePtCorrectedMass' : True, } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from JetTagTools.JetTagToolsConf import Analysis__JetFitterNNTool + from JetTagTools.JetTagToolsConf import Analysis__JetFitterInputWriter + if BTaggingFlags.RunJetFitterNNTool: + return Analysis__JetFitterNNTool(**options) + else: + return Analysis__JetFitterInputWriter(**_slim_jf_options(options)) + +#------------------------------------------------------------------------- + +metaJetFitterTagNN_Trig = { 'IsATagger' : True, + 'xAODBaseName' : 'JetFitter', + 'DependsOn' : ['AtlasExtrapolator', + 'BTagTrackToVertexTool', + 'NewJetFitterVxFinder', + 'JetFitterNNTool', + 'NeuralNetworkToHistoToolNN', + 'JetFitterNtupleWriterNN'], + 'PassByPointer' : { 'jetfitterClassifier' : 'JetFitterNNTool', + 'jetfitterNtupleWriter' : 'JetFitterNtupleWriterNN' }, + 'JetCollectionList' : 'jetCollectionList', + 'ToolCollection' : 'JetFitterCollection_Trig' } + +def toolJetFitterTagNN_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a JetFitterTagNN tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + Runmodus default: BTaggingFlags.Runmodus + jetCollectionList default: BTaggingFlags.Jets + SecVxFinderName default: "JetFitter" + useForcedCalibration default: False + ipinfoTaggerName default: "" + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, + 'Runmodus' : BTaggingFlags.Runmodus, + 'jetCollectionList' : BTaggingFlags.Jets, + 'SecVxFinderName' : 'JetFitter', + 'useForcedCalibration' : False, + 'ipinfoTaggerName' : "", + } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from JetTagTools.JetTagToolsConf import Analysis__JetFitterTag + return Analysis__JetFitterTag(**options) + +#------------------------------------------------------------------------- diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_SV1TrigTag.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_SV1TrigTag.py new file mode 100644 index 000000000000..0f9d6ccb5220 --- /dev/null +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfiguration_SV1TrigTag.py @@ -0,0 +1,76 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +# Configuration functions for SV1Tag_Trig +# Author: Wouter van den Wollenberg (2013-2014) +from BTagging.BTaggingFlags import BTaggingFlags + +metaSV1Tag_Trig = { 'IsATagger' : True, + 'xAODBaseName' : 'SV1', + 'DependsOn' : ['AtlasExtrapolator', + 'BTagTrackToVertexTool', + 'InDetVKalVxInJetTool_Trig', + 'SV1NewLikelihoodTool_Trig'], + 'PassByPointer' : {'LikelihoodTool' : 'SV1NewLikelihoodTool_Trig'}, + 'JetCollectionList' : 'jetCollectionList', + 'ToolCollection' : 'SV1Tag_Trig' } + +def toolSV1Tag_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a SV1Tag_Trig tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + Runmodus default: BTaggingFlags.Runmodus + referenceType default: BTaggingFlags.ReferenceType + SVAlgType default: "SV1" + jetCollectionList default: BTaggingFlags.Jets + SecVxFinderName default: "SV1" + LikelihoodTool default: None + UseCHypo default: True + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, + 'Runmodus' : BTaggingFlags.Runmodus, + 'referenceType' : BTaggingFlags.ReferenceType, + 'SVAlgType' : 'SV1', + 'jetCollectionList' : BTaggingFlags.Jets, + 'SecVxFinderName' : 'SV1', + 'LikelihoodTool' : None, + 'UseCHypo' : True, + } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from JetTagTools.JetTagToolsConf import Analysis__SVTag + return Analysis__SVTag(**options) + +#--------------------------------------------------------------------- + +metaSV1NewLikelihoodTool_Trig = { 'CalibrationTaggers' : ['SV1',], + 'ToolCollection' : 'SV1Tag_Trig' } + +def toolSV1NewLikelihoodTool_Trig(name, useBTagFlagsDefaults = True, **options): + """Sets up a SV1NewLikelihoodTool_Trig tool and returns it. + + The following options have BTaggingFlags defaults: + + OutputLevel default: BTaggingFlags.OutputLevel + taggerName default: "SV1" + + input: name: The name of the tool (should be unique). + useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. + **options: Python dictionary with options for the tool. + output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" + if useBTagFlagsDefaults: + defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, + 'HistosKey' : 'TrigJetTagCalibHistosKey', + 'taggerName' : 'SV1' } + for option in defaults: + options.setdefault(option, defaults[option]) + options['name'] = name + from JetTagTools.JetTagToolsConf import Analysis__NewLikelihoodTool + return Analysis__NewLikelihoodTool(**options) -- GitLab