From 6c9f987d92b54d687459eda731d67dbcf9e852ce Mon Sep 17 00:00:00 2001 From: cdelitzs <chris.malena.delitzsch@cern.ch> Date: Mon, 17 Aug 2020 10:33:57 +0200 Subject: [PATCH 1/2] Adding UFO large-R jets to PHYSLITE --- .../python/JetAnalysisSequence.py | 45 ++++++++++--------- .../DerivationFrameworkPhys/share/PHYS.py | 2 +- .../DerivationFrameworkPhys/share/PHYSLITE.py | 35 ++++++++++----- 3 files changed, 50 insertions(+), 32 deletions(-) diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetAnalysisSequence.py b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetAnalysisSequence.py index 030304c8910f..4976f8e774c2 100644 --- a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetAnalysisSequence.py +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetAnalysisSequence.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from __future__ import print_function @@ -84,7 +84,7 @@ def makeJetAnalysisSequence( dataType, jetCollection, postfix = '', # interpret the jet collection collection_pattern = re.compile( - r"AntiKt(\d+)(EMTopo|EMPFlow|LCTopo|TrackCaloCluster)(TrimmedPtFrac5SmallR20)?Jets") + r"AntiKt(\d+)(EMTopo|EMPFlow|LCTopo|TrackCaloCluster|UFOCSSK)(TrimmedPtFrac5SmallR20|SoftDropBeta100Zcut10)?Jets") match = collection_pattern.match(jetCollection) if not match: raise ValueError( @@ -111,7 +111,7 @@ def makeJetAnalysisSequence( dataType, jetCollection, postfix = '', # IsBtag decoration for Jet Flavour Uncertainties # (https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JetUncertaintiesRel21Summer2018SmallR) - if dataType != 'data': + if dataType != 'data' and radius is not 10: # Step 1: pt and eta selection alg = createAlgorithm('CP::AsgSelectionAlg', 'JetIsBtagPtEtaSelectionAlg'+postfix) addPrivateTool(alg, 'selectionTool', 'CP::AsgPtEtaSelectionTool') @@ -369,7 +369,7 @@ def makeLargeRJetAnalysisSequence( seq, dataType, jetCollection, if largeRMass not in ["Comb", "Calo", "TCC", "TA"]: raise ValueError ("Invalid large-R mass defintion {0}!".format(largeRMass) ) - if jetInput not in ["LCTopo", "TrackCaloCluster"]: + if jetInput not in ["LCTopo", "TrackCaloCluster", "UFOCSSK"]: raise ValueError ( "Unsupported input type '{0}' for large-R jets!".format(jetInput) ) if jetInput == "TrackCaloCluster": @@ -378,7 +378,7 @@ def makeLargeRJetAnalysisSequence( seq, dataType, jetCollection, raise ValueError( "Unsupported large-R TCC jet mass '{0}'!".format(largeRMass) ) configFile = "JES_MC16recommendation_FatJet_TCC_JMS_calo_30Oct2018.config" - else: + elif jetInput == "LCTopo": if largeRMass == "Comb": configFile = "JES_MC16recommendation_FatJet_Trimmed_JMS_comb_17Oct2018.config" elif largeRMass == "Calo": @@ -387,6 +387,9 @@ def makeLargeRJetAnalysisSequence( seq, dataType, jetCollection, configFile = "JES_MC16recommendation_FatJet_TCC_JMS_calo_30Oct2018.config" else: configFile = "JES_MC16recommendation_FatJet_Trimmed_JMS_TA_12Oct2018.config" + else: + configFile = "JES_MC16recommendation_R10_UFO_CSSK_SoftDrop_JMS_01April2020.config" + # Prepare the jet calibration algorithm alg = createAlgorithm( 'CP::JetCalibrationAlg', 'JetCalibrationAlg'+postfix ) addPrivateTool( alg, 'calibrationTool', 'JetCalibrationTool' ) @@ -396,18 +399,20 @@ def makeLargeRJetAnalysisSequence( seq, dataType, jetCollection, alg.calibrationTool.IsData = 0 seq.append( alg, inputPropName = 'jets', outputPropName = 'jetsOut', stageName = 'calibration' ) - # Jet uncertainties - alg = createAlgorithm( 'CP::JetUncertaintiesAlg', 'JetUncertaintiesAlg'+postfix ) - # R=1.0 jets have a validity range - alg.outOfValidity = 2 # SILENT - alg.outOfValidityDeco = 'outOfValidity' - addPrivateTool( alg, 'uncertaintiesTool', 'JetUncertaintiesTool' ) - alg.uncertaintiesTool.JetDefinition = jetCollection[:-4] - alg.uncertaintiesTool.ConfigFile = \ - "rel21/Moriond2018/R10_{0}Mass_all.config".format(largeRMass) - alg.uncertaintiesTool.MCType = "MC16a" - alg.uncertaintiesTool.IsData = (dataType == "data") - seq.append( alg, inputPropName = 'jets', outputPropName = 'jetsOut', - affectingSystematics = largeRSysts, stageName = 'calibration', - metaConfig = {'selectionDecorNames' : ['outOfValidity'], - 'selectionDecorCount' : [1]} ) + if jetInput == "LCToop": + # Jet uncertainties + alg = createAlgorithm( 'CP::JetUncertaintiesAlg', 'JetUncertaintiesAlg'+postfix ) + # R=1.0 jets have a validity range + alg.outOfValidity = 2 # SILENT + alg.outOfValidityDeco = 'outOfValidity' + addPrivateTool( alg, 'uncertaintiesTool', 'JetUncertaintiesTool' ) + alg.uncertaintiesTool.JetDefinition = jetCollection[:-4] + alg.uncertaintiesTool.ConfigFile = "rel21/Moriond2018/R10_{0}Mass_all.config".format(largeRMass) + alg.uncertaintiesTool.MCType = "MC16a" + alg.uncertaintiesTool.IsData = (dataType == "data") + seq.append( alg, inputPropName = 'jets', outputPropName = 'jetsOut', + affectingSystematics = largeRSysts, stageName = 'calibration', + metaConfig = {'selectionDecorNames' : ['outOfValidity'], + 'selectionDecorCount' : [1]} ) + + return seq diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYS.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYS.py index ae321dd6a107..0b0b87b713f6 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYS.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYS.py @@ -188,7 +188,7 @@ if (DerivationFrameworkIsMonteCarlo): replaceAODReducedJets(reducedJetList,SeqPHYS,"PHYS") add_largeR_truth_jets = DerivationFrameworkIsMonteCarlo and not hasattr(SeqPHYS,'jetalgAntiKt10TruthTrimmedPtFrac5SmallR20') addDefaultTrimmedJets(SeqPHYS,"PHYS",dotruth=add_largeR_truth_jets) -add_largeR_truth_SD_jets = DerivationFrameworkIsMonteCarlo and not hasattr(SeqPHYS,'jetalgAntiKt10UFOCSSKSoftDropBeta100Zcut10') +add_largeR_truth_SD_jets = DerivationFrameworkIsMonteCarlo and not hasattr(SeqPHYS,'jetalgAntiKt10TruthSoftDropBeta100Zcut10') addDefaultUFOSoftDropJets(SeqPHYS,"PHYS",dotruth=add_largeR_truth_SD_jets) # Add large-R jet truth labeling diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYSLITE.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYSLITE.py index 0970d0f0d2e1..b2105effe858 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYSLITE.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYSLITE.py @@ -207,15 +207,15 @@ thinningTools.append(PHYSLITEVertexThinningTool) #============================================================================== # Jet building #============================================================================== -OutputJets["PHYSLITE"] = ["AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets"] +OutputJets["PHYSLITE"] = ["AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets"] reducedJetList = ["AntiKt2PV0TrackJets","AntiKt4PV0TrackJets"] if (DerivationFrameworkIsMonteCarlo): - OutputJets["PHYSLITE"].append("AntiKt10TruthTrimmedPtFrac5SmallR20Jets") + OutputJets["PHYSLITE"].append("AntiKt10TruthSoftDropBeta100Zcut10Jets") replaceAODReducedJets(reducedJetList,SeqPHYSLITE,"PHYSLITE") -add_largeR_truth_jets = DerivationFrameworkIsMonteCarlo and not hasattr(SeqPHYSLITE,'jetalgAntiKt10TruthTrimmedPtFrac5SmallR20') -addDefaultTrimmedJets(SeqPHYSLITE,"PHYSLITE",dotruth=add_largeR_truth_jets) +add_largeR_truth_jets = DerivationFrameworkIsMonteCarlo and not hasattr(SeqPHYSLITE,'jetalgAntiKt10TruthSoftDropBeta100Zcut10') +addDefaultUFOSoftDropJets(SeqPHYSLITE,"PHYSLITE",dotruth=add_largeR_truth_jets) # Rebuild the PFlow jets for a consistent set of inputs to MET addCHSPFlowObjects() @@ -223,7 +223,7 @@ addStandardJets("AntiKt", 0.4, "EMPFlow", ptmin=5000, ptminFilter=10000, algseq= # Add large-R jet truth labeling if (DerivationFrameworkIsMonteCarlo): - addJetTruthLabel(jetalg="AntiKt10LCTopoTrimmedPtFrac5SmallR20",sequence=SeqPHYSLITE,algname="JetTruthLabelingAlg",labelname="R10TruthLabel_R21Consolidated") + addJetTruthLabel(jetalg="AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets",sequence=SeqPHYSLITE,algname="JetTruthLabelingAlg",labelname="R10TruthLabel_R21Consolidated") # q/g discrimination addQGTaggerTool(jetalg="AntiKt4EMPFlow",sequence=SeqPHYSLITE,algname="QGTaggerToolPFAlg") @@ -234,15 +234,16 @@ getPFlowfJVT(jetalg='AntiKt4EMPFlow',sequence=SeqPHYSLITE, algname='PHYSLITEJetF #==================================================================== # Flavour tagging #==================================================================== -# Create variable-R trackjets and dress AntiKt10LCTopo with ghost VR-trkjet -addVRJets(SeqPHYSLITE) +# Create variable-R trackjets and dress AntiKt10UFOCSSKJets with ghost VR-trkjet +largeRJetCollections = ["AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets"] +addVRJets(SeqPHYSLITE,largeRJetCollections,training='201903') #addVRJetsTCC(DerivationFrameworkJob, "AntiKtVR30Rmax4Rmin02Track", "GhostVR30Rmax4Rmin02TrackJet", # VRJetAlg="AntiKt", VRJetRadius=0.4, VRJetInputs="pv0track", # ghostArea = 0 , ptmin = 2000, ptminFilter = 2000, # variableRMinRadius = 0.02, variableRMassScale = 30000, calibOpt = "none") -# add xbb taggers -from DerivationFrameworkFlavourTag.HbbCommon import addRecommendedXbbTaggers -addRecommendedXbbTaggers(SeqPHYSLITE, ToolSvc) +# add xbb taggers (not optimised yet for UFO SD jets) +#from DerivationFrameworkFlavourTag.HbbCommon import addRecommendedXbbTaggers +#addRecommendedXbbTaggers(SeqPHYSLITE, ToolSvc) FlavorTagInit(JetCollections = [ 'AntiKt4EMPFlowJets'], Sequencer = SeqPHYSLITE) @@ -321,6 +322,14 @@ print( jetSequence ) # For debugging SeqPHYSLITE += jetSequence +largeRJetContainer = 'AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets' + +# Include, and then set up the jet analysis algorithm sequence for large-radius jets +largeRJetSequence = makeJetAnalysisSequence(dataType, largeRJetContainer, postfix = 'largeR', deepCopyOutput = True, shallowViewOutput = False, runGhostMuonAssociation = False ) +largeRJetSequence.configure( inputName = largeRJetContainer, outputName = 'AnalysisLargeRJets' ) + +SeqPHYSLITE += largeRJetSequence + # Make sure the MET knows what we've done # Now build MET from our analysis objects from DerivationFrameworkJetEtMiss import METCommon @@ -437,11 +446,12 @@ PHYSLITESlimmingHelper.AppendToDictionary = { 'AnalysisElectrons':'xAOD::ElectronContainer', 'AnalysisElectronsAux':'xAOD::ElectronAuxContainer', 'AnalysisMuons':'xAOD::MuonContainer', 'AnalysisMuonsAux':'xAOD::MuonAuxContainer', 'AnalysisJets':'xAOD::JetContainer','AnalysisJetsAux':'xAOD::AuxContainerBase', + 'AnalysisLargeRJets':'xAOD::JetContainer','AnalysisLargeRJetsAux':'xAOD::AuxContainerBase', 'AnalysisPhotons':'xAOD::PhotonContainer', 'AnalysisPhotonsAux':'xAOD::PhotonAuxContainer', 'AnalysisTauJets':'xAOD::TauJetContainer', 'AnalysisTauJetsAux':'xAOD::TauJetAuxContainer', 'MET_Core_AnalysisMET':'xAOD::MissingETContainer', 'MET_Core_AnalysisMETAux':'xAOD::MissingETAuxContainer', 'METAssoc_AnalysisMET':'xAOD::MissingETAssociationMap', 'METAssoc_AnalysisMETAux':'xAOD::MissingETAuxAssociationMap', - 'AntiKt10TruthTrimmedPtFrac5SmallR20Jets':'xAOD::JetContainer', 'AntiKt10TruthTrimmedPtFrac5SmallR20JetsAux':'xAOD::JetAuxContainer', + 'AntiKt10TruthSoftDropBeta100Zcut10Jets':'xAOD::JetContainer', 'AntiKt10TruthSoftDropBeta100Zcut10JetsAux':'xAOD::JetAuxContainer' } # Leaving these as smart collections @@ -465,6 +475,9 @@ PHYSLITESlimmingHelper.ExtraVariables = [ "MuonSpectrometerTrackParticles.phi.d0.z0.vz.definingParametersCovMatrix.vertexLink.theta.qOverP.truthParticleLink", "AnalysisTauJets.pt.eta.phi.m.tauTrackLinks.jetLink.charge.isTauFlags.BDTJetScore.BDTEleScore.ptFinalCalib.etaFinalCalib.phiFinalCalib.mFinalCalib.electronLink.EleMatchLikelihoodScore.pt_combined.eta_combined.phi_combined.m_combined.BDTJetScoreSigTrans.BDTEleScoreSigTrans.PanTau_DecayMode.RNNJetScore.RNNJetScoreSigTrans.IsTruthMatched.truthOrigin.truthType.truthParticleLink.truthJetLink", "AnalysisJets.pt.eta.phi.m.JetConstitScaleMomentum_pt.JetConstitScaleMomentum_eta.JetConstitScaleMomentum_phi.JetConstitScaleMomentum_m.NumTrkPt500.SumPtTrkPt500.DetectorEta.Jvt.JVFCorr.JvtRpt.NumTrkPt1000.TrackWidthPt1000.GhostMuonSegmentCount.PartonTruthLabelID.ConeTruthLabelID.HadronConeExclExtendedTruthLabelID.HadronConeExclTruthLabelID.TrueFlavor.DFCommonJets_jetClean_LooseBad.DFCommonJets_jetClean_TightBad.Timing.btagging.btaggingLink.GhostTrack.DFCommonJets_fJvt.DFCommonJets_QGTagger_NTracks.DFCommonJets_QGTagger_TracksWidth.DFCommonJets_QGTagger_TracksC1.PSFrac.EMFrac.Width", + "AnalysisLargeRJets.JetConstitScaleMomentum_pt.JetConstitScaleMomentum_eta.JetConstitScaleMomentum_phi.JetConstitScaleMomentum_m.ECF1.ECF2.ECF3.Tau1_wta.Tau2_wta.Tau3_wta.Split12.Split23.Qw.PlanarFlow.FoxWolfram2.FoxWolfram0.Angularity.Aplanarity.KtDR.ZCut12.Parent.DetectorEta.DetectorY.GhostCHadronsFinalCount.GhostBHadronsFinalCount.R10TruthLabel_R21Consolidated", + "AntiKt10UFOCSSKJets.NumTrkPt500.GhostVR30Rmax4Rmin02TrackJet_BTagging201903", + "AntiKt10TruthSoftDropBeta100Zcut10Jets.pt.eta.phi.m.ECF1.ECF2.ECF3.Tau2_wta.Tau3_wta.Qw.GhostCHadronsFinalCount.GhostBHadronsFinalCount", "BTagging_AntiKt4EMPFlow_201903.DL1r_pu.DL1rmu_pu.DL1r_pb.DL1rmu_pb.DL1r_pc.DL1rmu_pc", "TruthPrimaryVertices.t.x.y.z", "MET_Core_AnalysisMET.name.mpx.mpy.sumet.source", -- GitLab From 93d8dfb8510662f29e8a6f62ce061281dc9c8689 Mon Sep 17 00:00:00 2001 From: cdelitzs <chris.malena.delitzsch@cern.ch> Date: Tue, 18 Aug 2020 09:43:17 +0200 Subject: [PATCH 2/2] Fix to which jets b-tagging will be applied --- .../JetAnalysisAlgorithms/python/JetAnalysisSequence.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetAnalysisSequence.py b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetAnalysisSequence.py index 4976f8e774c2..3bdc1d03c6cc 100644 --- a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetAnalysisSequence.py +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetAnalysisSequence.py @@ -111,7 +111,7 @@ def makeJetAnalysisSequence( dataType, jetCollection, postfix = '', # IsBtag decoration for Jet Flavour Uncertainties # (https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JetUncertaintiesRel21Summer2018SmallR) - if dataType != 'data' and radius is not 10: + if dataType != 'data' and radius < 10: # Step 1: pt and eta selection alg = createAlgorithm('CP::AsgSelectionAlg', 'JetIsBtagPtEtaSelectionAlg'+postfix) addPrivateTool(alg, 'selectionTool', 'CP::AsgPtEtaSelectionTool') @@ -399,7 +399,7 @@ def makeLargeRJetAnalysisSequence( seq, dataType, jetCollection, alg.calibrationTool.IsData = 0 seq.append( alg, inputPropName = 'jets', outputPropName = 'jetsOut', stageName = 'calibration' ) - if jetInput == "LCToop": + if jetInput == "LCTopo": # Jet uncertainties alg = createAlgorithm( 'CP::JetUncertaintiesAlg', 'JetUncertaintiesAlg'+postfix ) # R=1.0 jets have a validity range -- GitLab