Commit b4a86806 authored by Wouter Van Den Wollenberg's avatar Wouter Van Den Wollenberg Committed by Graeme Stewart
Browse files

Implemented new configuration scheme. Tagged this version as the first with...

Implemented new configuration scheme. Tagged this version as the first with new configuration. (BTagging-00-06-73)

	* Added new configuration scheme.
	* Tagged as BTagging-00-06-73.
parent 3467136b
......@@ -24,6 +24,7 @@ namespace InDet {
#include "xAODJet/Jet.h"
#include "xAODBTagging/BTagging.h"
#include "xAODTracking/VertexContainer.h"
#include "xAODTracking/Vertex.h"
#include "xAODBTagging/BTagVertexContainer.h"
#include "xAODTracking/TrackParticleContainer.h"
......@@ -40,6 +41,7 @@ namespace Trk{
namespace Analysis
{
class IJetFitterVariablesFactory;
class IMSVVariablesFactory;
class BTagSecVertexing : public AthAlgTool, virtual public IBTagSecVertexing
{
......@@ -51,17 +53,16 @@ namespace Analysis
StatusCode initialize();
StatusCode BTagSecVtx_exec(xAOD::Jet& myJet, xAOD::BTagging*, xAOD::VertexContainer*, xAOD::BTagVertexContainer*);
StatusCode finalize();
//StatusCode BTagSecVertexing_exec(Jet& myJet, const Trk::RecVertex& MyprimaryVertex);
private:
StatusCode fillVkalVariables(xAOD::BTagging*, xAOD::VertexContainer*, const Trk::VxSecVKalVertexInfo*, const xAOD::TrackParticleContainer*, std::string);
StatusCode fillVkalVariables(xAOD::Jet&, xAOD::BTagging*, xAOD::VertexContainer*, const Trk::VxSecVKalVertexInfo*, const xAOD::TrackParticleContainer*,const xAOD::Vertex&, std::string);
StatusCode fillJFVariables(xAOD::Jet&, xAOD::BTagging*, xAOD::BTagVertexContainer*, const Trk::VxJetFitterVertexInfo*, const xAOD::TrackParticleContainer*, std::string);
//ToolHandle< InDet::ISecVertexInJetFinder > m_bTagVtx;
ToolHandleArray< InDet::ISecVertexInJetFinder > m_secVertexFinderToolsHandleArray;
ToolHandle<IJetFitterVariablesFactory> m_JFvarFactory;
ToolHandle<IMSVVariablesFactory> m_MSVvarFactory;
std::vector<std::string> m_secVertexFinderTrackNameList;
std::vector<std::string> m_secVertexFinderBaseNameList;
......
......@@ -30,9 +30,9 @@ namespace Analysis
static const InterfaceID& interfaceID() { return IID_IBTagSecVertexing; };
virtual StatusCode initialize() = 0;
virtual StatusCode BTagSecVtx_exec(xAOD::Jet& myJet, xAOD::BTagging*, xAOD::VertexContainer*, xAOD::BTagVertexContainer*) = 0;
virtual StatusCode BTagSecVtx_exec(xAOD::Jet& myJet, xAOD::BTagging*, xAOD::VertexContainer*, xAOD::BTagVertexContainer*) = 0;
virtual StatusCode finalize() = 0;
//virtual StatusCode BTagSecVertexing_exec(Jet& myJet, const Trk::RecVertex& MyprimaryVertex) = 0;
};
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef BTAGGING_IJETBTAGGERTOOL_HH
#define BTAGGING_IJETBTAGGERTOOL_HH
///////////////////////////////////////////
///
/// \class JetBTaggerTool
/// jet modfier tool to run and add btagging information.
////////////////////////////////////////////
#include "GaudiKernel/IAlgTool.h"
#include "xAODJet/Jet.h"
namespace Analysis{
static const InterfaceID IID_IJetBTaggerTool("IJetBTaggerTool", 1, 0);
class IJetBTaggerTool: virtual public IAlgTool {
public:
/** Virtual destructor */
virtual ~IJetBTaggerTool(){};
/** AlgTool interface methods */
static const InterfaceID& interfaceID() { return IID_IJetBTaggerTool; };
virtual StatusCode initialize() = 0;
virtual int modify(xAOD::JetContainer& jets) const = 0;
};
} // End namespace
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef BTAGGING_ISTANDALONEJETBTAGGERTOOL_HH
#define BTAGGING_ISTANDALONEJETBTAGGERTOOL_HH
///////////////////////////////////////////
///
/// \class IStandAloneJetBTaggerTool
/// StandAlone tool to run and add btagging information.
////////////////////////////////////////////
#include "GaudiKernel/IAlgTool.h"
#include "GaudiKernel/ToolHandle.h"
namespace Analysis{
static const InterfaceID IID_IStandAloneJetBTaggerTool("IStandAloneJetBTaggerTool", 1, 0);
class IStandAloneJetBTaggerTool : virtual public IAlgTool
{
public:
/** Virtual destructor */
virtual ~IStandAloneJetBTaggerTool() {};
/** AlgTool interface methods */
static const InterfaceID& interfaceID() { return IID_IStandAloneJetBTaggerTool; };
virtual StatusCode initialize() = 0;
virtual int modify() = 0;
};
}
#endif
......@@ -12,6 +12,7 @@
#include "AsgTools/AsgTool.h"
#include "JetInterface/IJetModifier.h"
#include "BTagging/IJetBTaggerTool.h"
#include "GaudiKernel/ToolHandle.h"
......@@ -24,20 +25,21 @@ class IBTagSecVertexing;
class JetBTaggerTool:
virtual public asg::AsgTool,
virtual public IJetBTaggerTool,
virtual public IJetModifier {
ASG_TOOL_CLASS(JetBTaggerTool, IJetModifier)
ASG_TOOL_CLASS2(JetBTaggerTool, IJetBTaggerTool, IJetModifier)
public:
virtual StatusCode initialize();
JetBTaggerTool(const std::string & n);
//JetBTaggerTool(const std::string&, const IInterface*, const std::string&);
virtual ~JetBTaggerTool();
virtual int modify(xAOD::JetContainer& jets) const;
private:
std::string m_BTagName;
std::string m_BTagSVName;
std::string m_BTagJFVtxName;
......@@ -45,6 +47,7 @@ class JetBTaggerTool:
ToolHandle< IBTagTool > m_bTagTool;
ToolHandle< IBTagTrackAssociation > m_BTagTrackAssocTool;
ToolHandle< IBTagSecVertexing > m_bTagSecVtxTool;
mutable bool m_retag;
};
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef BTAGGING_STANDALONEJETBTAGGERTOOL_HH
#define BTAGGING_STANDALONEJETBTAGGERTOOL_HH
///////////////////////////////////////////
///
/// \class StanAloneJetBTaggerAlg
/// StandAlone tool to run and add btagging information.
////////////////////////////////////////////
#include "AthenaBaseComps/AthAlgorithm.h"
#include "GaudiKernel/ToolHandle.h"
namespace Analysis{
class IJetBTaggerTool;
class StandAloneJetBTaggerAlg:
public AthAlgorithm
{
public:
/** Constructors and destructors */
StandAloneJetBTaggerAlg(const std::string& name, ISvcLocator *pSvcLocator);
virtual ~StandAloneJetBTaggerAlg();
/** Main routines specific to an ATHENA algorithm */
virtual StatusCode initialize();
virtual StatusCode execute();
private:
std::string m_JetCollectionName;
ToolHandle< IJetBTaggerTool > m_JetBTaggerTool;
};
}
#endif
......@@ -18,7 +18,8 @@ private
#use AtlasCLHEP AtlasCLHEP-* External
use GeoPrimitives GeoPrimitives-* DetectorDescription
use xAODBase xAODBase-* Event/xAOD
use xAODBase xAODBase-* Event/xAOD
use xAODCore xAODCore-* Event/xAOD
use xAODTracking xAODTracking-* Event/xAOD
use Particle Particle-* Reconstruction
......@@ -40,7 +41,7 @@ public
macro DOXYGEN_IMAGE_PATH "../doc/images"
#apply_pattern dual_use_library files="*.cxx"
apply_pattern dual_use_library files="BTagTool.cxx BTagTrackAssociation.cxx BTagSecVertexing.cxx JetBTaggerTool.cxx BTagLabeling.cxx"
apply_pattern dual_use_library files="BTagTool.cxx BTagTrackAssociation.cxx BTagSecVertexing.cxx JetBTaggerTool.cxx BTagLabeling.cxx StandAloneJetBTaggerAlg.cxx"
apply_pattern declare_joboptions files="*.py"
apply_pattern declare_python_modules files="*.py"
......
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# Common configuration functions setting up common tools
# These tools are used by virtually all other tools, be careful
# about modifying them
# Author: Wouter van den Wollenberg (2013-2014)
from BTagging.BTaggingFlags import BTaggingFlags
metaBTagCalibrationBrokerTool = { 'OneInTotal' : True }
# (Setting up this tool is handled outside the scope of the configuration, but we still need
# the meta data)
#----------------------------------------------------------------------
metaBTagLeptonTruthTool = { 'OneInTotal' : True }
def toolBTagLeptonTruthTool(name, useBTagFlagsDefaults = True, **options):
"""Sets up a BTagLeptonTruthTool 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 ParticleJetTools.ParticleJetToolsConf import Analysis__FindLeptonTruth
return Analysis__FindLeptonTruth(**options)
#----------------------------------------------------------------------
metathisBTagLabeling = { 'OneInTotal' : True,
#'DependsOn' : ['BTagLeptonTruthTool',
# 'BTagJetTruthMatching'],
'DependsOn' : ['BTagJetTruthMatching',],
'PassByPointer' : {'JetTruthMatchTool' : 'BTagJetTruthMatching',
# 'LeptonTruthTool' : 'BTagLeptonTruthTool'} }
} }
def toolthisBTagLabeling(name, useBTagFlagsDefaults = True, **options):
"""Sets up a TrackToVertexIPEstimator tool and returns it. There are actually two
incarnations of this tool, toolJetQuarkLabel or tooltoolJetTrackTruthMatching depending
on the options. The relevant option is 'subtype'.
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 be added to ToolSvc via ToolSvc += output."""
options['name'] = name
from BTagging.BTaggingConf import Analysis__BTagLabeling
return Analysis__BTagLabeling(**options)
#----------------------------------------------------------------------
metaBTagJetTruthMatching = { 'OneInTotal' : True }
def toolBTagJetTruthMatching(name, useBTagFlagsDefaults = True, **options):
"""Sets up a TrackToVertexIPEstimator tool and returns it. There are actually two
incarnations of this tool, toolJetQuarkLabel or tooltoolJetTrackTruthMatching depending
on the options. The relevant option is 'subtype'.
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 be added to ToolSvc via ToolSvc += output."""
options.setdefault('subtype', 'matchQuark')
if options['subtype'] == 'matchQuark':
del options['subtype']
return toolJetQuarkLabel('BTagJetTruthMatching', useBTagFlagsDefaults = useBTagFlagsDefaults, **options)
elif options['jetTrackTruthMatching']:
del options['subtype']
return toolJetTrackTruthMatching('BTagJetTruthMatching', useBTagFlagsDefaults = useBTagFlagsDefaults, **options)
else:
raise NotImplementedError, 'Unimplemented request for TrackToVertexIPEstimator sub-type: '+options['subtype']
def toolJetQuarkLabel(name, useBTagFlagsDefaults = True, **options):
"""Sets up a JetQuarkLabel 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 be added to ToolSvc via ToolSvc += output."""
options['name'] = name
from ParticleJetTools.ParticleJetToolsConf import Analysis__JetQuarkLabel
return Analysis__JetQuarkLabel(**options)
def toolJetTrackTruthMatching(name, useBTagFlagsDefaults = True, **options):
"""Sets up a JetTrackTruthMatching tool and returns it.
The following options have BTaggingFlags defaults:
TrackParticlesName default: BTaggingFlags.TrackParticleCollectionName
TrackParticleTruthMapName default: BTaggingFlags.TrackParticleTruthCollectionName
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 be added to ToolSvc via ToolSvc += output."""
if useBTagFlagsDefaults:
defaults = { 'TrackParticlesName' : BTaggingFlags.TrackParticleCollectionName,
'TrackParticleTruthMapName' : BTaggingFlags.TrackParticleTruthCollectionName }
for option in defaults:
options.setdefault(option, defaults[option])
options['name'] = name
from ParticleJetTools.ParticleJetToolsConf import Analysis__JetTrackTruthMatching
return Analysis__JetTrackTruthMatching(**options)
#----------------------------------------------------------------------
metaBTagTrackToVertexIPEstimator = { 'OneInTotal' : True,
'DependsOn' : ['AtlasExtrapolator',
'BTagFullLinearizedTrackFactory'],
'PassByPointer' : {'Extrapolator' : 'AtlasExtrapolator',
'LinearizedTrackFactory' : 'BTagFullLinearizedTrackFactory'} }
def toolBTagTrackToVertexIPEstimator(name, useBTagFlagsDefaults = True, **options):
"""Sets up a TrackToVertexIPEstimator 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 be 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 TrkVertexFitterUtils.TrkVertexFitterUtilsConf import Trk__TrackToVertexIPEstimator
return Trk__TrackToVertexIPEstimator(**options)
#----------------------------------------------------------------------
metaAtlasExtrapolator = { 'OneInTotal' : True }
def toolAtlasExtrapolator(name, useBTagFlagsDefaults = True, **options):
"""Sets up a AtlasExtrapolator 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.
(this function does not have any though, just here for consistency).
**options: Python dictionary with options for the tool.
output: The actual tool, which can then be added to ToolSvc via ToolSvc += output."""
if useBTagFlagsDefaults:
defaults = {}
for option in defaults:
options.setdefault(option, defaults[option])
options['name'] = name
from TrkExTools.AtlasExtrapolator import AtlasExtrapolator
return AtlasExtrapolator(**options)
#----------------------------------------------------------------------
metaBTagTrackToVertexTool = { 'OneInTotal' : True,
'DependsOn' : ['AtlasExtrapolator',],
'PassByPointer' : {'Extrapolator' : 'AtlasExtrapolator'} }
def toolBTagTrackToVertexTool(name, useBTagFlagsDefaults = True, **options):
"""Sets up a BTagTrackToVertexTool 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 be added to ToolSvc via ToolSvc += output."""
options['name'] = name
from TrackToVertex.TrackToVertexConf import Reco__TrackToVertex
return Reco__TrackToVertex(**options)
#----------------------------------------------------------------------
metaBTagFullLinearizedTrackFactory = { 'OneInTotal' : True,
'DependsOn' : ['AtlasExtrapolator',],
'PassByPointer' : {'Extrapolator' : 'AtlasExtrapolator'} }
def toolBTagFullLinearizedTrackFactory(name, useBTagFlagsDefaults = True, **options):
"""Sets up a BTagFullLinearizedTrackFactory 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 be added to ToolSvc via ToolSvc += output."""
options['name'] = name
from TrkVertexFitterUtils.TrkVertexFitterUtilsConf import Trk__FullLinearizedTrackFactory
return Trk__FullLinearizedTrackFactory(**options)
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# Configuration functions for GbbNNTag
# Author: Wouter van den Wollenberg (2013-2014)
from BTagging.BTaggingFlags import BTaggingFlags
metaGbbNNTag = { 'IsATagger' : True,
'DependsOn' : ['AtlasExtrapolator',
'BTagTrackToVertexTool',
'GbbNNTagTrackSelector'],
'PassByPointer' : {'trackSelectorTool' : 'GbbNNTagTrackSelector'},
'PassTracksAs' : 'trackAssociation',
'TypeCollection' : 'GbbNNTag' }
def toolGbbNNTag(name, useBTagFlagsDefaults = True, **options):
"""Sets up a GbbNNTag tool and returns it.
The following options have BTaggingFlags defaults:
OutputLevel default: BTaggingFlags.OutputLevel
Runmodus default: BTaggingFlags.Runmodus
NNweightsFileName default: "GbbNNweightsFile.txt"
trackAssociation default: "Tracks"
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,
'NNweightsFileName' : 'GbbNNweightsFile.txt',
'trackAssociation' : "Tracks" }
for option in defaults:
options.setdefault(option, defaults[option])
options['name'] = name
from JetTagTools.JetTagToolsConf import Analysis__GbbNNTag
return Analysis__GbbNNTag(**options)
#-------------------------------------------------------------------
metaGbbNNTagTrackSelector = { 'DependsOn' : ['BTagTrackToVertexTool',],
'PassByPointer' : {'trackToVertexTool' : 'BTagTrackToVertexTool'},
'TypeCollection' : 'GbbNNTag' }
def toolGbbNNTagTrackSelector(name, useBTagFlagsDefaults = True, **options):
"""Sets up a GbbNNTagTrackSelector 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__TrackSelector
return Analysis__TrackSelector(**options)
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# Configuration functions for IP1DTag
# Author: Wouter van den Wollenberg (2013-2014)
from BTagging.BTaggingFlags import BTaggingFlags
metaIP1DTag = { 'IsATagger' : True,
'DependsOn' : ['AtlasExtrapolator',
'BTagTrackToVertexTool',
'IP1DNewLikelihoodTool',
'IP1DTrackSelector',
'SVForIPTool_IP1D',
'IP1DBasicTrackGradeFactory',
'InDetVKalVxInJetTool',
'BTagTrackToVertexIPEstimator',
'BTagFullLinearizedTrackFactory'],
'PassByPointer' : {'SVForIPTool' : 'SVForIPTool_IP1D',
'trackSelectorTool' : 'IP1DTrackSelector',
'trackGradeFactory' : 'IP1DBasicTrackGradeFactory',
'trackToVertexTool' : 'BTagTrackToVertexTool',
'TrackToVertexIPEstimator' : 'BTagTrackToVertexIPEstimator',
'LikelihoodTool' : 'IP1DNewLikelihoodTool'},
'PassByName' : {'SecVxFinderNameForV0Removal' : 'InDetVKalVxInJetTool',
'SecVxFinderNameForIPSign' : 'InDetVKalVxInJetTool'},
'PassTracksAs' : 'trackAssociation',
'JetCollectionList' : 'jetCollectionList',
'JetWithInfoPlus' : 'jetWithInfoPlus',
'ToolCollection' : 'IP1DTag' }
def toolIP1DTag(name, useBTagFlagsDefaults = True, **options):
"""Sets up a IP1DTag tool and returns it.
The following options have BTaggingFlags defaults:
OutputLevel default: BTaggingFlags.OutputLevel
Runmodus default: BTaggingFlags.Runmodus
referenceType default: BTaggingFlags.ReferenceType
impactParameterView default: "1D"
trackGradePartitions default: [ "Good", "Shared" ]
RejectBadTracks default: False
originalTPCollectionName default: BTaggingFlags.TrackParticleCollectionName
jetCollectionList default: BTaggingFlags.Jets
jetWithInfoPlus default: BTaggingFlags.JetsWithInfoPlus
SecVxFinderNameForV0Removal default: "InDetVKalVxInJetTool"
SecVxFinderNameForIPSign default: "InDetVKalVxInJetTool"
unbiasIPEstimation default: False (switch to true (better!) when creating new PDFs)
trackAssociation default: "Tracks"
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,
'impactParameterView' : '1D',
'trackGradePartitions' : [ "Good", "Shared" ],
'RejectBadTracks' : False,
'originalTPCollectionName' : BTaggingFlags.TrackParticleCollectionName,
'jetCollectionList' : BTaggingFlags.Jets,
'jetWithInfoPlus' : BTaggingFlags.JetsWithInfoPlus,
'SecVxFinderNameForV0Removal' : "InDetVKalVxInJetTool",
'SecVxFinderNameForIPSign' : "InDetVKalVxInJetTool",
'unbiasIPEstimation' : False,
'trackAssociation' : "Tracks" }
for option in defaults:
options.setdefault(option, defaults[option])
options['name'] = name
from JetTagTools.JetTagToolsConf import Analysis__IPTag
return Analysis__IPTag(**options)