Commit b73c8cf3 authored by Oana Vickey Boeriu's avatar Oana Vickey Boeriu
Browse files

Merge branch 'dexter-topq1' into '21.2'

Add DeXTer to TOPQ1

See merge request atlas/athena!37295
parents 11a7960f 7f0cce7a
......@@ -690,3 +690,18 @@ def addExKtDoubleTaggerRCJets(sequence, ToolSvc):
BTaggingFlags.CalibrationChannelAliases += [ jetname[:-4].replace("PV0", "")+"->AntiKt4EMTopo" for jetname in ExKtJetCollection__SubJet ]
sequence += CfgMgr.xAODMaker__ElementLinkResetAlg("ELReset_AfterBtag", SGKeys=[name+"Aux." for name in ExKtJetCollection__SubJet])
def addExKtDoubleTaggerScore(sequence,
ToolSvc,
sec_vtx_collection = 'SoftBVrtClusterTool_MSVTight_Vertices',
nn_file_name = '/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/BTagging/DeepsetXbbTagger/202010/nn-config.json',
nn_config_file = 'BoostedJetTaggers/DeepsetXbbTagger/test_config.json'):
dexter_tagger_name = 'DexterTool'
if not hasattr(ToolSvc, dexter_tagger_name):
dexterTagger = CfgMgr.DexterTool(
dexter_tagger_name,
KerasConfigFile = nn_file_name,
ConfigFile = nn_config_file,
secvtxCollection = sec_vtx_collection)
ToolSvc += dexterTagger
......@@ -18,6 +18,7 @@ atlas_depends_on_subdirs(
Control/AthenaKernel
PhysicsAnalysis/CommonTools/ExpressionEvaluation
PhysicsAnalysis/JetTagging/FlavorTagDiscriminants
Reconstruction/Jet/BoostedJetTaggers
Event/xAOD/xAODJet
Event/xAOD/xAODEventInfo
Event/xAOD/xAODBTagging
......@@ -30,6 +31,7 @@ atlas_add_library( DerivationFrameworkTopLib
LINK_LIBRARIES AthenaBaseComps xAODTruth GaudiKernel
DerivationFrameworkInterfacesLib
FlavorTagDiscriminants
BoostedJetTaggersLib
PRIVATE_LINK_LIBRARIES AthenaKernel ExpressionEvaluationLib xAODJet
xAODEventInfo xAODBTagging xAODTracking )
......
......@@ -16,6 +16,7 @@
#include "AthContainers/AuxElement.h"
#include "GaudiKernel/ToolHandle.h"
#include "DerivationFrameworkInterfaces/IAugmentationTool.h"
#include "BoostedJetTaggers/DeepsetXbbTagger.h"
namespace DerivationFramework {
......@@ -40,6 +41,8 @@ namespace DerivationFramework {
std::string m_primaryVerticesCollectionName;
bool m_isMC;
ToolHandle<DexterTool> m_dexter;
struct ExKtbbDecorators {
static SG::AuxElement::Decorator<std::vector<float> > secvtx_pt;
......@@ -56,6 +59,21 @@ namespace DerivationFramework {
static SG::AuxElement::Decorator<std::vector<float> > secvtx_3dsig;
static SG::AuxElement::Decorator<float> jet_maxsd0;
static SG::AuxElement::Decorator<float> jet_av3sd0;
static SG::AuxElement::Decorator<float> jet_dexter_pbb;
static SG::AuxElement::Decorator<float> jet_dexter_pb;
static SG::AuxElement::Decorator<float> jet_dexter_pl;
static SG::AuxElement::Decorator<float> jet_dexter_pbb_trksflip;
static SG::AuxElement::Decorator<float> jet_dexter_pb_trksflip;
static SG::AuxElement::Decorator<float> jet_dexter_pl_trksflip;
static SG::AuxElement::Decorator<float> jet_dexter_pbb_trksflip_svmassflip;
static SG::AuxElement::Decorator<float> jet_dexter_pb_trksflip_svmassflip;
static SG::AuxElement::Decorator<float> jet_dexter_pl_trksflip_svmassflip;
static SG::AuxElement::Decorator<float> jet_dexter_pbb_negtrksflip;
static SG::AuxElement::Decorator<float> jet_dexter_pb_negtrksflip;
static SG::AuxElement::Decorator<float> jet_dexter_pl_negtrksflip;
static SG::AuxElement::Decorator<float> jet_dexter_pbb_negtrksflip_svmassflip;
static SG::AuxElement::Decorator<float> jet_dexter_pb_negtrksflip_svmassflip;
static SG::AuxElement::Decorator<float> jet_dexter_pl_negtrksflip_svmassflip;
static SG::AuxElement::Decorator<int> smalljet_largeJetLabel;
};
......
......@@ -182,7 +182,22 @@ TOPQExtraVariables_AntiKt4EMPFlowJets_ForTOPQ1 = ["AntiKt4EMPFlowJets
+ "LargeJetLabel."]
TOPQExtraVariables_AntiKt8EMPFlowJets_ForTOPQ1 = ["AntiKt8EMPFlowJets."
+ "ExKt2GASubJets."
+ "ExKt2SubJets."]
+ "ExKt2SubJets."
+ "ExKtbb_dexter_pbb."
+ "ExKtbb_dexter_pb."
+ "ExKtbb_dexter_pl."
+ "ExKtbb_dexter_pbb_trksflip."
+ "ExKtbb_dexter_pb_trksflip."
+ "ExKtbb_dexter_pl_trksflip."
+ "ExKtbb_dexter_pbb_trksflip_svmassflip."
+ "ExKtbb_dexter_pb_trksflip_svmassflip."
+ "ExKtbb_dexter_pl_trksflip_svmassflip."
+ "ExKtbb_dexter_pbb_negtrksflip."
+ "ExKtbb_dexter_pb_negtrksflip."
+ "ExKtbb_dexter_pl_negtrksflip."
+ "ExKtbb_dexter_pbb_negtrksflip_svmassflip."
+ "ExKtbb_dexter_pb_negtrksflip_svmassflip."
+ "ExKtbb_dexter_pl_negtrksflip_svmassflip."]
TOPQExtraVariables_AntiKt8EMPFlowExKt2GASubJets_ForTOPQ1 = ["AntiKt8EMPFlowExKt2GASubJets."
+ "AlgorithmType."
+ "ConeExclTausFinal."
......
......@@ -142,6 +142,10 @@ def addExKtDoubleTagVariables(algseq, ToolSvc):
algseq += softTagAlgMSVTight
from DerivationFrameworkFlavourTag.HbbCommon import addExKtDoubleTaggerScore
nn_file_name = '/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/BTagging/DeepsetXbbTagger/202010/nn-config.json'
addExKtDoubleTaggerScore(algseq, ToolSvc, nn_file_name = nn_file_name)
from DerivationFrameworkTop.TOPQAugTools import TOPQExKtCommonTruthKernel
algseq += TOPQExKtCommonTruthKernel
......
......@@ -27,6 +27,21 @@ namespace DerivationFramework {
SG::AuxElement::Decorator<std::vector<float> > ExKtbbAugmentation::ExKtbbDecorators::secvtx_3dsig("SoftBVrtClusterTool_MSVTight_Vertices_3dsig");
SG::AuxElement::Decorator<float> ExKtbbAugmentation::ExKtbbDecorators::jet_maxsd0("ExKtbb_maxsd0");
SG::AuxElement::Decorator<float> ExKtbbAugmentation::ExKtbbDecorators::jet_av3sd0("ExKtbb_av3sd0");
SG::AuxElement::Decorator<float> ExKtbbAugmentation::ExKtbbDecorators::jet_dexter_pbb("ExKtbb_dexter_pbb");
SG::AuxElement::Decorator<float> ExKtbbAugmentation::ExKtbbDecorators::jet_dexter_pb("ExKtbb_dexter_pb");
SG::AuxElement::Decorator<float> ExKtbbAugmentation::ExKtbbDecorators::jet_dexter_pl("ExKtbb_dexter_pl");
SG::AuxElement::Decorator<float> ExKtbbAugmentation::ExKtbbDecorators::jet_dexter_pbb_trksflip("ExKtbb_dexter_pbb_trksflip");
SG::AuxElement::Decorator<float> ExKtbbAugmentation::ExKtbbDecorators::jet_dexter_pb_trksflip("ExKtbb_dexter_pb_trksflip");
SG::AuxElement::Decorator<float> ExKtbbAugmentation::ExKtbbDecorators::jet_dexter_pl_trksflip("ExKtbb_dexter_pl_trksflip");
SG::AuxElement::Decorator<float> ExKtbbAugmentation::ExKtbbDecorators::jet_dexter_pbb_trksflip_svmassflip("ExKtbb_dexter_pbb_trksflip_svmassflip");
SG::AuxElement::Decorator<float> ExKtbbAugmentation::ExKtbbDecorators::jet_dexter_pb_trksflip_svmassflip("ExKtbb_dexter_pb_trksflip_svmassflip");
SG::AuxElement::Decorator<float> ExKtbbAugmentation::ExKtbbDecorators::jet_dexter_pl_trksflip_svmassflip("ExKtbb_dexter_pl_trksflip_svmassflip");
SG::AuxElement::Decorator<float> ExKtbbAugmentation::ExKtbbDecorators::jet_dexter_pbb_negtrksflip("ExKtbb_dexter_pbb_negtrksflip");
SG::AuxElement::Decorator<float> ExKtbbAugmentation::ExKtbbDecorators::jet_dexter_pb_negtrksflip("ExKtbb_dexter_pb_negtrksflip");
SG::AuxElement::Decorator<float> ExKtbbAugmentation::ExKtbbDecorators::jet_dexter_pl_negtrksflip("ExKtbb_dexter_pl_negtrksflip");
SG::AuxElement::Decorator<float> ExKtbbAugmentation::ExKtbbDecorators::jet_dexter_pbb_negtrksflip_svmassflip("ExKtbb_dexter_pbb_negtrksflip_svmassflip");
SG::AuxElement::Decorator<float> ExKtbbAugmentation::ExKtbbDecorators::jet_dexter_pb_negtrksflip_svmassflip("ExKtbb_dexter_pb_negtrksflip_svmassflip");
SG::AuxElement::Decorator<float> ExKtbbAugmentation::ExKtbbDecorators::jet_dexter_pl_negtrksflip_svmassflip("ExKtbb_dexter_pl_negtrksflip_svmassflip");
SG::AuxElement::Decorator<int> ExKtbbAugmentation::ExKtbbDecorators::smalljet_largeJetLabel("LargeJetLabel");
ExKtbbAugmentation::ExKtbbAugmentation(const std::string& t, const std::string& n, const IInterface* p):
......@@ -43,6 +58,7 @@ ExKtbbAugmentation::ExKtbbAugmentation(const std::string& t, const std::string&
declareProperty("PrimaryVerticesCollectionName",m_primaryVerticesCollectionName="PrimaryVertices");
declareProperty("isMC",m_isMC=false);
}
......@@ -54,6 +70,7 @@ ExKtbbAugmentation::~ExKtbbAugmentation(){}
StatusCode ExKtbbAugmentation::initialize(){
ATH_MSG_INFO("Initializing ExKtbbAugmentation tool... " );
ATH_CHECK(m_dexter.retrieve());
return StatusCode::SUCCESS;
......@@ -172,7 +189,62 @@ StatusCode ExKtbbAugmentation::addBranches() const{
}
}
if (ExKtSubjets.size() == 2) {
ATH_MSG_VERBOSE("Adding DexTer scores to AntiKt8 jets");
auto scores = m_dexter->getScores(*jet);
tj_decorators.jet_dexter_pbb(*jet) = scores.at("dexter_pbb");
tj_decorators.jet_dexter_pb(*jet) = scores.at("dexter_pb");
tj_decorators.jet_dexter_pl(*jet) = scores.at("dexter_pl");
m_dexter->setProperty("negativeTagMode", "TrksFlip");
auto scores_TrksFlip = m_dexter->getScores(*jet);
tj_decorators.jet_dexter_pbb_trksflip(*jet) = scores_TrksFlip.at("dexter_pbb");
tj_decorators.jet_dexter_pb_trksflip(*jet) = scores_TrksFlip.at("dexter_pb");
tj_decorators.jet_dexter_pl_trksflip(*jet) = scores_TrksFlip.at("dexter_pl");
m_dexter->setProperty("negativeTagMode", "SVMassTrksFlip");
auto scores_SVMassTrksFlip = m_dexter->getScores(*jet);
tj_decorators.jet_dexter_pbb_trksflip_svmassflip(*jet) = scores_SVMassTrksFlip.at("dexter_pbb");
tj_decorators.jet_dexter_pb_trksflip_svmassflip(*jet) = scores_SVMassTrksFlip.at("dexter_pb");
tj_decorators.jet_dexter_pl_trksflip_svmassflip(*jet) = scores_SVMassTrksFlip.at("dexter_pl");
m_dexter->setProperty("negativeTagMode", "NegTrksFlip");
auto scores_NegTrksFlip = m_dexter->getScores(*jet);
tj_decorators.jet_dexter_pbb_negtrksflip(*jet) = scores_NegTrksFlip.at("dexter_pbb");
tj_decorators.jet_dexter_pb_negtrksflip(*jet) = scores_NegTrksFlip.at("dexter_pb");
tj_decorators.jet_dexter_pl_negtrksflip(*jet) = scores_NegTrksFlip.at("dexter_pl");
m_dexter->setProperty("negativeTagMode", "SVMassNegTrksFlip");
auto scores_SVMassNegTrksFlip = m_dexter->getScores(*jet);
tj_decorators.jet_dexter_pbb_negtrksflip_svmassflip(*jet) = scores_SVMassNegTrksFlip.at("dexter_pbb");
tj_decorators.jet_dexter_pb_negtrksflip_svmassflip(*jet) = scores_SVMassNegTrksFlip.at("dexter_pb");
tj_decorators.jet_dexter_pl_negtrksflip_svmassflip(*jet) = scores_SVMassNegTrksFlip.at("dexter_pl");
} else {
tj_decorators.jet_dexter_pbb(*jet) = -999.;
tj_decorators.jet_dexter_pb(*jet) = -999.;
tj_decorators.jet_dexter_pl(*jet) = -999.;
tj_decorators.jet_dexter_pbb_trksflip(*jet) = -999.;
tj_decorators.jet_dexter_pb_trksflip(*jet) = -999.;
tj_decorators.jet_dexter_pl_trksflip(*jet) = -999.;
tj_decorators.jet_dexter_pbb_trksflip_svmassflip(*jet) = -999.;
tj_decorators.jet_dexter_pb_trksflip_svmassflip(*jet) = -999.;
tj_decorators.jet_dexter_pl_trksflip_svmassflip(*jet) = -999.;
tj_decorators.jet_dexter_pbb_negtrksflip(*jet) = -999.;
tj_decorators.jet_dexter_pb_negtrksflip(*jet) = -999.;
tj_decorators.jet_dexter_pl_negtrksflip(*jet) = -999.;
tj_decorators.jet_dexter_pbb_negtrksflip_svmassflip(*jet) = -999.;
tj_decorators.jet_dexter_pb_negtrksflip_svmassflip(*jet) = -999.;
tj_decorators.jet_dexter_pl_negtrksflip_svmassflip(*jet) = -999.;
}
if (ExKtSubjets.size() == 0) continue;
std::vector<std::vector<float> > vtx_pt(ExKtSubjets.size());
std::vector<std::vector<float> > vtx_eta(ExKtSubjets.size());
......@@ -200,7 +272,7 @@ StatusCode ExKtbbAugmentation::addBranches() const{
auto trackJet = std::min_element(ExKtSubjets.begin(), ExKtSubjets.end(),
[&SecVtxVector](const xAOD::Jet* j1, const xAOD::Jet* j2){
return (j1->pt()*SecVtxVector.DeltaR(j1->p4()) < j2->pt()*SecVtxVector.DeltaR(j2->p4()));
return (SecVtxVector.DeltaR(j1->p4()) < SecVtxVector.DeltaR(j2->p4()));
}
);
......
......@@ -11,6 +11,7 @@
#include "BoostedJetTaggers/TopoclusterTopTagger.h"
#include "BoostedJetTaggers/HbbTaggerDNN.h"
#include "BoostedJetTaggers/MassDecoXbbTagger.h"
#include "BoostedJetTaggers/DeepsetXbbTagger.h"
DECLARE_TOOL_FACTORY(SmoothedWZTagger)
DECLARE_TOOL_FACTORY(SmoothedTopTagger)
......@@ -21,6 +22,7 @@ DECLARE_TOOL_FACTORY(JSSWTopTaggerANN)
DECLARE_TOOL_FACTORY(TopoclusterTopTagger)
DECLARE_TOOL_FACTORY(HbbTaggerDNN)
DECLARE_TOOL_FACTORY(MassDecoXbbTagger)
DECLARE_TOOL_FACTORY(DexterTool)
DECLARE_NAMESPACE_TOOL_FACTORY(HTTxAOD, HEPTopTagger)
DECLARE_NAMESPACE_TOOL_FACTORY(CP, JetQGTagger)
DECLARE_NAMESPACE_TOOL_FACTORY(CP, JetQGTaggerBDT)
......@@ -35,6 +37,7 @@ DECLARE_FACTORY_ENTRIES(BoostedJetTaggers) {
DECLARE_TOOL(TopoclusterTopTagger)
DECLARE_TOOL(HbbTaggerDNN)
DECLARE_TOOL(MassDecoXbbTagger)
DECLARE_TOOL(DexterTool)
DECLARE_NAMESPACE_TOOL(HTTxAOD, HEPTopTagger)
DECLARE_NAMESPACE_TOOL(CP, JetQGTagger)
DECLARE_NAMESPACE_TOOL(CP, JetQGTaggerBDT)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment