From a3af52982b6d4f8cfc0167cac8225085ff16e1b8 Mon Sep 17 00:00:00 2001
From: cdelitzs <chris.malena.delitzsch@cern.ch>
Date: Sun, 15 Mar 2020 16:01:59 -0700
Subject: [PATCH] Adding more tracks to JETM1 and removing TCC from JETM6

---
 .../share/JETM1.py                            | 46 +++++++++++++++++
 .../share/JETM6.py                            | 50 ++++++-------------
 2 files changed, 60 insertions(+), 36 deletions(-)

diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/share/JETM1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/share/JETM1.py
index aa3e3bf99265..5d27af1c7706 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/share/JETM1.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/share/JETM1.py
@@ -6,6 +6,7 @@
 from DerivationFrameworkCore.DerivationFrameworkMaster import *
 from DerivationFrameworkJetEtMiss.JetCommon import *
 from DerivationFrameworkJetEtMiss.ExtendedJetCommon import *
+from DerivationFrameworkInDet.InDetCommon import *
 
 # Include TRUTH3 containers
 if DerivationFrameworkIsMonteCarlo:
@@ -83,6 +84,50 @@ JETM1ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning(n
 ToolSvc += JETM1ElectronTPThinningTool
 thinningTools.append(JETM1ElectronTPThinningTool)
 
+# TrackParticles associated with small-R jets
+from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning
+JETM1Akt4JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name          = "JETM1Akt4JetTPThinningTool",
+                                                                            ThinningService         = JETM1ThinningHelper.ThinningSvc(),
+                                                                            JetKey                  = "AntiKt4EMTopoJets",
+                                                                            SelectionString         = "AntiKt4EMTopoJets.pt > 18*GeV",
+                                                                            InDetTrackParticlesKey  = "InDetTrackParticles",
+                                                                            ApplyAnd                = False)
+ToolSvc += JETM1Akt4JetTPThinningTool
+thinningTools.append(JETM1Akt4JetTPThinningTool)
+
+JETM1Akt4PFlowJetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name          = "JETM1Akt4PFlowJetTPThinningTool",
+                                                                                 ThinningService         = JETM1ThinningHelper.ThinningSvc(),
+                                                                                 JetKey                  = "AntiKt4EMPFlowJets",
+                                                                                 SelectionString         = "AntiKt4EMPFlowJets.pt > 18*GeV",
+                                                                                 InDetTrackParticlesKey  = "InDetTrackParticles",
+                                                                                 ApplyAnd                = False)
+ToolSvc += JETM1Akt4PFlowJetTPThinningTool
+thinningTools.append(JETM1Akt4PFlowJetTPThinningTool)
+
+thinning_expression = "InDetTrackParticles.JETM1DFLoose && ( abs(InDetTrackParticles.d0) < 3.0 ) && ( abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 4.0 )"
+from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning
+JETM1TPThinningTool = DerivationFramework__TrackParticleThinning( name                = "JETM1TPThinningTool",
+                                                                  ThinningService         = JETM1ThinningHelper.ThinningSvc(),
+                                                                  SelectionString         = thinning_expression,
+                                                                  InDetTrackParticlesKey  = "InDetTrackParticles",
+                                                                  ApplyAnd        = True)
+ToolSvc += JETM1TPThinningTool
+thinningTools.append(JETM1TPThinningTool)
+
+#=======================================
+# Augmentation tools
+#=======================================
+
+augmentationTools = []
+
+from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__InDetTrackSelectionToolWrapper
+JETM1TrackSelectionTool = DerivationFramework__InDetTrackSelectionToolWrapper(name = "JETM1TrackSelectionTool",
+                                                                              ContainerName = "InDetTrackParticles",
+                                                                              DecorationName = "JETM1DFLoose" )
+
+JETM1TrackSelectionTool.TrackSelectionTool.CutLevel = "Loose"
+ToolSvc += JETM1TrackSelectionTool
+augmentationTools.append(JETM1TrackSelectionTool)
 
 
 #=======================================
@@ -91,6 +136,7 @@ thinningTools.append(JETM1ElectronTPThinningTool)
 
 from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel
 jetm1Seq += CfgMgr.DerivationFramework__DerivationKernel("JETM1Kernel" ,
+                                                         AugmentationTools = augmentationTools,
                                                          SkimmingTools = [JETM1ORTool],
                                                          ThinningTools = thinningTools)
 
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/share/JETM6.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/share/JETM6.py
index 15074d82a2f0..f6f7aa2e26e7 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/share/JETM6.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/share/JETM6.py
@@ -27,23 +27,23 @@ photonTriggers = TriggerLists.single_photon_Trig()
 jetTriggers = TriggerLists.jetTrig()
 
 # For first data
-jetSelection = '(count( AntiKt10LCTopoJets.pt > 400.*GeV && abs(AntiKt10LCTopoJets.eta) < 2.5 ) >=1 || count( AntiKt10TrackCaloClusterJets.pt > 400.*GeV && abs(AntiKt10TrackCaloClusterJets.eta) < 2.5 ) >= 1 || count( AntiKt10UFOCSSKJets.pt > 400.*GeV && abs(AntiKt10UFOCSSKJets.eta) < 2.5 ) >= 1)'
+jetSelection = '(count( AntiKt10LCTopoJets.pt > 400.*GeV && abs(AntiKt10LCTopoJets.eta) < 2.5 ) >=1 || count( AntiKt10UFOCSSKJets.pt > 400.*GeV && abs(AntiKt10UFOCSSKJets.eta) < 2.5 ) >= 1)'
 if DerivationFrameworkIsMonteCarlo:
-  jetSelection = '(count( AntiKt10LCTopoJets.pt > 180.*GeV && abs(AntiKt10LCTopoJets.eta) < 2.5 ) >=1 || count( AntiKt10TrackCaloClusterJets.pt > 180.*GeV && abs(AntiKt10TrackCaloClusterJets.eta) < 2.5 ) >= 1 || count( AntiKt10UFOCSSKJets.pt > 180.*GeV && abs(AntiKt10UFOCSSKJets.eta) < 2.5 ) >= 1)'
+  jetSelection = '(count( AntiKt10LCTopoJets.pt > 180.*GeV && abs(AntiKt10LCTopoJets.eta) < 2.5 ) >=1 || count( AntiKt10UFOCSSKJets.pt > 180.*GeV && abs(AntiKt10UFOCSSKJets.eta) < 2.5 ) >= 1)'
 
 orstr  = ' || '
 andstr = ' && '
 eltrigsel = '(EventInfo.eventTypeBitmask==1) || '+orstr.join(electronTriggers)
 elofflinesel = andstr.join(['count((Electrons.pt > 20*GeV) && (Electrons.DFCommonElectronsLHLoose)) >= 1',
-                            '(count(AntiKt10LCTopoJets.pt > 150*GeV && abs(AntiKt10LCTopoJets.eta) < 2.5) >=1 || count(AntiKt10TrackCaloClusterJets.pt > 150*GeV && abs(AntiKt10TrackCaloClusterJets.eta) < 2.5) >= 1 || count(AntiKt10UFOCSSKJets.pt > 150*GeV && abs(AntiKt10UFOCSSKJets.eta) < 2.5) >=1)'])
+                            '(count(AntiKt10LCTopoJets.pt > 150*GeV && abs(AntiKt10LCTopoJets.eta) < 2.5) >=1 || count(AntiKt10UFOCSSKJets.pt > 150*GeV && abs(AntiKt10UFOCSSKJets.eta) < 2.5) >=1)'])
 electronSelection = '( (' + eltrigsel + ') && (' + elofflinesel + ') )'
 
 mutrigsel = '(EventInfo.eventTypeBitmask==1) || '+orstr.join(muonTriggers)
 muofflinesel = andstr.join(['count((Muons.pt > 20*GeV) && (Muons.DFCommonMuonsPreselection)) >= 1',
-                            '(count(AntiKt10LCTopoJets.pt > 150*GeV && abs(AntiKt10LCTopoJets.eta) < 2.5) >=1 || count(AntiKt10TrackCaloClusterJets.pt > 150*GeV && abs(AntiKt10TrackCaloClusterJets.eta) < 2.5) >= 1 || count(AntiKt10UFOCSSKJets.pt > 150*GeV && abs(AntiKt10UFOCSSKJets.eta) < 2.5) >=1 )'])
+                            '(count(AntiKt10LCTopoJets.pt > 150*GeV && abs(AntiKt10LCTopoJets.eta) < 2.5) >=1 || count(AntiKt10UFOCSSKJets.pt > 150*GeV && abs(AntiKt10UFOCSSKJets.eta) < 2.5) >=1 )'])
 muonSelection = ' ( (' + mutrigsel + ') && (' + muofflinesel + ') ) '
 gammatrigsel = '(EventInfo.eventTypeBitmask==1) || '+orstr.join(photonTriggers)
