Skip to content
Snippets Groups Projects
Commit 8cc4f9ca authored by Edward Moyse's avatar Edward Moyse
Browse files

Merge branch 'master_btaggingLink_as_a_property' into 'master'

Master btagging link as a property

See merge request atlas/athena!27191
parents 8dfd5047 4c69bb20
No related branches found
No related tags found
No related merge requests found
......@@ -881,7 +881,7 @@ namespace InDet
if (myCandidate->chiSquared()<0 ||
myCandidate->numberDoF()<0)
{
msg(MSG::WARNING) << " Fit for V0 candidate failed: chi2 or ndf negative. Deleting candidate..." << endmsg;
msg(MSG::DEBUG) << " Fit for V0 candidate failed: chi2 or ndf negative. Deleting candidate..." << endmsg;
delete myCandidate;
myCandidate=0;
continue;
......
......@@ -48,6 +48,7 @@ class JetBTaggerAlg:
SG::WriteHandleKey<xAOD::BTaggingContainer> m_BTaggingCollectionName {this, "BTaggingCollectionName", "", "Output BTagging container"};
std::string m_JetName;
std::string m_BTagLink;
ToolHandle< IBTagTool > m_bTagTool;
ToolHandle< IBTagTrackAssociation > m_BTagTrackAssocTool;
......
......@@ -52,9 +52,12 @@ def registerOutputContainersForJetCollection(flags, JetCollection, suffix = ''):
input: JetCollection: The name of the jet collection."""
ItemList = []
# btaggingLink
ItemList.append('xAOD::JetContainer#'+JetCollection+'Jets.btaggingLink' + suffix)
ItemList.append('xAOD::JetAuxContainer#'+JetCollection+'JetsAux.btaggingLink'+ suffix)
OutputFilesSVname = "SecVtx"
OutputFilesJFVxname = "JFVtx"
OutputFilesBaseName = "xAOD::BTaggingContainer#"
OutputFilesBaseAuxName = "xAOD::BTaggingAuxContainer#"
OutputFilesBaseNameSecVtx = "xAOD::VertexContainer#"
......@@ -62,6 +65,9 @@ def registerOutputContainersForJetCollection(flags, JetCollection, suffix = ''):
OutputFilesBaseNameJFSecVtx = "xAOD::BTagVertexContainer#"
OutputFilesBaseAuxNameJFSecVtx= "xAOD::BTagVertexAuxContainer#"
if suffix:
suffix = '_' + suffix
author = flags.BTagging.OutputFiles.Prefix + JetCollection + suffix
ItemList.append(OutputFilesBaseName + author)
ItemList.append(OutputFilesBaseAuxName + author + 'Aux.-BTagTrackToJetAssociatorBB')
......@@ -95,14 +101,6 @@ def BTagRedoESDCfg(flags, jet):
def BTagESDtoESDCfg(flags, jet, new):
acc=ComponentAccumulator()
#Rename the element link of the BTagging container from the Jet container
from SGComps.SGCompsConf import AddressRemappingSvc, ProxyProviderSvc
AddressRemappingSvc = AddressRemappingSvc("AddressRemappingSvc")
# The new btaggingLink will point to the time-stamped BTagging container
AddressRemappingSvc.TypeKeyRenameMaps += ['xAOD::JetAuxContainer#AntiKt4EMTopoJets.btaggingLink->AntiKt4EMTopoJets.btaggingLink_old']
acc.addService(AddressRemappingSvc)
acc.addService(ProxyProviderSvc(ProviderNames = [ "AddressRemappingSvc" ]))
#Register input ESD container in output
ESDItemList = registerOutputContainersForJetCollection(flags, jet)
......@@ -162,8 +160,9 @@ def BTagCfg(inputFlags,**kwargs):
for jet in JetCollection:
if timestamp:
#Time-stamped BTagging container (21.2)
result.merge(BTagESDtoESDCfg(inputFlags, jet, timestamp))
kwargs.setdefault('TimeStamp', timestamp)
for ts in timestamp:
result.merge(BTagESDtoESDCfg(inputFlags, jet, ts))
kwargs['TimeStamp'] = timestamp
else:
result.merge(BTagRedoESDCfg(inputFlags, jet))
......@@ -218,7 +217,7 @@ if __name__=="__main__":
kwargs = {}
if args.release == "21.2":
kwargs["TimeStamp"] = "_201810"
kwargs["TimeStamp"] = ['201810','201903']
acc.merge(BTagCfg(cfgFlags, **kwargs))
acc.setAppProperty("EvtMax",-1)
......
......@@ -9,7 +9,7 @@ from BTagging.MSVVariablesFactoryConfig import MSVVariablesFactoryCfg
from BTagging.BTaggingConf import Analysis__BTagSecVertexing
def BTagSecVtxToolCfg(flags, name, JetCollection, outputObjs = None, **options):
def BTagSecVtxToolCfg(flags, Name, JetCollection, TimeStamp = "", **options):
"""Adds a SecVtxTool instance and registers it.
input: name: The tool's name.
......@@ -26,6 +26,8 @@ def BTagSecVtxToolCfg(flags, name, JetCollection, outputObjs = None, **options):
secVtxFinderList = []
secVtxFinderTrackNameList = []
secVtxFinderxAODBaseNameList = []
if TimeStamp:
TimeStamp = '_' + TimeStamp
newJetFitterVxFinder = acc.popToolsAndMerge(NewJetFitterVxFinderCfg(flags, 'JFVxFinder'))
secVtxFinderList.append(newJetFitterVxFinder)
......@@ -46,10 +48,7 @@ def BTagSecVtxToolCfg(flags, name, JetCollection, outputObjs = None, **options):
varFactory = acc.popToolsAndMerge(MSVVariablesFactoryCfg("MSVVarFactory"))
btagname = flags.BTagging.OutputFiles.Prefix + jetcol
timestamp = options.get('TimeStamp', None)
if timestamp:
btagname += timestamp
btagname = flags.BTagging.OutputFiles.Prefix + jetcol + TimeStamp
options = {}
options.setdefault('SecVtxFinderList', secVtxFinderList)
......@@ -57,14 +56,12 @@ def BTagSecVtxToolCfg(flags, name, JetCollection, outputObjs = None, **options):
options.setdefault('SecVtxFinderxAODBaseNameList', secVtxFinderxAODBaseNameList)
options.setdefault('PrimaryVertexName',BTaggingFlags.PrimaryVertexCollectionName)
options.setdefault('vxPrimaryCollectionName',BTaggingFlags.PrimaryVertexCollectionName)
options.setdefault('BTagJFVtxCollectionName', btagname + OutputFilesJFVxname)
options.setdefault('BTagSVCollectionName', btagname + OutputFilesSVname)
options['BTagJFVtxCollectionName'] = btagname + OutputFilesJFVxname
options['BTagSVCollectionName'] = btagname + OutputFilesSVname
options.setdefault('JetFitterVariableFactory', jetFitterVF)
options.setdefault('MSVVariableFactory', varFactory)
options['name'] = name
if outputObjs:
outputObjs['xAOD::VertexContainer'] = options['BTagSVCollectionName']
outputObjs['xAOD::BTagVertexContainer'] = options['BTagJFVtxCollectionName']
options['name'] = Name+TimeStamp
tool = Analysis__BTagSecVertexing(**options)
acc.setPrivateTools(tool)
......
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from BTagging.BTaggingFlags import BTaggingFlags
from BTagging.BTagSecVertexingConfig import BTagSecVtxToolCfg
from BTagging.BTagTrackAssociationConfig import BTagTrackAssociationCfg
from BTagging.BTagToolConfig import BTagToolCfg
# import the JetBTaggerAlg configurable
from BTagging.BTaggingConf import Analysis__JetBTaggerAlg as JetBTaggerAlg
......@@ -11,34 +13,32 @@ def JetBTaggerAlgCfg(ConfigFlags, JetCollection="", TaggerList=[], SetupScheme="
acc=ComponentAccumulator()
jetcol = JetCollection
objs = {}
#options = dict(options)
options.setdefault('OutputLevel', BTaggingFlags.OutputLevel)
# setup the Analysis__BTagTrackAssociation tool
from BTagging.BTagTrackAssociationConfig import BTagTrackAssociationCfg
options.setdefault('BTagTrackAssocTool', acc.popToolsAndMerge(BTagTrackAssociationCfg(ConfigFlags, 'TrackAssociation'+ ConfigFlags.BTagging.GeneralToolSuffix, jetcol, TaggerList )))
# setup the secondary vertexing tool
from BTagging.BTagSecVertexingConfig import BTagSecVtxToolCfg
options.setdefault('BTagSecVertexing', acc.popToolsAndMerge(BTagSecVtxToolCfg(ConfigFlags, 'SecVx'+ConfigFlags.BTagging.GeneralToolSuffix, jetcol, outputObjs = objs, **options)))
from BTagging.BTagToolConfig import BTagToolCfg
options.setdefault('BTagTool', acc.popToolsAndMerge(BTagToolCfg(ConfigFlags, jetcol, TaggerList)))
btagname = ConfigFlags.BTagging.OutputFiles.Prefix + jetcol
timestamp = options.get('TimeStamp', None)
if timestamp:
btagname += timestamp
if not timestamp:
timestamp = ['']
else:
del options['TimeStamp']
# Set remaining options
options.setdefault('name', (btagname + ConfigFlags.BTagging.GeneralToolSuffix).lower())
options.setdefault('JetCollectionName', jetcol.replace('Track','PV0Track') + "Jets")
options.setdefault('JetCalibrationName', jetcol.replace('Track','PV0Track'))
options.setdefault('BTaggingCollectionName', btagname)
# -- create main BTagging algorithm
acc.addEventAlgo(JetBTaggerAlg(**options))
for ts in timestamp:
# setup the secondary vertexing tool
options['BTagSecVertexing'] = acc.popToolsAndMerge(BTagSecVtxToolCfg(ConfigFlags, 'SecVx'+ConfigFlags.BTagging.GeneralToolSuffix, jetcol, TimeStamp = ts, **options))
btagname = ConfigFlags.BTagging.OutputFiles.Prefix + jetcol
if ts:
btagname += '_'+ts
# Set remaining options
options['name'] = (btagname + ConfigFlags.BTagging.GeneralToolSuffix).lower()
options['JetCollectionName']= jetcol.replace('Track','PV0Track') + "Jets"
options['JetCalibrationName']= jetcol.replace('Track','PV0Track')
options['BTaggingCollectionName'] = btagname
options['BTaggingLink'] = '.btaggingLink'+ts
# -- create main BTagging algorithm
acc.addEventAlgo(JetBTaggerAlg(**options))
return acc
......@@ -25,12 +25,14 @@ namespace Analysis {
JetBTaggerAlg::JetBTaggerAlg(const std::string& n, ISvcLocator *p) :
AthAlgorithm(n,p),
m_JetName(""),
m_BTagLink(".btaggingLink"),
m_bTagTool("Analysis::BTagTool",this),
m_BTagTrackAssocTool("Analysis::BTagTrackAssociation",this),
m_bTagSecVtxTool("Analysis::BTagSecVertexing",this),
m_magFieldSvc("AtlasFieldSvc",n)
{
declareProperty("JetCalibrationName", m_JetName);
declareProperty("BTaggingLink", m_BTagLink);
declareProperty("BTagTool", m_bTagTool);
declareProperty("BTagTrackAssocTool", m_BTagTrackAssocTool);
declareProperty("BTagSecVertexing", m_bTagSecVtxTool);
......@@ -49,7 +51,7 @@ namespace Analysis {
// by job configuration.
ATH_CHECK( m_JetCollectionName.initialize() );
ATH_CHECK( m_BTaggingCollectionName.initialize() );
m_jetBTaggingLinkName = m_JetCollectionName.key()+".btaggingLink";
m_jetBTaggingLinkName = m_JetCollectionName.key() + m_BTagLink;
ATH_CHECK( m_jetBTaggingLinkName.initialize() );
/// retrieve the main BTagTool
......@@ -137,7 +139,6 @@ namespace Analysis {
StatusCode jetIsAssociated;
if (!m_BTagTrackAssocTool.empty()) {
ATH_MSG_VERBOSE("#BTAG# Track association tool is not empty");
//jetIsAssociated = m_BTagTrackAssocTool->BTagTrackAssociation_exec(&jets, h_BTaggingCollectionName.ptr());
jetIsAssociated = m_BTagTrackAssocTool->BTagTrackAssociation_exec(h_JetCollectionName.ptr(), h_BTaggingCollectionName.ptr());
if ( jetIsAssociated.isFailure() ) {
ATH_MSG_ERROR("#BTAG# Failed to associate tracks to jet ");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment