Skip to content
Snippets Groups Projects
Commit 73d7f9b0 authored by Sara Alderweireldt's avatar Sara Alderweireldt
Browse files

Merge branch 'cherry-pick-c9b0a582' into '21.1-dev'

Merge branch '21.1-hi-btagging' into '21.1'

See merge request atlas/athena!13696

Former-commit-id: 2cf5c745f341f663762f3df72dbd929cd18a4b3e
parents d28d26fe e93abc0b
No related branches found
No related tags found
No related merge requests found
......@@ -87,6 +87,7 @@ namespace xAOD {
nameToTypemap["LCPFlow"] = LCPFlow;
nameToTypemap["EMPFlow"] = EMPFlow;
nameToTypemap["EMCPFlow"] = EMCPFlow;
nameToTypemap["HI"] = HI;
nameToTypemap[c_unCategorized] = Uncategorized;
......
......@@ -65,6 +65,7 @@ namespace xAOD {
Jet,
LCTopoOrigin,
EMTopoOrigin,
HI,
Other = 100,
Uncategorized= 1000
};
......
......@@ -464,7 +464,8 @@ class _BTaggingFlags:
"AntiKt4Track->AntiKt4Track,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4LCTopo",
"AntiKt3Track->AntiKt3Track,AntiKt4Track,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4LCTopo",
"AntiKt2Track->AntiKt2Track,AntiKt4Track,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4LCTopo",
"AntiKt4EMPFlow->AntiKt4EMPFlow,AntiKt4EMTopo,AntiKt4TopoEM,AntiKt4LCTopo"])
"AntiKt4EMPFlow->AntiKt4EMPFlow,AntiKt4EMTopo,AntiKt4TopoEM,AntiKt4LCTopo",
"AntiKt4HI->AntiKt4HI,AntiKt4EMTopo"])
for attr in self._CalibrationSingleFolder:
setattr(self, attr, True)
......
......@@ -10,7 +10,7 @@ if len(BTaggingAODList) == 0:
# Therefore, we duplicate here some code from BTagging/share/BTagging_jobOptions.py to specify the relevant Jet collections.
# Clearly this duplication is undesirable and should be replaced with a single function.
#JetCollectionList = ['AntiKt4LCTopoJets', 'AntiKt10LCTopoJets', 'AntiKt4EMTopoJets', 'AntiKt4TrackJets', 'AntiKt3TrackJets']
JetCollectionList = ['AntiKt4LCTopoJets', 'AntiKt4EMTopoJets', 'AntiKt4TrackJets', 'AntiKt4EMPFlowJets', 'AntiKt2TrackJets']
JetCollectionList = ['AntiKt4LCTopoJets', 'AntiKt4EMTopoJets', 'AntiKt4TrackJets', 'AntiKt4EMPFlowJets', 'AntiKt2TrackJets', 'AntiKt4HIJets']
from JetRec.JetRecFlags import jetFlags
# VD: disbling b-tagging on TruthJets
#if jetFlags.useTruth():
......
......@@ -18,6 +18,13 @@ std::string JetTagUtils::getJetAuthor(xAOD::Jet& jetToTag) {
xAOD::JetInput::Type jetAlgType = jetToTag.getInputType();
std::string type = xAOD::JetInput::typeName(jetAlgType);
std::string size = std::to_string(int(jetToTag.getSizeParameter()*10));
// Special test for HI jet collections
// (the attribute JetUnsubtractedScaleMomentum is specific to them)
xAOD::JetFourMom_t v;
if ( jetToTag.getAttribute<xAOD::JetFourMom_t>("JetUnsubtractedScaleMomentum",v) ) {
type = "HI";
}
std::string author = name;
author.append(size);
......
......@@ -108,6 +108,48 @@ for k in jtm.jetrecs :
AppendOutputList(jetFlags.jetAODList)
JetAlgFromTools(jtm.HIJetRecs,suffix="HI",persistify=True)
# code cloned from BTagging_jobOptions.py
# to allow b-tagging over HI jets
if not BTaggingFlags.DoNotSetupBTagging: # Temporary measure so the JetRec people can test setting this all up from their side.
#
# ========== Load and configure everything
#
from BTagging.BTaggingConfiguration import getConfiguration
ConfInstance = getConfiguration()
if ConfInstance.checkFlagsUsingBTaggingFlags():
#Jet collections
JetCollectionList = ['AntiKt4HIJets']
from JetRec.JetRecFlags import jetFlags
BTaggingFlags.Jets = [ name[:-4] for name in JetCollectionList]
#BTagging list
btag = ConfInstance.getOutputFilesPrefix() #BTaggingFlags.OutputFilesBTag #"BTagging_"
#TODO define name author (now BTagging_AntiKt4LCTopo)
AuthorSubString = [ btag+name[:-4] for name in JetCollectionList]
NotInJetToolManager = [] # For jet collections
from JetRec.JetRecStandard import jtm
for i, jet in enumerate(JetCollectionList):
try:
btagger = ConfInstance.setupJetBTaggerTool(ToolSvc, jet) #The [:-4] is not needed here; this function automatically removes trailing 'jets' or 'Jets'.
if btagger is None:
continue
jet = jet.replace("Track", "PV0Track")
jetname = getattr(jtm, jet)
jetname.unlock()
jetname.JetModifiers += [ btagger ]
jetname.lock()
if BTaggingFlags.OutputLevel < 3:
print ConfInstance.getJetCollectionTool(jet[:-4])
except AttributeError as error:
print '#BTAG# --> ' + str(error)
NotInJetToolManager.append(AuthorSubString[i])
if len(NotInJetToolManager) > 0:
AuthorSubString = list(set(AuthorSubString) - set(NotInJetToolManager))
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