-gammaofflinesel = '(count(Photons.pt > 150*GeV) >= 1 && (count(AntiKt10LCTopoJets.pt > 150*GeV && abs(AntiKt10LCTopoJets.eta) < 2.5) >=1 || count(AntiKt10TrackCaloClusterJets.pt > 150*GeV && abs(AntiKt10TrackCaloClusterJets.eta) < 2.5) >= 1 || count(AntiKt10UFOCSSKJets.pt > 150*GeV && abs(AntiKt10UFOCSSKJets.eta) < 2.5) >=1 ))'
+gammaofflinesel = '(count(Photons.pt > 150*GeV) >= 1 && (count(AntiKt10LCTopoJets.pt > 150*GeV && abs(AntiKt10LCTopoJets.eta) < 2.5) >=1 || count(AntiKt10UFOCSSKJets.pt > 150*GeV && abs(AntiKt10UFOCSSKJets.eta) < 2.5) >=1 ))'
 photonSelection = ' ( (' + gammatrigsel + ') && (' + gammaofflinesel + ') ) '
 
 lepSelection = '( ' + electronSelection + ' || ' + muonSelection + ' || ' + photonSelection + ' )'
@@ -180,21 +180,13 @@ JETM6Akt10JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( nam
 ToolSvc += JETM6Akt10JetTPThinningTool
 thinningTools.append(JETM6Akt10JetTPThinningTool)
 
-JETM6Akt10JetTPThinningToolTCC = DerivationFramework__JetTrackParticleThinning( name          = "JETM6Akt10JetTPThinningToolTCC",
-                                                                                ThinningService         = JETM6ThinningHelper.ThinningSvc(),
-                                                                                JetKey                  = "AntiKt10TrackCaloClusterJets",
-                                                                                InDetTrackParticlesKey  = "InDetTrackParticles",
-                                                                                ApplyAnd                = False)
-ToolSvc += JETM6Akt10JetTPThinningToolTCC
-thinningTools.append(JETM6Akt10JetTPThinningToolTCC)
-
-JETM6Akt10JetCSSKUFOThinningToolTCC = DerivationFramework__JetTrackParticleThinning( name          = "JETM6Akt10JetCSSKUFOThinningTool",
-                                                                                     ThinningService         = JETM6ThinningHelper.ThinningSvc(),
-                                                                                     JetKey                  = "AntiKt10UFOCSSKJets",
-                                                                                     InDetTrackParticlesKey  = "InDetTrackParticles",
-                                                                                     ApplyAnd                = False)
-ToolSvc += JETM6Akt10JetCSSKUFOThinningToolTCC
-thinningTools.append(JETM6Akt10JetCSSKUFOThinningToolTCC)
+JETM6Akt10JetCSSKUFOThinningTool = DerivationFramework__JetTrackParticleThinning( name          = "JETM6Akt10JetCSSKUFOThinningTool",
+                                                                                  ThinningService         = JETM6ThinningHelper.ThinningSvc(),
+                                                                                  JetKey                  = "AntiKt10UFOCSSKJets",
+                                                                                  InDetTrackParticlesKey  = "InDetTrackParticles",
+                                                                                  ApplyAnd                = False)
+ToolSvc += JETM6Akt10JetCSSKUFOThinningTool
+thinningTools.append(JETM6Akt10JetCSSKUFOThinningTool)
 
 
 # TrackParticles associated with Muons
@@ -259,16 +251,6 @@ jetm6Seq += CfgMgr.DerivationFramework__DerivationKernel(name = "JETM6TrigSkimKe
                                                          ThinningTools = [])
 
 
-#=======================================
-# BUILD TCC INPUTS
-#=======================================
-
-# Add TCC constituents
-from TrackCaloClusterRecTools.TrackCaloClusterConfig import runTCCReconstruction
-import AthenaCommon.AtlasUnixStandardJob
-include("RecExCond/AllDet_detDescr.py")
-runTCCReconstruction(jetm6Seq, ToolSvc, "LCOriginTopoClusters", "InDetTrackParticles", outputTCCName="TrackCaloClustersCombinedAndNeutral")
-
 #=======================================
 # BUILD UFO INPUTS
 #=======================================
@@ -297,7 +279,6 @@ reducedJetList = ["AntiKt2PV0TrackJets",
                   "AntiKt4TruthJets",
                   "AntiKt10TruthJets",
                   "AntiKt10LCTopoJets",
-                  "AntiKt10TrackCaloClusterJets",
                   "AntiKt10UFOCSSKJets",
                   "AntiKt10UFOCHSJets"
                   ]
@@ -317,7 +298,6 @@ jetm6Seq += CfgMgr.DerivationFramework__DerivationKernel( name = "JETM6MainKerne
 OutputJets["JETM6"] = []
 
 addDefaultTrimmedJets(jetm6Seq,"JETM6")
-addTCCTrimmedJets(jetm6Seq,"JETM6")
 
 if DerivationFrameworkIsMonteCarlo:
   addSoftDropJets('AntiKt', 1.0, 'Truth', beta=1.0, zcut=0.1, mods="truth_groomed", algseq=jetm6Seq, outputGroup="JETM6", writeUngroomed=False)
@@ -343,7 +323,6 @@ FlavorTagInit(JetCollections = ['AntiKt4EMPFlowJets'],Sequencer = jetm6Seq)
 
 largeRJetCollections = [
     "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets",
-    "AntiKt10TrackCaloClusterTrimmedPtFrac5SmallR20Jets",
     "AntiKt10UFOCHSTrimmedPtFrac5SmallR20Jets",
     "AntiKt10UFOCSSKTrimmedPtFrac5SmallR20Jets",
     "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets",
@@ -391,7 +370,6 @@ JETM6SlimmingHelper.SmartCollections = ["Electrons",
                                         "AntiKt2LCTopoJets",
                                         "AntiKt4EMTopoJets","AntiKt4EMPFlowJets","AntiKt4TruthJets",
                                         "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets",
-                                        "AntiKt10TrackCaloClusterTrimmedPtFrac5SmallR20Jets",
                                         "AntiKt10UFOCHSTrimmedPtFrac5SmallR20Jets",
                                         "AntiKt10UFOCSSKTrimmedPtFrac5SmallR20Jets",
                                         "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets",
@@ -456,8 +434,8 @@ JETM6SlimmingHelper.IncludeEGammaTriggerContent = True
 
 # Add the jet containers to the stream
 addJetOutputs(JETM6SlimmingHelper,
-              ["JETM6","AntiKt10LCTopoJets","AntiKt10TruthJets","AntiKt10TrackCaloClusterJets","AntiKt10UFOCSSKJets","AntiKt10UFOCHSJets"],
-              ["AntiKt10LCTopoJets","AntiKt10TruthJets","AntiKt10TrackCaloClusterJets","AntiKt10UFOCSSKJets","AntiKt10UFOCHSJets"], #smart slimming
+              ["JETM6","AntiKt10LCTopoJets","AntiKt10TruthJets","AntiKt10UFOCSSKJets","AntiKt10UFOCHSJets"],
+              ["AntiKt10LCTopoJets","AntiKt10TruthJets","AntiKt10UFOCSSKJets","AntiKt10UFOCHSJets"], #smart slimming
               ["AntiKt10EMPFlowCSSKJets"] #veto jets
               )
 
-- 
GitLab