From dcabdb55245f7a675a3134f2ecf89430f343b51f Mon Sep 17 00:00:00 2001
From: Ines Ochoa <ines.ochoa@cern.ch>
Date: Sun, 9 Sep 2018 21:26:51 -0400
Subject: [PATCH] adding ghosttrack association for ExKt, fixing bugs from
 previous commit

Former-commit-id: f12dcf7cc44721854c612543a7a1e2cb5eddb763
---
 .../python/FullListOfSmartContainers.py                     | 1 -
 .../DerivationFrameworkExotics/share/EXOT3.py               | 2 +-
 .../DerivationFrameworkFlavourTag/python/HbbCommon.py       | 6 ++++--
 .../DerivationFrameworkFlavourTag/share/FTAG5.py            | 4 ++--
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/FullListOfSmartContainers.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/FullListOfSmartContainers.py
index fd2d5d5ed36..510c52dbe25 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/FullListOfSmartContainers.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/FullListOfSmartContainers.py
@@ -22,7 +22,6 @@ FullListOfSmartContainers = [
    "AntiKt10LCTopoTrimmedPtFrac5SmallR20ExKt3SubJets",
    "AntiKt10LCTopoTrimmedPtFrac5SmallR20ExKt2GASubJets",
    "AntiKt10LCTopoTrimmedPtFrac5SmallR20ExKt3GASubJets",
-   "AntiKt10LCTopoTrimmedPtFrac5SmallR20ExCoM2SubJets",
    "AntiKt4EMPFlowJets",
    "AntiKt2LCTopoJets",
    "AntiKt3LCTopoJets",
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT3.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT3.py
index bcc167f42a2..06eefc80fd6 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT3.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT3.py
@@ -351,7 +351,7 @@ addTCCTrimmedJets(exot3Seq,"EXOT3")
 #
 ExKtJetCollection__FatJet = "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets"
 #  doTrackJet = False
-ExCoMJetCollection__SubJet = addExKtCoM(exot3Seq, ToolSvc, ExKtJetCollection__FatJet, 2, False, ["GhostBHadronsFinal","GhostCHadronsFinal"], 0, "CoM")
+ExCoMJetCollection__SubJet = addExKtCoM(exot3Seq, ToolSvc, ExKtJetCollection__FatJet, nSubjets=2, doTrackSubJet=False, ExGhostLabels=["GhostBHadronsFinal","GhostCHadronsFinal"], min_subjet_pt_mev=0, subjetAlgName="CoM")
 
 
 BTaggingFlags.CalibrationChannelAliases += [
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/python/HbbCommon.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/python/HbbCommon.py
index aef3b248c3c..49a0eea1b48 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/python/HbbCommon.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/python/HbbCommon.py
@@ -14,7 +14,7 @@ from JetRec.JetRecConf import JetAlgorithm
 #===================================================================
 
 # make exkt subjet finding tool
-def buildExclusiveSubjets(ToolSvc, JetCollectionName, subjet_mode, nsubjet, doGhostAssoc, doTrackSubJet, ExGhostLabels=["GhostBHadronsFinal", "GhostCHadronsFinal"], min_subjet_pt_mev = 0):
+def buildExclusiveSubjets(ToolSvc, JetCollectionName, subjet_mode, nsubjet, doGhostAssoc, doTrackSubJet, ExGhostLabels=["GhostBHadronsFinal", "GhostCHadronsFinal", "GhostTrack"], min_subjet_pt_mev = 0):
     #
     # a full list of ExGhostLabels = ["GhostBHadronsFinal", "GhostBHadronsInitial", "GhostBQuarksFinal", "GhostCHadronsFinal", "GhostCHadronsInitial",
     # "GhostCQuarksFinal", "GhostHBosons", "GhostPartons", "GhostTQuarksFinal", "GhostTausFinal", "GhostTruth", "GhostTrack"]
@@ -41,7 +41,9 @@ def buildExclusiveSubjets(ToolSvc, JetCollectionName, subjet_mode, nsubjet, doGh
       talabel = "GA"
     subjetlabel = "Ex%s%i%sSubJets" % (subjet_mode, nsubjet, talabel)
 
-    if globalflags.DataSource()=='data': ExGhostLabels = []
+    # removing truth labels if runining on data
+    if globalflags.DataSource()=='data': ExGhostLabels = ["GhostTrack"]
+
     SubjetContainerName = "%sEx%s%i%sSubJets" % (JetCollectionName.replace("Jets", ""), subjet_mode, nsubjet, talabel)
     ExKtbbTagToolName = str( "Ex%s%sbbTagTool%i_%s" % (subjet_mode, talabel, nsubjet, JetCollectionName) )
 
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/share/FTAG5.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/share/FTAG5.py
index 5483aa57a6c..38c3d8cbc5b 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/share/FTAG5.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/share/FTAG5.py
@@ -128,7 +128,7 @@ FTAG5BTaggedJets = [
     "AntiKt10LCTopoTrimmedPtFrac5SmallR20ExKt2SubJets",
     "AntiKt10LCTopoTrimmedPtFrac5SmallR20ExKt3SubJets",
     "AntiKt10LCTopoTrimmedPtFrac5SmallR20ExKt2GASubJets",
-    "AntiKt10LCTopoTrimmedPtFrac5SmallR20ExKt3GASubJets"]
+    "AntiKt10LCTopoTrimmedPtFrac5SmallR20ExKt3GASubJets",
     "AntiKt10LCTopoTrimmedPtFrac5SmallR20ExCoM2SubJets"]
 OutputJets["FTAG5"] = FTAG5BTaggedJets[:]
 
@@ -168,7 +168,7 @@ addExKtCoM(FTAG5Seq, ToolSvc, ExKtJetCollection__FatJet, 3, doGhostAssoc=True, d
 addExKtCoM(FTAG5Seq, ToolSvc, ExKtJetCollection__FatJet, 2, doTrackSubJet=False)
 addExKtCoM(FTAG5Seq, ToolSvc, ExKtJetCollection__FatJet, 3, doTrackSubJet=False)
 
-addExKtCoM(FTAG5Seq, ToolSvc, ExKtJetCollection__FatJet, 2, False, subjetAlgName = "CoM")
+addExKtCoM(FTAG5Seq, ToolSvc, ExKtJetCollection__FatJet, 2, doTrackSubJet=False, subjetAlgName = "CoM")
 
 BTaggingFlags.CalibrationChannelAliases += ["AntiKt10LCTopoTrimmedPtFrac5SmallR20ExKt2Sub->AntiKt4LCTopo,AntiKt4TopoEM,AntiKt4EMTopo",
                                             "AntiKt10LCTopoTrimmedPtFrac5SmallR20ExKt3Sub->AntiKt4LCTopo,AntiKt4TopoEM,AntiKt4EMTopo",
-- 
GitLab