From c620b8725ee1c5d7921a9646ef5ddc6711e8b28a Mon Sep 17 00:00:00 2001 From: Jason Veatch Date: Wed, 23 Jan 2019 08:11:41 +0100 Subject: [PATCH 01/21] Adding dR matching to JetTrackParticleThinning --- .../JetTrackParticleThinning.h | 2 ++ .../src/JetTrackParticleThinning.cxx | 25 ++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/DerivationFrameworkInDet/JetTrackParticleThinning.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/DerivationFrameworkInDet/JetTrackParticleThinning.h index 6e864624023..26eb2f1e949 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/DerivationFrameworkInDet/JetTrackParticleThinning.h +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/DerivationFrameworkInDet/JetTrackParticleThinning.h @@ -65,6 +65,8 @@ namespace DerivationFramework { std::string m_inDetSGKey = "InDetTrackParticles"; /// Selection string to use with the expression evaluation std::string m_selectionString; + /// DR matching criteria for use in addition to ghost-association + float m_dRMatch = 0.0; /// Flag for using @c IThinningSvc::Operator::And (instead of "or") bool m_and = false; diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/src/JetTrackParticleThinning.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/src/JetTrackParticleThinning.cxx index 6e912786d53..3872a0aa1f7 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/src/JetTrackParticleThinning.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/src/JetTrackParticleThinning.cxx @@ -32,7 +32,9 @@ namespace DerivationFramework { declareProperty( "InDetTrackParticlesKey", m_inDetSGKey, "StoreGate key of the track particle container" ); declareProperty( "SelectionString", m_selectionString, - "Selection string for the e/gamma objects" ); + "Selection string for the jet objects" ); + declareProperty( "DeltaRMatch", m_dRMatch, + "DeltaR matching criteria in addition to ghost-association" ); declareProperty( "ApplyAnd", m_and, "Use IThinningSvc::Operator::And instead of " "IThinningSvc::Operator::Or" ); @@ -160,6 +162,27 @@ namespace DerivationFramework { } } + // Set elements in the mask to true if they lie within dR of a + // reconstructed jet object if configured to do so + if(m_dRMatch > 0.0) { + for ( const xAOD::TrackParticle* tp : *importedTrackParticles ) { + + // If mask is already set to true, skip track + if( mask.at( tp->index() ) ) continue; + + for( const xAOD::Jet* jet : jetToCheck ) { + // Check if a jet lies within dR of track + + if(tp->p4().DeltaR(jet->p4()) <= m_dRMatch) { + // If so, update the mask + mask.at( tp->index() ) = true; + // and skip the rest of the jets + break; + } + } + } + } + // Count up the mask contents for( bool bit : mask ) { if( bit ) { -- GitLab From a248f0d5fe9de76b2f4d455953a3c5762dd07c66 Mon Sep 17 00:00:00 2001 From: Jason Veatch Date: Wed, 23 Jan 2019 14:57:35 +0100 Subject: [PATCH 02/21] Adding akt2 jets and tracks to EXOT27 --- .../share/EXOT27.py | 57 +++++++++++++++++-- 1 file changed, 51 insertions(+), 6 deletions(-) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py index 1c59873b6ed..b95717eea58 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py @@ -18,6 +18,7 @@ from TriggerMenu.api.TriggerEnums import TriggerPeriod, TriggerType from DerivationFrameworkCore.ThinningHelper import ThinningHelper from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper from DerivationFrameworkInDet.DerivationFrameworkInDetConf import ( + DerivationFramework__TrackParticleThinning, DerivationFramework__EgammaTrackParticleThinning, DerivationFramework__MuonTrackParticleThinning, DerivationFramework__TauTrackParticleThinning, @@ -30,6 +31,7 @@ import DerivationFrameworkJetEtMiss.METCommon as METCommon import DerivationFrameworkEGamma.EGammaCommon as EGammaCommon import DerivationFrameworkMuons.MuonsCommon as MuonsCommon import DerivationFrameworkFlavourTag.HbbCommon as HbbCommon +import DerivationFrameworkInDet.InDetCommon as InDetCommon from JetRec.JetRecStandardToolManager import jtm from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import ( DerivationFramework__GenericTruthThinning) @@ -68,7 +70,7 @@ EXOT27ExtraVariables = defaultdict(set) # their own way of doing this so anything EXOT27Jets is treated differently) EXOT27SmartContainers = [ "Electrons", "Photons", "AntiKt4EMTopoJets", "TauJets", "Muons", - "PrimaryVertices", "BTagging_AntiKt4EMTopo", "MET_Reference_AntiKt4EMTopo", + "PrimaryVertices", "BTagging_AntiKt4EMTopo", "MET_Reference_AntiKt4EMTopo", "AntiKt2LCTopoJets","InDetTrackParticles" ] EXOT27AllVariables = [ ] @@ -164,11 +166,16 @@ ExtendedJetCommon.addDefaultTrimmedJets(EXOT27Seq, "EXOT27Jets") # Add the default VR calo jets (rho=600 GeV) HbbCommon.addVRCaloJets(EXOT27Seq, "EXOT27Jets") +# add akt2 +JetCommon.addStandardJets("AntiKt",0.2,"LCTopo", mods="lctopo_ungroomed", calibOpt="none", ghostArea=0.01, ptmin=2000, ptminFilter=7000, algseq=EXOT27Seq, outputGroup="EXOT27") + # Add the default soft drop collection # Note that this function is a little eager - builds the jets with the VR ghost # tag jets already in place! ExtendedJetCommon.addCSSKSoftDropJets(EXOT27Seq, "EXOT27Jets") +OutputSmallR= ["AntiKt2LCTopoJets"] + OutputLargeR = [ "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets", "AntiKtVR600Rmax10Rmin2LCTopoTrimmedPtFrac5SmallR20Jets", @@ -179,6 +186,15 @@ for lrj in OutputLargeR: EXOT27ExtraVariables[lrj].update([ "Width", "GhostBQuarksFinal", + "GhostTrack", + "GhostTrackCount", + ]) +for srj in OutputSmallR: + EXOT27ExtraVariables[srj].update([ + "Width", + "GhostBQuarksFinal", + "GhostTrack", + "GhostTrackCount", ]) OutputLargeRParent = [ "AntiKt10LCTopoJets", @@ -241,6 +257,13 @@ for large_r in OutputLargeR: SelectionString="{0}.pt > 100*GeV".format(large_r), ContainerName = large_r) ) +for small_r in OutputSmallR: + EXOT27ThinningTools.append(DerivationFramework__GenericObjectThinning( + "EXOT27{0}ThinningTool".format(small_r), + ThinningService = EXOT27ThinningHelper.ThinningSvc(), + SelectionString="{0}.pt > 15*GeV".format(small_r), + ContainerName = small_r) ) + EXOT27BaselineElectron = "Electrons.DFCommonElectronsLHLooseBL" EXOT27BaselineMuon = "Muons.DFCommonGoodMuon && Muons.DFCommonMuonsPreselection" EXOT27BaselinePhoton = "Photons.pt > 15.*GeV && Photons.DFCommonPhotonsIsEMTight" @@ -250,19 +273,38 @@ EXOT27SignalElectron = (EXOT27BaselineElectron + " && Electrons.DFCommonElectr EXOT27SignalMuon = EXOT27BaselineMuon + " && Muons.pt > 20.*GeV" EXOT27SignalPhoton = EXOT27BaselinePhoton + " && Photons.pt > 100.*GeV" -# Set up the standard set of track thinning tools +EXOT27BaselineTrack = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" +EXOT27Akt2Track = "(AntiKt2LCTopoJets.pt > 15*GeV) && (abs(AntiKt2LCTopoJets.eta) < 2.8)" + +# Set up the track thinning tools EXOT27ThinningTools += [ + DerivationFramework__TrackParticleThinning( + "EXOT27TrackParticleThinningTool", + ThinningService = EXOT27ThinningHelper.ThinningSvc(), + SelectionString = EXOT27BaselineTrack, + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True, + ), + DerivationFramework__JetTrackParticleThinning( + "EXOT27AKt2JetTPThinningTool", + ThinningService = EXOT27ThinningHelper.ThinningSvc(), + JetKey = "AntiKt2LCTopoJets", + SelectionString = EXOT27Akt2Track, + InDetTrackParticlesKey = "InDetTrackParticles", + DeltaRMatch = 0.3, + ApplyAnd = True, + ), DerivationFramework__EgammaTrackParticleThinning( "EXOT27ElectronTrackParticleThinningTool", ThinningService = EXOT27ThinningHelper.ThinningSvc(), SGKey = "Electrons", - SelectionString = EXOT27BaselineElectron + SelectionString = EXOT27BaselineElectron, ), DerivationFramework__EgammaTrackParticleThinning( "EXOT27PhotonTrackParticleThinningTool", ThinningService = EXOT27ThinningHelper.ThinningSvc(), SGKey = "Photons", - SelectionString = EXOT27BaselinePhoton + SelectionString = EXOT27BaselinePhoton, ), DerivationFramework__MuonTrackParticleThinning( "EXOT27MuonTrackParticleThinningTool", @@ -273,9 +315,9 @@ EXOT27ThinningTools += [ "EXOT27TauTrackParticleThinningTool", ThinningService = EXOT27ThinningHelper.ThinningSvc(), TauKey = "TauJets", - SelectionString = EXOT27BaselineTauJet + SelectionString = EXOT27BaselineTauJet, ), - ] +] # Also thin the output objects by the same rules EXOT27ThinningTools += [ @@ -460,6 +502,7 @@ JetCommon.addJetOutputs( smartlist = [ "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets", "AntiKt10LCTopoCSSKSoftDropBeta100Zcut10Jets", + "AntiKt2LCTopoJets", ], vetolist = [ "AntiKt2PV0TrackJets", @@ -481,6 +524,8 @@ EXOT27SlimmingHelper.AppendToDictionary = { "AntiKtVR600Rmax10Rmin2LCTopoJetsAux" : "xAOD::JetAuxContainer", "AntiKtVR600Rmax10Rmin2LCTopoTrimmedPtFrac5SmallR20Jets" : "xAOD::JetContainer", "AntiKtVR600Rmax10Rmin2LCTopoTrimmedPtFrac5SmallR20JetsAux" : "xAOD::JetAuxContainer", + "AntiKt2LCTopoJets" : "xAOD::JetContainer", + "AntiKt2LCTopoJetsAux" : "xAOD::JetAuxContainer", } EXOT27SlimmingHelper.IncludeMuonTriggerContent = True -- GitLab From 9e6188d609382f470cc0e3e9f8693432c62a4a9c Mon Sep 17 00:00:00 2001 From: Jason Veatch Date: Mon, 28 Jan 2019 16:49:23 +0100 Subject: [PATCH 03/21] Modifying z0*sin(theta) cut and adding d0 cut for track thinning --- .../DerivationFrameworkExotics/share/EXOT27.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py index b95717eea58..90f4fc3d0a3 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py @@ -273,7 +273,7 @@ EXOT27SignalElectron = (EXOT27BaselineElectron + " && Electrons.DFCommonElectr EXOT27SignalMuon = EXOT27BaselineMuon + " && Muons.pt > 20.*GeV" EXOT27SignalPhoton = EXOT27BaselinePhoton + " && Photons.pt > 100.*GeV" -EXOT27BaselineTrack = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" +EXOT27BaselineTrack = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta) < 3.0*mm) && (InDetTrackParticles.d0 < 2.0*mm)" EXOT27Akt2Track = "(AntiKt2LCTopoJets.pt > 15*GeV) && (abs(AntiKt2LCTopoJets.eta) < 2.8)" # Set up the track thinning tools -- GitLab From 7ed74d5cc5690703d21f4fa1aa7628fc7ef8355d Mon Sep 17 00:00:00 2001 From: Jason Veatch Date: Mon, 28 Jan 2019 21:15:46 +0100 Subject: [PATCH 04/21] Fixing Si hits requirement in track thinning --- .../DerivationFrameworkExotics/share/EXOT27.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py index 90f4fc3d0a3..8c6a8049f8a 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py @@ -273,7 +273,7 @@ EXOT27SignalElectron = (EXOT27BaselineElectron + " && Electrons.DFCommonElectr EXOT27SignalMuon = EXOT27BaselineMuon + " && Muons.pt > 20.*GeV" EXOT27SignalPhoton = EXOT27BaselinePhoton + " && Photons.pt > 100.*GeV" -EXOT27BaselineTrack = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta) < 3.0*mm) && (InDetTrackParticles.d0 < 2.0*mm)" +EXOT27BaselineTrack = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits+InDetTrackParticles.numberOfSCTHits >= 7) && (abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta) < 3.0*mm) && (InDetTrackParticles.d0 < 2.0*mm)" EXOT27Akt2Track = "(AntiKt2LCTopoJets.pt > 15*GeV) && (abs(AntiKt2LCTopoJets.eta) < 2.8)" # Set up the track thinning tools -- GitLab From 87117d9aa5576136d23f76ad264166b12d6f672a Mon Sep 17 00:00:00 2001 From: Jason Veatch Date: Thu, 31 Jan 2019 17:34:56 +0100 Subject: [PATCH 05/21] Modifying track thinning criteria --- .../DerivationFrameworkExotics/share/EXOT27.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py index 8c6a8049f8a..086b984b10d 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py @@ -273,7 +273,7 @@ EXOT27SignalElectron = (EXOT27BaselineElectron + " && Electrons.DFCommonElectr EXOT27SignalMuon = EXOT27BaselineMuon + " && Muons.pt > 20.*GeV" EXOT27SignalPhoton = EXOT27BaselinePhoton + " && Photons.pt > 100.*GeV" -EXOT27BaselineTrack = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits+InDetTrackParticles.numberOfSCTHits >= 7) && (abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta) < 3.0*mm) && (InDetTrackParticles.d0 < 2.0*mm)" +EXOT27BaselineTrack = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits+InDetTrackParticles.numberOfSCTHits+InDetTrackParticles.numberOfPixelHoles+InDetTrackParticles.numberOfSCTHoles >= 7) && (abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta) < 3.0*mm) && (InDetTrackParticles.d0 < 2.0*mm)" EXOT27Akt2Track = "(AntiKt2LCTopoJets.pt > 15*GeV) && (abs(AntiKt2LCTopoJets.eta) < 2.8)" # Set up the track thinning tools @@ -291,7 +291,7 @@ EXOT27ThinningTools += [ JetKey = "AntiKt2LCTopoJets", SelectionString = EXOT27Akt2Track, InDetTrackParticlesKey = "InDetTrackParticles", - DeltaRMatch = 0.3, + DeltaRMatch = 0.32, ApplyAnd = True, ), DerivationFramework__EgammaTrackParticleThinning( -- GitLab From 4e0ccf9a90b1046aa362d0fa390081f37d45b959 Mon Sep 17 00:00:00 2001 From: Jason Veatch Date: Fri, 1 Feb 2019 13:47:57 +0100 Subject: [PATCH 06/21] Adding AntiKt2LCTopoJets to ContainersOnTheFly --- .../DerivationFrameworkCore/python/ContainersOnTheFly.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/ContainersOnTheFly.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/ContainersOnTheFly.py index 79281c181b5..bf2c4188c16 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/ContainersOnTheFly.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/ContainersOnTheFly.py @@ -32,6 +32,8 @@ ContainersOnTheFly = [ ["AntiKt10LCTopoTrimmedPtFrac5SmallR20ExKt3GASubJetsAux","xAOD::JetAuxContainer"], ["AntiKt10LCTopoTrimmedPtFrac5SmallR20ExCoM2SubJets","xAOD::JetContainer"], ["AntiKt10LCTopoTrimmedPtFrac5SmallR20ExCoM2SubJetsAux","xAOD::JetAuxContainer"], + ["AntiKt2LCTopoJets","xAOD::JetContainer"], + ["AntiKt2LCTopoJetsAux","xAOD::JetAuxContainer"], ["AntiKt4TruthJets","xAOD::JetContainer"], ["AntiKt4TruthJetsAux","xAOD::JetAuxContainer"], ["AntiKt4TruthWZJets","xAOD::JetContainer"], -- GitLab From d279fe6ce83b70571c76e36bfd8ac2d184328905 Mon Sep 17 00:00:00 2001 From: Jason Veatch Date: Fri, 1 Feb 2019 13:49:30 +0100 Subject: [PATCH 07/21] Cleaning up changes to EXOT27 --- .../share/EXOT27.py | 54 +++++++++++-------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py index 086b984b10d..4f23f754745 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py @@ -18,6 +18,7 @@ from TriggerMenu.api.TriggerEnums import TriggerPeriod, TriggerType from DerivationFrameworkCore.ThinningHelper import ThinningHelper from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper from DerivationFrameworkInDet.DerivationFrameworkInDetConf import ( + DerivationFramework__InDetTrackSelectionToolWrapper, DerivationFramework__TrackParticleThinning, DerivationFramework__EgammaTrackParticleThinning, DerivationFramework__MuonTrackParticleThinning, @@ -174,7 +175,12 @@ JetCommon.addStandardJets("AntiKt",0.2,"LCTopo", mods="lctopo_ungroomed", calibO # tag jets already in place! ExtendedJetCommon.addCSSKSoftDropJets(EXOT27Seq, "EXOT27Jets") -OutputSmallR= ["AntiKt2LCTopoJets"] +EXOT27ExtraVariables["AntiKt2LCTopoJets"].update([ + "Width", + "GhostBQuarksFinal", + "GhostTrack", + "GhostTrackCount", + ]) OutputLargeR = [ "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets", @@ -186,15 +192,6 @@ for lrj in OutputLargeR: EXOT27ExtraVariables[lrj].update([ "Width", "GhostBQuarksFinal", - "GhostTrack", - "GhostTrackCount", - ]) -for srj in OutputSmallR: - EXOT27ExtraVariables[srj].update([ - "Width", - "GhostBQuarksFinal", - "GhostTrack", - "GhostTrackCount", ]) OutputLargeRParent = [ "AntiKt10LCTopoJets", @@ -239,6 +236,20 @@ for extra in HbbCommon.xbbTaggerExtraVariables: partition = extra.partition('.') EXOT27ExtraVariables[partition[0]].update(partition[2].split('.') ) +################################################################################ +# Setup augmentation (add new decorations to objects) +################################################################################ +EXOT27AugmentationTools = [] + +EXOT27TrackSelection = DerivationFramework__InDetTrackSelectionToolWrapper(name = "EXOT27TrackSelection", + ContainerName = "InDetTrackParticles", + DecorationName = "EXOT27DFLoose" ) + +EXOT27TrackSelection.TrackSelectionTool.CutLevel = "Loose" +ToolSvc += EXOT27TrackSelection + +EXOT27AugmentationTools.append(EXOT27TrackSelection) + ################################################################################ # Setup thinning (remove objects from collections) ################################################################################ @@ -254,15 +265,16 @@ for large_r in OutputLargeR: EXOT27ThinningTools.append(DerivationFramework__GenericObjectThinning( "EXOT27{0}ThinningTool".format(large_r), ThinningService = EXOT27ThinningHelper.ThinningSvc(), - SelectionString="{0}.pt > 100*GeV".format(large_r), + SelectionString = "{0}.pt > 100*GeV".format(large_r), ContainerName = large_r) ) -for small_r in OutputSmallR: - EXOT27ThinningTools.append(DerivationFramework__GenericObjectThinning( - "EXOT27{0}ThinningTool".format(small_r), - ThinningService = EXOT27ThinningHelper.ThinningSvc(), - SelectionString="{0}.pt > 15*GeV".format(small_r), - ContainerName = small_r) ) +EXOT27Akt2Jet = "(AntiKt2LCTopoJets.pt > 15*GeV) && (abs(AntiKt2LCTopoJets.eta) < 2.8)" + +EXOT27ThinningTools.append(DerivationFramework__GenericObjectThinning( + "EXOT27AntiKt2LCTopoJetsThinningTool", + ThinningService = EXOT27ThinningHelper.ThinningSvc(), + SelectionString = EXOT27Akt2Jet, + ContainerName = "AntiKt2LCTopoJets") ) EXOT27BaselineElectron = "Electrons.DFCommonElectronsLHLooseBL" EXOT27BaselineMuon = "Muons.DFCommonGoodMuon && Muons.DFCommonMuonsPreselection" @@ -273,8 +285,7 @@ EXOT27SignalElectron = (EXOT27BaselineElectron + " && Electrons.DFCommonElectr EXOT27SignalMuon = EXOT27BaselineMuon + " && Muons.pt > 20.*GeV" EXOT27SignalPhoton = EXOT27BaselinePhoton + " && Photons.pt > 100.*GeV" -EXOT27BaselineTrack = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits+InDetTrackParticles.numberOfSCTHits+InDetTrackParticles.numberOfPixelHoles+InDetTrackParticles.numberOfSCTHoles >= 7) && (abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta) < 3.0*mm) && (InDetTrackParticles.d0 < 2.0*mm)" -EXOT27Akt2Track = "(AntiKt2LCTopoJets.pt > 15*GeV) && (abs(AntiKt2LCTopoJets.eta) < 2.8)" +EXOT27BaselineTrack = "(InDetTrackParticles.EXOT27DFLoose) && (InDetTrackParticles.pt > 0.5*GeV) && (abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta) < 3.0*mm) && (InDetTrackParticles.d0 < 2.0*mm)" # Set up the track thinning tools EXOT27ThinningTools += [ @@ -289,7 +300,7 @@ EXOT27ThinningTools += [ "EXOT27AKt2JetTPThinningTool", ThinningService = EXOT27ThinningHelper.ThinningSvc(), JetKey = "AntiKt2LCTopoJets", - SelectionString = EXOT27Akt2Track, + SelectionString = EXOT27Akt2Jet, InDetTrackParticlesKey = "InDetTrackParticles", DeltaRMatch = 0.32, ApplyAnd = True, @@ -481,6 +492,7 @@ for tool in EXOT27SkimmingTools: EXOT27Seq += CfgMgr.DerivationFramework__DerivationKernel( "EXOT27SecondaryKernel", SkimmingTools = EXOT27SkimmingTools, + AugmentationTools = EXOT27AugmentationTools, ThinningTools = EXOT27ThinningTools ) @@ -524,8 +536,6 @@ EXOT27SlimmingHelper.AppendToDictionary = { "AntiKtVR600Rmax10Rmin2LCTopoJetsAux" : "xAOD::JetAuxContainer", "AntiKtVR600Rmax10Rmin2LCTopoTrimmedPtFrac5SmallR20Jets" : "xAOD::JetContainer", "AntiKtVR600Rmax10Rmin2LCTopoTrimmedPtFrac5SmallR20JetsAux" : "xAOD::JetAuxContainer", - "AntiKt2LCTopoJets" : "xAOD::JetContainer", - "AntiKt2LCTopoJetsAux" : "xAOD::JetAuxContainer", } EXOT27SlimmingHelper.IncludeMuonTriggerContent = True -- GitLab From 717fb8ee5bda586c660f60b0b33f4897e36b4774 Mon Sep 17 00:00:00 2001 From: Jason Veatch Date: Fri, 8 Feb 2019 18:23:17 +0100 Subject: [PATCH 08/21] Adding AntiKt2LCTopo to list of jet calibrations --- .../DerivationFrameworkJetEtMiss/python/ExtendedJetCommon.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/ExtendedJetCommon.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/ExtendedJetCommon.py index 9f5718a805c..3bc682e8897 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/ExtendedJetCommon.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/ExtendedJetCommon.py @@ -258,6 +258,8 @@ def applyJetCalibration(jetalg,algname,sequence,fatjetconfig = 'comb'): 'JetArea_Residual_EtaJES_GSC'), 'AntiKt10LCTopoTrimmedPtFrac5SmallR20':('JES_MC16recommendation_FatJet_JMS_comb_19Jan2018.config', 'EtaJES_JMS'), + 'AntiKt2LCTopo':('JES_2015_2016_data_Rscan2LC_18Dec2018_R21.config', + 'JetArea_Residual_EtaJES_GSC'), } if fatjetconfig=='calo': #Choose JES_MC16recommendation_FatJet_JMS_calo_29Nov2017.config for AntiKt10LCTopoTrimmedPtFrac5SmallR20 configdict.update({'AntiKt10LCTopoTrimmedPtFrac5SmallR20':('JES_MC16recommendation_FatJet_JMS_calo_29Nov2017.config', @@ -303,7 +305,7 @@ def applyJetCalibration_xAODColl(jetalg='AntiKt4EMTopo',sequence=DerivationFrame applyJetCalibration(jetalg,'JetCommonKernel_{0}'.format(jetalg),sequence) def applyJetCalibration_CustomColl(jetalg='AntiKt10LCTopoTrimmedPtFrac5SmallR20',sequence=None): - supportedJets = ['AntiKt10LCTopoTrimmedPtFrac5SmallR20'] + supportedJets = ['AntiKt10LCTopoTrimmedPtFrac5SmallR20','AntiKt2LCTopo'] if not jetalg in supportedJets: extjetlog.warning('*** Calibration requested for unsupported jet collection! ***') extjetlog.warning('Supported custom jets: '+supportedJets) -- GitLab From f7c4973c08ae569fd87a1eac6f960f7637aaa11c Mon Sep 17 00:00:00 2001 From: Jason Veatch Date: Fri, 8 Feb 2019 18:24:02 +0100 Subject: [PATCH 09/21] Calibrating akt2 jets and modifying cuts accordingly --- .../DerivationFrameworkExotics/share/EXOT27.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py index 4f23f754745..c261fe486fc 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py @@ -170,6 +170,9 @@ HbbCommon.addVRCaloJets(EXOT27Seq, "EXOT27Jets") # add akt2 JetCommon.addStandardJets("AntiKt",0.2,"LCTopo", mods="lctopo_ungroomed", calibOpt="none", ghostArea=0.01, ptmin=2000, ptminFilter=7000, algseq=EXOT27Seq, outputGroup="EXOT27") +# add akt2 jet calibration +ExtendedJetCommon.applyJetCalibration_CustomColl("AntiKt2LCTopo", EXOT27Seq) + # Add the default soft drop collection # Note that this function is a little eager - builds the jets with the VR ghost # tag jets already in place! @@ -268,7 +271,7 @@ for large_r in OutputLargeR: SelectionString = "{0}.pt > 100*GeV".format(large_r), ContainerName = large_r) ) -EXOT27Akt2Jet = "(AntiKt2LCTopoJets.pt > 15*GeV) && (abs(AntiKt2LCTopoJets.eta) < 2.8)" +EXOT27Akt2Jet = "(AntiKt2LCTopoJets.pt > 18*GeV) && (abs(AntiKt2LCTopoJets.eta) < 2.5)" EXOT27ThinningTools.append(DerivationFramework__GenericObjectThinning( "EXOT27AntiKt2LCTopoJetsThinningTool", @@ -302,7 +305,7 @@ EXOT27ThinningTools += [ JetKey = "AntiKt2LCTopoJets", SelectionString = EXOT27Akt2Jet, InDetTrackParticlesKey = "InDetTrackParticles", - DeltaRMatch = 0.32, + DeltaRMatch = 0.3, ApplyAnd = True, ), DerivationFramework__EgammaTrackParticleThinning( -- GitLab From 8d4d9192de9e41d8b34390a6210fcf891b7d7ca9 Mon Sep 17 00:00:00 2001 From: Jason Veatch Date: Sun, 10 Feb 2019 16:16:20 +0100 Subject: [PATCH 10/21] Adding temporary EXOT273 with new associated object thinning --- .../python/DerivationFrameworkProdFlags.py | 13 + .../python/EXOT273Utils.py | 112 ++++ .../share/EXOT273.py | 608 ++++++++++++++++++ 3 files changed, 733 insertions(+) create mode 100644 PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/python/EXOT273Utils.py create mode 100644 PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT273.py diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/DerivationFrameworkProdFlags.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/DerivationFrameworkProdFlags.py index bafc12813bd..17001fe23fa 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/DerivationFrameworkProdFlags.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/DerivationFrameworkProdFlags.py @@ -1510,6 +1510,19 @@ class WriteDAOD_EXOT27Stream(JobProperty): jobproperties.DerivationFrameworkProdFlags.add_JobProperty(WriteDAOD_EXOT27Stream) listAODtoDPD.append(WriteDAOD_EXOT27Stream.StreamName) +class WriteDAOD_EXOT273Stream(JobProperty): + """EXOT273: Derivation for Mono-Hbb and Mono-sWW analyses""" + statusOn = True + allowedTypes = ['bool'] + StoredValue = False + StreamName = 'StreamDAOD_EXOT273' + FileName = '' + isVirtual = False + DPDMakerScript = "DerivationFrameworkExotics/EXOT273.py" + pass +jobproperties.DerivationFrameworkProdFlags.add_JobProperty(WriteDAOD_EXOT273Stream) +listAODtoDPD.append(WriteDAOD_EXOT273Stream.StreamName) + ################################# # Defined by the Jet/MET group ################################# diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/python/EXOT273Utils.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/python/EXOT273Utils.py new file mode 100644 index 00000000000..4158c958acb --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/python/EXOT273Utils.py @@ -0,0 +1,112 @@ +from JetRec.JetRecStandardToolManager import jtm +import DerivationFrameworkJetEtMiss.JetCommon as JetCommon +import DerivationFrameworkJetEtMiss.ExtendedJetCommon as ExtendedJetCommon +from JetRec.JetRecConf import JetAlgorithm +# Create a logger for this stream +import AthenaCommon +from BTagging.BTaggingConfiguration import getConfiguration +ConfInst=getConfiguration() +logger = AthenaCommon.Logging.logging.getLogger("EXOT273Utils") + +def getJetRecTool(collection, getParent=True): + """Get the JetRecTool for a given collection from the jtm. If getParent is + set then if that tool has an InputContainer property set then try and + retrieve the JetRecTool for that parent, continue going until there is no + InputContainer property. Will raise a KeyError if no JetRecTool can be + found at any stage. + """ + try: + jetRecTool = jtm[collection] + except KeyError as e: + raise KeyError("JetRecTool {0} not present in jtm".format(collection) ) + if getParent and hasattr(jetRecTool, "InputContainer") and jetRecTool.InputContainer: + jetRecTool = getJetRecTool(jetRecTool.InputContainer, True) + return jetRecTool + +def linkPseudoJetGettersToExistingJetCollection( + sequence, collection, getters): + """Re-run jet finding for a jet collection using a new list of + PseudoJetGetters. These PseudoJetGetters should already have been loaded + into jtm. + collection should be the name of the jet collection, which should already + have been sequenced, so it's jet rec tool will exist in jtm. + getters should be a map of PseudoJetGetters, each key being the name of the + (non ghost) collection, with the value being the name of the + PseudoJetGetter in jtm. + Returns the name of the ungroomed collection that is the parent of + 'collection' (this will be the same as 'collection' if this isn't groomed) + *and* the list of ghost labels (these are the element link names). + This code is largely based on the linkVRJetsToLargeRJets from HbbCommon + """ + # First, retrieve the original JetRecTool - this is the one that made the + # *ungroomed* jets, not the groomed ones. Ghost association is done to + # ungroomed objects + originalJetRecTool = getJetRecTool(collection, getParent = True) + originalUngroomedName = originalJetRecTool.name() + ungroomedJetAlg = originalUngroomedName + if ungroomedJetAlg.endswith("Jets"): + ungroomedJetAlg = ungroomedJetAlg[:-4] + originalFinder = jtm[originalJetRecTool.JetFinder.getName()] + originalGetters = [jtm[g.getName()] for g in originalJetRecTool.PseudoJetGetters] + newGetters = [jtm[g] for g in getters.values()] + + # Next, prepare the names of the new objects we'll need from jtm + + comb_name = "_".join(getters.keys() ) + LargeRJetFindingAlg = "jfind_{0}_{1}".format(collection, comb_name).lower() + LargeRJetPrefix = "{0}_{1}".format(collection, comb_name) + LargeRJets = LargeRJetPrefix+"Jets" + LinkTransferAlg = "LinkTransfer_{0}_{1}".format(collection, comb_name) + + # Check to see if this large R jet collection is already known to JetCommon + if LargeRJetFindingAlg in JetCommon.DFJetAlgs: + logger.info("Found {0} in DFJetAlgs".format(LargeRJetFindingAlg) ) + # Is it in our sequence? + if hasattr(sequence, LargeRJetFindingAlg): + logger.info("Algorithm already exists in the input sequence. Will not " + "add again") + else: + logger.info("Adding algorithm into the sequence {0}".format(sequence) ) + sequence += JetCommon.DFJetAlgs[LargeRJetFindingAlg] + else: + # Check to see if the corresponding JetRecTool already exists + if hasattr(jtm, LargeRJets): + logger.info("JetRecTool {0} already exists in jtm".format(LargeRJets) ) + else: + logger.info("Create a new JetRecTool {0}".format(LargeRJets) ) + JetCommon.OutputJets.setdefault("CustomJets", []).append(LargeRJets) + originalModifiers = [jtm[m.getName()] for m in originalJetRecTool.JetModifiers] + jtm.addJetFinder( + output = LargeRJets, + alg = originalFinder.JetAlgorithm, + radius = originalFinder.JetRadius, + gettersin = originalGetters + newGetters, + modifiersin = originalModifiers, + ghostArea = 0, + ptmin = originalFinder.PtMin, + variableRMinRadius = originalFinder.VariableRMinRadius, + variableRMassScale = originalFinder.VariableRMassScale, + calibOpt = "none") + # Note that we don't need ptminFilter as this was included in the original + # list of JetModifiers + logger.info( + "Creating new jet algorithm {0} and adding it to sequence {1}".format( + LargeRJetFindingAlg, sequence) ) + theJetAlg = JetAlgorithm(LargeRJetFindingAlg, Tools = [jtm[LargeRJets] ]) + sequence += theJetAlg + JetCommon.DFJetAlgs[LargeRJetFindingAlg] = theJetAlg + + # Everything so far has been to create the links on a copy of the ungroomed + # collection. Now we need to copy those links over to the original ungroomed + # collection. + + assocTool = ExtendedJetCommon.getJetExternalAssocTool( + ungroomedJetAlg, + LargeRJetPrefix, + MomentPrefix = '', + ListOfOldLinkNames=[g.Label for g in newGetters] + ) + ExtendedJetCommon.applyJetAugmentation( + ungroomedJetAlg, LinkTransferAlg, sequence, assocTool) + + return originalUngroomedName, [g.Label for g in newGetters] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT273.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT273.py new file mode 100644 index 00000000000..ed1d6b5763a --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT273.py @@ -0,0 +1,608 @@ +################################################################################ +# EXOT273 - Official monoHbb+monoScalar derivation + track and akt2 + akt2 calib + Jon's dR thinning +################################################################################ + +from DerivationFrameworkCore.DerivationFrameworkMaster import ( + derivationFlags, buildFileName, MSMgr, DerivationFrameworkJob, + DerivationFrameworkIsMonteCarlo) +from DerivationFrameworkCore.DerivationFrameworkCoreConf import ( + DerivationFramework__DerivationKernel) +from DerivationFrameworkTools.DerivationFrameworkToolsConf import ( + DerivationFramework__xAODStringSkimmingTool, + DerivationFramework__TriggerSkimmingTool, + DerivationFramework__GenericObjectThinning, + DerivationFramework__FilterCombinationAND, + DerivationFramework__FilterCombinationOR) +from TriggerMenu.api.TriggerAPI import TriggerAPI +from TriggerMenu.api.TriggerEnums import TriggerPeriod, TriggerType +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import ( + DerivationFramework__InDetTrackSelectionToolWrapper, + DerivationFramework__TrackParticleThinning, + DerivationFramework__EgammaTrackParticleThinning, + DerivationFramework__MuonTrackParticleThinning, + DerivationFramework__TauTrackParticleThinning) +from ThinningUtils.ThinningUtilsConf import ( + ThinAssociatedObjectsTool, + # EleLinkThinningTool, + DeltaRThinningTool) + +# CP group common variables +import DerivationFrameworkJetEtMiss.JetCommon as JetCommon +import DerivationFrameworkJetEtMiss.ExtendedJetCommon as ExtendedJetCommon +import DerivationFrameworkJetEtMiss.METCommon as METCommon +import DerivationFrameworkEGamma.EGammaCommon as EGammaCommon +import DerivationFrameworkMuons.MuonsCommon as MuonsCommon +import DerivationFrameworkFlavourTag.HbbCommon as HbbCommon +import DerivationFrameworkInDet.InDetCommon as InDetCommon +from JetRec.JetRecStandardToolManager import jtm +from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import ( + DerivationFramework__GenericTruthThinning) +import DerivationFrameworkMCTruth.MCTruthCommon as MCTruthCommon +from BTagging.BTaggingFlags import BTaggingFlags +from DerivationFrameworkCore.FullListOfSmartContainers import ( + FullListOfSmartContainers) +# Make sure all the normal truth stuff is there +if DerivationFrameworkIsMonteCarlo: + MCTruthCommon.addStandardTruthContents() + +import DerivationFrameworkExotics.EXOT273Utils as EXOT273Utils + +# Create a logger for this stream +import AthenaCommon +logger = AthenaCommon.Logging.logging.getLogger("EXOT273") + +from collections import defaultdict + +################################################################################ +# Setup the stream and our private sequence +################################################################################ +streamName = derivationFlags.WriteDAOD_EXOT273Stream.StreamName +fileName = buildFileName( derivationFlags.WriteDAOD_EXOT273Stream ) +EXOT273Stream = MSMgr.NewPoolRootStream( streamName, fileName ) +# Create a private sequence to run everything in. +# The advantage of this is that we can run any time-intensive operations (e.g +# jet finding) only if the kernel's selections pass. +EXOT273Seq = CfgMgr.AthSequencer("EXOT273Sequence") +DerivationFrameworkJob += EXOT273Seq +# As we add extra variables add them to this dictionary (key is container name, +# aux data in the value) +EXOT273ExtraVariables = defaultdict(set) +# As we add extra containers add them to these lists (note that the jets have +# their own way of doing this so anything EXOT273Jets is treated differently) +EXOT273SmartContainers = [ + "Electrons", "Photons", "AntiKt4EMTopoJets", "TauJets", "Muons", + "PrimaryVertices", "BTagging_AntiKt4EMTopo", "MET_Reference_AntiKt4EMTopo", + "AntiKt4EMPFlowJets", "MET_Reference_AntiKt4EMPFlow", + "AntiKt2LCTopoJets","InDetTrackParticles" + ] +EXOT273AllVariables = [ + ] +# Note which small-r jets are used in this list, will be useful later (doing it +# here as it is close to the EXOT273SmartContainers declaration which is what +# ensures that they will be added to the output). +OutputSmallRJets = ["AntiKt4EMTopoJets", "AntiKt4EMPFlowJets"] + + +if DerivationFrameworkIsMonteCarlo: + EXOT273AllVariables += [ + "TruthParticles", + "TruthVertices", + "MET_Truth", + ] +EXOT273ExtraVariables["TauJets"].update(["truthJetLink", "truthParticleLink", + "ptDetectorAxis", "etaDetectorAxis", "mDetectorAxis"]) +def outputContainer(container, warnIfNotSmart=True): + if container in EXOT273SmartContainers + EXOT273AllVariables: + logger.debug("Container '{0}' already requested for output!") + return + if container in FullListOfSmartContainers: + EXOT273SmartContainers.append(container) + else: + if warnIfNotSmart: + logger.warning( + "Container '{0}' added but not in smart lists!".format(container) ) + logger.warning("Will be added to AllVariables - could inflate the size!") + EXOT273AllVariables.append(container) + + +################################################################################ +# Setup preliminary skimming (remove whole events) +################################################################################ +# NOTE: +# I've split the skimming into two parts, one which can be run before the more +# CPU intensive operations (e.g. custom jet finding) and one which has to run +# after those +# This section is just for the preliminary skimming +EXOT273PreliminarySkimmingTools = [] + +# trigger selection +trigger_all_periods = ( + TriggerPeriod.y2015 | TriggerPeriod.y2016 | TriggerPeriod.y2017 + | TriggerPeriod.y2018 | TriggerPeriod.future2e34) +# Set live fraction to 0.95 to catch any short, accidental prescales +trigger_list = TriggerAPI.getLowestUnprescaledAnyPeriod( + trigger_all_periods, + triggerType = TriggerType.xe | TriggerType.el | TriggerType.mu | TriggerType.g, + livefraction = 0.95) +EXOT273TriggerSkimmingTool = DerivationFramework__TriggerSkimmingTool( + "EXOT273TriggerSkimmingTool", + TriggerListOR = trigger_list + ) +EXOT273PreliminarySkimmingTools.append(EXOT273TriggerSkimmingTool) + +# Add the tools to the ToolSvc +for tool in EXOT273PreliminarySkimmingTools: + ToolSvc += tool + +EXOT273Seq += CfgMgr.DerivationFramework__DerivationKernel( + "EXOT273PreliminaryKernel", + SkimmingTools = EXOT273PreliminarySkimmingTools + ) + +################################################################################ +# Augmenting (add new objects) +################################################################################ +# Create the new jet sequence in JetCommon (if it doesn't already exist) +JetCommon.OutputJets.setdefault("EXOT273Jets", []) +# Create the VR track jets +# Use buildVRJets instead of addVRJets so we can manually control the ghost +# association to the large-R jets +# do_ghost is ghost *tagging* - future improvement, not yet calibrated +vrTrackJets, vrTrackJetGhosts = HbbCommon.buildVRJets( + sequence = EXOT273Seq, do_ghost = False, logger = logger) +JetCommon.OutputJets["EXOT273Jets"].append(vrTrackJets+"Jets") +vrGhostTagTrackJets, vrGhostTagTrackJetsGhosts = HbbCommon.buildVRJets( + sequence = EXOT273Seq, do_ghost = True, logger = logger) +JetCommon.OutputJets["EXOT273Jets"].append(vrGhostTagTrackJets+"Jets") + +# We need the AntiKt10LCTopo jets here though so that the trimmed jets are +# produced correctly +# *Something* is asking for the pseudo jet getters for the FR track jets so I'm +# still producing them, just not outputting them. +replace_jet_list = [ + "AntiKt2PV0TrackJets", + "AntiKt4PV0TrackJets", + "AntiKt10LCTopoJets"] +if JetCommon.jetFlags.useTruth: + replace_jet_list += ["AntiKt4TruthJets"] +ExtendedJetCommon.replaceAODReducedJets( + jetlist=replace_jet_list, sequence=EXOT273Seq, outputlist="EXOT273Jets") + + +# Includes the 5% pT trimmed R=1.0 jets +ExtendedJetCommon.addDefaultTrimmedJets(EXOT273Seq, "EXOT273Jets") + +# Add the default VR calo jets (rho=600 GeV) +HbbCommon.addVRCaloJets(EXOT273Seq, "EXOT273Jets") + +# add akt2 +JetCommon.addStandardJets("AntiKt",0.2,"LCTopo", mods="lctopo_ungroomed", calibOpt="none", ghostArea=0.01, ptmin=2000, ptminFilter=7000, algseq=EXOT273Seq, outputGroup="EXOT273") + +# add akt2 jet calibration +ExtendedJetCommon.applyJetCalibration_CustomColl("AntiKt2LCTopo", EXOT273Seq) + +# Add the default soft drop collection +# Note that this function is a little eager - builds the jets with the VR ghost +# tag jets already in place! +ExtendedJetCommon.addCSSKSoftDropJets(EXOT273Seq, "EXOT273Jets") + +EXOT273ExtraVariables["AntiKt2LCTopoJets"].update([ + "Width", + "GhostBQuarksFinal", + "GhostTrack", + "GhostTrackCount", + ]) + +OutputLargeR = [ + "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets", + "AntiKtVR600Rmax10Rmin2LCTopoTrimmedPtFrac5SmallR20Jets", + "AntiKt10LCTopoCSSKSoftDropBeta100Zcut10Jets", + ] +# XAMPP seems to use the 'Width' variable from these? +for lrj in OutputLargeR: + EXOT273ExtraVariables[lrj].update([ + "Width", + "GhostBQuarksFinal", + ]) +OutputLargeRParent = [ + "AntiKt10LCTopoJets", + "AntiKtVR600Rmax10Rmin2LCTopoJets", + "AntiKt10LCTopoCSSKJets" + ] +for lrj in OutputLargeRParent: + EXOT273ExtraVariables[lrj].update(["GhostBQuarksFinal"]) + +# Ghost-associated the track jets to these large-R jets +toBeAssociatedTo = [ + "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets", + "AntiKtVR600Rmax10Rmin2LCTopoTrimmedPtFrac5SmallR20Jets", + ] +toAssociate = { + vrTrackJetGhosts : vrTrackJetGhosts.lower(), + vrGhostTagTrackJetsGhosts : vrGhostTagTrackJetsGhosts.lower() +} +for collection in toBeAssociatedTo: + ungroomed, labels = EXOT273Utils.linkPseudoJetGettersToExistingJetCollection( + EXOT273Seq, collection, toAssociate) + EXOT273ExtraVariables[ungroomed].update(labels) +# Link the SoftDrop jets *only* to the non-ghost tag jets. The other links +# already exist and will cause a crash if scheduled again + +ungroomed, labels = EXOT273Utils.linkPseudoJetGettersToExistingJetCollection( + EXOT273Seq, "AntiKt10LCTopoCSSKSoftDropBeta100Zcut10Jets", + {vrTrackJetGhosts : vrTrackJetGhosts.lower()}) +# However, we still want to write out both so add both to the extra variables +EXOT273ExtraVariables[ungroomed].update(labels) +EXOT273ExtraVariables[ungroomed].update([vrGhostTagTrackJetsGhosts]) + +# Alias b-tagging container for VR track jets +BTaggingFlags.CalibrationChannelAliases += ["AntiKtVR30Rmax4Rmin02Track->AntiKtVR30Rmax4Rmin02Track,AntiKt4EMTopo"] +# Schedule for output +outputContainer("BTagging_AntiKtVR30Rmax4Rmin02Track") + +# Add in Xbb tagging variables +HbbCommon.addRecommendedXbbTaggers(EXOT273Seq, ToolSvc, logger=logger) +# Add the new variables too +for extra in HbbCommon.xbbTaggerExtraVariables: + partition = extra.partition('.') + EXOT273ExtraVariables[partition[0]].update(partition[2].split('.') ) + +################################################################################ +# Setup augmentation (add new decorations to objects) +################################################################################ +EXOT273AugmentationTools = [] + +EXOT273TrackSelection = DerivationFramework__InDetTrackSelectionToolWrapper(name = "EXOT273TrackSelection", + ContainerName = "InDetTrackParticles", + DecorationName = "EXOT273DFLoose" ) + +EXOT273TrackSelection.TrackSelectionTool.CutLevel = "Loose" +ToolSvc += EXOT273TrackSelection + +EXOT273AugmentationTools.append(EXOT273TrackSelection) + +################################################################################ +# Setup thinning (remove objects from collections) +################################################################################ +EXOT273ThinningHelper = ThinningHelper("EXOT273ThinningHelper") +# Thin the navigation with the chains we're interested in +EXOT273ThinningHelper.TriggerChains = "|".join(trigger_list) +EXOT273ThinningHelper.AppendToStream(EXOT273Stream) +EXOT273ThinningTools = [] + +# Apply a pt cut on output large r jet collections +# TODO - revisit if this is harmful/necessary +for large_r in OutputLargeR: + EXOT273ThinningTools.append(DerivationFramework__GenericObjectThinning( + "EXOT273{0}ThinningTool".format(large_r), + ThinningService = EXOT273ThinningHelper.ThinningSvc(), + SelectionString = "{0}.pt > 100*GeV".format(large_r), + ContainerName = large_r) ) + +EXOT273Akt2Jet = "(AntiKt2LCTopoJets.pt > 18*GeV) && (abs(AntiKt2LCTopoJets.eta) < 2.5)" + +EXOT273Akt10JetDeltaRAkt2JetThinning = DeltaRThinningTool( + "EXOT273Akt10JetDeltaRAkt2JetThinning", + ThinningService = EXOT273ThinningHelper.ThinningSvc(), + SGKey = "AntiKt2LCTopoJets", + ConeSize = 1.4, + ApplyAnd = True) + +ToolSvc += EXOT273Akt10JetDeltaRAkt2JetThinning + +EXOT273ThinningTools += [ + DerivationFramework__GenericObjectThinning( + "EXOT273AntiKt2LCTopoJetsThinningTool", + ThinningService = EXOT273ThinningHelper.ThinningSvc(), + SelectionString = EXOT273Akt2Jet, + ContainerName = "AntiKt2LCTopoJets", + ApplyAnd = True + ), + ThinAssociatedObjectsTool( + "EXOT273AKt10JetAkt2JetThinningTool", + ThinningService = EXOT273ThinningHelper.ThinningSvc(), + SGKey = "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets", + SelectionString = "(AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets.pt > 150*GeV) && (abs(AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets.eta) < 2.2)", + ChildThinningTools = [EXOT273Akt10JetDeltaRAkt2JetThinning], + ), + ] + +EXOT273BaselineElectron = "Electrons.DFCommonElectronsLHLooseBL" +EXOT273BaselineMuon = "Muons.DFCommonGoodMuon && Muons.DFCommonMuonsPreselection" +EXOT273BaselinePhoton = "Photons.pt > 15.*GeV && Photons.DFCommonPhotonsIsEMTight" +EXOT273BaselineTauJet = "TauJets.pt > 10.*GeV" +EXOT273SignalElectron = (EXOT273BaselineElectron + " && Electrons.DFCommonElectronsLHTight " + + "&& Electrons.pt > 20.*GeV") +EXOT273SignalMuon = EXOT273BaselineMuon + " && Muons.pt > 20.*GeV" +EXOT273SignalPhoton = EXOT273BaselinePhoton + " && Photons.pt > 100.*GeV" + +EXOT273BaselineTrack = "(InDetTrackParticles.EXOT273DFLoose) && (InDetTrackParticles.pt > 0.5*GeV) && (abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta) < 3.0*mm) && (InDetTrackParticles.d0 < 2.0*mm)" + +# JVEATCH: leaving this commented out instead of deleting during development +""" +EXOT273Akt2JetGhostTrackThinning = EleLinkThinningTool( + "EXOT273Akt2JetGhostTrackThinning", + ThinningService = EXOT273ThinningHelper.ThinningSvc(), + LinkName = "GhostTrack(InDetTrackParticles)", + ApplyAnd = True) + +ToolSvc += EXOT273Akt2JetGhostTrackThinning +""" +# Applying only DeltaR thinning and not EleLink thinning is fine as long as ConeSize +# is sufficiently large compared to the jet size. If it is reduced to something close +# to the size of the jet, there is no guarantee that all ghost-associated tracks will +# be picked up +EXOT273Akt2JetDeltaRTrackThinning = DeltaRThinningTool( + "EXOT273Akt2JetDeltaRTrackThinning", + ThinningService = EXOT273ThinningHelper.ThinningSvc(), + SGKey = "InDetTrackParticles", + ConeSize = 0.3, + ApplyAnd = True) + +ToolSvc += EXOT273Akt2JetDeltaRTrackThinning + +# Set up the track thinning tools +EXOT273ThinningTools += [ + DerivationFramework__TrackParticleThinning( + "EXOT273TrackParticleThinningTool", + ThinningService = EXOT273ThinningHelper.ThinningSvc(), + SelectionString = EXOT273BaselineTrack, + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True, + ), + ThinAssociatedObjectsTool( + "EXOT273AKt2JetTPThinningTool", + ThinningService = EXOT273ThinningHelper.ThinningSvc(), + SGKey = "AntiKt2LCTopoJets", + ChildThinningTools = [EXOT273Akt2JetDeltaRTrackThinning], + ), + DerivationFramework__EgammaTrackParticleThinning( + "EXOT273ElectronTrackParticleThinningTool", + ThinningService = EXOT273ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + SelectionString = EXOT273BaselineElectron, + ), + DerivationFramework__EgammaTrackParticleThinning( + "EXOT273PhotonTrackParticleThinningTool", + ThinningService = EXOT273ThinningHelper.ThinningSvc(), + SGKey = "Photons", + SelectionString = EXOT273BaselinePhoton, + ), + DerivationFramework__MuonTrackParticleThinning( + "EXOT273MuonTrackParticleThinningTool", + ThinningService = EXOT273ThinningHelper.ThinningSvc(), + MuonKey = "Muons", + ), + DerivationFramework__TauTrackParticleThinning( + "EXOT273TauTrackParticleThinningTool", + ThinningService = EXOT273ThinningHelper.ThinningSvc(), + TauKey = "TauJets", + SelectionString = EXOT273BaselineTauJet, + ), +] + +# Also thin the output objects by the same rules +EXOT273ThinningTools += [ + DerivationFramework__GenericObjectThinning( + "EXOT273ElectronsThinningTool", + ThinningService = EXOT273ThinningHelper.ThinningSvc(), + SelectionString = EXOT273BaselineElectron, + ContainerName = "Electrons"), + DerivationFramework__GenericObjectThinning( + "EXOT273PhotonsThinningTool", + ThinningService = EXOT273ThinningHelper.ThinningSvc(), + SelectionString = EXOT273BaselinePhoton, + ContainerName = "Photons"), + DerivationFramework__GenericObjectThinning( + "EXOT273TauJetsThinningTool", + ThinningService = EXOT273ThinningHelper.ThinningSvc(), + SelectionString = EXOT273BaselineTauJet, + ContainerName = "TauJets"), + ] + + +# TODO (perhaps): truth thinning +# What I have here is extremely simplistic - designed to at least have what I +# need for my immediate studies and (by inspection) what is used by XAMPP truth +# code +if DerivationFrameworkIsMonteCarlo: + truth_with_descendants = [6, 23, 24, 25, 54] # pdg id 54: scalar particle in mono-scalar signal model + truth_sel_with_descendants = "||".join(map("(abs(TruthParticles.pdgId) == {0})".format, truth_with_descendants) ) + EXOT273ThinningTools += [ + DerivationFramework__GenericTruthThinning( + "EXOT273TruthDescendantsThinningTool", + ThinningService = EXOT273ThinningHelper.ThinningSvc(), + ParticleSelectionString = truth_sel_with_descendants, + PreserveDescendants = True), + ] + truth_no_descendants = [5, 11, 12, 13, 14, 15, 16, 17, 18, 55] # pdg id 55: Z' boson in mono-scalar signal model + truth_sel_no_descendants = "||".join(map("(abs(TruthParticles.pdgId) == {0})".format, truth_no_descendants) ) + EXOT273ThinningTools += [ + DerivationFramework__GenericTruthThinning( + "EXOT273TruthNoDescendantsThinningTool", + ThinningService = EXOT273ThinningHelper.ThinningSvc(), + ParticleSelectionString = truth_sel_no_descendants, + PreserveDescendants = False), + ] + +for tool in EXOT273ThinningTools: + ToolSvc += tool + + +################################################################################ +# Setup secondary skimming (remove whole events) +################################################################################ +EXOT273SkimmingTools = [] +# string selection +sel_list = [] +# Common SR selection +# Resolved requirement - analysis level selection is 1 central jet with pT > 45 +# GeV. Use 30 GeV and |eta| < 2.8 to allow for future differences in calibration +sel_list += [("count(({0}.DFCommonJets_Calib_pt > 30.*GeV) && " + + "(abs({0}.DFCommonJets_Calib_eta) < 2.8)) >= 1").format(jets) + for jets in ["AntiKt4EMTopoJets"] ] + +# NB - this selection is only applied to the TopoJets as the PFlow jets don't +# have the DFCommonJets_Calib_* decorations. Is this going to be an issue? Do we +# need to remove this whole part of the preselection? +# NB - this selection is almost comically loose - is there really nothing +# tighter we can apply? + + +# Merged requirement - analysis level selection is 1 central large-R jet with pT +# > 200 GeV. Use 100 GeV and |eta| < 2.4 to allow for future differences in +# calibration. Do this for all of the large-R jet collections that are output +sel_list += ["count(({0}.pt > 100.*GeV) && (abs({0}.eta) < 2.4)) >= 1".format( + lrj) for lrj in OutputLargeR] + +# This incantation gives us an OR'd string, encasing each expression in brackets +# to ensure that everything works as expected +sel_string = " || ".join(map("({0})".format, sel_list) ) +if sel_string: + # Empty strings are falsey so this will only be executed if sel_list + # contained something + EXOT273StringSkimmingTool = DerivationFramework__xAODStringSkimmingTool( + "EXOT273JetSkimmingTool", + expression = sel_string + ) + EXOT273SkimmingTools.append(EXOT273StringSkimmingTool) + +# Add additional skimming for events passing lepton and photon triggers +# Ideally we would add similar requirements for events passing the MET triggers +# but I don't know how far I trust the resolution on the reference MET +# collection. If we find that the size is still too great we can look at it. +EXOT273SkimmingORTools = [] +# The lepton triggers are only used for the 2l control regions (1l is MET +# trigger) +# These regions require >=1 signal lepton && >=2 baseline leptons +# Electrons: +ToolSvc += DerivationFramework__TriggerSkimmingTool( + "EXOT273EleTriggerSkimmingTool", + TriggerListOR = TriggerAPI.getLowestUnprescaledAnyPeriod( + trigger_all_periods, + triggerType = TriggerType.el, + livefraction = 0.95) ) +ToolSvc += DerivationFramework__xAODStringSkimmingTool( + "EXOT273EleOfflineSkimmingTool", + expression = " && ".join(map("({0})".format, [ + "count("+EXOT273BaselineElectron+") >= 2", + "count("+EXOT273SignalElectron+") >= 1"]) ) ) +EXOT273SkimmingORTools.append(DerivationFramework__FilterCombinationAND( + "EXOT273EleChannelSkim", + FilterList=[ + ToolSvc.EXOT273EleTriggerSkimmingTool, + ToolSvc.EXOT273EleOfflineSkimmingTool]) ) + +# Muons: +ToolSvc += DerivationFramework__TriggerSkimmingTool( + "EXOT273MuonTriggerSkimmingTool", + TriggerListOR = TriggerAPI.getLowestUnprescaledAnyPeriod( + trigger_all_periods, + triggerType = TriggerType.mu, + livefraction = 0.95) ) +ToolSvc += DerivationFramework__xAODStringSkimmingTool( + "EXOT273MuonOfflineSkimmingTool", + expression = " && ".join(map("({0})".format, [ + "count("+EXOT273BaselineMuon+") >= 2", + "count("+EXOT273SignalMuon+") >= 1"]) ) ) +EXOT273SkimmingORTools.append(DerivationFramework__FilterCombinationAND( + "EXOT273MuonChannelSkim", + FilterList=[ + ToolSvc.EXOT273MuonTriggerSkimmingTool, + ToolSvc.EXOT273MuonOfflineSkimmingTool]) ) + +# Photons: +ToolSvc += DerivationFramework__TriggerSkimmingTool( + "EXOT273PhotonTriggerSkimmingTool", + TriggerListOR = TriggerAPI.getLowestUnprescaledAnyPeriod( + trigger_all_periods, + triggerType = TriggerType.g, + livefraction = 0.95) ) +ToolSvc += DerivationFramework__xAODStringSkimmingTool( + "EXOT273PhotonOfflineSkimmingTool", + expression = "count("+EXOT273SignalPhoton+") >= 1") +EXOT273SkimmingORTools.append(DerivationFramework__FilterCombinationAND( + "EXOT273PhotonChannelSkim", + FilterList=[ + ToolSvc.EXOT273PhotonTriggerSkimmingTool, + ToolSvc.EXOT273PhotonOfflineSkimmingTool]) ) + +# Apply no extra selection to events passing the MET trigger +EXOT273SkimmingORTools.append(DerivationFramework__TriggerSkimmingTool( + "EXOT273METTriggerSkimmingTool", + TriggerListOR = TriggerAPI.getLowestUnprescaledAnyPeriod( + trigger_all_periods, + triggerType = TriggerType.xe, + livefraction = 0.95) ) ) + +for tool in EXOT273SkimmingORTools: + ToolSvc += tool + +EXOT273SkimmingTools.append(DerivationFramework__FilterCombinationOR( + "EXOTTriggerChannelORTool", + FilterList = EXOT273SkimmingORTools) ) + +for tool in EXOT273SkimmingTools: + ToolSvc += tool + +EXOT273Seq += CfgMgr.DerivationFramework__DerivationKernel( + "EXOT273SecondaryKernel", + SkimmingTools = EXOT273SkimmingTools, + AugmentationTools = EXOT273AugmentationTools, + ThinningTools = EXOT273ThinningTools + ) + + + + +################################################################################ +# Setup slimming (remove variables/collections) +################################################################################ +EXOT273SlimmingHelper = SlimmingHelper("EXOT273SlimmingHelper") +EXOT273SlimmingHelper.SmartCollections += EXOT273SmartContainers +EXOT273SlimmingHelper.AllVariables += EXOT273AllVariables +logger.info("EXOT273Jets: {0}".format(JetCommon.OutputJets["EXOT273Jets"]) ) +for alg in EXOT273Seq: + logger.info("Alg: {0}".format(alg) ) +JetCommon.addJetOutputs( + slimhelper = EXOT273SlimmingHelper, + contentlist=["EXOT273Jets"], + smartlist = [ + "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets", + "AntiKt10LCTopoCSSKSoftDropBeta100Zcut10Jets", + "AntiKt2LCTopoJets", + ], + vetolist = [ + "AntiKt2PV0TrackJets", + "AntiKt4PV0TrackJets", + "AntiKt10LCTopoJets", + "AntiKt10TruthJets", + "AntiKtVR600Rmax10Rmin2LCTopoJets", + "AntiKtVR600Rmax10Rmin2PV0TrackTrimmedPtFrac5SmallR20Jets", + "AntiKtVR600Rmax10Rmin2TruthTrimmedPtFrac5SmallR20Jets", + "AntiKt10LCTopoCSSKJets"] + ) + +EXOT273SlimmingHelper.ExtraVariables += [ + "{0}.{1}".format(k, '.'.join(v) ) for k, v in EXOT273ExtraVariables.iteritems() +] + +EXOT273SlimmingHelper.AppendToDictionary = { + "AntiKtVR600Rmax10Rmin2LCTopoJets" : "xAOD::JetContainer", + "AntiKtVR600Rmax10Rmin2LCTopoJetsAux" : "xAOD::JetAuxContainer", + "AntiKtVR600Rmax10Rmin2LCTopoTrimmedPtFrac5SmallR20Jets" : "xAOD::JetContainer", + "AntiKtVR600Rmax10Rmin2LCTopoTrimmedPtFrac5SmallR20JetsAux" : "xAOD::JetAuxContainer", + } + +EXOT273SlimmingHelper.IncludeMuonTriggerContent = True +EXOT273SlimmingHelper.IncludeEGammaTriggerContent = True +EXOT273SlimmingHelper.IncludeEtMissTriggerContent = True +EXOT273SlimmingHelper.AppendContentToStream(EXOT273Stream) + +################################################################################ +# Finalise +################################################################################ +# Any remaining tasks, e.g. adding the kernels to the stream +EXOT273Stream.AcceptAlgs(["EXOT273SecondaryKernel"]) -- GitLab From 28b03fdbf6d6739ac9870539150387c174e252d5 Mon Sep 17 00:00:00 2001 From: Jon Burr Date: Tue, 12 Feb 2019 16:31:46 +0100 Subject: [PATCH 11/21] Add associated object thinning through element links. --- .../share/EXOT27.py | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py index 4b12c1e2011..0e3e2b183ea 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py @@ -22,6 +22,10 @@ from DerivationFrameworkInDet.DerivationFrameworkInDetConf import ( DerivationFramework__MuonTrackParticleThinning, DerivationFramework__TauTrackParticleThinning, DerivationFramework__JetTrackParticleThinning) +from ThinningUtils.ThinningUtilsConf import ( + DeltaRThinningTool, + EleLinkThinningTool, + ThinAssociatedObjectsTool) # CP group common variables import DerivationFrameworkJetEtMiss.JetCommon as JetCommon @@ -302,6 +306,39 @@ EXOT27ThinningTools += [ ContainerName = "TauJets"), ] +# Create tools that perform 'smart' thinning, thin containers that are used by +# the CP collections. +# Electron 'smart' thinning - TODO, the ElectronTrackParticle thinning can also +# be done like this +ToolSvc += EleLinkThinningTool( + "EXOT27CaloClusterLinksThinningTool", + LinkName = "caloClusterLinks(egammaClusters)", + ThinningService = EXOT27ThinningHelper.ThinningSvc() ) +EXOT27ThinningTools.append( + ThinAssociatedObjectsTool( + "EXOT27ElectronAssocThinningTool", + ThinningService = EXOT27ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + ChildThinningTools = [ToolSvc.EXOT27CaloClusterLinksThinningTool] ) ) +# Photon 'smart' thinning +EXOT27ThinningTools.append( + ThinAssociatedObjectsTool( + "EXOT27PhotonAssocThinningTool", + ThinningService = EXOT27ThinningHelper.ThinningSvc(), + SGKey = "Photons", + ChildThinningTools = [ToolSvc.EXOT27CaloClusterLinksThinningTool] ) ) + +# Tau 'smart' thinning +ToolSvc += EleLinkThinningTool( + "EXOT27TauTrackLinksThinningTool", + LinkName = "tauTrackLinks(TauTracks)", + ThinningService = EXOT27ThinningHelper.ThinningSvc() ) +EXOT27ThinningTools.append( + ThinAssociatedObjectsTool( + "EXOT27TauAssocThinningTool", + ThinningService = EXOT27ThinningHelper.ThinningSvc(), + SGKey = "TauJets", + ChildThinningTools = [ToolSvc.EXOT27TauTrackLinksThinningTool]) ) # TODO (perhaps): truth thinning # What I have here is extremely simplistic - designed to at least have what I -- GitLab From 2e61ab0a7edbcbc03701523f82375f0bb46ddbcc Mon Sep 17 00:00:00 2001 From: Jon Burr Date: Tue, 12 Feb 2019 16:55:03 +0100 Subject: [PATCH 12/21] Adding missing types from the element thinning link type list --- .../ThinningUtils/src/EleLinkThinningTypeList.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PhysicsAnalysis/AnalysisCommon/ThinningUtils/src/EleLinkThinningTypeList.h b/PhysicsAnalysis/AnalysisCommon/ThinningUtils/src/EleLinkThinningTypeList.h index 10caed32e14..0e981eb1107 100644 --- a/PhysicsAnalysis/AnalysisCommon/ThinningUtils/src/EleLinkThinningTypeList.h +++ b/PhysicsAnalysis/AnalysisCommon/ThinningUtils/src/EleLinkThinningTypeList.h @@ -13,6 +13,8 @@ #include "xAODJet/JetContainer.h" #include "xAODBTagging/BTaggingContainer.h" #include "xAODBTagging/BTagVertexContainer.h" +#include "xAODTau/TauJetContainer.h" +#include "xAODTau/TauTrackContainer.h" namespace EleLinkThinningHelpers { /// This struct provides the list of candidate types for the element link @@ -29,6 +31,8 @@ namespace EleLinkThinningHelpers { xAOD::MuonContainer, xAOD::JetContainer, xAOD::BTaggingContainer, - xAOD::BTagVertexContainer>* types = nullptr; + xAOD::BTagVertexContainer, + xAOD::TauJetContainer, + xAOD::TauTrackContainer>* types = nullptr; }; } -- GitLab From 2ea6bfc3f73416973b0264b5d55567c21a5169c4 Mon Sep 17 00:00:00 2001 From: Jon Burr Date: Tue, 12 Feb 2019 16:55:19 +0100 Subject: [PATCH 13/21] Removing large-R jet containers --- .../share/EXOT27.py | 40 +------------------ 1 file changed, 2 insertions(+), 38 deletions(-) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py index 0e3e2b183ea..b7766b36ee0 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py @@ -154,14 +154,11 @@ vrGhostTagTrackJets, vrGhostTagTrackJetsGhosts = HbbCommon.buildVRJets( sequence = EXOT27Seq, do_ghost = True, logger = logger) JetCommon.OutputJets["EXOT27Jets"].append(vrGhostTagTrackJets+"Jets") -# We need the AntiKt10LCTopo jets here though so that the trimmed jets are -# produced correctly # *Something* is asking for the pseudo jet getters for the FR track jets so I'm # still producing them, just not outputting them. replace_jet_list = [ "AntiKt2PV0TrackJets", - "AntiKt4PV0TrackJets", - "AntiKt10LCTopoJets"] + "AntiKt4PV0TrackJets"] if JetCommon.jetFlags.useTruth: replace_jet_list += ["AntiKt4TruthJets"] ExtendedJetCommon.replaceAODReducedJets( @@ -171,18 +168,9 @@ ExtendedJetCommon.replaceAODReducedJets( # Includes the 5% pT trimmed R=1.0 jets ExtendedJetCommon.addDefaultTrimmedJets(EXOT27Seq, "EXOT27Jets") -# Add the default VR calo jets (rho=600 GeV) -HbbCommon.addVRCaloJets(EXOT27Seq, "EXOT27Jets") - -# Add the default soft drop collection -# Note that this function is a little eager - builds the jets with the VR ghost -# tag jets already in place! -ExtendedJetCommon.addCSSKSoftDropJets(EXOT27Seq, "EXOT27Jets") OutputLargeR = [ "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets", - "AntiKtVR600Rmax10Rmin2LCTopoTrimmedPtFrac5SmallR20Jets", - "AntiKt10LCTopoCSSKSoftDropBeta100Zcut10Jets", ] # XAMPP seems to use the 'Width' variable from these? for lrj in OutputLargeR: @@ -192,8 +180,6 @@ for lrj in OutputLargeR: ]) OutputLargeRParent = [ "AntiKt10LCTopoJets", - "AntiKtVR600Rmax10Rmin2LCTopoJets", - "AntiKt10LCTopoCSSKJets" ] for lrj in OutputLargeRParent: EXOT27ExtraVariables[lrj].update(["GhostBQuarksFinal"]) @@ -201,7 +187,6 @@ for lrj in OutputLargeRParent: # Ghost-associated the track jets to these large-R jets toBeAssociatedTo = [ "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets", - "AntiKtVR600Rmax10Rmin2LCTopoTrimmedPtFrac5SmallR20Jets", ] toAssociate = { vrTrackJetGhosts : vrTrackJetGhosts.lower(), @@ -211,15 +196,6 @@ for collection in toBeAssociatedTo: ungroomed, labels = EXOT27Utils.linkPseudoJetGettersToExistingJetCollection( EXOT27Seq, collection, toAssociate) EXOT27ExtraVariables[ungroomed].update(labels) -# Link the SoftDrop jets *only* to the non-ghost tag jets. The other links -# already exist and will cause a crash if scheduled again - -ungroomed, labels = EXOT27Utils.linkPseudoJetGettersToExistingJetCollection( - EXOT27Seq, "AntiKt10LCTopoCSSKSoftDropBeta100Zcut10Jets", - {vrTrackJetGhosts : vrTrackJetGhosts.lower()}) -# However, we still want to write out both so add both to the extra variables -EXOT27ExtraVariables[ungroomed].update(labels) -EXOT27ExtraVariables[ungroomed].update([vrGhostTagTrackJetsGhosts]) # Alias b-tagging container for VR track jets BTaggingFlags.CalibrationChannelAliases += ["AntiKtVR30Rmax4Rmin02Track->AntiKtVR30Rmax4Rmin02Track,AntiKt4EMTopo"] @@ -507,30 +483,18 @@ JetCommon.addJetOutputs( contentlist=["EXOT27Jets"], smartlist = [ "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets", - "AntiKt10LCTopoCSSKSoftDropBeta100Zcut10Jets", ], vetolist = [ "AntiKt2PV0TrackJets", "AntiKt4PV0TrackJets", "AntiKt10LCTopoJets", - "AntiKt10TruthJets", - "AntiKtVR600Rmax10Rmin2LCTopoJets", - "AntiKtVR600Rmax10Rmin2PV0TrackTrimmedPtFrac5SmallR20Jets", - "AntiKtVR600Rmax10Rmin2TruthTrimmedPtFrac5SmallR20Jets", - "AntiKt10LCTopoCSSKJets"] + "AntiKt10TruthJets"] ) EXOT27SlimmingHelper.ExtraVariables += [ "{0}.{1}".format(k, '.'.join(v) ) for k, v in EXOT27ExtraVariables.iteritems() ] -EXOT27SlimmingHelper.AppendToDictionary = { - "AntiKtVR600Rmax10Rmin2LCTopoJets" : "xAOD::JetContainer", - "AntiKtVR600Rmax10Rmin2LCTopoJetsAux" : "xAOD::JetAuxContainer", - "AntiKtVR600Rmax10Rmin2LCTopoTrimmedPtFrac5SmallR20Jets" : "xAOD::JetContainer", - "AntiKtVR600Rmax10Rmin2LCTopoTrimmedPtFrac5SmallR20JetsAux" : "xAOD::JetAuxContainer", - } - EXOT27SlimmingHelper.IncludeMuonTriggerContent = True EXOT27SlimmingHelper.IncludeEGammaTriggerContent = True EXOT27SlimmingHelper.IncludeEtMissTriggerContent = True -- GitLab From 94067028d3a712532d35a9c1872dfe7fdf13cc2c Mon Sep 17 00:00:00 2001 From: Jason Veatch Date: Tue, 12 Feb 2019 19:21:41 +0100 Subject: [PATCH 14/21] Reverting to loose akt2 and track cuts --- .../DerivationFrameworkExotics/share/EXOT27.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py index adbd58658f1..736e03741f2 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py @@ -176,7 +176,7 @@ ExtendedJetCommon.addDefaultTrimmedJets(EXOT27Seq, "EXOT27Jets") JetCommon.addStandardJets("AntiKt",0.2,"LCTopo", mods="lctopo_ungroomed", calibOpt="none", ghostArea=0.01, ptmin=2000, ptminFilter=7000, algseq=EXOT27Seq, outputGroup="EXOT27") # add akt2 jet calibration -ExtendedJetCommon.applyJetCalibration_CustomColl("AntiKt2LCTopo", EXOT27Seq) +#ExtendedJetCommon.applyJetCalibration_CustomColl("AntiKt2LCTopo", EXOT27Seq) EXOT27ExtraVariables["AntiKt2LCTopoJets"].update([ "Width", @@ -257,7 +257,8 @@ for large_r in OutputLargeR: SelectionString = "{0}.pt > 100*GeV".format(large_r), ContainerName = large_r) ) -EXOT27Akt2Jet = "(AntiKt2LCTopoJets.pt > 18*GeV) && (abs(AntiKt2LCTopoJets.eta) < 2.5)" +#EXOT27Akt2Jet = "(AntiKt2LCTopoJets.pt > 18*GeV) && (abs(AntiKt2LCTopoJets.eta) < 2.5)" +EXOT27Akt2Jet = "(AntiKt2LCTopoJets.pt > 10*GeV) && (abs(AntiKt2LCTopoJets.eta) < 3.1)" EXOT27ThinningTools.append(DerivationFramework__GenericObjectThinning( "EXOT27AntiKt2LCTopoJetsThinningTool", @@ -291,7 +292,7 @@ EXOT27ThinningTools += [ JetKey = "AntiKt2LCTopoJets", SelectionString = EXOT27Akt2Jet, InDetTrackParticlesKey = "InDetTrackParticles", - DeltaRMatch = 0.3, + DeltaRMatch = 0.33, ApplyAnd = True, ), DerivationFramework__EgammaTrackParticleThinning( -- GitLab From 80814ed29b396c4a6b5eb8d60008704d4a40bdf8 Mon Sep 17 00:00:00 2001 From: Jason Veatch Date: Tue, 12 Feb 2019 19:27:53 +0100 Subject: [PATCH 15/21] Cleaning up commented code --- .../DerivationFrameworkExotics/share/EXOT27.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py index 736e03741f2..9d8ed601658 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py @@ -175,9 +175,6 @@ ExtendedJetCommon.addDefaultTrimmedJets(EXOT27Seq, "EXOT27Jets") # add akt2 JetCommon.addStandardJets("AntiKt",0.2,"LCTopo", mods="lctopo_ungroomed", calibOpt="none", ghostArea=0.01, ptmin=2000, ptminFilter=7000, algseq=EXOT27Seq, outputGroup="EXOT27") -# add akt2 jet calibration -#ExtendedJetCommon.applyJetCalibration_CustomColl("AntiKt2LCTopo", EXOT27Seq) - EXOT27ExtraVariables["AntiKt2LCTopoJets"].update([ "Width", "GhostBQuarksFinal", @@ -257,7 +254,6 @@ for large_r in OutputLargeR: SelectionString = "{0}.pt > 100*GeV".format(large_r), ContainerName = large_r) ) -#EXOT27Akt2Jet = "(AntiKt2LCTopoJets.pt > 18*GeV) && (abs(AntiKt2LCTopoJets.eta) < 2.5)" EXOT27Akt2Jet = "(AntiKt2LCTopoJets.pt > 10*GeV) && (abs(AntiKt2LCTopoJets.eta) < 3.1)" EXOT27ThinningTools.append(DerivationFramework__GenericObjectThinning( -- GitLab From dc21ec228e3fdc1b55e4225080ce8608a8e900b4 Mon Sep 17 00:00:00 2001 From: Jason Veatch Date: Wed, 13 Feb 2019 21:07:47 +0100 Subject: [PATCH 16/21] Adding Tau4 and Tau4_wta variables and fixing akt2 outputGroup --- .../DerivationFrameworkExotics/share/EXOT27.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py index 9d8ed601658..c7b00048a00 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py @@ -173,7 +173,7 @@ ExtendedJetCommon.replaceAODReducedJets( ExtendedJetCommon.addDefaultTrimmedJets(EXOT27Seq, "EXOT27Jets") # add akt2 -JetCommon.addStandardJets("AntiKt",0.2,"LCTopo", mods="lctopo_ungroomed", calibOpt="none", ghostArea=0.01, ptmin=2000, ptminFilter=7000, algseq=EXOT27Seq, outputGroup="EXOT27") +JetCommon.addStandardJets("AntiKt",0.2,"LCTopo", mods="lctopo_ungroomed", calibOpt="none", ghostArea=0.01, ptmin=2000, ptminFilter=7000, algseq=EXOT27Seq, outputGroup="EXOT27Jets") EXOT27ExtraVariables["AntiKt2LCTopoJets"].update([ "Width", @@ -190,6 +190,8 @@ for lrj in OutputLargeR: EXOT27ExtraVariables[lrj].update([ "Width", "GhostBQuarksFinal", + "Tau4", + "Tau4_wta", ]) OutputLargeRParent = [ "AntiKt10LCTopoJets", -- GitLab From 250eb9402de1e2922dc20c50b2ffb59120a45f2b Mon Sep 17 00:00:00 2001 From: Jason Veatch Date: Wed, 13 Feb 2019 21:36:11 +0100 Subject: [PATCH 17/21] Removing Tau4 --- .../DerivationFrameworkExotics/share/EXOT27.py | 1 - 1 file changed, 1 deletion(-) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py index c7b00048a00..de91921e5aa 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py @@ -190,7 +190,6 @@ for lrj in OutputLargeR: EXOT27ExtraVariables[lrj].update([ "Width", "GhostBQuarksFinal", - "Tau4", "Tau4_wta", ]) OutputLargeRParent = [ -- GitLab From b88a8f4c842226f7a9a42cdde7a14e53c83f9349 Mon Sep 17 00:00:00 2001 From: Jason Veatch Date: Mon, 18 Feb 2019 13:11:53 +0100 Subject: [PATCH 18/21] Removing temporary EXOT273 --- .../python/DerivationFrameworkProdFlags.py | 13 - .../python/EXOT273Utils.py | 112 ---- .../share/EXOT273.py | 608 ------------------ 3 files changed, 733 deletions(-) delete mode 100644 PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/python/EXOT273Utils.py delete mode 100644 PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT273.py diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/DerivationFrameworkProdFlags.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/DerivationFrameworkProdFlags.py index 17001fe23fa..bafc12813bd 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/DerivationFrameworkProdFlags.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/DerivationFrameworkProdFlags.py @@ -1510,19 +1510,6 @@ class WriteDAOD_EXOT27Stream(JobProperty): jobproperties.DerivationFrameworkProdFlags.add_JobProperty(WriteDAOD_EXOT27Stream) listAODtoDPD.append(WriteDAOD_EXOT27Stream.StreamName) -class WriteDAOD_EXOT273Stream(JobProperty): - """EXOT273: Derivation for Mono-Hbb and Mono-sWW analyses""" - statusOn = True - allowedTypes = ['bool'] - StoredValue = False - StreamName = 'StreamDAOD_EXOT273' - FileName = '' - isVirtual = False - DPDMakerScript = "DerivationFrameworkExotics/EXOT273.py" - pass -jobproperties.DerivationFrameworkProdFlags.add_JobProperty(WriteDAOD_EXOT273Stream) -listAODtoDPD.append(WriteDAOD_EXOT273Stream.StreamName) - ################################# # Defined by the Jet/MET group ################################# diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/python/EXOT273Utils.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/python/EXOT273Utils.py deleted file mode 100644 index 4158c958acb..00000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/python/EXOT273Utils.py +++ /dev/null @@ -1,112 +0,0 @@ -from JetRec.JetRecStandardToolManager import jtm -import DerivationFrameworkJetEtMiss.JetCommon as JetCommon -import DerivationFrameworkJetEtMiss.ExtendedJetCommon as ExtendedJetCommon -from JetRec.JetRecConf import JetAlgorithm -# Create a logger for this stream -import AthenaCommon -from BTagging.BTaggingConfiguration import getConfiguration -ConfInst=getConfiguration() -logger = AthenaCommon.Logging.logging.getLogger("EXOT273Utils") - -def getJetRecTool(collection, getParent=True): - """Get the JetRecTool for a given collection from the jtm. If getParent is - set then if that tool has an InputContainer property set then try and - retrieve the JetRecTool for that parent, continue going until there is no - InputContainer property. Will raise a KeyError if no JetRecTool can be - found at any stage. - """ - try: - jetRecTool = jtm[collection] - except KeyError as e: - raise KeyError("JetRecTool {0} not present in jtm".format(collection) ) - if getParent and hasattr(jetRecTool, "InputContainer") and jetRecTool.InputContainer: - jetRecTool = getJetRecTool(jetRecTool.InputContainer, True) - return jetRecTool - -def linkPseudoJetGettersToExistingJetCollection( - sequence, collection, getters): - """Re-run jet finding for a jet collection using a new list of - PseudoJetGetters. These PseudoJetGetters should already have been loaded - into jtm. - collection should be the name of the jet collection, which should already - have been sequenced, so it's jet rec tool will exist in jtm. - getters should be a map of PseudoJetGetters, each key being the name of the - (non ghost) collection, with the value being the name of the - PseudoJetGetter in jtm. - Returns the name of the ungroomed collection that is the parent of - 'collection' (this will be the same as 'collection' if this isn't groomed) - *and* the list of ghost labels (these are the element link names). - This code is largely based on the linkVRJetsToLargeRJets from HbbCommon - """ - # First, retrieve the original JetRecTool - this is the one that made the - # *ungroomed* jets, not the groomed ones. Ghost association is done to - # ungroomed objects - originalJetRecTool = getJetRecTool(collection, getParent = True) - originalUngroomedName = originalJetRecTool.name() - ungroomedJetAlg = originalUngroomedName - if ungroomedJetAlg.endswith("Jets"): - ungroomedJetAlg = ungroomedJetAlg[:-4] - originalFinder = jtm[originalJetRecTool.JetFinder.getName()] - originalGetters = [jtm[g.getName()] for g in originalJetRecTool.PseudoJetGetters] - newGetters = [jtm[g] for g in getters.values()] - - # Next, prepare the names of the new objects we'll need from jtm - - comb_name = "_".join(getters.keys() ) - LargeRJetFindingAlg = "jfind_{0}_{1}".format(collection, comb_name).lower() - LargeRJetPrefix = "{0}_{1}".format(collection, comb_name) - LargeRJets = LargeRJetPrefix+"Jets" - LinkTransferAlg = "LinkTransfer_{0}_{1}".format(collection, comb_name) - - # Check to see if this large R jet collection is already known to JetCommon - if LargeRJetFindingAlg in JetCommon.DFJetAlgs: - logger.info("Found {0} in DFJetAlgs".format(LargeRJetFindingAlg) ) - # Is it in our sequence? - if hasattr(sequence, LargeRJetFindingAlg): - logger.info("Algorithm already exists in the input sequence. Will not " - "add again") - else: - logger.info("Adding algorithm into the sequence {0}".format(sequence) ) - sequence += JetCommon.DFJetAlgs[LargeRJetFindingAlg] - else: - # Check to see if the corresponding JetRecTool already exists - if hasattr(jtm, LargeRJets): - logger.info("JetRecTool {0} already exists in jtm".format(LargeRJets) ) - else: - logger.info("Create a new JetRecTool {0}".format(LargeRJets) ) - JetCommon.OutputJets.setdefault("CustomJets", []).append(LargeRJets) - originalModifiers = [jtm[m.getName()] for m in originalJetRecTool.JetModifiers] - jtm.addJetFinder( - output = LargeRJets, - alg = originalFinder.JetAlgorithm, - radius = originalFinder.JetRadius, - gettersin = originalGetters + newGetters, - modifiersin = originalModifiers, - ghostArea = 0, - ptmin = originalFinder.PtMin, - variableRMinRadius = originalFinder.VariableRMinRadius, - variableRMassScale = originalFinder.VariableRMassScale, - calibOpt = "none") - # Note that we don't need ptminFilter as this was included in the original - # list of JetModifiers - logger.info( - "Creating new jet algorithm {0} and adding it to sequence {1}".format( - LargeRJetFindingAlg, sequence) ) - theJetAlg = JetAlgorithm(LargeRJetFindingAlg, Tools = [jtm[LargeRJets] ]) - sequence += theJetAlg - JetCommon.DFJetAlgs[LargeRJetFindingAlg] = theJetAlg - - # Everything so far has been to create the links on a copy of the ungroomed - # collection. Now we need to copy those links over to the original ungroomed - # collection. - - assocTool = ExtendedJetCommon.getJetExternalAssocTool( - ungroomedJetAlg, - LargeRJetPrefix, - MomentPrefix = '', - ListOfOldLinkNames=[g.Label for g in newGetters] - ) - ExtendedJetCommon.applyJetAugmentation( - ungroomedJetAlg, LinkTransferAlg, sequence, assocTool) - - return originalUngroomedName, [g.Label for g in newGetters] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT273.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT273.py deleted file mode 100644 index ed1d6b5763a..00000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT273.py +++ /dev/null @@ -1,608 +0,0 @@ -################################################################################ -# EXOT273 - Official monoHbb+monoScalar derivation + track and akt2 + akt2 calib + Jon's dR thinning -################################################################################ - -from DerivationFrameworkCore.DerivationFrameworkMaster import ( - derivationFlags, buildFileName, MSMgr, DerivationFrameworkJob, - DerivationFrameworkIsMonteCarlo) -from DerivationFrameworkCore.DerivationFrameworkCoreConf import ( - DerivationFramework__DerivationKernel) -from DerivationFrameworkTools.DerivationFrameworkToolsConf import ( - DerivationFramework__xAODStringSkimmingTool, - DerivationFramework__TriggerSkimmingTool, - DerivationFramework__GenericObjectThinning, - DerivationFramework__FilterCombinationAND, - DerivationFramework__FilterCombinationOR) -from TriggerMenu.api.TriggerAPI import TriggerAPI -from TriggerMenu.api.TriggerEnums import TriggerPeriod, TriggerType -from DerivationFrameworkCore.ThinningHelper import ThinningHelper -from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import ( - DerivationFramework__InDetTrackSelectionToolWrapper, - DerivationFramework__TrackParticleThinning, - DerivationFramework__EgammaTrackParticleThinning, - DerivationFramework__MuonTrackParticleThinning, - DerivationFramework__TauTrackParticleThinning) -from ThinningUtils.ThinningUtilsConf import ( - ThinAssociatedObjectsTool, - # EleLinkThinningTool, - DeltaRThinningTool) - -# CP group common variables -import DerivationFrameworkJetEtMiss.JetCommon as JetCommon -import DerivationFrameworkJetEtMiss.ExtendedJetCommon as ExtendedJetCommon -import DerivationFrameworkJetEtMiss.METCommon as METCommon -import DerivationFrameworkEGamma.EGammaCommon as EGammaCommon -import DerivationFrameworkMuons.MuonsCommon as MuonsCommon -import DerivationFrameworkFlavourTag.HbbCommon as HbbCommon -import DerivationFrameworkInDet.InDetCommon as InDetCommon -from JetRec.JetRecStandardToolManager import jtm -from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import ( - DerivationFramework__GenericTruthThinning) -import DerivationFrameworkMCTruth.MCTruthCommon as MCTruthCommon -from BTagging.BTaggingFlags import BTaggingFlags -from DerivationFrameworkCore.FullListOfSmartContainers import ( - FullListOfSmartContainers) -# Make sure all the normal truth stuff is there -if DerivationFrameworkIsMonteCarlo: - MCTruthCommon.addStandardTruthContents() - -import DerivationFrameworkExotics.EXOT273Utils as EXOT273Utils - -# Create a logger for this stream -import AthenaCommon -logger = AthenaCommon.Logging.logging.getLogger("EXOT273") - -from collections import defaultdict - -################################################################################ -# Setup the stream and our private sequence -################################################################################ -streamName = derivationFlags.WriteDAOD_EXOT273Stream.StreamName -fileName = buildFileName( derivationFlags.WriteDAOD_EXOT273Stream ) -EXOT273Stream = MSMgr.NewPoolRootStream( streamName, fileName ) -# Create a private sequence to run everything in. -# The advantage of this is that we can run any time-intensive operations (e.g -# jet finding) only if the kernel's selections pass. -EXOT273Seq = CfgMgr.AthSequencer("EXOT273Sequence") -DerivationFrameworkJob += EXOT273Seq -# As we add extra variables add them to this dictionary (key is container name, -# aux data in the value) -EXOT273ExtraVariables = defaultdict(set) -# As we add extra containers add them to these lists (note that the jets have -# their own way of doing this so anything EXOT273Jets is treated differently) -EXOT273SmartContainers = [ - "Electrons", "Photons", "AntiKt4EMTopoJets", "TauJets", "Muons", - "PrimaryVertices", "BTagging_AntiKt4EMTopo", "MET_Reference_AntiKt4EMTopo", - "AntiKt4EMPFlowJets", "MET_Reference_AntiKt4EMPFlow", - "AntiKt2LCTopoJets","InDetTrackParticles" - ] -EXOT273AllVariables = [ - ] -# Note which small-r jets are used in this list, will be useful later (doing it -# here as it is close to the EXOT273SmartContainers declaration which is what -# ensures that they will be added to the output). -OutputSmallRJets = ["AntiKt4EMTopoJets", "AntiKt4EMPFlowJets"] - - -if DerivationFrameworkIsMonteCarlo: - EXOT273AllVariables += [ - "TruthParticles", - "TruthVertices", - "MET_Truth", - ] -EXOT273ExtraVariables["TauJets"].update(["truthJetLink", "truthParticleLink", - "ptDetectorAxis", "etaDetectorAxis", "mDetectorAxis"]) -def outputContainer(container, warnIfNotSmart=True): - if container in EXOT273SmartContainers + EXOT273AllVariables: - logger.debug("Container '{0}' already requested for output!") - return - if container in FullListOfSmartContainers: - EXOT273SmartContainers.append(container) - else: - if warnIfNotSmart: - logger.warning( - "Container '{0}' added but not in smart lists!".format(container) ) - logger.warning("Will be added to AllVariables - could inflate the size!") - EXOT273AllVariables.append(container) - - -################################################################################ -# Setup preliminary skimming (remove whole events) -################################################################################ -# NOTE: -# I've split the skimming into two parts, one which can be run before the more -# CPU intensive operations (e.g. custom jet finding) and one which has to run -# after those -# This section is just for the preliminary skimming -EXOT273PreliminarySkimmingTools = [] - -# trigger selection -trigger_all_periods = ( - TriggerPeriod.y2015 | TriggerPeriod.y2016 | TriggerPeriod.y2017 - | TriggerPeriod.y2018 | TriggerPeriod.future2e34) -# Set live fraction to 0.95 to catch any short, accidental prescales -trigger_list = TriggerAPI.getLowestUnprescaledAnyPeriod( - trigger_all_periods, - triggerType = TriggerType.xe | TriggerType.el | TriggerType.mu | TriggerType.g, - livefraction = 0.95) -EXOT273TriggerSkimmingTool = DerivationFramework__TriggerSkimmingTool( - "EXOT273TriggerSkimmingTool", - TriggerListOR = trigger_list - ) -EXOT273PreliminarySkimmingTools.append(EXOT273TriggerSkimmingTool) - -# Add the tools to the ToolSvc -for tool in EXOT273PreliminarySkimmingTools: - ToolSvc += tool - -EXOT273Seq += CfgMgr.DerivationFramework__DerivationKernel( - "EXOT273PreliminaryKernel", - SkimmingTools = EXOT273PreliminarySkimmingTools - ) - -################################################################################ -# Augmenting (add new objects) -################################################################################ -# Create the new jet sequence in JetCommon (if it doesn't already exist) -JetCommon.OutputJets.setdefault("EXOT273Jets", []) -# Create the VR track jets -# Use buildVRJets instead of addVRJets so we can manually control the ghost -# association to the large-R jets -# do_ghost is ghost *tagging* - future improvement, not yet calibrated -vrTrackJets, vrTrackJetGhosts = HbbCommon.buildVRJets( - sequence = EXOT273Seq, do_ghost = False, logger = logger) -JetCommon.OutputJets["EXOT273Jets"].append(vrTrackJets+"Jets") -vrGhostTagTrackJets, vrGhostTagTrackJetsGhosts = HbbCommon.buildVRJets( - sequence = EXOT273Seq, do_ghost = True, logger = logger) -JetCommon.OutputJets["EXOT273Jets"].append(vrGhostTagTrackJets+"Jets") - -# We need the AntiKt10LCTopo jets here though so that the trimmed jets are -# produced correctly -# *Something* is asking for the pseudo jet getters for the FR track jets so I'm -# still producing them, just not outputting them. -replace_jet_list = [ - "AntiKt2PV0TrackJets", - "AntiKt4PV0TrackJets", - "AntiKt10LCTopoJets"] -if JetCommon.jetFlags.useTruth: - replace_jet_list += ["AntiKt4TruthJets"] -ExtendedJetCommon.replaceAODReducedJets( - jetlist=replace_jet_list, sequence=EXOT273Seq, outputlist="EXOT273Jets") - - -# Includes the 5% pT trimmed R=1.0 jets -ExtendedJetCommon.addDefaultTrimmedJets(EXOT273Seq, "EXOT273Jets") - -# Add the default VR calo jets (rho=600 GeV) -HbbCommon.addVRCaloJets(EXOT273Seq, "EXOT273Jets") - -# add akt2 -JetCommon.addStandardJets("AntiKt",0.2,"LCTopo", mods="lctopo_ungroomed", calibOpt="none", ghostArea=0.01, ptmin=2000, ptminFilter=7000, algseq=EXOT273Seq, outputGroup="EXOT273") - -# add akt2 jet calibration -ExtendedJetCommon.applyJetCalibration_CustomColl("AntiKt2LCTopo", EXOT273Seq) - -# Add the default soft drop collection -# Note that this function is a little eager - builds the jets with the VR ghost -# tag jets already in place! -ExtendedJetCommon.addCSSKSoftDropJets(EXOT273Seq, "EXOT273Jets") - -EXOT273ExtraVariables["AntiKt2LCTopoJets"].update([ - "Width", - "GhostBQuarksFinal", - "GhostTrack", - "GhostTrackCount", - ]) - -OutputLargeR = [ - "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets", - "AntiKtVR600Rmax10Rmin2LCTopoTrimmedPtFrac5SmallR20Jets", - "AntiKt10LCTopoCSSKSoftDropBeta100Zcut10Jets", - ] -# XAMPP seems to use the 'Width' variable from these? -for lrj in OutputLargeR: - EXOT273ExtraVariables[lrj].update([ - "Width", - "GhostBQuarksFinal", - ]) -OutputLargeRParent = [ - "AntiKt10LCTopoJets", - "AntiKtVR600Rmax10Rmin2LCTopoJets", - "AntiKt10LCTopoCSSKJets" - ] -for lrj in OutputLargeRParent: - EXOT273ExtraVariables[lrj].update(["GhostBQuarksFinal"]) - -# Ghost-associated the track jets to these large-R jets -toBeAssociatedTo = [ - "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets", - "AntiKtVR600Rmax10Rmin2LCTopoTrimmedPtFrac5SmallR20Jets", - ] -toAssociate = { - vrTrackJetGhosts : vrTrackJetGhosts.lower(), - vrGhostTagTrackJetsGhosts : vrGhostTagTrackJetsGhosts.lower() -} -for collection in toBeAssociatedTo: - ungroomed, labels = EXOT273Utils.linkPseudoJetGettersToExistingJetCollection( - EXOT273Seq, collection, toAssociate) - EXOT273ExtraVariables[ungroomed].update(labels) -# Link the SoftDrop jets *only* to the non-ghost tag jets. The other links -# already exist and will cause a crash if scheduled again - -ungroomed, labels = EXOT273Utils.linkPseudoJetGettersToExistingJetCollection( - EXOT273Seq, "AntiKt10LCTopoCSSKSoftDropBeta100Zcut10Jets", - {vrTrackJetGhosts : vrTrackJetGhosts.lower()}) -# However, we still want to write out both so add both to the extra variables -EXOT273ExtraVariables[ungroomed].update(labels) -EXOT273ExtraVariables[ungroomed].update([vrGhostTagTrackJetsGhosts]) - -# Alias b-tagging container for VR track jets -BTaggingFlags.CalibrationChannelAliases += ["AntiKtVR30Rmax4Rmin02Track->AntiKtVR30Rmax4Rmin02Track,AntiKt4EMTopo"] -# Schedule for output -outputContainer("BTagging_AntiKtVR30Rmax4Rmin02Track") - -# Add in Xbb tagging variables -HbbCommon.addRecommendedXbbTaggers(EXOT273Seq, ToolSvc, logger=logger) -# Add the new variables too -for extra in HbbCommon.xbbTaggerExtraVariables: - partition = extra.partition('.') - EXOT273ExtraVariables[partition[0]].update(partition[2].split('.') ) - -################################################################################ -# Setup augmentation (add new decorations to objects) -################################################################################ -EXOT273AugmentationTools = [] - -EXOT273TrackSelection = DerivationFramework__InDetTrackSelectionToolWrapper(name = "EXOT273TrackSelection", - ContainerName = "InDetTrackParticles", - DecorationName = "EXOT273DFLoose" ) - -EXOT273TrackSelection.TrackSelectionTool.CutLevel = "Loose" -ToolSvc += EXOT273TrackSelection - -EXOT273AugmentationTools.append(EXOT273TrackSelection) - -################################################################################ -# Setup thinning (remove objects from collections) -################################################################################ -EXOT273ThinningHelper = ThinningHelper("EXOT273ThinningHelper") -# Thin the navigation with the chains we're interested in -EXOT273ThinningHelper.TriggerChains = "|".join(trigger_list) -EXOT273ThinningHelper.AppendToStream(EXOT273Stream) -EXOT273ThinningTools = [] - -# Apply a pt cut on output large r jet collections -# TODO - revisit if this is harmful/necessary -for large_r in OutputLargeR: - EXOT273ThinningTools.append(DerivationFramework__GenericObjectThinning( - "EXOT273{0}ThinningTool".format(large_r), - ThinningService = EXOT273ThinningHelper.ThinningSvc(), - SelectionString = "{0}.pt > 100*GeV".format(large_r), - ContainerName = large_r) ) - -EXOT273Akt2Jet = "(AntiKt2LCTopoJets.pt > 18*GeV) && (abs(AntiKt2LCTopoJets.eta) < 2.5)" - -EXOT273Akt10JetDeltaRAkt2JetThinning = DeltaRThinningTool( - "EXOT273Akt10JetDeltaRAkt2JetThinning", - ThinningService = EXOT273ThinningHelper.ThinningSvc(), - SGKey = "AntiKt2LCTopoJets", - ConeSize = 1.4, - ApplyAnd = True) - -ToolSvc += EXOT273Akt10JetDeltaRAkt2JetThinning - -EXOT273ThinningTools += [ - DerivationFramework__GenericObjectThinning( - "EXOT273AntiKt2LCTopoJetsThinningTool", - ThinningService = EXOT273ThinningHelper.ThinningSvc(), - SelectionString = EXOT273Akt2Jet, - ContainerName = "AntiKt2LCTopoJets", - ApplyAnd = True - ), - ThinAssociatedObjectsTool( - "EXOT273AKt10JetAkt2JetThinningTool", - ThinningService = EXOT273ThinningHelper.ThinningSvc(), - SGKey = "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets", - SelectionString = "(AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets.pt > 150*GeV) && (abs(AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets.eta) < 2.2)", - ChildThinningTools = [EXOT273Akt10JetDeltaRAkt2JetThinning], - ), - ] - -EXOT273BaselineElectron = "Electrons.DFCommonElectronsLHLooseBL" -EXOT273BaselineMuon = "Muons.DFCommonGoodMuon && Muons.DFCommonMuonsPreselection" -EXOT273BaselinePhoton = "Photons.pt > 15.*GeV && Photons.DFCommonPhotonsIsEMTight" -EXOT273BaselineTauJet = "TauJets.pt > 10.*GeV" -EXOT273SignalElectron = (EXOT273BaselineElectron + " && Electrons.DFCommonElectronsLHTight " - + "&& Electrons.pt > 20.*GeV") -EXOT273SignalMuon = EXOT273BaselineMuon + " && Muons.pt > 20.*GeV" -EXOT273SignalPhoton = EXOT273BaselinePhoton + " && Photons.pt > 100.*GeV" - -EXOT273BaselineTrack = "(InDetTrackParticles.EXOT273DFLoose) && (InDetTrackParticles.pt > 0.5*GeV) && (abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta) < 3.0*mm) && (InDetTrackParticles.d0 < 2.0*mm)" - -# JVEATCH: leaving this commented out instead of deleting during development -""" -EXOT273Akt2JetGhostTrackThinning = EleLinkThinningTool( - "EXOT273Akt2JetGhostTrackThinning", - ThinningService = EXOT273ThinningHelper.ThinningSvc(), - LinkName = "GhostTrack(InDetTrackParticles)", - ApplyAnd = True) - -ToolSvc += EXOT273Akt2JetGhostTrackThinning -""" -# Applying only DeltaR thinning and not EleLink thinning is fine as long as ConeSize -# is sufficiently large compared to the jet size. If it is reduced to something close -# to the size of the jet, there is no guarantee that all ghost-associated tracks will -# be picked up -EXOT273Akt2JetDeltaRTrackThinning = DeltaRThinningTool( - "EXOT273Akt2JetDeltaRTrackThinning", - ThinningService = EXOT273ThinningHelper.ThinningSvc(), - SGKey = "InDetTrackParticles", - ConeSize = 0.3, - ApplyAnd = True) - -ToolSvc += EXOT273Akt2JetDeltaRTrackThinning - -# Set up the track thinning tools -EXOT273ThinningTools += [ - DerivationFramework__TrackParticleThinning( - "EXOT273TrackParticleThinningTool", - ThinningService = EXOT273ThinningHelper.ThinningSvc(), - SelectionString = EXOT273BaselineTrack, - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True, - ), - ThinAssociatedObjectsTool( - "EXOT273AKt2JetTPThinningTool", - ThinningService = EXOT273ThinningHelper.ThinningSvc(), - SGKey = "AntiKt2LCTopoJets", - ChildThinningTools = [EXOT273Akt2JetDeltaRTrackThinning], - ), - DerivationFramework__EgammaTrackParticleThinning( - "EXOT273ElectronTrackParticleThinningTool", - ThinningService = EXOT273ThinningHelper.ThinningSvc(), - SGKey = "Electrons", - SelectionString = EXOT273BaselineElectron, - ), - DerivationFramework__EgammaTrackParticleThinning( - "EXOT273PhotonTrackParticleThinningTool", - ThinningService = EXOT273ThinningHelper.ThinningSvc(), - SGKey = "Photons", - SelectionString = EXOT273BaselinePhoton, - ), - DerivationFramework__MuonTrackParticleThinning( - "EXOT273MuonTrackParticleThinningTool", - ThinningService = EXOT273ThinningHelper.ThinningSvc(), - MuonKey = "Muons", - ), - DerivationFramework__TauTrackParticleThinning( - "EXOT273TauTrackParticleThinningTool", - ThinningService = EXOT273ThinningHelper.ThinningSvc(), - TauKey = "TauJets", - SelectionString = EXOT273BaselineTauJet, - ), -] - -# Also thin the output objects by the same rules -EXOT273ThinningTools += [ - DerivationFramework__GenericObjectThinning( - "EXOT273ElectronsThinningTool", - ThinningService = EXOT273ThinningHelper.ThinningSvc(), - SelectionString = EXOT273BaselineElectron, - ContainerName = "Electrons"), - DerivationFramework__GenericObjectThinning( - "EXOT273PhotonsThinningTool", - ThinningService = EXOT273ThinningHelper.ThinningSvc(), - SelectionString = EXOT273BaselinePhoton, - ContainerName = "Photons"), - DerivationFramework__GenericObjectThinning( - "EXOT273TauJetsThinningTool", - ThinningService = EXOT273ThinningHelper.ThinningSvc(), - SelectionString = EXOT273BaselineTauJet, - ContainerName = "TauJets"), - ] - - -# TODO (perhaps): truth thinning -# What I have here is extremely simplistic - designed to at least have what I -# need for my immediate studies and (by inspection) what is used by XAMPP truth -# code -if DerivationFrameworkIsMonteCarlo: - truth_with_descendants = [6, 23, 24, 25, 54] # pdg id 54: scalar particle in mono-scalar signal model - truth_sel_with_descendants = "||".join(map("(abs(TruthParticles.pdgId) == {0})".format, truth_with_descendants) ) - EXOT273ThinningTools += [ - DerivationFramework__GenericTruthThinning( - "EXOT273TruthDescendantsThinningTool", - ThinningService = EXOT273ThinningHelper.ThinningSvc(), - ParticleSelectionString = truth_sel_with_descendants, - PreserveDescendants = True), - ] - truth_no_descendants = [5, 11, 12, 13, 14, 15, 16, 17, 18, 55] # pdg id 55: Z' boson in mono-scalar signal model - truth_sel_no_descendants = "||".join(map("(abs(TruthParticles.pdgId) == {0})".format, truth_no_descendants) ) - EXOT273ThinningTools += [ - DerivationFramework__GenericTruthThinning( - "EXOT273TruthNoDescendantsThinningTool", - ThinningService = EXOT273ThinningHelper.ThinningSvc(), - ParticleSelectionString = truth_sel_no_descendants, - PreserveDescendants = False), - ] - -for tool in EXOT273ThinningTools: - ToolSvc += tool - - -################################################################################ -# Setup secondary skimming (remove whole events) -################################################################################ -EXOT273SkimmingTools = [] -# string selection -sel_list = [] -# Common SR selection -# Resolved requirement - analysis level selection is 1 central jet with pT > 45 -# GeV. Use 30 GeV and |eta| < 2.8 to allow for future differences in calibration -sel_list += [("count(({0}.DFCommonJets_Calib_pt > 30.*GeV) && " + - "(abs({0}.DFCommonJets_Calib_eta) < 2.8)) >= 1").format(jets) - for jets in ["AntiKt4EMTopoJets"] ] - -# NB - this selection is only applied to the TopoJets as the PFlow jets don't -# have the DFCommonJets_Calib_* decorations. Is this going to be an issue? Do we -# need to remove this whole part of the preselection? -# NB - this selection is almost comically loose - is there really nothing -# tighter we can apply? - - -# Merged requirement - analysis level selection is 1 central large-R jet with pT -# > 200 GeV. Use 100 GeV and |eta| < 2.4 to allow for future differences in -# calibration. Do this for all of the large-R jet collections that are output -sel_list += ["count(({0}.pt > 100.*GeV) && (abs({0}.eta) < 2.4)) >= 1".format( - lrj) for lrj in OutputLargeR] - -# This incantation gives us an OR'd string, encasing each expression in brackets -# to ensure that everything works as expected -sel_string = " || ".join(map("({0})".format, sel_list) ) -if sel_string: - # Empty strings are falsey so this will only be executed if sel_list - # contained something - EXOT273StringSkimmingTool = DerivationFramework__xAODStringSkimmingTool( - "EXOT273JetSkimmingTool", - expression = sel_string - ) - EXOT273SkimmingTools.append(EXOT273StringSkimmingTool) - -# Add additional skimming for events passing lepton and photon triggers -# Ideally we would add similar requirements for events passing the MET triggers -# but I don't know how far I trust the resolution on the reference MET -# collection. If we find that the size is still too great we can look at it. -EXOT273SkimmingORTools = [] -# The lepton triggers are only used for the 2l control regions (1l is MET -# trigger) -# These regions require >=1 signal lepton && >=2 baseline leptons -# Electrons: -ToolSvc += DerivationFramework__TriggerSkimmingTool( - "EXOT273EleTriggerSkimmingTool", - TriggerListOR = TriggerAPI.getLowestUnprescaledAnyPeriod( - trigger_all_periods, - triggerType = TriggerType.el, - livefraction = 0.95) ) -ToolSvc += DerivationFramework__xAODStringSkimmingTool( - "EXOT273EleOfflineSkimmingTool", - expression = " && ".join(map("({0})".format, [ - "count("+EXOT273BaselineElectron+") >= 2", - "count("+EXOT273SignalElectron+") >= 1"]) ) ) -EXOT273SkimmingORTools.append(DerivationFramework__FilterCombinationAND( - "EXOT273EleChannelSkim", - FilterList=[ - ToolSvc.EXOT273EleTriggerSkimmingTool, - ToolSvc.EXOT273EleOfflineSkimmingTool]) ) - -# Muons: -ToolSvc += DerivationFramework__TriggerSkimmingTool( - "EXOT273MuonTriggerSkimmingTool", - TriggerListOR = TriggerAPI.getLowestUnprescaledAnyPeriod( - trigger_all_periods, - triggerType = TriggerType.mu, - livefraction = 0.95) ) -ToolSvc += DerivationFramework__xAODStringSkimmingTool( - "EXOT273MuonOfflineSkimmingTool", - expression = " && ".join(map("({0})".format, [ - "count("+EXOT273BaselineMuon+") >= 2", - "count("+EXOT273SignalMuon+") >= 1"]) ) ) -EXOT273SkimmingORTools.append(DerivationFramework__FilterCombinationAND( - "EXOT273MuonChannelSkim", - FilterList=[ - ToolSvc.EXOT273MuonTriggerSkimmingTool, - ToolSvc.EXOT273MuonOfflineSkimmingTool]) ) - -# Photons: -ToolSvc += DerivationFramework__TriggerSkimmingTool( - "EXOT273PhotonTriggerSkimmingTool", - TriggerListOR = TriggerAPI.getLowestUnprescaledAnyPeriod( - trigger_all_periods, - triggerType = TriggerType.g, - livefraction = 0.95) ) -ToolSvc += DerivationFramework__xAODStringSkimmingTool( - "EXOT273PhotonOfflineSkimmingTool", - expression = "count("+EXOT273SignalPhoton+") >= 1") -EXOT273SkimmingORTools.append(DerivationFramework__FilterCombinationAND( - "EXOT273PhotonChannelSkim", - FilterList=[ - ToolSvc.EXOT273PhotonTriggerSkimmingTool, - ToolSvc.EXOT273PhotonOfflineSkimmingTool]) ) - -# Apply no extra selection to events passing the MET trigger -EXOT273SkimmingORTools.append(DerivationFramework__TriggerSkimmingTool( - "EXOT273METTriggerSkimmingTool", - TriggerListOR = TriggerAPI.getLowestUnprescaledAnyPeriod( - trigger_all_periods, - triggerType = TriggerType.xe, - livefraction = 0.95) ) ) - -for tool in EXOT273SkimmingORTools: - ToolSvc += tool - -EXOT273SkimmingTools.append(DerivationFramework__FilterCombinationOR( - "EXOTTriggerChannelORTool", - FilterList = EXOT273SkimmingORTools) ) - -for tool in EXOT273SkimmingTools: - ToolSvc += tool - -EXOT273Seq += CfgMgr.DerivationFramework__DerivationKernel( - "EXOT273SecondaryKernel", - SkimmingTools = EXOT273SkimmingTools, - AugmentationTools = EXOT273AugmentationTools, - ThinningTools = EXOT273ThinningTools - ) - - - - -################################################################################ -# Setup slimming (remove variables/collections) -################################################################################ -EXOT273SlimmingHelper = SlimmingHelper("EXOT273SlimmingHelper") -EXOT273SlimmingHelper.SmartCollections += EXOT273SmartContainers -EXOT273SlimmingHelper.AllVariables += EXOT273AllVariables -logger.info("EXOT273Jets: {0}".format(JetCommon.OutputJets["EXOT273Jets"]) ) -for alg in EXOT273Seq: - logger.info("Alg: {0}".format(alg) ) -JetCommon.addJetOutputs( - slimhelper = EXOT273SlimmingHelper, - contentlist=["EXOT273Jets"], - smartlist = [ - "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets", - "AntiKt10LCTopoCSSKSoftDropBeta100Zcut10Jets", - "AntiKt2LCTopoJets", - ], - vetolist = [ - "AntiKt2PV0TrackJets", - "AntiKt4PV0TrackJets", - "AntiKt10LCTopoJets", - "AntiKt10TruthJets", - "AntiKtVR600Rmax10Rmin2LCTopoJets", - "AntiKtVR600Rmax10Rmin2PV0TrackTrimmedPtFrac5SmallR20Jets", - "AntiKtVR600Rmax10Rmin2TruthTrimmedPtFrac5SmallR20Jets", - "AntiKt10LCTopoCSSKJets"] - ) - -EXOT273SlimmingHelper.ExtraVariables += [ - "{0}.{1}".format(k, '.'.join(v) ) for k, v in EXOT273ExtraVariables.iteritems() -] - -EXOT273SlimmingHelper.AppendToDictionary = { - "AntiKtVR600Rmax10Rmin2LCTopoJets" : "xAOD::JetContainer", - "AntiKtVR600Rmax10Rmin2LCTopoJetsAux" : "xAOD::JetAuxContainer", - "AntiKtVR600Rmax10Rmin2LCTopoTrimmedPtFrac5SmallR20Jets" : "xAOD::JetContainer", - "AntiKtVR600Rmax10Rmin2LCTopoTrimmedPtFrac5SmallR20JetsAux" : "xAOD::JetAuxContainer", - } - -EXOT273SlimmingHelper.IncludeMuonTriggerContent = True -EXOT273SlimmingHelper.IncludeEGammaTriggerContent = True -EXOT273SlimmingHelper.IncludeEtMissTriggerContent = True -EXOT273SlimmingHelper.AppendContentToStream(EXOT273Stream) - -################################################################################ -# Finalise -################################################################################ -# Any remaining tasks, e.g. adding the kernels to the stream -EXOT273Stream.AcceptAlgs(["EXOT273SecondaryKernel"]) -- GitLab From 23225880330434422071f46262bf9633062a1fad Mon Sep 17 00:00:00 2001 From: Jason Veatch Date: Mon, 18 Feb 2019 13:20:00 +0100 Subject: [PATCH 19/21] Adding minor fixes to DeltaRTool --- .../DerivationFrameworkTools/src/DeltaRTool.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTools/src/DeltaRTool.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTools/src/DeltaRTool.cxx index 72bfd152e3e..a78c59b00a3 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTools/src/DeltaRTool.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTools/src/DeltaRTool.cxx @@ -132,7 +132,7 @@ namespace DerivationFramework { } } - // Double loop to get the pairs for which the mass should be calculated + // Double loop to get the pairs for which the deltaRs should be calculated std::vector > pairs; if (!secondContainer) { unsigned int outerIt, innerIt; @@ -160,13 +160,13 @@ namespace DerivationFramework { } } - // Loop over the pairs; calculate the mass; put into vector and return + // Loop over the pairs; calculate the deltaR; put into vector and return std::vector >::iterator pairIt; for (pairIt=pairs.begin(); pairIt!=pairs.end(); ++pairIt) { unsigned int first = (*pairIt)[0]; unsigned int second = (*pairIt)[1]; if (!secondContainer) { - float phi1f = ((*particles)[first])->p4().Phi(); float phi2f = ((*particles)[second])->p4().Phi(); + float phi1f = ((*particles)[first])->p4().Phi(); float phi2f = ((*particles)[second])->p4().Phi(); float eta1f = ((*particles)[first])->p4().Eta(); float eta2f = ((*particles)[second])->p4().Eta(); float deltaR = calculateDeltaR(phi1f,phi2f,eta1f,eta2f); deltaRs->push_back(deltaR); -- GitLab From 72d44903dee500fef186ee848aca062f95fc5ad0 Mon Sep 17 00:00:00 2001 From: Jason Veatch Date: Mon, 18 Feb 2019 13:51:20 +0100 Subject: [PATCH 20/21] Fixing Tau bug --- .../DerivationFrameworkExotics/share/EXOT27.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py index 70c6f59d2b9..00d34fe5bf0 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT27.py @@ -35,7 +35,7 @@ import DerivationFrameworkJetEtMiss.ExtendedJetCommon as ExtendedJetCommon import DerivationFrameworkJetEtMiss.METCommon as METCommon import DerivationFrameworkEGamma.EGammaCommon as EGammaCommon import DerivationFrameworkMuons.MuonsCommon as MuonsCommon -import DerivationFrameworkTaus.TausCommon as TausCommon +import DerivationFrameworkTau.TauCommon as TauCommon import DerivationFrameworkFlavourTag.HbbCommon as HbbCommon import DerivationFrameworkInDet.InDetCommon as InDetCommon from JetRec.JetRecStandardToolManager import jtm -- GitLab From 8ba949ffb3bf9e5a5ab90120233ea10031f1906d Mon Sep 17 00:00:00 2001 From: Jason Veatch Date: Mon, 18 Feb 2019 13:51:48 +0100 Subject: [PATCH 21/21] Making spacing consistent --- .../python/ContainersOnTheFly.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/ContainersOnTheFly.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/ContainersOnTheFly.py index 402c19bd862..009f8244020 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/ContainersOnTheFly.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/ContainersOnTheFly.py @@ -22,16 +22,16 @@ ContainersOnTheFly = [ ["AntiKtVR30Rmax4Rmin02TrackJetsAux","xAOD::JetAuxContainer"], ["AntiKtVR30Rmax4Rmin02TrackGhostTagJets","xAOD::JetContainer"], ["AntiKtVR30Rmax4Rmin02TrackGhostTagJetsAux","xAOD::JetAuxContainer"], - ["AntiKt10LCTopoTrimmedPtFrac5SmallR20ExKt2SubJets","xAOD::JetContainer"], - ["AntiKt10LCTopoTrimmedPtFrac5SmallR20ExKt2SubJetsAux","xAOD::JetAuxContainer"], - ["AntiKt10LCTopoTrimmedPtFrac5SmallR20ExKt3SubJets","xAOD::JetContainer"], - ["AntiKt10LCTopoTrimmedPtFrac5SmallR20ExKt3SubJetsAux","xAOD::JetAuxContainer"], + ["AntiKt10LCTopoTrimmedPtFrac5SmallR20ExKt2SubJets","xAOD::JetContainer"], + ["AntiKt10LCTopoTrimmedPtFrac5SmallR20ExKt2SubJetsAux","xAOD::JetAuxContainer"], + ["AntiKt10LCTopoTrimmedPtFrac5SmallR20ExKt3SubJets","xAOD::JetContainer"], + ["AntiKt10LCTopoTrimmedPtFrac5SmallR20ExKt3SubJetsAux","xAOD::JetAuxContainer"], ["AntiKt10LCTopoTrimmedPtFrac5SmallR20ExKt2GASubJets","xAOD::JetContainer"], ["AntiKt10LCTopoTrimmedPtFrac5SmallR20ExKt2GASubJetsAux","xAOD::JetAuxContainer"], ["AntiKt10LCTopoTrimmedPtFrac5SmallR20ExKt3GASubJets","xAOD::JetContainer"], ["AntiKt10LCTopoTrimmedPtFrac5SmallR20ExKt3GASubJetsAux","xAOD::JetAuxContainer"], - ["AntiKt10LCTopoTrimmedPtFrac5SmallR20ExCoM2SubJets","xAOD::JetContainer"], - ["AntiKt10LCTopoTrimmedPtFrac5SmallR20ExCoM2SubJetsAux","xAOD::JetAuxContainer"], + ["AntiKt10LCTopoTrimmedPtFrac5SmallR20ExCoM2SubJets","xAOD::JetContainer"], + ["AntiKt10LCTopoTrimmedPtFrac5SmallR20ExCoM2SubJetsAux","xAOD::JetAuxContainer"], ["AntiKt2LCTopoJets","xAOD::JetContainer"], ["AntiKt2LCTopoJetsAux","xAOD::JetAuxContainer"], ["AntiKt4TruthJets","xAOD::JetContainer"], -- GitLab