diff --git a/Reconstruction/Jet/JetRec/python/FastJetInterfaceConfig.py b/Reconstruction/Jet/JetRec/python/FastJetInterfaceConfig.py deleted file mode 100644 index 26ce5e8a3f2621d6cd0def553a01a39b3a93fe92..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetRec/python/FastJetInterfaceConfig.py +++ /dev/null @@ -1,173 +0,0 @@ -# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration - - -from AthenaCommon.SystemOfUnits import GeV -from AthenaCommon.Logging import logging - -from JetRec.JetRecConf import FastJetInterfaceTool - -_fastjetLog = logging.getLogger("FastJetInterfaceConfiguration") - -# set up some enumerator values -def enums(name='Enum',**enums): - return type( name, (), enums) - -# recognized keys -fastjet_conf_tags = enums('FastJetConfTags', - Strategy=[ 'default', 'Best', - 'N2MinHeapTiled','N2Tiled', 'N2PoorTiled', 'N2Plain', - 'N3Dumb', - 'NlnN', 'NlnN3pi', 'NlnN4pi', 'NlnNCam4pi', 'NlnNCam2pi2R', 'NlNCam', - 'plugin_strategy' ], - RecombScheme = [ 'default', 'E', 'pt', 'pt2', 'Et', 'Et2', 'BIpt', 'BIpt2' ], - Algorithm = [ 'default', 'kt', 'Kt', 'anti-kt', 'AntiKt', 'cambridge', 'CamKt', - 'genkt', 'passive cambridge', 'passive genkt', - 'CMSCone', 'SISCone'], - JetAreaMethod = [ 'default', 'VoronoiArea', 'ActiveArea', - 'ActiveAreaExplicitGhost', 'PassiveArea', '1GhostPassiveArea' ], - SISSplitMergeScale = [ 'default', 'pttilde', 'PtTilde', 'Pt', 'Et', 'mt' ], - ) - -# Ghosted area parameters -fastjet_gas = enums('FastJetGhostAreaSettings', - def_ghost_maxrap = 6.0, #fastjet::gas::def_ghost_maxrap - def_repeat = 1, #fastjet::gas::def_repeat - def_ghost_area = 0.01, #fastjet::gas::def_ghost_area - def_grid_scatter = 1.0, #fastjet::gas::def_grid_scatter - def_kt_scatter = 0.1, #fastjet::gas::def_kt_scatter - def_mean_ghost_kt = 1e-100,#fastjet::gas::def_mean_ghost_kt - ) - -# ignored keys -config_ignored_keys = enums('SetupIgnoredKeys', - ControlKeys = ["_alreadyChecked_","_locked_","_ignoreUnknown_" ]) - -# Default FastJet configuration dictionary: -# -# Most keys are the same as the corresponding FastJet tags or enumerator names. -# In addition, for backward compatibility, the following tags are recognized: -# -# -defFastJetInterfaceConfigDict = { - # -- overall setup and process control - 'Algorithm' : "anti-kt", - 'JetAreaMethod' : "VoronoiArea", - 'CalculateJetArea' : False, - # -- kt-style parameters - 'Strategy' : "Best", - 'RecombScheme' : "E", - # -- CMS cone parameters - 'CMS_SeedThreshold' : 15.*GeV, - # -- SIS cone parameters - 'SIS_OverlapThreshold' : 0.75, - 'SIS_NumPassMax' : 0, - 'SIS_ProtojetPtMin' : 0.0, - 'SIS_DoCaching' : False, - 'SIS_SplitMergeScale' : 'PtTilde', - 'SIS_SplitMergeStopScale' : 0.0, - # -- jet algorithm parameters - 'Radius' : 0.4, # ATLAS default - 'Inclusive' : True, # ATLAS default - 'InclusivePtMin' : 0.*GeV, - 'ExclusiveDcut' : 0.5, - 'ExclusiveNjets' : 3, - # -- jet area calculation directives and parameters - 'VoronoiEffectiveRfact' : 1.0, # Voronoi - 'GhostMaxRapidity' : fastjet_gas.def_ghost_maxrap, - 'GhostMinRapidity' : -fastjet_gas.def_ghost_maxrap, - 'GhostRepeats' : fastjet_gas.def_repeat, - 'GhostAreaSize' : fastjet_gas.def_ghost_area, - 'GhostGridScatter' : fastjet_gas.def_grid_scatter, - 'GhostKtScatter' : fastjet_gas.def_kt_scatter, - 'GhostMeanKt' : fastjet_gas.def_mean_ghost_kt - } - -# Check whole dictionary or key/value assigments and return dictionary with -# invalid options stripped (if allowed) or exception thrown for invalid options -def checkAndUpdate(**options): - # already checked - if options.get("_alreadyChecked_",False) or options.get("_locked_",False): - return options - - # check what to do with unknowns - ignoreUnknown = options.pop("_ignoreUnknown_",False) - - # check every entry - for k in options.keys(): - if k not in defFastJetInterfaceConfigDict : - if ignoreUnknown : - _fastjetLog.warning("Option %s unknown - ignoring it!",k) - options.pop(k) - else : - _fastjetLog.error("Option %s unknown - abort configuration!",k) - raise Exception - - checkedOptions = dict(defFastJetInterfaceConfigDict) - for k,v in defFastJetInterfaceConfigDict.iteritems(): - t = type(v) - if t in ( list, set, dict ) : - checkedOptions[k] = t(v) - - checkedOptions['_alreadyChecked_'] = True - checkedOptions.update(options) - - # check settings for Strategy - key = "Strategy" - # print checkedOptions - _fastjetLog.info("Test option %s",key) - if checkedOptions[key] not in fastjet_conf_tags.Strategy : - _fastjetLog.error("Strategy \042%s\042 not recognized - fatal! Allowed values are: ",checkedOptions['Strategy']) - for s in fastjet_conf_tags.Strategy : - _fastjetLog.error("\042%s\042",s) - raise Exception - - # check settings for RecombScheme - if checkedOptions['RecombScheme'] not in fastjet_conf_tags.RecombScheme : - _fastjetLog.error("RecombScheme \042%s\042 not recognized - fatal! Allowed values are: ",checkedOptions['RecombScheme']) - for s in fastjet_conf_tags.RecombScheme : - _fastjetLog.error("\042%s\042",s) - raise Exception - - # check settings for Algorithm - if checkedOptions['Algorithm'] not in fastjet_conf_tags.Algorithm : - _fastjetLog.error("Algorithm \042%s\042 not recognized - fatal! Allowed values are: ",checkedOptions['Algorithm']) - for s in fastjet_conf_tags.Algorithm : - _fastjetLog.error("\042%%s\042",s) - raise Exception - - # check settings for JetAreaMethod - if checkedOptions['JetAreaMethod'] not in fastjet_conf_tags.JetAreaMethod : - _fastjetLog.error("JetAreaMethod \042%s\042 not recognized - fatal! Allowed values are: ",checkedOptions['JetAreaMethod']) - for s in fastjet_conf_tags.JetAreaMethod : - _fastjetLog.error("\042%s\042",s) - raise Exception - - # check settings for SIS split merge scale - if checkedOptions['SIS_SplitMergeScale'] not in fastjet_conf_tags.SISSplitMergeScale : - _fastjetLog.error("SIS_SplitMergeScale \042%2\042 not recognized - fatal! Allowed values are: ",checkedOptions['SIS_SplitMergeScale']) - for s in fastjet_conf_tags.SISSplitMergeScale : - _fastjetLog.error("\042%s\042",s) - raise Exception - - return checkedOptions - - -def getFastJetInterfaceConfig(name,**options): - # get tool configuration - fjTool = FastJetInterfaceTool(name) - from AthenaCommon.AppMgr import ToolSvc - ToolSvc += fjTool - # check job options - options = checkAndUpdate(**options) - # set tool properties - for k,v in options.iteritems(): - if k not in config_ignored_keys.ControlKeys : - setattr(fjTool,k,v) - # return tool configuration object - return fjTool - -#def dumpFastJetInterfaceConfig(**options=**defFastJetInterfaceConfigDict): -# # write out all attributes -# for k,v in options.iteritems(): -# _fastjetLog.message("Config::%s value %s",%(k),%(v)) - diff --git a/Reconstruction/Jet/JetRec/python/JetAlgorithm.py b/Reconstruction/Jet/JetRec/python/JetAlgorithm.py deleted file mode 100644 index 6097ac4205944a4dc70d7a715d1afc219f51025d..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetRec/python/JetAlgorithm.py +++ /dev/null @@ -1,209 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -# JetAlgorithm.py -# -# David Adams -# March 2014 -# October 2014: Update to provide a fn that allow specification of alg sequence. -# -# Configure the jet algorithm after the tool manager has been configured. - -from AthenaCommon import Logging -jetlog = Logging.logging.getLogger('JetRec_jobOptions') - -# Record the jet algorithm here. -# Retrieve this with "from JetRec.JetAlgorithm import jetalg" *after* -# calling addJetRecoToAlgSequence(). -jetalg = None - -# Function to add jet reconstruction to an algorithm sequence -# job: algorithm sequence -# useTruth: Flag to schedule building of selected-truth containers -# eventShapeTools: Keys for the event shape tools to be run -# separateJetAlgs: Run JetRecTools in separate algs (experts only) -# debug: Debug level (0 for quiet). See below. -def addJetRecoToAlgSequence(job =None, useTruth =None, eventShapeTools =None, - separateJetAlgs= None, debug =None): - - myname = "JetAlgorithm: " - - # We need this to modify the global variable. - global jetalg - - # Import message level flags. - from GaudiKernel.Constants import DEBUG - - # Import the jet reconstruction control flags. - from JetRec.JetRecFlags import jetFlags - - # Import the standard jet tool manager. - from JetRec.JetRecStandard import jtm - - # Set sequence and flags as needed. - if job is None: - from AthenaCommon.AlgSequence import AlgSequence - job = AlgSequence() - if useTruth is None: - useTruth = jetFlags.useTruth() - if eventShapeTools is None: - eventShapeTools = jetFlags.eventShapeTools() - if eventShapeTools is None: - eventShapeTools = [] - if separateJetAlgs is None: - separateJetAlgs = jetFlags.separateJetAlgs() - - - # Event shape tools. - from JetRecConfig.StandardJetConstits import stdConstitDic as cst - evsDict = { - "emtopo" : ("EMTopoEventShape", jtm.emget, cst.EMTopo), - "lctopo" : ("LCTopoEventShape", jtm.lcget, cst.LCTopo), - "empflow" : ("EMPFlowEventShape", jtm.empflowget, cst.EMPFlow), - } - - if jetFlags.useTracks(): - if jetFlags.useVertices(): - evsDict["emtopo"] = ("EMTopoOriginEventShape", jtm.emoriginget, cst.EMTopoOrigin) - evsDict["lctopo"] = ("LCTopoOriginEventShape", jtm.lcoriginget, cst.LCTopoOrigin) - else: - evsDict["emtopo"] = ("EMTopoOriginEventShape", jtm.emget, cst.EMTopo) - evsDict["lctopo"] = ("LCTopoOriginEventShape", jtm.lcget, cst.LCtopo) - jetlog.info( myname + "Event shape tools: " + str(eventShapeTools) ) - - from RecExConfig.AutoConfiguration import IsInInputFile - for evskey in eventShapeTools: - from EventShapeTools.EventDensityConfig import configEventDensityTool - if evskey in evsDict: - (toolname, getter, constitdef) = evsDict[evskey] - if toolname in jtm.tools: - jetlog.info( myname + "Skipping duplicate event shape: " + toolname ) - else: - jetlog.info( myname + "Adding event shape " + evskey ) - if not IsInInputFile("xAOD::EventShape",toolname): - jtm += configEventDensityTool(toolname, constitdef, 0.4) - jtm.allEDTools += [jtm.tools[toolname]] - else: - jetlog.info( myname + "Invalid event shape key: " + evskey ) - raise Exception - - # Add the tool runner. It runs the jetrec tools. - ctools = [] - # Add the truth tools. - if useTruth: - from JetRec.JetFlavorAlgs import scheduleCopyTruthParticles - ctools += scheduleCopyTruthParticles() - - # build truth jet input : - ctools += [ jtm.truthpartcopy, jtm.truthpartcopywz ] - - ## if jetFlags.useCells(): - ## ctools += [jtm.missingcells] commented out : incompatible with trigger : ATR-9696 - - if jetFlags.useTracks: - ctools += [jtm.tracksel, jtm.trackselloose_trackjets] - if jetFlags.useVertices: - ctools += [jtm.tvassoc] - - # LCOriginTopoClusters and EMOriginTopoClusters are shallow copies - # of CaloCalTopoClusters. This means that if CaloCalTopoClusters gets - # thinned on output, the the two derived containers need to be thinned - # in the same way, else they'll be corrupted in the output. - # FIXME: this should be automatic somehow. - postalgs = [] - thinneg = False - from RecExConfig.RecFlags import rec - if rec.doWriteAOD() and not rec.readAOD(): - from ParticleBuilderOptions.AODFlags import AODFlags - if AODFlags.ThinNegativeEnergyCaloClusters: - thinneg = True - - if jetFlags.useTracks and jetFlags.useVertices: - if not IsInInputFile("xAOD::CaloClusterContainer","LCOriginTopoClusters"): - ctools += [jtm.JetConstitSeq_LCOrigin] - if thinneg: - from ThinningUtils.ThinningUtilsConf import ThinNegativeEnergyCaloClustersAlg - postalgs.append (ThinNegativeEnergyCaloClustersAlg ('ThinNegLCOriginTopoClusters', - ThinNegativeEnergyCaloClusters = True, - CaloClustersKey = 'LCOriginTopoClusters', - StreamName = 'StreamAOD')) - if not IsInInputFile("xAOD::CaloClusterContainer","EMOriginTopoClusters"): - ctools += [jtm.JetConstitSeq_EMOrigin] - if thinneg: - from ThinningUtils.ThinningUtilsConf import ThinNegativeEnergyCaloClustersAlg - postalgs.append (ThinNegativeEnergyCaloClustersAlg ('ThinNegEMOriginTopoClusters', - ThinNegativeEnergyCaloClusters = True, - CaloClustersKey = 'EMOriginTopoClusters', - StreamName = 'StreamAOD')) - if not IsInInputFile("xAOD::FlowElementContainer","CHSParticleFlowObjects"): - if not hasattr(job,"jetalgCHSPFlow"): - if jetFlags.useTrackVertexTool: - ctools += [jtm.ttvaassocNew] - ctools += [jtm.JetConstitSeq_PFlowCHS] - if thinneg: - from ThinningUtils.ThinningUtilsConf import ThinNegativeEnergyNeutralPFOsAlg - CHSnPFOsThinAlg = ThinNegativeEnergyNeutralPFOsAlg( - "ThinNegativeEnergyCHSNeutralPFOsAlg", - NeutralPFOsKey="CHSNeutralParticleFlowObjects", - ThinNegativeEnergyNeutralPFOs = True, - StreamName = 'StreamAOD' - ) - postalgs.append(CHSnPFOsThinAlg) - - from JetRec.JetRecConf import JetToolRunner - from JetRec.JetRecConf import JetAlgorithm - runners = [] - if len(ctools)>0: - jtm += JetToolRunner("jetconstit", - EventShapeTools=[], - Tools=ctools - ) - job += JetAlgorithm("jetalgConstituents", - Tools=[jtm.jetconstit]) - - # Add all the PseudoJetAlgorithms now - # To avoid massive refactoring and to preserve familiarity, - # kept calling things "getters", but these are already - # PseudoJetAlgorithms as we eliminated the wrappers - for getter in jtm.allGetters: - job += getter - - # Then, add all event shape tools in separate algs - for evstool in jtm.allEDTools: - from EventShapeTools.EventShapeToolsConf import EventDensityAthAlg - job += EventDensityAthAlg("edalg_%s" % evstool.OutputContainer, - EventDensityTool=evstool) - - if separateJetAlgs: - - for t in jtm.jetrecs: - jalg = JetAlgorithm("jetalg"+t.name(), - Tools = [t]) - job += jalg - - else: - from JetRec.JetRecConf import JetToolRunner - jtm += JetToolRunner("jetrun", - EventShapeTools=[], - Tools=jtm.jetrecs - ) - runners += [jtm.jetrun] - - job += JetAlgorithm("jetalg") - jetalg = job.jetalg - jetalg.Tools = runners - if jetFlags.debug > 0: - # jtm.setOutputLevel(jtm.jetrun, DEBUG) - jetalg.OutputLevel = DEBUG - if jetFlags.debug > 1: - for tool in jtm.jetrecs: - jtm.setOutputLevel(tool, DEBUG) - if jetFlags.debug > 2: - for tool in jtm.finders: - jtm.setOutputLevel(tool, DEBUG) - if jetFlags.debug > 3: - jtm.setOutputLevel(jtm.jetBuilderWithArea, DEBUG) - jtm.setOutputLevel(jtm.jetBuilderWithoutArea, DEBUG) - - for postalg in postalgs: - job += postalg - diff --git a/Reconstruction/Jet/JetRec/python/JetFlavorAlgs.py b/Reconstruction/Jet/JetRec/python/JetFlavorAlgs.py deleted file mode 100644 index 3bc37378ac2120d1e7271ac3ca77c80f3fdbb35b..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetRec/python/JetFlavorAlgs.py +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration - -# JetFlavorAlgs.py -# -# David Adams -# September 2014 - -from AthenaCommon import Logging -jetlog = Logging.logging.getLogger('JetRec_jobOptions') - -# Import the jet reconstruction control flags. -from JetRec.JetRecFlags import jetFlags - -jetlog.info( str(jetFlags.truthFlavorTags()) ) - -def scheduleCopyTruthParticles(): - myname = "scheduleCopyTruthParticles: " - from JetRec.JetRecStandardToolManager import jtm - if not jtm.haveParticleJetTools: return - from ParticleJetTools.ParticleJetToolsConf import CopyFlavorLabelTruthParticles - from ParticleJetTools.ParticleJetToolsConf import CopyBosonTopLabelTruthParticles - from ParticleJetTools.ParticleJetToolsConf import CopyTruthPartons - - tools = [] - for ptype in jetFlags.truthFlavorTags(): - toolname = "CopyTruthTag" + ptype - if toolname in jtm.tools: - jetlog.info( myname + "Skipping previously-defined tool: " + toolname ) - jetlog.info( jtm.tools[toolname] ) - else: - jetlog.info( myname + "Scheduling " + toolname ) - ptmin = 5000 - if ptype == "Partons": - ctp = CopyTruthPartons(toolname) - elif ptype in ["WBosons", "ZBosons", "HBosons", "TQuarksFinal"]: - ctp = CopyBosonTopLabelTruthParticles(toolname) - ctp.ParticleType = ptype - ptmin = 100000 - else: - ctp = CopyFlavorLabelTruthParticles(toolname) - ctp.ParticleType = ptype - ctp.OutputName = "TruthLabel" + ptype - ctp.PtMin = ptmin - jtm += ctp - #theJob += CopyTruthParticlesAlg(ctp, toolname + "Alg") - jetlog.info( ctp ) - tools.append( ctp ) - return tools diff --git a/Reconstruction/Jet/JetRec/python/JetRecCalibrationFinder.py b/Reconstruction/Jet/JetRec/python/JetRecCalibrationFinder.py deleted file mode 100644 index e0b85fb922978b5511de3a2c8e6054cec17e0da1..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetRec/python/JetRecCalibrationFinder.py +++ /dev/null @@ -1,133 +0,0 @@ -# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration - -# JetRecCalibrationFinder.py - -# David Adams -# September 2014 -# -# Class to retrieve the calibration tool for a given jet definition -# and calibration sequence. The calibration tool is created if it -# does not already exist. -# -# Usage: -# from JetRec.JetRecCalibrationFinder import jrcf -# tool = jrcf.find(alg, rad, inp, seq, con) -# -# Arguments: -# alg - Algorithm name: AntiKt, CamKt or Kt -# rad - Jet size parameter, e.g. 0.4 -# inp - Input type: EMTopo or LCTopo -# seq - Calibration sequence as one letter for each step, e.g. "ar" -# a = Active area correction (rho*A) -# r = Pileup residual correction (i.e. using mu and NPV) -# j = JES correction (from MC) -# g = GSC correction (from MC) -# i = Insitu correction (data only) -# con - Configuration file name or entry in jrcf.configDict -# -# To add to the confid dictionary: -# jrcf.configDict["myname"] = "someConfigFile.config" - -from AthenaCommon import Logging -jetlog = Logging.logging.getLogger('JetRec_jobOptions') - -class JetRecCalibrationFinder: - - # Dictionary of calibrations steps. - calibStep = { - "a":"JetArea", - "r":"Residual", - "o":"Origin", - "j":"AbsoluteEtaJES", - "m":"JMS", - "g":"GSC", - "i":"Insitu" - } - - # Dictionary for calibration configurations. - configDict = { - "reco" : "JES_MC15cRecommendation_May2016_rel21.config", - "trigger" : "JES_Full2012dataset_Preliminary_Trigger.config", - "triggerNoPileup" : "JES_Full2012dataset_Preliminary_Trigger_NoPileup.config", - "trigger2016" : "JES_MC15cRecommendation_May2016_Trigger.config", - "triggerTrim" : "JES_MC15recommendation_FatJet_June2015.config", - "pflow" : "JES_MC15cRecommendation_PFlow_Aug2016_rel21.config" - } - - # Default the calibration area tag to that used for T0 reconstruction for consistency - # This is based on the initial R21 production in 2016 - def find(self, alg, rad, inpin, seq, configkeyin, evsprefix, calibareatag="00-04-77"): - from JetCalibTools.JetCalibToolsConf import JetCalibrationTool - from JetRec.JetRecStandardToolManager import jtm - inp = inpin - if inpin == "PFlowCustomVtx": - inp = "EMPFlow" - # Find the configuration file. - configkey = configkeyin - if configkey == "": configkey = "reco" - if configkey in self.configDict: - configfile = self.configDict[configkey] - else: - configfile = configkey - # Assign name for tool - jetdefn = alg + str(int(10*rad+0.1)) + inp.split("Origin")[0] - tname = "calib_" + jetdefn + "_" + configkey.replace(".","_") + "_" + seq - # Display configuration. - myname = "JetRecCalibrationFinder:find: " - jetlog.info( myname + "Building jet calibration tool." ) - jetlog.info( myname + " Arguments:" ) - jetlog.info( myname + " alg: " + str(alg) ) - jetlog.info( myname + " rad: " + str(rad) ) - jetlog.info( myname + " inp: " + str(inp) ) - jetlog.info( myname + " seq: " + str(seq) ) - jetlog.info( myname + " Jet definition: " + jetdefn ) - jetlog.info( myname + " Configuration file: " + configfile ) - - if tname in jtm.tools: - jetlog.info( myname + " Skipping previously-defined tool: " + tname ) - else: - # build calib tool - jetlog.info( myname + " Creating " + tname ) - # ...define calbration sequence - try: - fullseq = [self.calibStep[l] for l in seq] # translate letters - except KeyError as err: - jetlog.info( myname + " ERROR Invalid sequence: " + seq ) - jetlog.info( myname + " ERROR Unknown sequence key: " + err.message ) - raise err - fullseq = '_'.join(fullseq) # join seq names with a '_' - jetlog.info( myname + " Calibration sequence: " + fullseq ) - # ...define the key for the event shape container - if inpin == "EMTopo": - evssuf="EMTopoEventShape" - elif inpin == "LCTopo": - evssuf="LCTopoEventShape" - elif inpin.startswith("LCTopoTrimmed"): - evssuf="LCTopoEventShape" - elif inpin == "EMTopoOrigin": - evssuf="EMTopoOriginEventShape" - elif inpin == "LCTopoOrigin": - evssuf="LCTopoOriginEventShape" - elif inpin == "EMPFlow": - evssuf="EMPFlowEventShape" - elif inpin == "EMCPFlow": - evssuf="EMCPFlowEventShape" - elif inpin == "LCPFlow": - evssuf="LCPFlowEventShape" - elif inpin == "PFlowCustomVtx": - evssuf="PFlowCustomVtxEventShape" - else: - evssuf="INVALID" - jetlog.info( myname + " ERROR: Invalid input specifier: " + inp ) - raise KeyError - evskey = evsprefix + evssuf - jetlog.info( myname + " Event shape key: " + evskey ) - # ...create the tool. - jtm += JetCalibrationTool(tname, JetCollection=jetdefn, ConfigFile=configfile, CalibSequence=fullseq, RhoKey=evskey, - CalibArea=calibareatag) - - return jtm.tools[tname] - -# This is the only instance of the above class that should be used to -# that should be used to fetch calibration tools. -jrcf = JetRecCalibrationFinder() diff --git a/Reconstruction/Jet/JetRec/python/JetRecFlags.py b/Reconstruction/Jet/JetRec/python/JetRecFlags.py deleted file mode 100644 index ea5e69506cfe4ba3651dde519381217b804957a7..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetRec/python/JetRecFlags.py +++ /dev/null @@ -1,265 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -# JetRecFlags.py -# -# David Adams -# Updated March 2015 -# -# These are flags for controlling the behavior of jet reconstruction in RecExCommon -# -# Typical usage is -# from JetRec.JetRecFlags import jetFlags -# if jetFlags.UseTruth: -# doSomethingWithTruth() -# -# Properties: -# Enabled - Skip all jet reco if false (drop whe rec.doJets is added) -# debug - JetRecTools are run a DEBUG level -# useTruth - Truth jets and association are enabled (for MC) -# useTopo - Topocluster jets are enabled -# useTracks - Track jets and association are enabled -# useLargeD0Tracks - Large D0 track jets and association are enabled -# useVertices - Toggles whether PFlow jet reconstruction makes use of vertex information. -# useMuonSegmentss - Muon segemnt association is enabled -# usePFlow - PFlow jets and associations are enabled\ -# useInDetTrackSelection - The inner detector track selection -# tool is used. This requires track propagator exist. -# jetAODList - The list of jet collections to be written out -# writeJetsToAOD - bool to enable/disable writing jet collections to AOD -# And much more--see below. - -from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer -from AthenaCommon.JobProperties import jobproperties - -class JetRecFlags(JobPropertyContainer): - """ The Jet making flag property container - """ - pass - -class Enabled(JobProperty): - """ If false will prevent run of any Jet Alg - """ - statusOn = True - allowedTypes = ['bool'] # type - StoredValue = True # default value - -class debug(JobProperty): - """ If > 0, debug (or higher) messages are written by jet tools. - """ - statusOn = True - allowedTypes = ['int'] # type - StoredValue = 0 # default value - -class useTruth(JobProperty): - """ If true, truth is present and used in jet reconstruction. - The status is set on in JetRecStandardToolManager. - """ - statusOn = False - allowedTypes = ['bool'] # type - StoredValue = True # default value - -class truthFlavorTags(JobProperty): - """ List of flavor tags for truth tagging jets. - """ - statusOn = True - allowedTypes = ['array'] # type - StoredValue = ["BHadronsInitial", "BHadronsFinal", "BQuarksFinal", - "CHadronsInitial", "CHadronsFinal", "CQuarksFinal", - "TausFinal", - "WBosons", "ZBosons", "HBosons", "TQuarksFinal", - "Partons", - ] - -class useTopo(JobProperty): - """ If true, topoclusters are present and used in jet reconstruction. - The status is set on in JetRecStandardToolManager. - """ - statusOn = False - allowedTypes = ['bool'] # type - StoredValue = True # default value - -class useTracks(JobProperty): - """ If true, tracks and vertices are present and used in jet reconstruction. - The status is set on in JetRecStandardToolManager. - """ - statusOn = True - allowedTypes = ['bool'] # type - StoredValue = True # default value changed to False for Test by RL - -class useLargeD0Tracks(JobProperty): - """ If true, large d0 tracks and vertices are present and used in jet - reconstruction. The status is set on in JetRecStandardToolManager. - """ - statusOn = True - allowedTypes = ['bool'] # type - StoredValue = True # default value changed to False for Test by RL - -class useVertices(JobProperty): - """ If true, vertices are present and used in pflow jet reconstruction. - """ - statusOn = False - allowedTypes = ['bool'] # type - StoredValue = True # default value - -class useMuonSegments(JobProperty): - """ If true, muon segments are present and used in jet reconstruction. - The status is set on in JetRecStandardToolManager. - """ - statusOn = False - allowedTypes = ['bool'] # type - StoredValue = True # default value - -class usePFlow(JobProperty): - """ If true, pflow objects are present and used in jet reconstruction. - The status is set in JetRecStandardToolManager. - """ - statusOn = True - allowedTypes = ['bool'] # type - StoredValue = True # default value - -class eventShapeTools(JobProperty): - """ List of event shape tools that should be called to calculate rho. - Allowed values are "emtopo", "lctopo", "emorig", "lcorig", "empflow", "emcpflow", "lcpflow". - """ - statusOn = True - allowedTypes = ['None', 'list'] # type - StoredValue = None # default value - -class useInDetTrackSelection(JobProperty): - """ If true, the InDet track selection tool is used. - """ - statusOn = True - allowedTypes = ['bool'] # type - StoredValue = False # default value - -class useCells(JobProperty): - """ If true, calo cells are accesible - """ - statusOn = True - allowedTypes = ['bool'] # type - StoredValue = False # default value - -class useCaloQualityTool(JobProperty): - """ If true, the (slow) CaloQuality tool is used - """ - statusOn = True - allowedTypes = ['bool'] # type - StoredValue = True # default value - -class useBTagging(JobProperty): - """ If true, then btagging is done when requested - """ - statusOn = True - allowedTypes = ['bool'] # type - StoredValue = False # default value - -class skipTools(JobProperty): - """ List of modifier tools to exclude - """ - statusOn = True - allowedTypes = ['list'] # type - StoredValue = [] # default value - -class additionalTopoGetters(JobProperty): - """ List of PseudoJet getters to add for Topo jets. - E.g. to tag jets with track jets - """ - statusOn = True - allowedTypes = ['list'] # type - StoredValue = [] # default value - -class defaultCalibOpt(JobProperty): - """ Calibration applied to topo jets during jet building. See JetRecCalibrationFinder. - """ - statusOn = True - allowedTypes = ['str'] # type - StoredValue = "" # default value - -class containerNamePrefix(JobProperty): - """ Prefix for jet collection names - """ - statusOn = True - allowedTypes = ['str'] # type - StoredValue = "" # default value - -class separateJetAlgs(JobProperty): - """ If true, find and build jet containers in separate alg. Used for debugging. - """ - statusOn = True - allowedTypes = ['bool'] # type - StoredValue = True # default value - -class jetAODList(JobProperty): - """ The collections to be saved in (x)AOD files - """ - statusOn = True - allowedTypes = ['list'] - StoredValue = [] - -class writeJetsToAOD(JobProperty): - """ Toggles whether to write jet collections to (x)AOD files - """ - statusOn = True - allowedTypes = ['bool'] - StoredValue = False - -class useTrackVertexTool(JobProperty): - """ Toggles whether to use track-vertex tool (only known client is currently pflow jet finding) - """ - statusOn = True - allowedTypes = ['bool'] - StoredValue = False - -class JetContentDetail: - Reduced=1 - Full=2 - Validation=3 - Trigger=4 - -class detailLevel(JobProperty): - """ Toggles detail level for AOD jet reconstruction when running with RecExCommon - If doWriteESD is set to True, then all built jet collections are written - to the AODs otherwise as specified below: - 1. Reduced: This will build jet containers needed for monitoring: - AntiKt4EMTopoJets, AntiKt4EMPFlowJets, AntiKt4LCTopoJets, AntiKt4TruthJets, AntiKt10LCTopoJets - If writing to AOD turned on, only R = 0.4 reco jets will be written to disk - 2. Full: Same building of jet collections as 'Reduced' - If writing to AOD turned on, all jet collections will be written to disk - 3. Validation: Not supported in r22 - 4. Trigger: Same building of jet collections as 'Reduced' + trimmed R = 1.0 LCTopo jets - All reco jet collections (R = 0.4, R = 1.0 ungroomed and groomed) are written to disk - """ - statusOn = True - allowedTypes = ['int'] - StoredValue = JetContentDetail.Reduced - - - -jobproperties.add_Container(JetRecFlags) - -jobproperties.JetRecFlags.add_JobProperty(Enabled) -jobproperties.JetRecFlags.add_JobProperty(debug) -jobproperties.JetRecFlags.add_JobProperty(useTruth) -jobproperties.JetRecFlags.add_JobProperty(truthFlavorTags) -jobproperties.JetRecFlags.add_JobProperty(useTopo) -jobproperties.JetRecFlags.add_JobProperty(useTracks) -jobproperties.JetRecFlags.add_JobProperty(useLargeD0Tracks) -jobproperties.JetRecFlags.add_JobProperty(useVertices) -jobproperties.JetRecFlags.add_JobProperty(useInDetTrackSelection) -jobproperties.JetRecFlags.add_JobProperty(useMuonSegments) -jobproperties.JetRecFlags.add_JobProperty(usePFlow) -jobproperties.JetRecFlags.add_JobProperty(eventShapeTools) -jobproperties.JetRecFlags.add_JobProperty(jetAODList) -jobproperties.JetRecFlags.add_JobProperty(writeJetsToAOD) -jobproperties.JetRecFlags.add_JobProperty(useCells) -jobproperties.JetRecFlags.add_JobProperty(useCaloQualityTool) -jobproperties.JetRecFlags.add_JobProperty(useBTagging) -jobproperties.JetRecFlags.add_JobProperty(skipTools) -jobproperties.JetRecFlags.add_JobProperty(additionalTopoGetters) -jobproperties.JetRecFlags.add_JobProperty(defaultCalibOpt) -jobproperties.JetRecFlags.add_JobProperty(containerNamePrefix) -jobproperties.JetRecFlags.add_JobProperty(separateJetAlgs) -jobproperties.JetRecFlags.add_JobProperty(useTrackVertexTool) -jobproperties.JetRecFlags.add_JobProperty(detailLevel) - -jetFlags = jobproperties.JetRecFlags diff --git a/Reconstruction/Jet/JetRec/python/JetRecStandard.py b/Reconstruction/Jet/JetRec/python/JetRecStandard.py deleted file mode 100644 index 399eb1b0cd987b7e45d2d993b4b7995b21854060..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetRec/python/JetRecStandard.py +++ /dev/null @@ -1,122 +0,0 @@ -# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration - -# JetRecStandard.py -# -# David Adams -# October 2014 -# Updated March 2015 -# -# Wrapper for JetRecStandardToolManager.py that first uses RecExCommon to set flags. -# High-level RecExCommon scripts should use this in place or JetRecStandardToolManager. -# -# Call with -# from JetRec.JetRecStandard import jtm -# -# Jet flags should be set before making this call. Those for truth, clusters, tracks -# and muon segments will be set here iff they are not already set. - -from AthenaCommon import Logging -jetlog = Logging.logging.getLogger('JetRec_jobOptions') - -myname = "JetRecStandard: " -jetlog.info( myname + "Begin.") - -from RecExConfig.RecFlags import rec -from InDetRecExample.InDetJobProperties import InDetFlags - -# Function to display flag value and status. -def sflagstat(flag): - return str(flag()) + " (status=" + str(flag.statusOn) + ")" - -# Import the jet reconstruction control flags. -from JetRec.JetRecFlags import jetFlags -from RecExConfig.ObjKeyStore import cfgKeyStore - -# Skip truth if rec says it is absent. -# No action if someone has already set the flag. -jetlog.info( myname + "Initial useTruth: " + sflagstat(jetFlags.useTruth)) -jetlog.info( myname + " rec.doTruth: " + str(rec.doTruth()) ) -if not jetFlags.useTruth.statusOn: - jetFlags.useTruth = rec.doTruth() -jetlog.info( myname + " Final useTruth: " + sflagstat(jetFlags.useTruth)) - -# Skip use of topoclusters if not built -# No action if someone has already set the flag. -jetlog.info( myname + "Initial use topoclusters: " + str(jetFlags.useTopo())) -if not jetFlags.useTopo.statusOn: - jetFlags.useTopo = rec.doCalo() -jetlog.info( myname + " Final use topoclusters: " + str(jetFlags.useTopo())) - -# Skip tracks if tracks or vertices are not present in the job. -# No action if someone has already set the flag. -haveTracks = cfgKeyStore.isInInput('xAOD::TrackParticleContainer','InDetTrackParticles') -haveVertices = cfgKeyStore.isInInput("xAOD::VertexContainer","PrimaryVertices") -recTracks = rec.doInDet() -recVertices = bool(InDetFlags.doVertexFinding) and (recTracks or haveTracks) -jetlog.info( myname + "Initial useTracks: " + sflagstat(jetFlags.useTracks) ) -jetlog.info( myname + " rec doInDet: " + str(recTracks) ) -jetlog.info( myname + " doVertexFinding: " + str(recVertices) ) -jetlog.info( myname + " have tracks: " + str(haveTracks) ) -jetlog.info( myname + " have vertices: " + str(haveVertices) ) -if not jetFlags.useTracks.statusOn: - jetFlags.useTracks = (recTracks or haveTracks) and (recVertices or haveVertices) -jetlog.info( myname + " Final useTracks: " + sflagstat(jetFlags.useTracks) ) - -if not jetFlags.useVertices.statusOn: - jetFlags.useVertices = (recVertices or haveVertices) -jetlog.info( myname + " useVertices: " + sflagstat(jetFlags.useVertices) ) - -# Disable usage of vertices in pflow jets, if we are using cosmic data. -from AthenaCommon.BeamFlags import jobproperties -if jobproperties.Beam.beamType == 'cosmics': - jetFlags.useVertices = False - -# Skip pflow if we are not using tracks. -jetlog.info( myname + "Initial usePFlow: " + sflagstat(jetFlags.usePFlow) ) -if not jetFlags.usePFlow.statusOn: - jetFlags.usePFlow = jetFlags.useTracks() -jetlog.info( myname + "Final usePFlow: " + sflagstat(jetFlags.usePFlow) ) - -# Skip use of muon segments if not built. -# No action if someone has already set the flag. -jetlog.info( myname + "Initial use muon segments: " + sflagstat(jetFlags.useMuonSegments) ) -if not jetFlags.useMuonSegments.statusOn: - jetFlags.useMuonSegments = rec.doMuon() and rec.doMuonCombined() -jetlog.info( myname + " Final use muon segments: " + sflagstat(jetFlags.useMuonSegments) ) - -# Use rec flag to control BTagging. -# No. Disable this unit we get support from Btagging to do this. -# No action if someone has already set the flag. -jetlog.info( myname + "Initial use Btagging: " + str(jetFlags.useBTagging) ) -jetlog.info( myname + " rec do BTagging: " + str(rec.doBTagging()) ) -if not jetFlags.useBTagging.statusOn: - #jetFlags.useBTagging = rec.doBTagging() - jetFlags.useBTagging = False -jetlog.info( myname + " Final use Btagging: " + str(jetFlags.useBTagging) ) - -# The following can be used to exclude tools from reconstruction. -if 0: - jetFlags.skipTools = ["comshapes"] -jetlog.info( "Skipped tools: %s", jetFlags.skipTools()) - -from RecExConfig.RecAlgsFlags import recAlgs -if not recAlgs.doEFlow(): - jetFlags.usePFlow = False - -# Set the list of rho calculations. -# If caller has set jetFlags.eventShapeTools(), then we use those values. -if jetFlags.eventShapeTools() is None: - jetFlags.eventShapeTools = [] - if jetFlags.useTopo(): - jetFlags.eventShapeTools += ['emtopo', 'lctopo'] - if jetFlags.usePFlow(): - jetFlags.eventShapeTools += ['empflow'] - -# Import the jet tool manager. -from JetRec.JetRecStandardToolManager import jtm -jetlog.verbose("Initialised jtm with tools %s", jtm.tools) -# Import the constituent tool manager -from JetRecTools.ConstitToolManager import ctm -jetlog.verbose("Initialised ctm with modifiers %s", ctm.modifiersMap) - -jetlog.info( myname + "End." ) diff --git a/Reconstruction/Jet/JetRec/python/JetRecStandardToolManager.py b/Reconstruction/Jet/JetRec/python/JetRecStandardToolManager.py deleted file mode 100644 index 318c03c1d7b7e63c35f3c2fac2ac849a270dee86..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetRec/python/JetRecStandardToolManager.py +++ /dev/null @@ -1,365 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -# JetRecStandardToolManager.py -# -# David Adams -# March 2014 -# -# Constructs an instance jtm of the JetToolManager with -# standard definitions for jet tools. -# -# Usage: -# from JetRec.JetRecStandardToolManager import jtm -# jtm.addJetFinder("AntiKt4EMTopoJets", "AntiKt", 0.4, "em", "calib_emtopo_ungroomed") -# -from AthenaCommon import Logging -jetlog = Logging.logging.getLogger('JetRec_jobOptions') - -myname = "JetRecStandardToolManager.py: " - -jetlog.info( myname + "Defining standard tools" ) - -######################################################### -# Set and lock flags. -######################################################### - -from JetRec.JetRecFlags import jetFlags, JetContentDetail - -# Set status on for flags that are initialized with status off. -jetFlags.useTruth.set_On() -jetFlags.useTopo.set_On() -jetFlags.useTracks.set_On() -jetFlags.usePFlow.set_On() -jetFlags.useMuonSegments.set_On() -jetFlags.useBTagging.set_On() - -from InDetRecExample.InDetJobProperties import InDetFlags -if not InDetFlags.doR3LargeD0(): - jetFlags.useLargeD0Tracks.set_Off() - - -# Lock all the flags used here so that later attempts to change -# the value will fail with an error message. -jetFlags.useTruth.lock() -jetFlags.useTopo.lock() -jetFlags.useTracks.lock() -jetFlags.useMuonSegments.lock() -jetFlags.useBTagging.lock() -jetFlags.useCaloQualityTool.lock() -jetFlags.additionalTopoGetters.lock() -jetFlags.truthFlavorTags.lock() -jetFlags.skipTools.lock() - -# Display all flags used here. -jetlog.info( myname + "jetFlags.useTruth: " + str(jetFlags.useTruth()) ) -jetlog.info( myname + "jetFlags.useTopo: " + str(jetFlags.useTopo()) ) -jetlog.info( myname + "jetFlags.useTracks: " + str(jetFlags.useTracks()) ) -jetlog.info( myname + "jetFlags.useMuonSegments: " + str(jetFlags.useMuonSegments()) ) -jetlog.info( myname + "jetFlags.useBTagging: " + str(jetFlags.useBTagging()) ) -jetlog.info( myname + "jetFlags.useCaloQualityTool: " + str(jetFlags.useCaloQualityTool()) ) -jetlog.info( myname + "jetFlags.additionalTopoGetters: " + str(jetFlags.additionalTopoGetters()) ) -jetlog.info( myname + "jetFlags.truthFlavorTags: " + str(jetFlags.truthFlavorTags()) ) -jetlog.info( myname + "jetFlags.skipTools: " + str(jetFlags.skipTools()) ) -jetlog.info( myname + "jetFlags.useTrackVertexTool: " + str(jetFlags.useTrackVertexTool()) ) - -######################################################### -# Create standard tool manager. -######################################################### - -# Import the jet tool manager. -from JetRec.JetToolSupport import JetToolManager - -# Global jet tool manager with standard definitions -jtm = JetToolManager() - -# Pt thresholds in MeV -jtm.ptminFinder = 2000 -jtm.ptminFilter = 0 - -# Add standard tool definitions to the tool manager. -import JetRec.JetRecStandardTools as JetRecStandardTools -jetlog.verbose("Use trigger store? %s", JetRecStandardTools.UseTriggerStore) - -# Function to filter out skipped tools. -def filterout(skiptoolnames, tools): - outtools = [] - remtoolnames = [] - for tool in tools: - keep = True - for toolname in skiptoolnames: - skiptool = jtm[toolname] - same = tool == skiptool - if same: - keep = False - remtoolnames += [toolname] - if keep: - outtools += [tool] - jetlog.info( myname + "Removed tools: " + str(remtoolnames) ) - return outtools - -######################################################### -# Getters -######################################################### - -# Pseudojet getters -empfgetters = [jtm.empflowget] - -trackgetters = [jtm.trackget] -pv0trackgetters = [jtm.pv0trackget] -# Add track ghosts -emgetters = [jtm.emget] -lcgetters = [jtm.lcget] -if jetFlags.useTracks(): - if jetFlags.useVertices(): - emgetters = [jtm.emoriginget] - lcgetters = [jtm.lcoriginget] - else: - emgetters = [jtm.emget] - lcgetters = [jtm.lcget] - emgetters += [jtm.gtrackget] - lcgetters += [jtm.gtrackget] - empfgetters += [jtm.gtrackget] - -if jetFlags.useLargeD0Tracks(): - emgetters += [jtm.gtracklrtget] - -if jetFlags.useMuonSegments(): - emgetters += [jtm.gmusegget] - lcgetters += [jtm.gmusegget] - empfgetters += [jtm.gmusegget] -# Add jet ghosts. -if 1: - for gettername in jetFlags.additionalTopoGetters(): - getter = jtm[gettername] - emgetters += [getter] - lcgetters += [getter] -# Add truth getter and truth ghosts. -if jetFlags.useTruth(): - truthgetters = [jtm.truthget] - truthwzgetters = [jtm.truthwzget] - trackgetters += [jtm.gtruthget] - pv0trackgetters += [jtm.gtruthget] - emgetters += [jtm.gtruthget] - lcgetters += [jtm.gtruthget] - empfgetters += [jtm.gtruthget] - # Add truth cone matching and truth flavor ghosts. - flavorgetters = [] - for ptype in jetFlags.truthFlavorTags(): - flavorgetters += [getattr(jtm, "gtruthget_" + ptype)] - emgetters += flavorgetters - lcgetters += flavorgetters - truthgetters += flavorgetters - truthwzgetters += flavorgetters - trackgetters += flavorgetters - pv0trackgetters += flavorgetters - empfgetters += flavorgetters -# Add track jet ghosts. -if jetFlags.useTracks(): - trackjetgetters = [] - trackjetgetters += [jtm.gakt2trackget] -# trackjetgetters += [jtm.gakt3trackget] - trackjetgetters += [jtm.gakt4trackget] -# trackjetgetters += [jtm.gvrtrackget] - emgetters += trackjetgetters - lcgetters += trackjetgetters - empfgetters += trackjetgetters - -empfgetters += [jtm.gtowerget] - -# Add getter lists to jtm indexed by input type name. -jtm.gettersMap["emtopo"] = list(emgetters) -jtm.gettersMap["lctopo"] = list(lcgetters) -jtm.gettersMap["empflow"] = list(empfgetters) -jtm.gettersMap["track"] = list(trackgetters) -jtm.gettersMap["pv0track"] = list(pv0trackgetters) -if jetFlags.useTruth(): - jtm.gettersMap["truth"] = list(truthgetters) - jtm.gettersMap["truthwz"] = list(truthwzgetters) - -jtm.gettersMap["emtopo_reduced"] = filterout(["gakt2trackget","gakt4trackget"],emgetters) -jtm.gettersMap["lctopo_reduced"] = filterout(["gakt2trackget","gakt4trackget"],lcgetters) -jtm.gettersMap["empflow_reduced"] = filterout(["gakt2trackget","gakt4trackget"],empfgetters) - - -######################################################### -# Modifiers -######################################################### - -# Modifiers for ungroomed jets from all input types. -common_ungroomed_modifiers = [ - jtm.width, -] - -# Add parton truth labels and truth jet modifiers. -if jetFlags.useTruth(): - if jtm.haveParticleJetTools: - common_ungroomed_modifiers += [jtm.partontruthlabel] - common_ungroomed_modifiers += [jtm.truthpartondr] - - # Modifiers for truth jets. - truth_ungroomed_modifiers = list(common_ungroomed_modifiers) - if jtm.haveParticleJetTools: - truth_ungroomed_modifiers += [jtm.jetdrlabeler] - - # Modifiers for ungroomed truth large-R jets - truth_ungroomed_larger_modifiers = truth_ungroomed_modifiers - # Add splitting scale modifiers for truth labeling - truth_ungroomed_larger_modifiers += [jtm.ktsplitter] - -# Modifiers for track jets. -track_ungroomed_modifiers = list(common_ungroomed_modifiers) -if jetFlags.useTruth() and jtm.haveParticleJetTools: - track_ungroomed_modifiers += [jtm.trackjetdrlabeler] - -# Modifiers for calibrated topo jets. -# Modifiers for topo (and pflow) jets. -ungroomed_modifiers = [jtm.jetens, "calib", jtm.jetsorter] # calibration first. turn off with calibopt -ungroomed_modifiers += ["jetfilter"] -ungroomed_modifiers += common_ungroomed_modifiers -ungroomed_modifiers += [jtm.larhvcorr] -ungroomed_modifiers += [jtm.ecpsfrac] -if jetFlags.useCaloQualityTool(): - ungroomed_modifiers += [jtm.caloqual_cluster] -if jetFlags.useTracks(): - if jetFlags.useVertices(): - ungroomed_modifiers += [jtm.trkmoms] - ungroomed_modifiers += [jtm.trksummoms] - ungroomed_modifiers += [jtm.jvf] - ungroomed_modifiers += [jtm.jvt] - ungroomed_modifiers += [jtm.jetorigin_setpv] - ungroomed_modifiers += [jtm.charge] - ungroomed_modifiers += ["trackassoc"] - -if jetFlags.useTruth(): - if jetFlags.detailLevel()>=JetContentDetail.Full: - # only at this detail level are the truth jets build. We can then schedule the TruthAssociation calculation : - ungroomed_modifiers += ["truthassoc"] - if jtm.haveParticleJetTools: - ungroomed_modifiers += [jtm.jetdrlabeler] - -#if jetFlags.detailLevel>=JetContentDetail.Validation: -# ungroomed_modifiers += [jtm.jvt] - -# Modifiers for groomed jets. -groomed_modifiers = [ - jtm.jetsorter, - jtm.nsubjettiness, - jtm.ktdr, - jtm.ktsplitter, - jtm.encorr, - jtm.energycorrelatorgeneralized, - jtm.energycorrelatorgeneralizedratios, - jtm.charge, - jtm.angularity, - jtm.comshapes, - jtm.ktmassdrop, - jtm.dipolarity, - jtm.pull, - jtm.planarflow, - jtm.width, - jtm.qw, - jtm.trksummoms - ] - -# Modifiers for pflow jets. -# Same as topo jets. -# 28may2015 - ecpsfrac is not yet working for pflow in xAOD. -pflow_ungroomed_modifiers = [] -pflow_ungroomed_modifiers += [jtm.constitfourmom_pflow] -pflow_ungroomed_modifiers += filterout(["ecpsfrac"], ungroomed_modifiers) - -pflow_groomed_modifiers = [] -pflow_groomed_modifiers += [jtm.constitfourmom_pflow] -pflow_groomed_modifiers += groomed_modifiers - -# For truth jets, don't add track moments -truth_groomed_modifiers = filterout(["trksummoms"], groomed_modifiers) - -# Here add tools to be run for topo jets and NOT for pflow. - -# Cluster moments. -ungroomed_modifiers += [jtm.clsmoms] - -# Voronoi moments. -#ungroomed_modifiers += [jtm.voromoms] - -# Add Btagging. -btags = ["btag"] -if jetFlags.useBTagging(): - ungroomed_modifiers += btags - -# EM-only modifiers here -emtopo_ungroomed_modifiers = [] -emtopo_ungroomed_modifiers += [jtm.constitfourmom_emtopo] -emtopo_ungroomed_modifiers += ungroomed_modifiers - -emtopo_groomed_modifiers = [] -emtopo_groomed_modifiers += [jtm.constitfourmom_emtopo] -emtopo_groomed_modifiers += groomed_modifiers - -# LC-only modifiers here -lctopo_ungroomed_modifiers = [] -lctopo_ungroomed_modifiers += [jtm.constitfourmom_lctopo] -lctopo_ungroomed_modifiers += ungroomed_modifiers - -lctopo_groomed_modifiers = [] -lctopo_groomed_modifiers += [jtm.constitfourmom_lctopo] -lctopo_groomed_modifiers += groomed_modifiers - - - -### XAOD SIZE REDUCTION -# define a reduced set for AOD size reduction -pflow_reduced_modifiers = [jtm.constitfourmom_pflow, jtm.jetens, "calib", jtm.jetsorter] -emtopo_reduced_modifiers = [jtm.constitfourmom_emtopo, jtm.jetens, "calib", jtm.jetsorter] -lctopo_reduced_modifiers = [jtm.constitfourmom_lctopo, jtm.jetens, "calib", jtm.jetsorter] - - - -# Filter out skipped tools. -if len(jetFlags.skipTools()): - jetlog.info( myname + "Tools to be skipped: " + str(jetFlags.skipTools()) ) - ungroomed_modifiers = filterout(jetFlags.skipTools(), ungroomed_modifiers) - if jetFlags.useTruth(): - truth_ungroomed_modifiers = filterout(jetFlags.skipTools(), truth_ungroomed_modifiers) - track_ungroomed_modifiers = filterout(jetFlags.skipTools(), track_ungroomed_modifiers) - groomed_modifiers = filterout(jetFlags.skipTools(), groomed_modifiers) - pflow_ungroomed_modifiers = filterout(jetFlags.skipTools(), pflow_ungroomed_modifiers) - emtopo_ungroomed_modifiers = filterout(jetFlags.skipTools(), emtopo_ungroomed_modifiers) - lctopo_ungroomed_modifiers = filterout(jetFlags.skipTools(), lctopo_ungroomed_modifiers) - pflow_groomed_modifiers = filterout(jetFlags.skipTools(), pflow_groomed_modifiers) - emtopo_groomed_modifiers = filterout(jetFlags.skipTools(), emtopo_groomed_modifiers) - lctopo_groomed_modifiers = filterout(jetFlags.skipTools(), lctopo_groomed_modifiers) - -# Add modifier lists to jtm indexed by modifier type name. -jtm.modifiersMap["none"] = [] -jtm.modifiersMap["ungroomed"] = list(ungroomed_modifiers) -jtm.modifiersMap["groomed"] = list(groomed_modifiers) - -jtm.modifiersMap["emtopo_ungroomed"] = list(emtopo_ungroomed_modifiers) -jtm.modifiersMap["lctopo_ungroomed"] = list(lctopo_ungroomed_modifiers) -jtm.modifiersMap["pflow_ungroomed"] = list(pflow_ungroomed_modifiers) - -jtm.modifiersMap["emtopo_groomed"] = list(emtopo_groomed_modifiers) -jtm.modifiersMap["lctopo_groomed"] = list(lctopo_groomed_modifiers) -jtm.modifiersMap["pflow_groomed"] = list(pflow_groomed_modifiers) - -jtm.modifiersMap["emtopo_reduced"] = list(emtopo_reduced_modifiers) -jtm.modifiersMap["lctopo_reduced"] = list(lctopo_reduced_modifiers) -jtm.modifiersMap["pflow_reduced"] = list(pflow_reduced_modifiers) - -if jetFlags.useTruth(): - jtm.modifiersMap["truth_ungroomed"] = list(truth_ungroomed_modifiers) - jtm.modifiersMap["truth_ungroomed_larger"] = list(truth_ungroomed_larger_modifiers) - jtm.modifiersMap["truth_groomed"] = list(truth_groomed_modifiers) -jtm.modifiersMap["track_ungroomed"] = list(track_ungroomed_modifiers) - -# Also index modifier type names by input type name. -# These are used when the modifier list is omitted. -jtm.modifiersMap["track"] = list(track_ungroomed_modifiers) -jtm.modifiersMap["pv0track"] = list(track_ungroomed_modifiers) -if jetFlags.useTruth(): - jtm.modifiersMap["truth"] = list(truth_ungroomed_modifiers) - jtm.modifiersMap["truthwz"] = list(truth_ungroomed_modifiers) - -jetlog.info( myname + "End." ) diff --git a/Reconstruction/Jet/JetRec/python/JetRecStandardTools.py b/Reconstruction/Jet/JetRec/python/JetRecStandardTools.py deleted file mode 100644 index 378367615ad5a0f529ea5c2116ea31727c0411d8..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetRec/python/JetRecStandardTools.py +++ /dev/null @@ -1,843 +0,0 @@ -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration - -# JetRecStandardTools.py -# -# David Adams -# March 2014 -# -# Define the low-level tools used in jet reconstruction. -# -# Tools are configured and put in the global jet tool manager so -# they can be accessed when configuring JetRec tools. -# -# Execute this file to add the definitions to -# JetRecStandardToolManager.jtm, e.g. -# import JetRec.JetRecStandardTools - -# Import the jet flags. -from JetRec.JetRecFlags import jetFlags - -if "UseTriggerStore " not in locals(): - UseTriggerStore = False - -from eflowRec.eflowRecFlags import jobproperties - -from JetRec.JetRecStandardToolManager import jtm -from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool -from MCTruthClassifier.MCTruthClassifierConf import MCTruthClassifier - -from PFlowUtils.PFlowUtilsConf import CP__WeightPFOTool as WeightPFOTool -from JetRecTools.JetRecToolsConf import CorrectPFOTool -from JetRecTools.JetRecToolsConf import ChargedHadronSubtractionTool -from JetRecTools.JetRecToolsConf import JetTrackSelectionTool -from JetRecTools.JetRecToolsConf import JetTrackSelectionTool2 -from JetRecTools.JetRecToolsConf import SimpleJetTrackSelectionTool -from JetRecTools.JetRecToolsConf import TrackVertexAssociationTool - -try: - jtm.haveJetRecCalo = True -except ImportError: - jtm.haveJetRecCalo = False -from JetRec.JetRecConf import JetPseudojetRetriever -from JetRec.JetRecConf import JetConstituentsRetriever -from JetRec.JetRecConf import JetFromPseudojet -from JetRec.JetRecConf import JetConstitRemover -from JetRec.JetRecConf import JetSorter -from JetRec.JetRecConf import PseudoJetAlgorithm -from JetRec.JetRecConf import MuonSegmentPseudoJetAlgorithm -from JetMomentTools.JetMomentToolsConf import JetCaloQualityTool -try: - from JetMomentTools.JetMomentToolsConf import JetCaloCellQualityTool - jtm.haveJetCaloCellQualityTool = True -except ImportError: - jtm.haveJetCaloCellQualityTool = False -from JetMomentTools.JetMomentToolsConf import JetWidthTool -from JetMomentTools.JetMomentToolsConf import JetCaloEnergies -try: - jtm.haveJetBadChanCorrTool = True -except ImportError: - jtm.haveJetBadChanCorrTool = False -from JetMomentTools.JetMomentToolsConf import JetECPSFractionTool -from JetMomentTools.JetMomentToolsConf import JetVertexFractionTool -from JetMomentTools.JetMomentToolsConf import JetVertexTaggerTool -from JetMomentTools.JetMomentToolsConf import JetTrackMomentsTool -from JetMomentTools.JetMomentToolsConf import JetTrackSumMomentsTool -from JetMomentTools.JetMomentToolsConf import JetClusterMomentsTool -from JetMomentTools.JetMomentToolsConf import JetVoronoiMomentsTool -from JetMomentTools.JetMomentToolsConf import JetIsolationTool -from JetMomentTools.JetMomentToolsConf import JetLArHVTool -from JetMomentTools.JetMomentToolsConf import JetOriginCorrectionTool -from JetMomentTools.JetMomentToolsConf import JetConstitFourMomTool -from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import KtDeltaRTool -from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import NSubjettinessTool -from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import KTSplittingScaleTool -from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import AngularityTool -from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import DipolarityTool -from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import PlanarFlowTool -from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import KtMassDropTool -from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import EnergyCorrelatorTool -from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import EnergyCorrelatorGeneralizedTool -from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import EnergyCorrelatorGeneralizedRatiosTool -from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import CenterOfMassShapesTool -from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import JetPullTool -from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import JetChargeTool -from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import QwTool -try: - from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import ShowerDeconstructionTool - jtm.haveShowerDeconstructionTool = True -except ImportError: - jtm.haveShowerDeconstructionTool = False -try: - from ParticleJetTools.ParticleJetToolsConf import Analysis__JetQuarkLabel - jtm.haveParticleJetTools = True -except ImportError: - jtm.haveParticleJetTools = False -if jtm.haveParticleJetTools: - from ParticleJetTools.ParticleJetToolsConf import Analysis__JetConeLabeling - from ParticleJetTools.ParticleJetToolsConf import Analysis__JetPartonTruthLabel - from ParticleJetTools.ParticleJetToolsConf import CopyTruthJetParticles - from ParticleJetTools.ParticleJetToolsConf import ParticleJetDeltaRLabelTool - from ParticleJetTools.ParticleJetToolsConf import ParticleJetGhostLabelTool - -# Setting flags -useVertices = True -if not jetFlags.useVertices: - useVertices = False - -if jobproperties.eflowRecFlags.useUpdated2015ChargedShowerSubtraction: - useChargedWeights = True -else: - useChargedWeights = False - -useTrackVertexTool = False -if jetFlags.useTrackVertexTool: - useTrackVertexTool = True - -#-------------------------------------------------------------- -# Track selection. -#-------------------------------------------------------------- - -# This is the InDet loose selection from -# https://twiki.cern.ch/twiki/bin/view/AtlasProtected/InDetTrackingPerformanceGuidelines -# October 28, 2014 -#jtm += InDet__InDetDetailedTrackSelectionTool( -jtm += InDet__InDetTrackSelectionTool( - "trk_trackselloose", - CutLevel = "Loose", - minPt = 500 -) - -# This tool is only used to access the selector so we use -# the simplified JetTrackSelectionTool. The other tools definied here -# could probably also move to this tool. - -jtm += JetTrackSelectionTool2( - "trackselloose", - # InputContainer = jtm.trackContainer, - # OutputContainer = "JetSelectedTracks", - Selector = jtm.trk_trackselloose - ) - -jtm += InDet__InDetTrackSelectionTool( - "trk_trackselloose_trackjets", - CutLevel = "Loose", - minPt = 500 -) - -jtm += JetTrackSelectionTool( - "trackselloose_trackjets", - InputContainer = jtm.trackContainer, - OutputContainer = "JetSelectedTracks_LooseTrackJets", - Selector = jtm.trk_trackselloose_trackjets -) - -if jetFlags.useInDetTrackSelection(): - jtm += JetTrackSelectionTool( - "tracksel", - InputContainer = jtm.trackContainer, - OutputContainer = "JetSelectedTracks", - Selector = jtm.trk_trackselloose - ) -else: - jtm += SimpleJetTrackSelectionTool( - "tracksel", - PtMin = 500.0, - InputContainer = jtm.trackContainer, - OutputContainer = "JetSelectedTracks", - ) - -#-------------------------------------------------------------- -# Track-vertex association. -#-------------------------------------------------------------- - -from TrackVertexAssociationTool.getTTVAToolForReco import getTTVAToolForReco -jtm += getTTVAToolForReco("jetLooseTVAtool", WorkingPoint="Custom", d0_cut=2.0, dzSinTheta_cut=2.0, TrackContName=jtm.trackContainer, VertexContName=jtm.vertexContainer) -jtm += getTTVAToolForReco("trackjetTVAtool", WorkingPoint="Nonprompt_All_MaxWeight", TrackContName="JetSelectedTracks_LooseTrackJets", VertexContName=jtm.vertexContainer) -jtm += getTTVAToolForReco("jetLooseTVAtoolNew", WorkingPoint="Nonprompt_All_MaxWeight", TrackContName=jtm.trackContainer, VertexContName=jtm.vertexContainer) - -jtm += TrackVertexAssociationTool( - "tvassoc", - TrackParticleContainer = jtm.trackContainer, - TrackVertexAssociation = "JetTrackVtxAssoc", - VertexContainer = jtm.vertexContainer, - TrackVertexAssoTool = jtm.jetLooseTVAtool, -) - -jtm += TrackVertexAssociationTool( - "ttvaassocNew", - TrackParticleContainer = jtm.trackContainer, - TrackVertexAssociation = "JetTrackVtxAssoc_Nonprompt_All_MaxWeight", - VertexContainer = jtm.vertexContainer, - TrackVertexAssoTool = jtm.jetLooseTVAtoolNew, -) - - -from TrackVertexAssociationTool.TrackVertexAssociationToolConf import PV0TrackSelectionAlg - -jtm += PV0TrackSelectionAlg( - "pv0tracksel_trackjet", - InputTrackContainer = "JetSelectedTracks_LooseTrackJets", - VertexContainer = jtm.vertexContainer, - OutputTrackContainer = "PV0JetSelectedTracks_LooseTrackJets", - TVATool = jtm.trackjetTVAtool -) -#-------------------------------------------------------------- -# Truth selection. -#-------------------------------------------------------------- - -if jetFlags.useTruth: - truthClassifier = MCTruthClassifier(name = "JetMCTruthClassifier", - ParticleCaloExtensionTool="") - jtm += truthClassifier - - jtm += CopyTruthJetParticles("truthpartcopy", OutputName="JetInputTruthParticles", - MCTruthClassifier=truthClassifier) - jtm += CopyTruthJetParticles("truthpartcopywz", OutputName="JetInputTruthParticlesNoWZ", - MCTruthClassifier=truthClassifier, - IncludePromptLeptons=False, - IncludeMuons=True,IncludeNeutrinos=True) - - -#-------------------------------------------------------------- -# Jet reco infrastructure. -#-------------------------------------------------------------- - -# Jet pseudojet retriever. -jtm += JetPseudojetRetriever("jpjretriever") - -# Jet constituent retriever. -labs = [] -if jetFlags.useTracks(): - labs += ["Track"] - labs += ["AntiKt2TrackJet", "AntiKt2TrackJet"] -if jetFlags.useMuonSegments(): - labs += ["MuonSegment",] -if jetFlags.useTruth(): - labs += ["Truth"] - for lab in jetFlags.truthFlavorTags(): - labs += [lab] -jtm += JetConstituentsRetriever( - "jconretriever", - UsePseudojet = True, - UseJetConstituents = True, - PseudojetRetriever = jtm.jpjretriever, - GhostLabels = labs) - -#-------------------------------------------------------------- -# Pseudojet builders. -#-------------------------------------------------------------- - -# Prepare a sequence of input constituent modifiers -from JetRecTools.ConstitToolManager import ctm -jtm += ctm.buildConstitModifSequence( "JetConstitSeq_LCOrigin", - OutputContainer='LCOriginTopoClusters', - InputContainer= 'CaloCalTopoClusters', - modList = [ 'clus_origin' ] ) - -jtm += ctm.buildConstitModifSequence( "JetConstitSeq_EMOrigin", - OutputContainer='EMOriginTopoClusters', - InputContainer= 'CaloCalTopoClusters', - modList = [ 'clus_emscale', 'clus_origin' ] ) - -jtm += PseudoJetAlgorithm( - "lcoriginget", - InputContainer = jtm.JetConstitSeq_LCOrigin.OutputContainer, - Label = "LCTopoOrigin", - OutputContainer = "PseudoJetLCTopoOrigin", - SkipNegativeEnergy = True, -) - -jtm += PseudoJetAlgorithm( - "emoriginget", - InputContainer = jtm.JetConstitSeq_EMOrigin.OutputContainer, - Label = "EMTopoOrigin", - OutputContainer = "PseudoJetEMTopoOrigin", - SkipNegativeEnergy = True, -) - -# Clusters. -jtm += PseudoJetAlgorithm( - "lcget", - InputContainer = "CaloCalTopoClusters", - Label = "LCTopo", - OutputContainer = "PseudoJetLCTopo", - SkipNegativeEnergy = True, -) - -# EM clusters. -jtm += PseudoJetAlgorithm( - "emget", - InputContainer = "CaloCalTopoClusters", - Label = "EMTopo", - OutputContainer = "PseudoJetEMTopo", - SkipNegativeEnergy = True, -) - -# Tracks. -jtm += PseudoJetAlgorithm( - "trackget", - InputContainer = jtm.trackselloose_trackjets.OutputContainer, - Label = "Track", - OutputContainer = "PseudoJetTrack", - SkipNegativeEnergy = True, -) - -# PV0 Tracks. -jtm += PseudoJetAlgorithm( - "pv0trackget", - InputContainer = jtm.pv0tracksel_trackjet.OutputTrackContainer, - Label = "Track", - OutputContainer = "PseudoJetPV0Track", - SkipNegativeEnergy = True, -) - -# Ghost tracks. -jtm += PseudoJetAlgorithm( - "gtrackget", - InputContainer = jtm.tracksel.OutputContainer, - Label = "GhostTrack", - OutputContainer = "PseudoJetGhostTrack", - SkipNegativeEnergy = True, -) - -if jetFlags.useLargeD0Tracks(): - jtm += PseudoJetAlgorithm( - "gtracklrtget", - InputContainer = "InDetLargeD0TrackParticles", - Label = "GhostTrackLRT", - OutputContainer = "PseudoJetGhostTrackLRT", - SkipNegativeEnergy = True, - ) - -# Muon segments -jtm += MuonSegmentPseudoJetAlgorithm( - "gmusegget", - InputContainer = "MuonSegments", - Label = "GhostMuonSegment", - OutputContainer = "PseudoJetGhostMuonSegment", - Pt = 1.e-20 -) - -# Ghost towers: -jtm += PseudoJetAlgorithm( - "gtowerget", - InputContainer = "CaloCalFwdTopoTowers", - Label = "GhostTower", - OutputContainer = "PseudoJetGhostTower" -) - -# Weight tool for charged pflow objects. -jtm += WeightPFOTool("pflowweighter") - -# Trigger xAODType.ObjectType dict entry loading -import cppyy -try: - cppyy.load_library('libxAODBaseObjectTypeDict') -except Exception: - pass -from ROOT import xAODType -xAODType.ObjectType - -# Would go in JetRecToolsConfig but this hits a circular dependency on jtm? -# this applies four-momentum corrections to PFlow objects: -# - points neutral PFOs to the selected vertex -# - weights charged PFOs to smoothly turn off shower subtraction at high pt -ctm.add( CorrectPFOTool("CorrectPFOTool", - WeightPFOTool = jtm.pflowweighter, - InputIsEM = True, - CalibratePFO = False, - UseChargedWeights = True, - InputType = xAODType.FlowElement - ), - alias = 'correctPFO' ) - -# this removes (weights momenta to 0) charged PFOs from non-hard-scatter vertices -# keep option to run the CHS tool without the TVA tool so that the one can run it and create the PU sidebands -if useTrackVertexTool: - ctm.add( ChargedHadronSubtractionTool("CHSTool", InputType = xAODType.FlowElement, UseTrackToVertexTool=True, TrackVertexAssociation=jtm.ttvaassocNew.TrackVertexAssociation), - alias = 'chsPFO' ) -else: - ctm.add( ChargedHadronSubtractionTool("CHSTool", InputType = xAODType.FlowElement), - alias = 'chsPFO' ) - -# Options to disable dependence on primary vertex container -# for PFO corrections (e.g. when running cosmics) -if not (jetFlags.useTracks and jetFlags.useVertices): - ctm.modifiersMap['correctPFO'].CorrectNeutral=False - ctm.modifiersMap['chsPFO'].IgnoreVertex=True - -# Run the above tools to modify PFO -jtm += ctm.buildConstitModifSequence( "JetConstitSeq_PFlowCHS", - InputContainer = "JetETMiss", - OutputContainer = "CHS", #"ParticleFlowObjects" will be appended later - modList = ['correctPFO', 'chsPFO'] ) - -# EM-scale pflow. -jtm += PseudoJetAlgorithm( - "empflowget", - Label = "EMPFlow", - InputContainer = "CHSParticleFlowObjects", - OutputContainer = "PseudoJetEMPFlow", - SkipNegativeEnergy = True, - UseCharged = True, - UseNeutral = True, - UseChargedPV = True, - UseChargedPUsideband = False, -) - -# EM-scale pflow with custom selection for the primary vertex -jtm += PseudoJetAlgorithm( - "pflowcustomvtxget", - Label = "PFlowCustomVtx", - InputContainer = "CustomVtxParticleFlowObjects", - OutputContainer = "PseudoJetPFlowCustomVtx", - SkipNegativeEnergy = True, - UseCharged = True, - UseNeutral = True, - UseChargedPV = True, - UseChargedPUsideband = False, -) - -#New sideband definition (default for precision recs) -jtm += PseudoJetAlgorithm( - "empflowpusbget", - Label = "EMPFlowPUSB", - InputContainer = "CHSParticleFlowObjects", - OutputContainer = "PseudoJetEMPFlowPUSB", - SkipNegativeEnergy = True, - UseCharged = True, - UseNeutral = True, - UseChargedPV = False, - UseChargedPUsideband = True, -) - -# EM-scale pflow - neutral objects only -jtm += PseudoJetAlgorithm( - "empflowneutget", - Label = "EMPFlowNeut", - InputContainer = "CHSParticleFlowObjects", - OutputContainer = "PseudoJetEMPFlowNeut", - SkipNegativeEnergy = True, - UseCharged = False, - UseNeutral = True, - UseChargedPV = False, - UseChargedPUsideband = False, -) - -# AntiKt2 track jets. -jtm += PseudoJetAlgorithm( - "gakt2trackget", # give a unique name - InputContainer = jetFlags.containerNamePrefix() + "AntiKt2PV0TrackJets", # SG key - Label = "GhostAntiKt2TrackJet", # this is the name you'll use to retrieve associated ghosts - OutputContainer = "PseudoJetGhostAntiKt2TrackJet", - SkipNegativeEnergy = True, -) - -# AntiKt4 track jets. -jtm += PseudoJetAlgorithm( - "gakt4trackget", # give a unique name - InputContainer = jetFlags.containerNamePrefix() + "AntiKt4PV0TrackJets", # SG key - Label = "GhostAntiKt4TrackJet", # this is the name you'll use to retrieve associated ghosts - OutputContainer = "PseudoJetGhostAntiKt4TrackJet", - SkipNegativeEnergy = True, -) - -# Standard VR track jets. -jtm += PseudoJetAlgorithm( - "gvrtrackget", # give a unique name - InputContainer = jetFlags.containerNamePrefix() + "AntiKtVR30Rmax4Rmin02PV0TrackJets", # SG key - Label = "GhostVR30Rmax4Rmin02PV0TrackJet", # this is the name you'll use to retrieve associated ghosts - OutputContainer = "PseudoJetGhostVR30Rmax4Rmin02PV0TrackJet", - SkipNegativeEnergy = True, -) - -# Truth. -if jetFlags.useTruth and jtm.haveParticleJetTools: - jtm += PseudoJetAlgorithm( - "truthget", - Label = "Truth", - InputContainer = jtm.truthpartcopy.OutputName, - OutputContainer = "PseudoJetTruth", - SkipNegativeEnergy = True, - - ) - jtm += PseudoJetAlgorithm( - "truthwzget", - Label = "TruthWZ", - InputContainer = jtm.truthpartcopywz.OutputName, - OutputContainer = "PseudoJetTruthWZ", - SkipNegativeEnergy = True, - - ) - jtm += PseudoJetAlgorithm( - "gtruthget", - Label = "GhostTruth", - InputContainer = jtm.truthpartcopy.OutputName, - OutputContainer = "PseudoJetGhostTruth", - SkipNegativeEnergy = True, - ) - - # Truth flavor tags. - for ptype in jetFlags.truthFlavorTags(): - jtm += PseudoJetAlgorithm( - "gtruthget_" + ptype, - InputContainer = "TruthLabel" + ptype, - Label = "Ghost" + ptype, - OutputContainer = "PseudoJetGhost" + ptype, - SkipNegativeEnergy = True, - ) - - # ParticleJetTools tools may be omitted in analysi releases. - #ift jtm.haveParticleJetTools: - # Delta-R truth parton label: truthpartondr. - jtm += Analysis__JetQuarkLabel( - "jetquarklabel", - McEventCollection = "TruthEvents" - ) - jtm += Analysis__JetConeLabeling( - "truthpartondr", - JetTruthMatchTool = jtm.jetquarklabel - ) - - # Parton truth label. - jtm += Analysis__JetPartonTruthLabel("partontruthlabel") - - # Cone matching for B, C and tau truth for all but track jets. - jtm += ParticleJetDeltaRLabelTool( - "jetdrlabeler", - LabelName = "HadronConeExclTruthLabelID", - DoubleLabelName = "HadronConeExclExtendedTruthLabelID", - LabelPtName = "HadronConeExclTruthLabelPt", - LabelPtScaledName = "HadronConeExclTruthLabelPtScaled", - LabelLxyName = "HadronConeExclTruthLabelLxy", - LabelDRName = "HadronConeExclTruthLabelDR", - LabelPdgIdName = "HadronConeExclTruthLabelPdgId", - LabelBarcodeName = "HadronConeExclTruthLabelBarcode", - ChildLxyName = "HadronConeExclTruthLabelChildLxy", - ChildPtName = "HadronConeExclTruthLabelChildPt", - ChildPdgIdName = "HadronConeExclTruthLabelChildPdgId", - BLabelName = "ConeExclBHadronsFinal", - CLabelName = "ConeExclCHadronsFinal", - TauLabelName = "ConeExclTausFinal", - BParticleCollection = "TruthLabelBHadronsFinal", - CParticleCollection = "TruthLabelCHadronsFinal", - TauParticleCollection = "TruthLabelTausFinal", - PartPtMin = 5000.0, - JetPtMin = 0.0, - DRMax = 0.3, - MatchMode = "MinDR" - ) - - # Cone matching for B, C and tau truth for track jets. - jtm += ParticleJetDeltaRLabelTool( - "trackjetdrlabeler", - LabelName = "HadronConeExclTruthLabelID", - DoubleLabelName = "HadronConeExclExtendedTruthLabelID", - LabelPtName = "HadronConeExclTruthLabelPt", - LabelPtScaledName = "HadronConeExclTruthLabelPtScaled", - LabelLxyName = "HadronConeExclTruthLabelLxy", - LabelDRName = "HadronConeExclTruthLabelDR", - LabelPdgIdName = "HadronConeExclTruthLabelPdgId", - LabelBarcodeName = "HadronConeExclTruthLabelBarcode", - ChildLxyName = "HadronConeExclTruthLabelChildLxy", - ChildPtName = "HadronConeExclTruthLabelChildPt", - ChildPdgIdName = "HadronConeExclTruthLabelChildPdgId", - BLabelName = "ConeExclBHadronsFinal", - CLabelName = "ConeExclCHadronsFinal", - TauLabelName = "ConeExclTausFinal", - BParticleCollection = "TruthLabelBHadronsFinal", - CParticleCollection = "TruthLabelCHadronsFinal", - TauParticleCollection = "TruthLabelTausFinal", - PartPtMin = 5000.0, - JetPtMin = 4500.0, - DRMax = 0.3, - MatchMode = "MinDR" - ) - - jtm += ParticleJetGhostLabelTool( - "ghostlabeler", - LabelName = "HadronGhostTruthLabelID", - DoubleLabelName = "HadronGhostExtendedTruthLabelID", - LabelPtName = "HadronGhostTruthLabelPt", - LabelPtScaledName = "HadronGhostTruthLabelPtScaled", - LabelLxyName = "HadronGhostTruthLabelLxy", - LabelDRName = "HadronGhostTruthLabelDR", - LabelPdgIdName = "HadronGhostTruthLabelPdgId", - LabelBarcodeName = "HadronGhostTruthLabelBarcode", - ChildLxyName = "HadronGhostTruthLabelChildLxy", - ChildPtName = "HadronGhostTruthLabelChildPt", - ChildPdgIdName = "HadronGhostTruthLabelChildPdgId", - GhostBName = "GhostBHadronsFinal", - GhostCName = "GhostCHadronsFinal", - GhostTauName = "GhostTausFinal", - PartPtMin = 5000.0 - ) - -#-------------------------------------------------------------- -# Jet builder. -# The tool manager must have one jet builder. -#-------------------------------------------------------------- - -jtm.addJetBuilderWithArea(JetFromPseudojet( - "jblda", - Attributes = ["ActiveArea", "ActiveArea4vec"] -)) - -jtm.addJetBuilderWithoutArea(JetFromPseudojet( - "jbldna", - Attributes = [] -)) - -#-------------------------------------------------------------- -# Non-substructure moment builders. -#-------------------------------------------------------------- - -# Quality from clusters. -jtm += JetCaloQualityTool( - "caloqual_cluster", - TimingCuts = [5, 10], - Calculations = ["LArQuality", "N90Constituents", "FracSamplingMax", "NegativeE", "Timing", "HECQuality", "Centroid", "AverageLArQF", "BchCorrCell"], -) - -# Quality from cells. -if jtm.haveJetCaloCellQualityTool: - jtm += JetCaloCellQualityTool( - "caloqual_cell", - LArQualityCut = 4000, - TileQualityCut = 254, - TimingCuts = [5, 10], - Calculations = ["LArQuality", "N90Cells", "FracSamplingMax", "NegativeE", "Timing", "HECQuality", "Centroid", "AverageLArQF"] - ) - -# Jet width. -jtm += JetWidthTool("width") - -# Calo layer energies. -jtm += JetCaloEnergies("jetens") - -# Jet vertex fraction with selection. -# This is never used without jtm.trksummoms when configured from here, so suppress input dependence. -jtm += JetVertexFractionTool( - "jvf", - VertexContainer = jtm.vertexContainer, - AssociatedTracks = "GhostTrack", - TrackVertexAssociation = jtm.tvassoc.TrackVertexAssociation, - TrackParticleContainer = jtm.trackContainer, - TrackSelector = jtm.trackselloose, - JVFName = "JVF", - K_JVFCorrScale = 0.01, - #Z0Cut = 3.0, - PUTrkPtCut = 30000.0, - SuppressInputDependence = True -) - -# Jet vertex tagger. -# This is never used without jtm.jvf and jtm.trksummoms when configured from here, so suppress input dependence. -jtm += JetVertexTaggerTool( - "jvt", - VertexContainer = jtm.vertexContainer, - JVTName = "Jvt", - SuppressInputDependence = True, -) - -# Jet track info. -jtm += JetTrackMomentsTool( - "trkmoms", - VertexContainer = jtm.vertexContainer, - AssociatedTracks = "GhostTrack", - TrackVertexAssociation = jtm.tvassoc.TrackVertexAssociation, - TrackMinPtCuts = [500, 1000], - TrackSelector = jtm.trackselloose -) - -# Jet track vector sum info -jtm += JetTrackSumMomentsTool( - "trksummoms", - VertexContainer = jtm.vertexContainer, - AssociatedTracks = "GhostTrack", - TrackVertexAssociation = jtm.tvassoc.TrackVertexAssociation, - RequireTrackPV = True, - TrackSelector = jtm.trackselloose -) - -# Jet cluster info. -jtm += JetClusterMomentsTool("clsmoms") - -jtm += JetVoronoiMomentsTool( - "voromoms", - AreaXmin= -5., - AreaXmax= 5., - AreaYmin= -3.141592, - AreaYmax= 3.141592 -) - -# Number of associated muon segments. -#jtm += JetMuonSegmentMomentsTool("muonsegs") - -# Isolations. -# Note absence of PseudoJetAlgorithm property means the jet inputs -# are obtained according to the InputType property of the jet. -jtm += JetIsolationTool( - "jetisol", - IsolationCalculations = ["IsoDelta:2:SumPt", "IsoDelta:3:SumPt"], -) -jtm += JetIsolationTool( - "run1jetisol", - IsolationCalculations = ["IsoKR:11:Perp", "IsoKR:11:Par", "IsoFixedCone:6:SumPt",], -) - -# Bad LAr fractions. -jtm += JetLArHVTool("larhvcorr") - -# Bad LAr fractions. -jtm += JetECPSFractionTool( - "ecpsfrac", -) - -# Jet origin correction. -jtm += JetOriginCorrectionTool( - "jetorigincorr", - VertexContainer = jtm.vertexContainer, - OriginCorrectedName = "JetOriginConstitScaleMomentum" -) - -# Just set the PV without applying origin correction -jtm += JetOriginCorrectionTool( - "jetorigin_setpv", - VertexContainer = jtm.vertexContainer, - OriginCorrectedName = "", - OnlyAssignPV = True, -) - -### Not ideal, but because CaloCluster.Scale is an internal class -### it makes the dict load really slow. -### So just copy the enum to a dict... -### Defined in Event/xAOD/xAODCaloEvent/versions/CaloCluster_v1.h -CaloClusterStates = { - "UNKNOWN" : -1, - "UNCALIBRATED" : 0, - "CALIBRATED" : 1, - "ALTCALIBRATED" : 2, - "NSTATES" : 3 - } - -### Workaround for inability of Gaudi to parse single-element tuple -import GaudiPython.Bindings as GPB -_old_setattr = GPB.iProperty.__setattr__ -def _new_setattr(self, name, value): - if type(value) == tuple: - value = list(value) - return _old_setattr(self, name, value) -GPB.iProperty.__setattr__ = _new_setattr -### - -jtm += JetConstitFourMomTool( - "constitfourmom_lctopo", - JetScaleNames = ["DetectorEtaPhi"], - AltConstitColls = ["CaloCalTopoClusters"], - AltConstitScales = [CaloClusterStates["CALIBRATED"]], - AltJetScales = [""] - ) - -jtm += JetConstitFourMomTool( - "constitfourmom_emtopo", - JetScaleNames = ["DetectorEtaPhi","JetLCScaleMomentum"], - AltConstitColls = ["CaloCalTopoClusters","LCOriginTopoClusters" if (jetFlags.useTracks() and jetFlags.useVertices()) else "CaloCalTopoClusters"], - AltConstitScales = [CaloClusterStates["UNCALIBRATED"],CaloClusterStates["CALIBRATED"]], - AltJetScales = ["",""] - ) - -jtm += JetConstitFourMomTool( - "constitfourmom_pflow", - JetScaleNames = ["DetectorEtaPhi"], - AltConstitColls = [""], - AltConstitScales = [0], - AltJetScales = ["JetConstitScaleMomentum"] - ) - -#-------------------------------------------------------------- -# Substructure moment builders. -#-------------------------------------------------------------- - -# Nsubjettiness -jtm += NSubjettinessTool( - "nsubjettiness", - Alpha = 1.0 -) - -# KtDR -jtm += KtDeltaRTool( - "ktdr", - JetRadius = 0.4 -) - -# Kt-splitter -jtm += KTSplittingScaleTool("ktsplitter") - -# Angularity. -jtm += AngularityTool("angularity") - -# Dipolarity. -jtm += DipolarityTool("dipolarity", SubJetRadius = 0.3) - -# Planar flow. -jtm += PlanarFlowTool("planarflow") - -# Kt mass drop. -jtm += KtMassDropTool("ktmassdrop") - -# Energy correlations. -jtm += EnergyCorrelatorTool("encorr", Beta = 1.0) - -# Generalized energy correlations -jtm += EnergyCorrelatorGeneralizedTool("energycorrelatorgeneralized") - -# ... & their ratios -jtm += EnergyCorrelatorGeneralizedRatiosTool("energycorrelatorgeneralizedratios") - -# COM shapes. -jtm += CenterOfMassShapesTool("comshapes") - -# Jet pull -jtm += JetPullTool( - "pull", - UseEtaInsteadOfY = False, - IncludeTensorMoments = True -) - -# Jet charge -jtm += JetChargeTool("charge", K=1.0) - -# Shower deconstruction. -if jtm.haveShowerDeconstructionTool: - jtm += ShowerDeconstructionTool("showerdec") - -#Q jets -jtm += QwTool("qw") - -# Remove constituents (useful for truth jets in evgen pile-up file) -jtm += JetConstitRemover("removeconstit") - -# Sort jets by pT -# May be deisred after calibration or grooming. -jtm += JetSorter("jetsorter") diff --git a/Reconstruction/Jet/JetRec/python/JetRecUtils.py b/Reconstruction/Jet/JetRec/python/JetRecUtils.py deleted file mode 100644 index 3500163c4f529ddc034aed2318375c9a241eeaeb..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetRec/python/JetRecUtils.py +++ /dev/null @@ -1,134 +0,0 @@ -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration - -from AthenaCommon import Logging -jetlog = Logging.logging.getLogger('JetRec_jobOptions') - -def retrieveAODList(enableOutputOverride = False): - from JetRec.JetRecFlags import jetFlags, JetContentDetail - from RecExConfig.RecFlags import rec - - #We always want to write pileup truth jets to AOD, irrespective of whether we write jets to AOD in general - #This is because we cannot rebuild jets from pileup truth particles from the AOD - jetPileUpTruthList = [] - if rec.doTruth(): - jetPileUpTruthList += [ - 'xAOD::JetContainer#InTimeAntiKt4TruthJets', 'xAOD::AuxContainerBase!#InTimeAntiKt4TruthJetsAux.-PseudoJet.-constituentLinks.-constituentWeights', - 'xAOD::JetContainer#OutOfTimeAntiKt4TruthJets', 'xAOD::AuxContainerBase!#OutOfTimeAntiKt4TruthJetsAux.-PseudoJet.-constituentLinks.-constituentWeights', - ] - - #If we don't want to write jets to AOD then we just return the above list of pileup truth jets - if (not enableOutputOverride) and (not jetFlags.writeJetsToAOD()): - return jetPileUpTruthList - - if rec.doWriteESD(): - jetAODList = jetFlags.jetAODList() - if rec.doTruth(): - jetAODList += jetPileUpTruthList - return jetAODList - # then we are merging or doing a AOD ? - # We can not simply copy what we have from input since some - # jobs starts from empty files. See ATEAM-191. - # We hard code the list here while waiting for a more robust solution - - l = [ - # event shape objects - 'xAOD::EventShape#Kt4EMPFlowEventShape', 'xAOD::EventShapeAuxInfo#Kt4EMPFlowEventShapeAux.', - 'xAOD::EventShape#Kt4EMTopoOriginEventShape', 'xAOD::EventShapeAuxInfo#Kt4EMTopoOriginEventShapeAux.', - 'xAOD::EventShape#Kt4LCTopoOriginEventShape', 'xAOD::EventShapeAuxInfo#Kt4LCTopoOriginEventShapeAux.', - 'xAOD::EventShape#Kt4EMTopoEventShape', 'xAOD::EventShapeAuxInfo#Kt4EMTopoEventShapeAux.', - 'xAOD::EventShape#Kt4LCTopoEventShape', 'xAOD::EventShapeAuxInfo#Kt4LCTopoEventShapeAux.', - 'xAOD::EventShape#NeutralParticleFlowIsoCentralEventShape', 'xAOD::EventShapeAuxInfo#NeutralParticleFlowIsoCentralEventShapeAux.', - 'xAOD::EventShape#NeutralParticleFlowIsoForwardEventShape', 'xAOD::EventShapeAuxInfo#NeutralParticleFlowIsoForwardEventShapeAux.', - 'xAOD::EventShape#ParticleFlowIsoCentralEventShape', 'xAOD::EventShapeAuxInfo#ParticleFlowIsoCentralEventShapeAux.', - 'xAOD::EventShape#ParticleFlowIsoForwardEventShape', 'xAOD::EventShapeAuxInfo#ParticleFlowIsoForwardEventShapeAux.', - 'xAOD::EventShape#TopoClusterIsoCentralEventShape', 'xAOD::EventShapeAuxInfo#TopoClusterIsoCentralEventShapeAux.', - 'xAOD::EventShape#TopoClusterIsoForwardEventShape', 'xAOD::EventShapeAuxInfo#TopoClusterIsoForwardEventShapeAux.', - - 'xAOD::JetContainer#AntiKt4EMPFlowJets', 'xAOD::JetAuxContainer#AntiKt4EMPFlowJetsAux.-PseudoJet', - 'xAOD::JetContainer#AntiKt4EMPFlowByVertexJets', 'xAOD::JetAuxContainer#AntiKt4EMPFlowByVertexJetsAux.-PseudoJet', - 'xAOD::JetContainer#AntiKt4EMTopoJets', 'xAOD::JetAuxContainer#AntiKt4EMTopoJetsAux.-PseudoJet', - 'xAOD::JetContainer#AntiKt4LCTopoJets', 'xAOD::JetAuxContainer#AntiKt4LCTopoJetsAux.-PseudoJet', - ] - - if rec.doTruth(): - l += jetPileUpTruthList - - if jetFlags.detailLevel()==JetContentDetail.Full: - l += [ - 'xAOD::JetContainer#AntiKt10LCTopoJets', 'xAOD::JetAuxContainer#AntiKt10LCTopoJetsAux.-PseudoJet', - - 'xAOD::CaloClusterContainer#EMOriginTopoClusters', 'xAOD::ShallowAuxContainer#EMOriginTopoClustersAux.', - 'xAOD::CaloClusterContainer#LCOriginTopoClusters' , 'xAOD::ShallowAuxContainer#LCOriginTopoClustersAux.', - ] - - if rec.doTruth(): - l += [ - 'xAOD::JetContainer#AntiKt4TruthJets', 'xAOD::JetAuxContainer#AntiKt4TruthJetsAux.-PseudoJet', - ] - elif jetFlags.detailLevel()==JetContentDetail.Trigger: - l += ['xAOD::JetContainer#AntiKt10LCTopoJets', 'xAOD::JetAuxContainer#AntiKt10LCTopoJetsAux.-PseudoJet'] - l += ['xAOD::JetContainer#AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets', 'xAOD::JetAuxContainer#AntiKt10LCTopoTrimmedPtFrac5SmallR20JetsAux.-PseudoJet'] - - return l - -# define the convention that we write R truncating the decimal point -# if R>=1, then we write R*10 -def formatRvalue(parameter): - from AthenaCommon import Logging - jetlog = Logging.logging.getLogger('JetRecUtils') - # impose precision limits where there could be ambiguity - if int(10*parameter)>=1 and int(100*parameter % 10): - jetlog.warning('Radius parameter {0} exceeds allowable precision of 0.1'.format(parameter)) - if int(parameter)>=1: - return "{0:.0f}".format(10*parameter) - else: - return "{0:.1g}".format(10*parameter).replace('.','') - -def buildJetAlgName(finder, mainParam, variableRMassScale=0, variableRMinRadius=0): # variableRMassScale (Rho) in MeV - if ( variableRMassScale > 0 ): - rmaxstr = formatRvalue(mainParam) - rminstr = formatRvalue(variableRMinRadius) - return finder + "VR" + str(int(variableRMassScale/1000)) + "Rmax" + rmaxstr + "Rmin" + rminstr - return finder + formatRvalue(mainParam) - -def buildJetContName(finder, mainParam, input, variableRMassScale=0, variableRMinRadius=0): - return buildJetAlgName(finder, mainParam, variableRMassScale, variableRMinRadius) +input+"Jets" # could be more elaborated... - -def interpretJetName(jetcollName, finder = None,input=None, mainParam=None): - from AthenaCommon import Logging - jetlog = Logging.logging.getLogger('JetRecUtils') - # first step : guess the finder, input , mainParam, if needed - if finder is None: - for a in [ 'AntiKt','CamKt','Kt', 'Cone','SISCone','CMSCone']: - if jetcollName.startswith(a): - finder = a - break - if finder is None: - jetlog.warning( "Error could not guess jet finder type in ",jetcollName ) - return - - if input is None: - for i in ['LCTopo','Tower','EMTopo', "Truth", "ZTrack", 'PV0Track']: - if i in jetcollName: - input = i - if i== "Tower": - if 'Ghost' in jetcollName: - input = 'Tower' - else: - input = "TopoTower" - break - if input is None: - jetlog.warning( "Error could not guess input type in ",jetcollName ) - return - - if mainParam is None: - # get the 2 chars following finder : - mp = jetcollName[len(finder):len(finder)+2] - mp = mp[0] if not mp[1] in '0123456789' else mp - try : - mainParam = float(mp)/10. - except ValueError : - jetlog.warning( "Error could not guess main parameter in ",jetcollName ) - return - - return finder, mainParam, input diff --git a/Reconstruction/Jet/JetRec/python/JetToolSupport.py b/Reconstruction/Jet/JetRec/python/JetToolSupport.py deleted file mode 100644 index 2de58d959aee4e0538f167f78bc237a48af97f06..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetRec/python/JetToolSupport.py +++ /dev/null @@ -1,750 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -# JetToolSupport.py -# -# David Adams -# March 2014 -# -# Defines the jet tool manager (class JetToolManager, JTM for short) -# which can be used to configure jet reconstruction tools. -# -# Use add or "+=" to register a tool both with this an instance of this -# class and with ToolSvc. The advantage of doing it here is there is a -# check to make sure the same name is not used more than once. -# -# Tools are locked when registered. The method setOutputLevel may -# be used to override this lock to change the tool's output level. -# -# Methods are provide to configure a jetrec tool along with its -# associated finder or groomer. The member "jetrecs" holds the full -# list of offline jetrec tools and can be used to configure the tool or -# algorithm that loops over such tools. The member trigjetrecs holds -# the same for the trigger. The members "finders" and -# "groomers" hold the finding and grooming tools used by the jetrec -# tools. -# -# The prefix for messages from this tool is held by the member "prefix" -# and the member "debug" may be set to 1 to obtain more messages. -# -# The members "jetBuilderWithArea" and "jetBuilderWithoutArea" hold the -# jet builders used by all jetrec tools. -# -# The member "ghostArea" specifies the area to use for the ghosts -# generated for jet finding. - -from __future__ import print_function - -from AthenaCommon import Logging -jetlog = Logging.logging.getLogger('JetRec_jobOptions') - -# import the jet flags. -from JetRec.JetRecFlags import jetFlags - -# The tool manager -class JetToolManager: - prefix = "JetToolManager: " - debug = 0 - m_jetBuilder = None - jetBuilderWithArea = None - jetBuilderWithoutArea = None - tools = { } - finders = [] - groomers = [] - jetrecs = [] - trigjetrecs = [] - # Jet container names. Add input containers to this list: - # jetcons += ["SomeExistingJetContainer"] - jetcons = [] - # pT thresholds in MeV (for finding and filtering after calibration) - ptminFinder = 2000 - ptminFilter = 10000 - # Map of getter lists. - gettersMap = {} - allGetters = [] - # Map of modifier lists - modifiersMap = {} - # List of event density tools - allEDTools = [] - - vertexContainer = "PrimaryVertices" - trackContainer = "InDetTrackParticles" - - # Print a message to the log. - def msg(self, lvl, mymsg): - if lvl <= self.debug: jetlog.debug( self.prefix + str(mymsg) ) - - # Add a tool. - def add(self, mytool): - myname = mytool.name() - self.msg(1, "Adding tool " + myname) - if myname in self.tools: - print ("Tool " + myname + " is already registered") - self.msg(0, "Tool " + myname + " is already registered") - raise LookupError - else: - jetlog.info( type(mytool) ) - self.tools[myname] = mytool - from AthenaCommon.AppMgr import ToolSvc - - # Hardcoded Public tools to support Public ToolHandles in other packages - publictools =( [ - "triggerEnergyDensity", - "triggerPseudoJetGet", - #"TriggerJetGroomer", -]) - if any(t.lower() in myname.lower() for t in publictools): - ToolSvc += mytool - mytool.lock() - setattr(self, myname, mytool) - return mytool - - # Add a tool with a local name (alias). - # Used to provide alternative names for tools with long names. - def addNamed(self, myname, mytool): - if myname in self.tools: - self.msg( "Name " + myname + " is already registered") - raise LookupError - self.tools[myname] = self.add(mytool) - setattr(self, myname, mytool) - return mytool - - # Ad op+= as alternative syntax to add. - def __iadd__(self, mytool): - self.add(mytool) - return self - - # Add for a jet builder. - # The jet builder is used by by all finders an groomers and - # must be added with one of these methods. - def addJetBuilderWithArea(self, mytool): - if self.add(mytool): - self.jetBuilderWithArea = mytool - self.msg(1, "Jet builder with area added: " + mytool.name()) - return mytool - else: - self.msg(0, "Error adding jet builder with area.") - raise LookupError - def addJetBuilderWithoutArea(self, mytool): - if self.add(mytool): - self.jetBuilderWithoutArea = mytool - self.msg(1, "Jet builder without area added: " + mytool.name()) - return mytool - else: - self.msg(0, "Error adding jet builder without area.") - raise LookupError - - # Configures any tools in the given modifier list with the property - # "JetContainer" to set that property to the given string containerName. - # Also handles any container-specific configuration needed. - def autoconfigureModifiers(self, modifiers, containerName): - for mod in modifiers: - if "JetContainer" in mod.properties(): - print ("configuring " + mod.name() + " to have container name " + containerName) - mod.JetContainer = containerName - if "DoPFlowMoments" in mod.properties(): - mod.DoPFlowMoments = ("PFlow" in containerName) - - # Return the list of modifiers associated with a name. - # If the argument is a list, a copy is returned directly. - # Also configures any necessary container names in the copy. - def getModifiers(self, modifiersin, altname =None): - if modifiersin is None: - if altname in ["lctopo","emtopo"]: - return self.modifiersMap[altname+"_ungroomed"] - elif "pflow" in altname: - return self.modifiersMap["pflow_ungroomed"] - else: - return self.modifiersMap[altname] - if type(modifiersin) == str: - return self.modifiersMap[modifiersin] - - return modifiersin - - # Build the list of modifiers, replacing the string "calib:XXX:CALIB" with - # the appropriate calibration tool. - def buildModifiers(self, modifiersin, finder, getters, altname, output, calibOpt, constmods=[]): - from GaudiKernel.Proxy.Configurable import ConfigurableAlgTool - outmods = [] - inmods = self.getModifiers(modifiersin, altname) - ncalib = 0 - constmodstr = "".join(constmods) - for mod in inmods: - jetlog.info( self.prefix + "Adding modifier " + str(mod) ) - mod0 = "" - # Split mod = a:b:c... into mod0="a" and modarr = [a, b, c, ...] - if type(mod) == str: - if len(mod) == 0: continue - modarr = mod.split(":") - mod0 = modarr[0] - # Fully configured tool. - if isinstance(mod, ConfigurableAlgTool): - self.msg(2, " Adding modifier " + mod.name()) - outmods += [mod] - # Add jet calibration: - # calib:XXX:CALIB - Applies calibration sequence XXX (see JetRecCalibrationFinder) - # using JetCalibrationTool with configuration (or key) CONFIG. - elif mod0 == "calib": - ncalib += 1 - alg = finder.JetAlgorithm - rad = finder.JetRadius - get = getters[0] - inp = get.Label - copt = calibOpt - if type(calibOpt)==str and len(calibOpt): - calargs = calibOpt.split(":") - else: - calargs = modarr[1:] - if len(calargs) == 0: - copt = jetFlags.defaultCalibOpt - if type(copt)==str and len(copt): - calargs = copt.split(":") - else: - jetlog.info( self.prefix + 'ERROR: If the modifier "calib" is used, then calibOpt or jetFlags.CalibOpt must be a non-blank string.' ) - jetlog.info( self.prefix + 'ERROR: Another alternative is to use the modifier string format "calib:<OPT>", e.g. "calib:a"' ) - raise Exception - if len(calargs) == 0 or calargs[0]=="": - jetlog.info( self.prefix + "ERROR: Calibration requested without option." ) - jetlog.info( self.prefix + " Add calibOpt to tool string, jet build command or to jetFlags.defaultCalibOpt" ) - raise Exception - seq = calargs[0] - if seq == "none": - jetlog.info( self.prefix + "Skipping calibration." ) - continue - config = "" - evsprefix = "Kt4" - if len(calargs) > 1: - config = calargs[1] - if len(calargs) > 2: - evsprefix = calargs[2] - self.msg(0, " Adding " + seq + " calibration for " + alg + " R=" + str(rad) + " " + inp) - self.msg(0, " Configuration key/file: " + config) - self.msg(0, " Event shape prefix: " + evsprefix) - from JetRec.JetRecCalibrationFinder import jrcf - calmod = jrcf.find(alg, rad, inp, seq, config, evsprefix) - jetlog.info( self.prefix + "Adding calib modifier " + str(calmod) ) - outmods += [calmod] - # truthassoc - Does truth jet association replacing the input name with "Truth" - elif mod == "truthassoc": - sinp = getters[0].Label.split("Origin")[0] - salg = finder.JetAlgorithm - srad = str(int(10*finder.JetRadius)) - cname = output.replace(sinp, "Truth").replace(constmodstr, "") - if cname == output: - jetlog.info( sinp, cname, output ) - raise TypeError - # Check that the building of the association tool has been scheduled. - if cname not in self.jetcons: - jetlog.info( self.prefix + "Truth association skipped because container is missing: " + cname ) - jetlog.info( self.prefix + "Add to jetcons if input stream is expected to have this." ) - tname = mod + "_" + salg + srad - if tname not in self.tools: - from JetMomentTools.JetMomentToolsConf import JetPtAssociationTool - self += JetPtAssociationTool(tname, JetContainer=output, MatchingJetContainer=cname, AssociationName="GhostTruth") - outmods += [self.tools[tname]] - # trackassoc - Does track jet association replacing the input name with "Track" - elif mod == "trackassoc": - sinp = getters[0].Label.split("Origin")[0] - salg = finder.JetAlgorithm - srad = str(int(10*finder.JetRadius)) - cname = output.replace(sinp, "PV0Track").replace(constmodstr, "") - if cname == output: - jetlog.info( sinp, cname, output ) - raise TypeError - # Check that the building of the association tool has been scheduled. - if cname not in self.jetcons: - jetlog.info( self.prefix + "Track association skipped because container is missing: " + cname ) - jetlog.info( self.prefix + "Add to jetcons if input stream is expected to have this." ) - else: - tname = mod + "_" + salg + srad - if tname not in self.tools: - from JetMomentTools.JetMomentToolsConf import JetPtAssociationTool - self += JetPtAssociationTool(tname, JetContainer=output, MatchingJetContainer=cname, AssociationName="GhostTrack") - outmods += [self.tools[tname]] - # jetfilter - Filter to remove jets with pT < self.ptminFilter - elif mod == "jetfilter": - if self.ptminFilter <= 0: - jetlog.info( self.prefix + "Jet filter requested without a threshold." ) - raise Exception - tname = "jetpt" + str(self.ptminFilter) - if tname not in self.tools: - from JetRec.JetRecConf import JetFilterTool - self.add( JetFilterTool(tname, PtMin=self.ptminFilter) ) - outmods += [self.tools[tname]] - # btag - btagging - elif mod == "btag": - from BTagging.BTaggingConfiguration import getConfiguration - ConfInstance = getConfiguration() - from AthenaCommon.AppMgr import ToolSvc - sinp = getters[0].Label - salg = finder.JetAlgorithm - srad = str(int(10*finder.JetRadius)) - bspec = salg + srad + sinp - jetlog.info( self.prefix + "Scheduling btagging for " + bspec ) - btagger = ConfInstance.setupJetBTaggerTool(ToolSvc, bspec) - jetlog.info( btagger ) - self.add(btagger) - outmods += [btagger] - elif mod == "largeR": - outmods += self.modifiersMap["largeR"] - else: - raise TypeError - # Check calibration. - if calibOpt != "": - if ncalib==0: - jetlog.info( self.prefix + "Calibration option (" + calibOpt + ") provided without any calibration modifiers." ) - elif ncalib > 1: - jetlog.info( self.prefix + "Calibration option (" + calibOpt + ") provided with multiple calibration modifiers." ) - raise Exception - - return outmods - - # Create a jet finder without a JetRecToosl. - # alg = akgorithm name (Kt, CamKt, AntiKt) - # radius = size parameter - # rndseed: RandomOption for the finder - # gettersin = array of input pseudojet builders (or name in gettersMap) - # modifiersin = list of modifier tools (or name of such in modifiersMap) - # If absent, the gettersin name is used. - # consumers = sequence of jet consumers to run after reco - # ghostArea: if > 0, then ghosts are found with this inverse density - # rndseed: RandomOption for the finder - # variableRMinRadius: Min radius for variable-R finding - # variableRMassScale: Mass scale for variable-R finding - # calibOpt: Calibration option, e.g. "ar". See JetRecCalibrationFinder.py. - # returns the created finder - def addJetFinderTool(self, toolname, alg, radius, - ghostArea =0.0, ptmin =0.0, rndseed =1, - variableRMinRadius =-1.0, variableRMassScale =-1.0, constmods=[]): - myname = "JetToolManager:addJetFinderTool: " - if toolname in self.tools: - m = "Tool " + myname + " is already registered" - self.msg(0, m) - raise LookupError(m) - self.msg(2, "Adding finder tool") - if ghostArea == 0.0: - self.m_jetBuilder = self.jetBuilderWithoutArea - else: - self.m_jetBuilder = self.jetBuilderWithArea - if self.m_jetBuilder is None: - self.msg(0, "Jet builder must be specified") - raise Exception - from JetRec.JetRecConf import JetFinder - finder = JetFinder(toolname) - finder.JetAlgorithm = alg - finder.JetRadius = radius - finder.VariableRMinRadius = variableRMinRadius - finder.VariableRMassScale = variableRMassScale - finder.RandomOption = rndseed - finder.GhostArea = ghostArea - if ptmin > 0.0: - finder.PtMin = ptmin - else: - finder.PtMin = self.ptminFinder - finder.JetBuilder = self.m_jetBuilder - self += finder - self.finders += [finder] - return finder - - # Create a jet finder and rectool. - # output = name for output container (and JetRecTool) - # alg = akgorithm name (Kt, CamKt, AntiKt) - # radius = size parameter - # rndseed: RandomOption for the finder - # isTrigger: If true, the trigger store is used and the tools is added to - # trigjetrecs instead of jetrecs - # useTriggerStore: If true, the trigger store is used. - # gettersin = array of input pseudojet builders (or name in gettersMap) - # modifiersin = list of modifier tools (or name of such in modifiersMap) - # If absent, the gettersin name is used. - # consumers = sequence of jet consumers to run after reco - # ghostArea: if > 0, then ghosts are found with this inverse density - # ptminFilter: If > 0, then this is used as the pT threhold for filtering jets. - # rndseed: RandomOption for the finder - # isTrigger: If true, the trigger store is used and the tools is added to - # trigjetrecs instead of jetrecs - # useTriggerStore: If true, the trigger store is used (only for testing) - # variableRMinRadius: Min radius for variable-R finding - # variableRMassScale: Mass scale for variable-R finding - # calibOpt: Calibration option, e.g. "ar". See JetRecCalibrationFinder.py. - def addJetFinder(self, output, alg, radius, gettersin, modifiersin =None, - consumers =None, - ghostArea =0.0, ptmin =0.0, ptminFilter =0.0, rndseed =1, - isTrigger =False, useTriggerStore =False, - variableRMinRadius =-1.0, variableRMassScale =-1.0, - calibOpt ="", jetPseudojetCopier ="", constmods=[]): - self.msg(2, "Adding finder") - from JetRec.JetRecConf import JetRecTool - if type(gettersin) == str: - getters = self.gettersMap[gettersin] - else: - getters = gettersin - - # Accumulate all PseudoJetGetters such that we can schedule all - # needed PseudoJetAlgorithms before jet building - self.allGetters += [getter for getter in getters if getter not in self.allGetters] - - # Retrieve/build the jet finder. - finder = self.addJetFinderTool(output+"Finder", alg, radius, ghostArea, ptmin, rndseed, - variableRMinRadius, variableRMassScale, constmods=constmods) - jetrec = JetRecTool(output) - jetrec.InputPseudoJets = [str(getter.OutputContainer) for getter in getters] - jetrec.JetFinder = finder - jetrec.OutputContainer = output - ptminSave = self.ptminFilter - if ptminFilter > 0.0: self.ptminFilter = ptminFilter - jetrec.JetModifiers = self.buildModifiers(modifiersin, finder, getters, gettersin, output, calibOpt, constmods=constmods) - self.autoconfigureModifiers(jetrec.JetModifiers, output) - if consumers is not None: - jetrec.JetConsumers = consumers - self.ptminFilter = ptminSave - jetrec.Trigger = isTrigger or useTriggerStore - #jetrec.WarnIfDuplicate = warnIfDuplicate - #jetrec.Overwrite = overwrite - self += jetrec - if isTrigger: - self.trigjetrecs += [jetrec] - else: - self.jetrecs += [jetrec] - self.jetcons += [output] - return jetrec - - - -# Create a mass-drop filter and rectool. -# output = name for output container (and JetRecTool) -# mumax = MuMax used in the filter -# ymin = YMin used in the filter -# input = name of the input jet container -# modifiersin = list of modifier tools (or name of such in modifiersMap) -# doArea = whether to write jet areas (default false because work is needed to -# recover this for reclustered jets). - - - def addJetSplitter(self, output, mumax, ymin, input, modifiersin ="groomed", - isTrigger =False, useTriggerStore =False, doArea =True): - from JetRec.JetRecConf import JetSplitter - from JetRec.JetRecConf import JetRecTool - groomer = JetSplitter(output + "Groomer") - groomer.MuMax = mumax - groomer.YMin = ymin - groomer.BDRS = False - groomer.NSubjetMax = 3 - if doArea: - groomer.JetBuilder = self.jetBuilderWithArea - else: - groomer.JetBuilder = self.jetBuilderWithoutArea - self += groomer - jetrec = JetRecTool(output) - jetrec.JetGroomer = groomer - jetrec.InputContainer = input - jetrec.OutputContainer = output - jetrec.JetModifiers = self.getModifiers(modifiersin) - self.autoconfigureModifiers(jetrec.JetModifiers, output) - jetrec.Trigger = isTrigger or useTriggerStore - self += jetrec - if isTrigger: - self.trigjetrecs += [jetrec] - else: - self.jetrecs += [jetrec] - self.jetcons += [output] - return jetrec - - # Create a Trimmer and rectool. - # output = name for output container (and JetRecTool) - # rclus = RClus used in the trimming - # ptfrac = PtFrac used in the trimming - # input = name of the input jet container - # modifiersin = list of modifier tools (or name of such in modifiersMap) - def addJetTrimmer(self, output, rclus, ptfrac, input, modifiersin ="groomed", - pseudojetRetriever ="jpjretriever", - isTrigger =False, useTriggerStore =False, doArea =True): - from JetRec.JetRecConf import JetTrimmer - from JetRec.JetRecConf import JetRecTool - groomer = JetTrimmer(output + "Groomer") - groomer.RClus = rclus - groomer.PtFrac = ptfrac - if doArea: - groomer.JetBuilder = self.jetBuilderWithArea - else: - groomer.JetBuilder = self.jetBuilderWithoutArea - self += groomer - jetrec = JetRecTool(output) - jetrec.JetGroomer = groomer - jetrec.InputContainer = input - jetrec.OutputContainer = output - jetrec.JetModifiers = self.getModifiers(modifiersin) - self.autoconfigureModifiers(jetrec.JetModifiers, output) - jetrec.Trigger = isTrigger or useTriggerStore - if pseudojetRetriever in self.tools: - jetrec.JetPseudojetRetriever = self.tools[pseudojetRetriever] - else: - jetlog.info( "Requested jet pseudojet retriever is not a registered tool: " \ - + pseudojetRetriever ) - raise KeyError - self += jetrec - if isTrigger: - self.trigjetrecs += [jetrec] - else: - self.jetrecs += [jetrec] - self.jetcons += [output] - return jetrec - - # Create a Pruner and rectool. - # output = name for output container (and JetRecTool) - # rcut = RCut used in the pruning - # zcut = ZCut used in the pruning - # input = name of the input jet container - # modifiersin = list of modifier tools (or name of such in modifiersMap) - - # Create a Trimmer and rectool. - # output = name for output container (and JetRecTool) - # rclus = RClus used in the trimming - # ptfrac = PtFrac used in the trimming - # input = name of the input jet container - # modifiersin = list of modifier tools (or name of such in modifiersMap) - - def addJetPruner(self, output, rcut, zcut, input, modifiersin ="groomed", - isTrigger =False, useTriggerStore =False, doArea =True): - from JetRec.JetRecConf import JetPruner - from JetRec.JetRecConf import JetRecTool - groomer = JetPruner(output + "Groomer") - groomer.RCut = rcut - groomer.ZCut = zcut - if doArea: - groomer.JetBuilder = self.jetBuilderWithArea - else: - groomer.JetBuilder = self.jetBuilderWithoutArea - self += groomer - jetrec = JetRecTool(output) - jetrec.JetGroomer = groomer - jetrec.InputContainer = input - jetrec.OutputContainer = output - jetrec.JetModifiers = self.getModifiers(modifiersin) - self.autoconfigureModifiers(jetrec.JetModifiers, output) - jetrec.Trigger = isTrigger or useTriggerStore - self += jetrec - if isTrigger: - self.trigjetrecs += [jetrec] - else: - self.jetrecs += [jetrec] - self.jetcons += [output] - return jetrec - - # Create a SoftDrop and rectool. - # output = name for output container (and JetRecTool) - # beta = Beta used in SoftDrop - # zcut = ZCut used in SoftDrop - # r0 = R0 used in RecursiveSoftDrop - # input = name of the input jet container - # modifiersin = list of modifier tools (or name of such in modifiersMap) - def addJetSoftDrop(self, output, beta, zcut, r0, input, modifiersin ="groomed", - isTrigger =False, useTriggerStore =False, doArea =True): - from JetRec.JetRecConf import JetSoftDrop - from JetRec.JetRecConf import JetRecTool - groomer = JetSoftDrop(output + "Groomer") - groomer.ZCut = zcut - groomer.Beta = beta - groomer.R0 = r0 - if doArea: - groomer.JetBuilder = self.jetBuilderWithArea - else: - groomer.JetBuilder = self.jetBuilderWithoutArea - self += groomer - jetrec = JetRecTool(output) - jetrec.JetGroomer = groomer - jetrec.InputContainer = input - jetrec.OutputContainer = output - jetrec.JetModifiers = self.getModifiers(modifiersin) - self.autoconfigureModifiers(jetrec.JetModifiers, output) - jetrec.Trigger = isTrigger or useTriggerStore - self += jetrec - if isTrigger: - self.trigjetrecs += [jetrec] - else: - self.jetrecs += [jetrec] - self.jetcons += [output] - return jetrec - - # Create a BottomUpSoftDrop and rectool. - # output = name for output container (and JetRecTool) - # beta = Beta used in BottomUpSoftDrop - # zcut = ZCut used in BottomUpSoftDrop - # r0 = R0 used in BottomUpSoftDrop - # input = name of the input jet container - # modifiersin = list of modifier tools (or name of such in modifiersMap) - def addJetBottomUpSoftDrop(self, output, beta, zcut, r0, input, modifiersin ="groomed", - isTrigger =False, useTriggerStore =False, doArea =True): - from JetRec.JetRecConf import JetBottomUpSoftDrop - from JetRec.JetRecConf import JetRecTool - - groomer = JetBottomUpSoftDrop(output + "Groomer") - groomer.ZCut = zcut - groomer.Beta = beta - groomer.R0 = r0 - if doArea: - groomer.JetBuilder = self.jetBuilderWithArea - else: - groomer.JetBuilder = self.jetBuilderWithoutArea - self += groomer - jetrec = JetRecTool(output) - jetrec.JetGroomer = groomer - jetrec.InputContainer = input - jetrec.OutputContainer = output - jetrec.JetModifiers = self.getModifiers(modifiersin) - self.autoconfigureModifiers(jetrec.JetModifiers, output) - jetrec.Trigger = isTrigger or useTriggerStore - self += jetrec - if isTrigger: - self.trigjetrecs += [jetrec] - else: - self.jetrecs += [jetrec] - self.jetcons += [output] - return jetrec - - # Create a RecursiveSoftDrop and rectool. - # output = name for output container (and JetRecTool) - # beta = Beta used in RecursiveSoftDrop - # zcut = ZCut used in RecursiveSoftDrop - # r0 = R0 used in RecursiveSoftDrop - # input = name of the input jet container - # modifiersin = list of modifier tools (or name of such in modifiersMap) - def addJetRecursiveSoftDrop(self, output, beta, zcut, N, r0, input, modifiersin ="groomed", - isTrigger =False, useTriggerStore =False, doArea =True): - from JetRec.JetRecConf import JetRecursiveSoftDrop - from JetRec.JetRecConf import JetRecTool - - groomer = JetRecursiveSoftDrop(output + "Groomer") - groomer.ZCut = zcut - groomer.Beta = beta - groomer.N = N - groomer.R0 = r0 - if doArea: - groomer.JetBuilder = self.jetBuilderWithArea - else: - groomer.JetBuilder = self.jetBuilderWithoutArea - self += groomer - jetrec = JetRecTool(output) - jetrec.JetGroomer = groomer - jetrec.InputContainer = input - jetrec.OutputContainer = output - jetrec.JetModifiers = self.getModifiers(modifiersin) - self.autoconfigureModifiers(jetrec.JetModifiers, output) - jetrec.Trigger = isTrigger or useTriggerStore - self += jetrec - if isTrigger: - self.trigjetrecs += [jetrec] - else: - self.jetrecs += [jetrec] - self.jetcons += [output] - return jetrec - - # Create a jet reclusterer and rectool. - # output = name for output container (and JetRecTool) - # alg = akgorithm name (Kt, CamKt, AntiKt) - # radius = size parameter - # input = name for the input jet collection - # rndseed: RandomOption for the finder - # isTrigger: If true, the trigger store is used and the tools is added to - # trigjetrecs instead of jetrecs - # useTriggerStore: If true, the trigger store is used. - # modifiersin = list of modifier tools (or name of such in modifiersMap) - # If absent, the gettersin name is used. - # consumers = sequence of jet consumers to run after reco - # ghostArea: if > 0, then ghosts are found with this inverse density - # ptminFilter: If > 0, then this is used as the pT threhold for filtering jets. - # rndseed: RandomOption for the finder - # isTrigger: If true, the trigger store is used and the tools is added to - # trigjetrecs instead of jetrecs - # useTriggerStore: If true, the trigger store is used (only for testing) - # variableRMinRadius: Min radius for variable-R finding - # variableRMassScale: Mass scale for variable-R finding - # calibOpt: Calibration option, e.g. "ar". See JetRecCalibrationFinder.py. - def addJetReclusterer(self, output, alg, radius, input, modifiersin =None, - consumers =None, - ghostArea =0.0, ptmin =0.0, ptminFilter =0.0, rndseed =1, - isTrigger =False, useTriggerStore =False, - variableRMinRadius =-1.0, variableRMassScale =-1.0, - calibOpt ="", jetPseudojetCopier ="", constmods=[]): - self.msg(2, "Adding reclusterer") - from JetRec.JetRecConf import JetRecTool - from JetRec.JetRecConf import JetReclusterer - # Retrieve/build the jet finder. - finder = self.addJetFinderTool(output+"Finder", alg, radius, ghostArea, ptmin, rndseed, - variableRMinRadius, variableRMassScale, constmods=constmods) - reclname = output + "Reclusterer" - groomer = JetReclusterer( - reclname, - JetConstituentsRetriever = self.tools["jconretriever"], - JetFinder = finder - ) - self += groomer - jetrec = JetRecTool(output) - jetrec.InputContainer = input - jetrec.OutputContainer = output - jetrec.JetGroomer = groomer - jetrec.JetModifiers = self.getModifiers(modifiersin) - self.autoconfigureModifiers(jetrec.JetModifiers, output) - if consumers is not None: - jetrec.JetConsumers = consumers - jetrec.Trigger = isTrigger or useTriggerStore - self += jetrec - if isTrigger: - self.trigjetrecs += [jetrec] - else: - self.jetrecs += [jetrec] - self.jetcons += [output] - return jetrec - - # Create a copying rectool. - # output = name for output container (and JetRecTool) - # output = name for input container - # modifiersin = list of modifier tools (or name of such in modifiersMap) - def addJetCopier(self, output, input, modifiersin, ptminFilter =0.0, radius =0.0, alg ="", inp ="", - isTrigger=False, useTriggerStore=False, calibOpt ="", shallow =True, constmods=[]): - from JetRec.JetRecConf import JetRecTool - jetrec = JetRecTool(output) - jetrec.InputContainer = input - jetrec.OutputContainer = output - ptminSave = self.ptminFilter - if ptminFilter > 0.0: self.ptminFilter = ptminFilter - class finder: - JetRadius = radius - JetAlgorithm = alg - class get: - Label = inp - getters = [get] - jetrec.JetModifiers = self.buildModifiers(modifiersin, finder, getters, None, output, calibOpt, constmods=constmods) - self.autoconfigureModifiers(jetrec.JetModifiers, output) - self.ptminFilter = ptminSave - jetrec.Trigger = isTrigger or useTriggerStore -### jetrec.ShallowCopy = shallow - self += jetrec - self.jetrecs += [jetrec] - self.jetcons += [output] - return jetrec - - # Ad op[] to return a tool. - def __getitem__(self, toolname): - return self.tools[toolname] - - # Change the output level of a tool. - def setOutputLevel(self, toolid, level): - if type(toolid) == str: - tool = self[toolid] - else: - tool = toolid - locked = tool.isLocked() - oldlevel = "undefined" - if locked: - slock = "locked" - tool.unlock() - else: - slock = "unlocked" - aname = "OutputLevel" - if hasattr(tool, aname): - oldlevel = getattr(tool, aname) - setattr(tool, aname, level) - if locked: - tool.lock() - self.msg(0, "Changed output level of " + slock + " tool " + tool.name() + \ - " from " + str(oldlevel) + " to " + str(level) + ".") diff --git a/Reconstruction/Jet/JetRec/share/JetRec_jobOptions.py b/Reconstruction/Jet/JetRec/share/JetRec_jobOptions.py deleted file mode 100644 index 315c646a1c1be1038bdfef8088b70c5d46410f9e..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetRec/share/JetRec_jobOptions.py +++ /dev/null @@ -1,75 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -# jobOption fragment to schedule jetbuilding in a runII config style standard reconstruction, -# BUT using the new runIII jet config - - -from AthenaConfiguration.ComponentAccumulator import conf2toConfigurable -from AthenaCommon.Configurable import ConfigurableCABehavior -from JetRecConfig.StandardSmallRJets import AntiKt4EMPFlow, AntiKt4LCTopo, AntiKt4EMTopo, AntiKt4Truth -from JetRecConfig.StandardLargeRJets import AntiKt10LCTopo_noVR -from JetRecConfig.JetRecConfig import getJetAlgs, reOrderAlgs - -from JetRecConfig.JetConfigFlags import jetInternalFlags - -# We're in Reco job : propagate this info to the runIII jet config -jetInternalFlags.isRecoJob = True - - - -# the Standard list of jets to run : -jetdefs = [AntiKt4EMTopo, AntiKt4EMPFlow, AntiKt4LCTopo, AntiKt4Truth, AntiKt10LCTopo_noVR] - -from JetRec.JetRecFlags import JetContentDetail -if jetFlags.detailLevel()==JetContentDetail.Trigger: - from JetRecConfig.StandardLargeRJets import AntiKt10LCTopoTrimmed_trigger - jetdefs += [AntiKt10LCTopoTrimmed_trigger] - -# we'll remember the EventDensity collections we create. -evtDensities = [] - -#-------------------------------------------------------------- -# Create the jet algs from the jet definitions -#-------------------------------------------------------------- - -for jd in jetdefs: - with ConfigurableCABehavior(): - algs, jetdef_i = getJetAlgs(ConfigFlags, jd, True) - algs, ca = reOrderAlgs( [a for a in algs if a is not None]) - # ignore dangling CA instance in legacy config - ca.wasMerged() - for a in algs: - topSequence += conf2toConfigurable(a) - if "EventDensityAthAlg" in a.getType(): - evtDensities.append( str(a.EventDensityTool.OutputContainer) ) - - - -#-------------------------------------------------------------- -# Build output container list. -#-------------------------------------------------------------- - -for jetdef in jetdefs: - jetFlags.jetAODList += [ f"xAOD::JetContainer#{jetdef.fullname()}" ] - auxprefix = "" - # if jetrec.Trigger: - # auxprefix = "Trig" - jetFlags.jetAODList += [ f"xAOD::Jet{auxprefix}AuxContainer#{jetdef.fullname()}Aux." , - f"xAOD::JetAuxContainer#{jetdef.fullname()}Aux.-PseudoJet"] - - -if jetFlags.useTracks() and jetFlags.useTopo(): - jetFlags.jetAODList += [ "xAOD::CaloClusterContainer#EMOriginTopoClusters" , - "xAOD::CaloClusterContainer#LCOriginTopoClusters" , - "xAOD::ShallowAuxContainer#LCOriginTopoClustersAux.", - "xAOD::ShallowAuxContainer#EMOriginTopoClustersAux."] - jetFlags.jetAODList += [ "xAOD::PFOContainer#CHSChargedParticleFlowObjects", - "xAOD::PFOContainer#CHSNeutralParticleFlowObjects", - "xAOD::ShallowAuxContainer#CHSChargedParticleFlowObjectsAux.", - "xAOD::ShallowAuxContainer#CHSNeutralParticleFlowObjectsAux."] - -# save event shapes set with the JetAlgorithm -for edname in evtDensities: - jetFlags.jetAODList += [ f"xAOD::EventShape#{edname}", - f"xAOD::EventShapeAuxInfo#{edname}Aux.",] - diff --git a/Reconstruction/Jet/JetValidation/CMakeLists.txt b/Reconstruction/Jet/JetValidation/CMakeLists.txt index a2a4fbe0a7a48598528c72935c304f16a5e1a3f9..16ac82642ed335fcbf68408ef14efb27f4b722dd 100644 --- a/Reconstruction/Jet/JetValidation/CMakeLists.txt +++ b/Reconstruction/Jet/JetValidation/CMakeLists.txt @@ -5,6 +5,5 @@ atlas_subdir( JetValidation ) # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) -atlas_install_joboptions( share/*.py ) atlas_install_scripts( scripts/jetMakeRefSamples.py ) atlas_install_runtime( scripts/runJetValidation.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Reconstruction/Jet/JetValidation/share/AODMCtest.py b/Reconstruction/Jet/JetValidation/share/AODMCtest.py deleted file mode 100644 index 85dbee00ca192348e33813517d000b6dacf3db90..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetValidation/share/AODMCtest.py +++ /dev/null @@ -1,127 +0,0 @@ -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags - -#RDO -#athenaCommonFlags.FilesInput = ['root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/phys-rig/pileupSamples/mc11_valid.105200.T1_McAtNlo_Jimmy.digit.RDO.e835_s1310_s1300_d639_tid682867_00/RDO.682867._000001.pool.root.1'] - -#AOD data -#athenaCommonFlags.FilesInput = ['root://eosatlas.cern.ch//eos/atlas/user/g/gbrooijm/dpd-rtt/data12_8TeV.00206299.physics_JetTauEtmiss.merge.AOD.f450_m1170._lb0078._0001.1'] - -#AOD MC -athenaCommonFlags.FilesInput = ['/afs/cern.ch/atlas/maxidisk/d33/referencefiles/aod/AOD-17.2.7.2/AOD-17.2.7.2-1.pool.root'] - - - - -from RecExConfig.RecFlags import rec - - -rec.readESD=False -rec.readAOD=True -rec.readRDO=False -rec.doWriteESD=False -rec.doWriteAOD=False -rec.doAOD=False -rec.doWriteTAG=False - -athenaCommonFlags.EvtMax=5 -#athenaCommonFlags.SkipEvents=6 -#athenaCommonFlags.OutputLevel = 2 - -#from ParticleBuilderOptions.AODFlags import AODFlags -#AODFlags.FastSimulation = False - -from JetRec.JetRecFlags import jetFlags -#jetFlags.Enable = False - -# Setup jet algorithm timing (how long is spent on jet finding/reconstruction) -jetFlags.monitorTime = True - -rec.UserExecs = ["myjets()"] - -from PrimaryDPDMaker.PrimaryDPDFlags import primDPD -primDPD.WritePhysDPDJetMET.JetCollectionNames = [] - -from JetRec.JetAlgConfiguration import checkAndUpdateOptions -#include("TestAssoc.py") - -def myjets(): - from JetRec.JetRecFlags import jetFlags - from JetRec.JetGetters import make_StandardJetGetter - - # Algorithms to test: AntiKt R = {0.4, 0.6} scheme = {EM, LC} - #jetAlg4EM = make_StandardJetGetter('AntiKt',0.4,'Topo',calibName='EM:OFFSET_ORIGIN_ETAJES',outputCollectionName='AntiKt4TopoJetsTest').jetAlgorithmHandle() - #jetAlg4EM = make_StandardJetGetter('AntiKt',0.4,'Topo',doCalib=False,minPt=5000,jetMoments=[],outputCollectionName='AntiKt4TopoJetsTest').jetAlgorithmHandle() - #jetAlg4LC = make_StandardJetGetter('AntiKt',0.4,'LCTopo',jetMoments=[],outputCollectionName='AntiKt4LCTopoJetsTest').jetAlgorithmHandle() - jetAlg4EM = make_StandardJetGetter('AntiKt',0.4,'Topo',doCalib=False,minPt=5000,outputCollectionName='AntiKt4TopoJetsTest').jetAlgorithmHandle() - jetAlg4LC = make_StandardJetGetter('AntiKt',0.4,'LCTopo',outputCollectionName='AntiKt4LCTopoJetsTest').jetAlgorithmHandle() - jetAlg4Tr = make_StandardJetGetter('AntiKt',0.4,'Truth',outputCollectionName='AntiKt4TruthJetsTest').jetAlgorithmHandle() - - #jetAlg6EM = make_StandardJetGetter('AntiKt',0.6,'Topo',calibName='EM:OFFSET_ORIGIN_ETAJES',outputCollectionName='AntiKt6TopoJetsTest').jetAlgorithmHandle() - #jetAlg6EM = make_StandardJetGetter('AntiKt',0.6,'Topo',doCalib=False,minPt=5000,jetMoments=[],outputCollectionName='AntiKt6TopoJetsTest').jetAlgorithmHandle() - #jetAlg6LC = make_StandardJetGetter('AntiKt',0.6,'LCTopo',jetMoments=[],outputCollectionName='AntiKt6LCTopoJetsTest').jetAlgorithmHandle() - jetAlg6EM = make_StandardJetGetter('AntiKt',0.6,'Topo',doCalib=False,minPt=5000,outputCollectionName='AntiKt6TopoJetsTest').jetAlgorithmHandle() - jetAlg6LC = make_StandardJetGetter('AntiKt',0.6,'LCTopo',outputCollectionName='AntiKt6LCTopoJetsTest').jetAlgorithmHandle() - jetAlg6Tr = make_StandardJetGetter('AntiKt',0.6,'Truth',outputCollectionName='AntiKt6TruthJetsTest').jetAlgorithmHandle() - - # In devval, areas are set by default - # However, we need to set second areas - g = topSequence.AntiKt4TopoJetsTest.AlgTools[0] - f = g.JetFindingSequence[-1] - f.CalculateSecondArea = True - - g = topSequence.AntiKt4LCTopoJetsTest.AlgTools[0] - f = g.JetFindingSequence[-1] - f.CalculateSecondArea = True - - #g = topSequence.AntiKt4TruthJetsTest.AlgTools[0] - #f = g.JetFindingSequence[-1] - g = topSequence.AntiKt4TruthJetsTest.AlgTools[2] - g.CalculateSecondArea = True - - g = topSequence.AntiKt6TopoJetsTest.AlgTools[0] - f = g.JetFindingSequence[-1] - f.CalculateSecondArea = True - - g = topSequence.AntiKt6LCTopoJetsTest.AlgTools[0] - f = g.JetFindingSequence[-1] - f.CalculateSecondArea = True - - #g = topSequence.AntiKt6TruthJetsTest.AlgTools[0] - #f = g.JetFindingSequence[-1] - g = topSequence.AntiKt6TruthJetsTest.AlgTools[2] - g.CalculateSecondArea = True - - - - from JetValidation.JetTestConfig import scheduleJetTester - # Now schedule the testers - scheduleJetTester("CaloCalTopoCluster",JetMoments=False, CollectionType="CaloClusterContainer", JetSigState=False, JetAuthor=False, JetNConstituents=False, JetConstituents=False) - - scheduleJetTester("AntiKt4TopoJetsTest",JetMoments_opts = {'moments':['nTrk', 'nTrk_allpv','JVF','WIDTH','trackWIDTH','trackWIDTH_allpv','ActiveArea','ActiveAreaPx','ActiveAreaPy','ActiveAreaPz','ActiveAreaE','VoronoiArea','VoronoiAreaPx','VoronoiAreaPy','VoronoiAreaPz','VoronoiAreaE']}) - scheduleJetTester("AntiKt4LCTopoJetsTest",JetMoments_opts = {'moments':['nTrk', 'nTrk_allpv','JVF','WIDTH','trackWIDTH','trackWIDTH_allpv','ActiveArea','ActiveAreaPx','ActiveAreaPy','ActiveAreaPz','ActiveAreaE','VoronoiArea','VoronoiAreaPx','VoronoiAreaPy','VoronoiAreaPz','VoronoiAreaE']}) - scheduleJetTester("AntiKt4TruthJetsTest",JetMoments_opts = {'moments':['nTrk', 'nTrk_allpv','JVF','WIDTH','trackWIDTH','trackWIDTH_allpv','ActiveArea','ActiveAreaPx','ActiveAreaPy','ActiveAreaPz','ActiveAreaE','VoronoiArea','VoronoiAreaPx','VoronoiAreaPy','VoronoiAreaPz','VoronoiAreaE']}) - - scheduleJetTester("AntiKt6TopoJetsTest",JetMoments_opts = {'moments':['nTrk', 'nTrk_allpv','JVF','WIDTH','trackWIDTH','trackWIDTH_allpv','ActiveArea','ActiveAreaPx','ActiveAreaPy','ActiveAreaPz','ActiveAreaE','VoronoiArea','VoronoiAreaPx','VoronoiAreaPy','VoronoiAreaPz','VoronoiAreaE']}) - scheduleJetTester("AntiKt6LCTopoJetsTest",JetMoments_opts = {'moments':['nTrk', 'nTrk_allpv','JVF','WIDTH','trackWIDTH','trackWIDTH_allpv','ActiveArea','ActiveAreaPx','ActiveAreaPy','ActiveAreaPz','ActiveAreaE','VoronoiArea','VoronoiAreaPx','VoronoiAreaPy','VoronoiAreaPz','VoronoiAreaE']}) - scheduleJetTester("AntiKt6TruthJetsTest",JetMoments_opts = {'moments':['nTrk', 'nTrk_allpv','JVF','WIDTH','trackWIDTH','trackWIDTH_allpv','ActiveArea','ActiveAreaPx','ActiveAreaPy','ActiveAreaPz','ActiveAreaE','VoronoiArea','VoronoiAreaPx','VoronoiAreaPy','VoronoiAreaPz','VoronoiAreaE']}) - - - -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.AllowIgnoreConfigError = False - - -# main jobOption -include ("RecExCommon/RecExCommon_topOptions.py") -#topSequence.AntiKt5TruthJets.OutputLevel = 2 -#topSequence.AntiKt4TopoJetsTer.OutputLevel = 2 - -## from JetTesters import JetTester, JetKinematics, JetMoments - -## topSequence += JetTester( CollectionName = "AntiKt4LCTopoJets", -## JetTestTools = [JetKinematics(), JetMoments(moments = ["JVF", "nTrk"])] -## ) - - -#svcMgr.MessageSvc.setDebug += ["JetCollectionCnv","JetMomentMapCnv"] - diff --git a/Reconstruction/Jet/JetValidation/share/JetPhysVal_jobOption.py b/Reconstruction/Jet/JetValidation/share/JetPhysVal_jobOption.py deleted file mode 100644 index 27c47f4c45207ab81a6ac86b55d5d33d6dd81639..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetValidation/share/JetPhysVal_jobOption.py +++ /dev/null @@ -1,44 +0,0 @@ -# Inspired by PhysVal_jobOptions.py - -# Set up the reading of the input xAOD: -FNAME = "AOD.pool.root" -#FNAME = "/afs/cern.ch/atlas/groups/JetEtmiss/ReferenceFiles/RTT/MC/AOD/mc12_8TeV.117050.PowhegPythia_P2011C_ttbar.simul.AOD.e1728_s1581.20_0_0.039772.pool.root.1" -include( "AthenaPython/iread_file.py" ) - -# only for testing... -# import AthenaPoolCnvSvc.ReadAthenaPool -# ServiceMgr.EventSelector.InputCollections = [ FNAME ] - - -from JetValidation.PhysicsValidationHistos import athenaPhysValTool -tool1 = athenaPhysValTool() -tool1.EnableLumi = False -tool1.OutputLevel = WARNING -tool1.DetailLevel = 10 - -from AthenaCommon.AppMgr import ToolSvc -ToolSvc += tool1 - -monMan = CfgMgr.AthenaMonManager("PhysValMonManager") -monMan.FileKey = "PhysVal" -monMan.ManualDataTypeSetup = True -monMan.DataType = "monteCarlo" -monMan.Environment = "altprod" -monMan.ManualRunLBSetup = True -monMan.Run = 1 -monMan.LumiBlock = 1 - -monMan.AthenaMonTools += [ tool1 ] -topSequence += monMan - - - -from AthenaCommon.AppMgr import ServiceMgr -from GaudiSvc.GaudiSvcConf import THistSvc -ServiceMgr += THistSvc() -svcMgr.THistSvc.Output += ["PhysVal DATAFILE='PhysVal.root' OPT='RECREATE'"] - - -from AthenaCommon.AppMgr import theApp -ServiceMgr.MessageSvc.OutputLevel = INFO -ServiceMgr.MessageSvc.defaultLimit = 1000000 diff --git a/Reconstruction/Jet/JetValidation/share/JetTask_ESDtoAOD.py b/Reconstruction/Jet/JetValidation/share/JetTask_ESDtoAOD.py deleted file mode 100644 index 81630049a36a4af20e0b3f177f5f5fd5c304821d..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetValidation/share/JetTask_ESDtoAOD.py +++ /dev/null @@ -1,73 +0,0 @@ - -#include( "AthenaPython/iread_file.py" ) - - -# Configure athena common flags -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -from AthenaCommon.GlobalFlags import globalflags - -athenaCommonFlags.EvtMax = 2 -athenaCommonFlags.SkipEvents = 0 -#athenaCommonFlags.OutputLevel = 2 -athenaCommonFlags.AllowIgnoreConfigError = False - -FNAME = "ESD.pool.root" -athenaCommonFlags.FilesInput = [FNAME] - -# Access the algorithm sequence: -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() - -import AthenaPoolCnvSvc.ReadAthenaPool -svcMgr.EventSelector.InputCollections = [FNAME,] - -#from ParticleBuilderOptions.AODFlags import AODFlags -#AODFlags.FastSimulation = False - -from JetValidation.RTTConfig import scheduleRTTJetTests - -scheduleRTTJetTests() - - - -# Create a POOL output file with the StoreGate contents: -from OutputStreamAthenaPool.MultipleStreamManager import MSMgr -xaodStream = MSMgr.NewPoolStream( "StreamXAOD", "xAOD.Out.pool.root" ) - -# Set up its contents: -xaodStream.AddItem( "xAOD::CaloClusterContainer_v1#*" ) -xaodStream.AddItem( "xAOD::CaloClusterAuxContainer_v1#*" ) -## #xaodStream.AddItem( "CaloCellContainer#AODCellContainer") -## #xaodStream.AddItem( "CaloClusterContainer#"+cont); -xaodStream.AddItem( "xAOD::JetContainer_v1#AntiKt*" ) -xaodStream.AddItem( "xAOD::JetAuxContainer_v1#AntiKt*" ) - -xaodStream.AddMetaDataItem( "xAOD::EventFormat_v1#*" ) -#xaodStream.Print() - -# Split all branches: -ServiceMgr.AthenaPoolCnvSvc.PoolAttributes += [ - "DEFAULT_SPLITLEVEL='99'" ] - -# Force POOL to just simply use the StoreGate keys as branch names: -ServiceMgr.AthenaPoolCnvSvc.SubLevelBranchName = "<key>" - - -# Do some additional tweaking: -from AthenaCommon.AppMgr import theApp - -ServiceMgr.MessageSvc.OutputLevel = INFO -ServiceMgr.MessageSvc.defaultLimit = 1000000 - -#ServiceMgr.StoreGateSvc.Dump=True -from AthenaServices.AthenaServicesConf import AthenaEventLoopMgr -ServiceMgr += AthenaEventLoopMgr(EventPrintoutInterval = 100) - -MessageSvc.Format = "% F%30W%S%7W%R%T %0W%M" - - - - - - - diff --git a/Reconstruction/Jet/JetValidation/share/JetTask_RAWtoESD.py b/Reconstruction/Jet/JetValidation/share/JetTask_RAWtoESD.py deleted file mode 100644 index ee1e06d599a1031babf021198a7da9fbe2aa568d..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetValidation/share/JetTask_RAWtoESD.py +++ /dev/null @@ -1,78 +0,0 @@ -# Configure athena common flags -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -from AthenaCommon.GlobalFlags import globalflags - -athenaCommonFlags.EvtMax = 1 -athenaCommonFlags.SkipEvents = 0 -#athenaCommonFlags.OutputLevel = 2 -athenaCommonFlags.AllowIgnoreConfigError = False - -globalflags.ConditionsTag.set_Value_and_Lock('COMCOND-BLKPA-RUN1-01') -#globalflags.ConditionsTag.set_Value_and_Lock('OFLCOND-MC12-SDR-06') -globalflags.DetDescrVersion.set_Value_and_Lock('ATLAS-GEO-20-00-01') - -#athenaCommonFlags.FilesInput = ['/afs/cern.ch/atlas/groups/JetEtmiss/ReferenceFiles/RTT/DATA/RAW/data12_8TeV.CurrentRef.RAW'] - - - - -# Configure execution flags -from RecExConfig.RecFlags import rec - -#rec.readESD=False -#rec.readAOD=False -#rec.readRDO=False -#rec.doWriteESD=True -#rec.doWriteAOD=False -#rec.doAOD=False - -#from ParticleBuilderOptions.AODFlags import AODFlags -#AODFlags.FastSimulation = False - -rec.UserExecs = ["myjets()"] - - -from PrimaryDPDMaker.PrimaryDPDFlags import primDPD -primDPD.WritePhysDPDJetMET.JetCollectionNames = [] - -from JetRec.JetAlgConfiguration import checkAndUpdateOptions - - - -# Function to run within athena -def myjets(): - from JetRec.JetRecFlags import jetFlags - from JetRec.JetGetters import make_StandardJetGetter - - # Algorithms to test: AntiKt R = {0.4, 0.6} scheme = {EM, LC} - #jetAlg4EM = make_StandardJetGetter('AntiKt',0.4,'Topo',calibName='EM:OFFSET_ORIGIN_ETAJES',outputCollectionName='AntiKt4TopoJetsTest').jetAlgorithmHandle() - jetAlg4EM = make_StandardJetGetter('AntiKt',0.4,'Topo',doCalib=False,minPt=5000,outputCollectionName='AntiKt4TopoEMJetsTest').jetAlgorithmHandle() - jetAlg4LC = make_StandardJetGetter('AntiKt',0.4,'LCTopo',outputCollectionName='AntiKt4LCTopoJetsTest').jetAlgorithmHandle() - - #jetAlg6EM = make_StandardJetGetter('AntiKt',0.6,'Topo',calibName='EM:OFFSET_ORIGIN_ETAJES',outputCollectionName='AntiKt6TopoJetsTest').jetAlgorithmHandle() - jetAlg6EM = make_StandardJetGetter('AntiKt',0.6,'Topo',doCalib=False,minPt=5000,outputCollectionName='AntiKt6TopoEMJetsTest').jetAlgorithmHandle() - jetAlg6LC = make_StandardJetGetter('AntiKt',0.6,'LCTopo',outputCollectionName='AntiKt6LCTopoJetsTest').jetAlgorithmHandle() - - # Prepare to dump relevant jet collections and associated moments - from JetValidation.JetTestConfig import scheduleJetTester - moments = {'moments':['nTrk', 'nTrk_allpv','JVF','WIDTH','trackWIDTH','trackWIDTH_allpv','ActiveArea','ActiveAreaPx','ActiveAreaPy','ActiveAreaPz','ActiveAreaE','VoronoiArea','VoronoiAreaPx','VoronoiAreaPy','VoronoiAreaPz','VoronoiAreaE']} - - # Schedule the jet testers for the existing collections - scheduleJetTester("CaloCalTopoCluster",JetMoments=False, CollectionType="CaloClusterContainer", JetSigState=False, JetAuthor=False, JetNConstituents=False, JetConstituents=False) - scheduleJetTester("AntiKt4TopoEMJets",JetMoments_opts = moments) - scheduleJetTester("AntiKt4LCTopoJets",JetMoments_opts = moments) - scheduleJetTester("AntiKt6TopoEMJets",JetMoments_opts = moments) - scheduleJetTester("AntiKt6LCTopoJets",JetMoments_opts = moments) - - # Schedule the jet testers for the recalculated collections - scheduleJetTester("AntiKt4TopoEMJetsTest",JetMoments_opts = moments) - scheduleJetTester("AntiKt4LCTopoJetsTest",JetMoments_opts = moments) - scheduleJetTester("AntiKt6TopoEMJetsTest",JetMoments_opts = moments) - scheduleJetTester("AntiKt6LCTopoJetsTest",JetMoments_opts = moments) - - - - -# main jobOption -include ("RecExCommon/RecExCommon_topOptions.py") - diff --git a/Reconstruction/Jet/JetValidation/share/JetTask_RDOtoESD.py b/Reconstruction/Jet/JetValidation/share/JetTask_RDOtoESD.py deleted file mode 100644 index a9bd015ef1610b703efa10b67f1500c15eaa57a0..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetValidation/share/JetTask_RDOtoESD.py +++ /dev/null @@ -1,43 +0,0 @@ -# Configure athena common flags -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -from AthenaCommon.GlobalFlags import globalflags - -from ParticleBuilderOptions.AODFlags import AODFlags -AODFlags.TrackParticleSlimmer=False -AODFlags.TrackParticleLastHitAndPerigeeSlimmer=False - -athenaCommonFlags.FilesInput = ['/afs/cern.ch/atlas/groups/JetEtmiss/ReferenceFiles/RTT/MC/RDO/mc12_8TeV.CurrentRef.RDO.pool.root'] -athenaCommonFlags.EvtMax = 5 -athenaCommonFlags.SkipEvents = 0 -#athenaCommonFlags.OutputLevel = 2 -#athenaCommonFlags.AllowIgnoreConfigError = False - - -from JetRec.JetRecFlags import jetFlags -jetFlags.useTruth = True -jetFlags.useTracks = True -jetFlags.useMuonSegments = True -#jetFlags.usePflow = True -jetFlags.separateJetAlgs = True -#jetFlags.applyCalibration = False - -from InDetRecExample.InDetJobProperties import InDetFlags -InDetFlags.doSecVertexFinder.set_Value_and_Lock(False) - -from RecExConfig.RecFlags import rec -rec.doTrigger=False -rec.doTau = False -#rec.doEgamma=False -## rec.doInDet = False -## rec.doMuon = False -## rec.doMuonCombined=False -## rec.doTruth = False -#rec.doCalo = False - -#rec.doFloatingPointException.set_Value_and_Lock(True) - - -# main jobOption -include ("RecExCommon/RecExCommon_topOptions.py") - -