Skip to content
Snippets Groups Projects
Commit 7edb28aa authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'delete_PhysicsD3PDMaker' into 'master'

PhysicsD3PDMaker: delete package

See merge request atlas/athena!38123
parents 52f34167 f0bd642e
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 1956 deletions
......@@ -137,27 +137,11 @@ listAllKnownD3PD.append (prodFlags.WriteTriggerD3PD)
#######################################################
# Top D3PDs
_importFlagsFromModule ('TopInputsD3PDMaker.TopInputsD3PDProdFlags', True)
# Standard Model D3PDs
_importFlagsFromModule ('PhysicsD3PDMaker.PhysicsD3PDProdFlags')
# Jet tag D3PDs
_importFlagsFromModule ('JetTagD3PDMaker.JetTagD3PDProdFlags')
# SUSY D3PDs
_importFlagsFromModule ('SUSYD3PDMaker.SUSYD3PDProdFlags', True)
# Tracking D3PDs.
_importFlagsFromModule ('InDetD3PDMaker.VertexD3PDAnalysisProdFlags', True)
# egamma D3PDs.
_importFlagsFromModule ('egammaD3PDMaker.egammaD3PDProdFlags')
# Heavy ion D3PDs.
_importFlagsFromModule ('HeavyIonD3PDMaker.HeavyIonD3PDProdFlags', True)
# Trigger D3PDs.
#_importFlagsFromModule ('TrigBJetD3PDMaker.TrigBJetD3PDProdFlags')
################################################################################
# Package: PhysicsD3PDMaker
################################################################################
# Declare the package name:
atlas_subdir( PhysicsD3PDMaker )
# Declare the package's dependencies:
atlas_depends_on_subdirs( PRIVATE
Control/AthenaBaseComps
Event/xAOD/xAODEgamma
Event/xAOD/xAODMuon
GaudiKernel )
# Component(s) in the package:
atlas_add_component( PhysicsD3PDMaker
src/*.cxx
src/components/*.cxx
LINK_LIBRARIES AthenaBaseComps xAODEgamma xAODMuon GaudiKernel )
# Install files from the package:
atlas_install_python_modules( python/*.py )
atlas_install_joboptions( share/*.py )
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
import copy
def getGroomedJetsConfig():
dictsConf = []
ParentDict = {
'JetFinder' : 'CamKt',
'JetdR' : 1.2,
'JetInput' : 'LCTopo',
}
GroomedDicts = [
#{ 'Type' : 'BDRSFiltering', 'args' : { 'SaveSubjets' : True } } #,
{ 'Type' : 'BDRSFiltering', 'args' : { 'SaveSubjets' : True , 'minSplitR' :0.} }
]
dictsConf += [ [ParentDict, GroomedDicts] ]
ParentDict = {
'JetFinder' : 'CamKt',
'JetdR' : 1.2,
'JetInput' : 'Truth',
}
dictsConf += [ [ParentDict, GroomedDicts] ]
return dictsConf
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
from __future__ import print_function
from JetD3PDMaker.JetD3PDObject import getJetD3PDObject
from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags
from RecExConfig.RecFlags import rec
from D3PDMakerCoreComps.IndexMultiAssociation import IndexMultiAssociation
from D3PDMakerCoreComps.IndexAssociation import IndexAssociation
from D3PDMakerCoreComps.SimpleAssociation import SimpleAssociation
from D3PDMakerCoreComps.ContainedVectorMultiAssociation import ContainedVectorMultiAssociation
import JetSubstructureD3PDMaker
from D3PDMakerCoreComps.D3PDObject import make_SG_D3PDObject
import EventCommonD3PDMaker
#from JetTagD3PDMaker.AddBTagD3PDInfo import addBTagInfoToJetObject
from JetTagD3PDMaker.JetTagD3PDMakerKeys import JetTagD3PDKeys
from JetTagD3PDMaker.JetTagD3PDMakerFlags import JetTagD3PDFlags
import JetTagD3PDMaker
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
def getJetCollectionD3PDObject(objectname = 'JetCollectionD3PDObject', prefix = 'jet_'):
return make_SG_D3PDObject('JetCollection','','jet_', objectname)
def AddUniqueMoments(obj, momlist, theblockname = 'ConfigParams', level = 0):
obj.defineBlock(level, theblockname, JetSubstructureD3PDMaker.JetMomentUniqueFillerTool, Moments = momlist, OutputLevel=3)
def AddHadronicInfo(obj, additionalMoments = [], theblockname = 'SubjetMomentsHadronic', level=0):
from JetD3PDMaker import JetMomentFillerTool
obj.defineBlock(level, theblockname, JetMomentFillerTool,Moments= [] + additionalMoments)
def AddAssocJetsIndex(obj, jetassocname, jettarget, intermediate_names = [], level=0):
JetAssocTrack = IndexMultiAssociation(obj, JetSubstructureD3PDMaker.JetSubstructureTagJetINavigable4MomentumAssociationTool,jettarget,level = level,
prefix=jetassocname+'_',
blockname=jetassocname+'blockindex', AssociationName = jetassocname , IntermediateAssociationNames=intermediate_names, OutputLevel=3 )
def AddConstitIndex(object, typename='CaloCluster', target='cl_', level=0):
import EventCommonD3PDMaker
import D3PDMakerCoreComps
ConstitAssoc = ContainedVectorMultiAssociation \
(object,
EventCommonD3PDMaker.NavigableConstituentAssociationTool,
'constit_',
blockname=typename+'NavigableConstituentAssociationTool',
TypeName = typename, WriteWeight = True,
level = level)
ConstitAssoc.defineBlock (0, 'ConstitIndex'+typename, D3PDMakerCoreComps.IndexFillerTool, Target = target)
def AddConstitTruthIndex(object, typename='TruthParticle', target='mc_', level=0):
import EventCommonD3PDMaker
import D3PDMakerCoreComps
import TruthD3PDMaker
ConstitAssoc = ContainedVectorMultiAssociation \
(object,
EventCommonD3PDMaker.NavigableConstituentAssociationTool,
'constit_',
blockname=typename+'NavigableConstituentAssociationTool',
TypeName = typename, WriteWeight = False,
level = level)
genPart = SimpleAssociation(ConstitAssoc,TruthD3PDMaker.TruthParticleGenParticleAssociationTool)
trupart2 = IndexAssociation (genPart, TruthD3PDMaker.GenParticleTruthParticleAssociationTool,
target = 'mc_',
Target = 'mc_')
def AddBTaggingInfo(obj, level = 0, block_prefix = "my"):
obj.defineBlock(level,block_prefix+JetTagD3PDKeys.BTagWeightsBlockName(),
JetTagD3PDMaker.JetTagBTagWeightsFillerTool,
prefix=JetTagD3PDKeys.BTagWeightsPrefix(),
TaggerNames=JetTagD3PDFlags.Taggers())
#addBTagInfoToJetObject(obj,0)
def AddBTaggingInfoFromSubjets(obj, sj_assoc_name = 'SplitFiltSubjets', sj_prefix = "subjets", level=0):
t = ContainedVectorMultiAssociation(obj, JetSubstructureD3PDMaker.JetSubstructureTagJetINavigable4MomentumAssociationTool,level = level, prefix= sj_prefix+"_",
blockname='blockbtag'+sj_assoc_name, nrowName = 'nsj', OutputLevel=3, AssociationName=sj_assoc_name, IntermediateAssociationNames=['Parent'])
#t.defineBlock(0, 'myKinematics', EventCommonD3PDMaker.FourMomFillerTool, WriteE = True)
AddBTaggingInfo(t, 0, "my"+sj_assoc_name)
myJSD3PD = []
def JSD3PD(jetsToWrite, alg):
global myJSD3PD
if not alg:
raise TypeError("alg should be specified!")
jsD3PD=None
for val in myJSD3PD:
if val[0]==jetsToWrite:
print ("using existing JSD3PD")
jsD3PD=val[1]
break
if jsD3PD==None:
jsD3PD = JSD3PD_Tool(jetsToWrite)
myJSD3PD += [ (jetsToWrite, jsD3PD) ]
jsD3PD.addToAlg(alg)
class JSD3PD_Tool(object):
def __init__(self,jetsToWrite):
self.commonExcludeList = ['El02Match','Mu02Match','L1Info','L2Info','EFInfo']
self.commonIncludeList = []
MyJetD3PDObject = getJetD3PDObject(objectname='MyJetD3PDObject')
MyGroomedJetD3PDObject = getJetD3PDObject(objectname='MyGroomedJetD3PDObject')
import re
JetAlgPattern = re.compile(r'^(\D+)(\d{1,2})(\D+)Jets') #assuming standard notation
ars = JetAlgPattern.match(jetsToWrite[0]).groups()
self.parentJets = ''.join(ars) #remove the 'Jets' at the end
self.groomedJetsList = jetsToWrite[1]
if 'Track' in self.parentJets:
AddConstitIndex(MyGroomedJetD3PDObject, typename='Rec::TrackParticle', target='trk')
AddConstitIndex(MyJetD3PDObject, typename='Rec::TrackParticle', target='trk')
elif 'LCTopo' in self.parentJets:
AddConstitIndex(MyGroomedJetD3PDObject)
AddConstitIndex(MyJetD3PDObject)
elif 'Truth' in self.parentJets:
AddConstitTruthIndex(MyJetD3PDObject)
AddConstitTruthIndex(MyGroomedJetD3PDObject)
#if 'Track' not in self.parentJets and 'Truth' not in self.parentJets:
# AddAssocJetsIndex(MyJetD3PDObject, 'TrackJets', 'jet_' + ars[0] + ars[1] + 'TrackZ_')
# if rec.doTruth():
# AddAssocJetsIndex(MyJetD3PDObject, 'TruthJets', 'jet_' + ars[0] + ars[1] + 'Truth_')
self.JetQualInclude = []
if 'Topo' in self.parentJets or 'LCTopo' in self.parentJets:
self.commonIncludeList += ['ConstituentScale', 'EMScale']
AddHadronicInfo(MyJetD3PDObject, ['OriginIndex','nTrk','sumPtTrk','EtaOrigin' , 'PhiOrigin' , 'MOrigin'], theblockname = 'OriginIndexBlock')
AddHadronicInfo(MyGroomedJetD3PDObject, ['EtaOrigin' , 'PhiOrigin' , 'MOrigin' ], theblockname = 'OriginIndexBlock')
if (self.parentJets == 'AntiKt10LCTopo') or (self.parentJets == 'CamKt12LCTopo'):
AddHadronicInfo(MyJetD3PDObject, ['LCJES', 'LCJES_EtaCorr', 'LCJES_MassCorr' ], theblockname='LCJESBlock')
AddHadronicInfo(MyGroomedJetD3PDObject, ['LCJES', 'LCJES_EtaCorr', 'LCJES_MassCorr' ], theblockname='LCJESBlock')
self.VtxInclude = []
if 'Topo' in self.parentJets:
self.VtxInclude += ['JVtx','JetVertexFraction']
AddAssocJetsIndex(MyGroomedJetD3PDObject, 'Parent', 'jet_' + self.parentJets + '_')
for gr in self.groomedJetsList:
AddAssocJetsIndex(MyJetD3PDObject, gr, 'jet_' + self.parentJets + gr + '_')
MyGroomedJetCollectionD3PDObject = getJetCollectionD3PDObject(objectname = "MyGroomedJetCollectionD3PDObject")
AddUniqueMoments(MyGroomedJetCollectionD3PDObject, ['SmallR','PtFrac', 'NSub'], theblockname = 'TrimConfigMoments', level=99)
AddUniqueMoments(MyGroomedJetCollectionD3PDObject, ['NSubjets','ktycut2','massFraction','minRfilt','minSplitR'], theblockname = 'FiltConfigMoments', level = 99)
AddHadronicInfo(MyGroomedJetD3PDObject, ['CORE_RBB','CORE_RFILT'], theblockname = 'FiltMoments', level=99)
## in groomedJetsList, subjets name should follow the name of the 'full/composite' jet.
for idx,gr in enumerate(self.groomedJetsList):
## names are unique
if 'Subjets' in gr and idx != 0 and 'Subjets' not in self.groomedJetsList[idx-1]:
AddBTaggingInfoFromSubjets(MyGroomedJetD3PDObject, sj_assoc_name = gr, sj_prefix = gr, level = 99)
AddAssocJetsIndex(MyGroomedJetD3PDObject, gr, 'jet_' + self.parentJets + gr + '_', intermediate_names = ['Parent'], level=99)
elif 'Subjets' in gr:
raise ValueError("Subjets without full composite jet ?") ## not suppose to happen
self.MyJetD3PDObject = MyJetD3PDObject
self.MyGroomedJetD3PDObject = MyGroomedJetD3PDObject
self.MyGroomedJetCollectionD3PDObject = MyGroomedJetCollectionD3PDObject
def addToAlg(self,alg):
alg += self.MyJetD3PDObject(0, prefix='jet_' + self.parentJets + '_', sgkey=self.parentJets+'Jets', exclude=self.commonExcludeList, include = self.commonIncludeList + self.VtxInclude + self.JetQualInclude)
for idx,gr in enumerate(self.groomedJetsList):
kw = {}
includelist = []
includelist_unique = []
if 'Trim' in gr:
includelist_unique += ['TrimConfigMoments']
elif 'Filt' in gr and 'Subjets' not in gr:
includelist += ['FiltMoments']
includelist_unique += ['FiltConfigMoments']
if len(self.groomedJetsList) > idx+1 and 'Subjets' in self.groomedJetsList[idx+1]:
includelist += ['blockbtag'+self.groomedJetsList[idx+1], self.groomedJetsList[idx+1]+'blockindex']
elif 'Subjets' in gr:
includelist += [JetTagD3PDKeys.BTagWeightsBlockName()]
includelist += [JetTagD3PDKeys.JetTrackAssocBlockName()]
includelist += [JetTagD3PDKeys.JetTrackBlockName()]
includelist += [JetTagD3PDKeys.IPInfoPlusTrackAssocBlockName()]
includelist += [JetTagD3PDKeys.IPInfoPlusTrackBlockName()]
kw[JetTagD3PDKeys.JetTrackAssocBlockName()+'_target']= "trk"
kw[JetTagD3PDKeys.IPInfoPlusTrackAssocBlockName()+'_target']= "trk"
alg += self.MyGroomedJetD3PDObject(0, prefix='jet_' + self.parentJets + gr + '_', sgkey=self.parentJets + gr +'Jets', include = includelist + self.commonIncludeList,exclude=self.commonExcludeList,**kw)
alg += self.MyGroomedJetCollectionD3PDObject( 0, prefix='jet_' + self.parentJets + gr + '_config_', sgkey=self.parentJets + gr +'Jets', include = includelist_unique)
return
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
#####Jet Reco ############
# Before adding your algorithms to topSequence
from JetRec.JetGetters import *
from JetRec.JetRecFlags import jetFlags
from JetRecTools.JetRecToolsConf import *
from AthenaCommon.AlgSequence import AlgSequence
from JetRec.JetMomentGetter import add_jetMoments_to_JetAlg, make_JetMomentGetter
from JetRec.JetRecConf import JetSorterTool
#from JetMomentTools.JetMomentToolsConf import JetWidthTool
import JetSubStructure
_GroomingTool = {
'Trimming' : JetSubStructure.SimpleTrimmingTool,
'BDRSFiltering' : JetSubStructure.BDRSFilteringTool,
}
def buildName(GroomedDict):
if type(GroomedDict) != dict:
raise TypeError("GroomedDicts must contain dicts!")
if GroomedDict['Type'] in _GroomingTool:
strconfig = ""
theArgs = GroomedDict['args']
for k in theArgs.keys():
if type(theArgs[k]) == int:
strconfig += k + '%d' % theArgs[k]
elif type(theArgs[k]) == float:
strconfig += k + '%d' % (theArgs[k]*100)
toolname = strconfig
return toolname
else:
raise KeyError("Couldn't find grooming tool %s" % GroomedDict['Type'])
def getGroomingTools(GroomedDicts):
myGroomingTools = []
catNames = []
for gr in GroomedDicts:
toolname = buildName(gr)
defname = _GroomingTool[gr['Type']].__slots__['Name'] ## safe hack ?
defsubjetsname = ''
if "SubjetsName" in _GroomingTool[gr['Type']].__slots__.keys():
defsubjetsname = _GroomingTool[gr['Type']].__slots__['SubjetsName']
kw = gr['args'].copy()
if 'Name' not in kw.keys():
kw['Name'] = defname
kw['Name'] += toolname
if 'SubjetsName' not in kw.keys() and defsubjetsname != '':
kw['SubjetsName'] = defsubjetsname
kw['SubjetsName'] += toolname
myGroomingTools += [_GroomingTool[gr['Type']](gr['Type']+toolname, StoreConfigParam = True, **kw)]
catNames += [ kw['Name'] ]
## are we requesting subjets ?
if "SaveSubjets" in kw.keys():
if kw["SaveSubjets"] == True:
catNames += [ kw['SubjetsName'] ]
return myGroomingTools, catNames
######################
## Truth Jets ##
######################
def setupTruthJets(myjetfinder, myjetdr, GroomedDicts, theseq):
if rec.doTruth():
myGroomingTools, catNames = getGroomingTools(GroomedDicts)
sortertool = JetSorterTool('myJetSorter', SortOrder="ByPtDown", OutputLevel=3)
assoc_tool_truth = JetSubStructure.JetAssociationTool(
name = 'JetAssocToolTruth',
GroomingTools = myGroomingTools, UsedSignalState = 2,
JetAlgTools = [sortertool], OutputLevel = 3
)
myjetgetter_truth = make_StandardJetGetter(myjetfinder, myjetdr, 'Truth', seq = theseq, doCalib=False ,addDefaultMoment=False)
truthcontname = myjetgetter_truth.outputKey()
make_JetMomentGetter(truthcontname , [assoc_tool_truth], theseq )
return [ truthcontname, catNames ]
else:
return [ None, None ]
######################
## Track Jets ##
######################
def setupTrackJets(myjetfinder, myjetdr, GroomedDicts, theseq):
myGroomingTools, catNames = getGroomingTools(GroomedDicts)
sortertool = JetSorterTool('myJetSorter', SortOrder="ByPtDown", OutputLevel=3 )
assoc_tool_track = JetSubStructure.JetAssociationTool(
name = 'JetAssocToolTrack',
GroomingTools = myGroomingTools, UsedSignalState = 2,
JetAlgTools = [sortertool], OutputLevel = 3
)
#---- TrackJet ----
from JetSubStructure.JSTrackJets import createJSTrackJets
mygetter = createJSTrackJets(theseq, myjetfinder,myjetdr)
trackjetcontname = mygetter.outputKey()
#---- End TrackJet ----
make_JetMomentGetter(trackjetcontname , [assoc_tool_track], theseq )
return [ trackjetcontname, catNames ]
######################
## Calo Jets ##
######################
def setupCaloJets(myjetfinder, myjetdr, myjetinput, GroomedDicts, theseq):
myGroomingTools, catNames = getGroomingTools(GroomedDicts)
sortertool = JetSorterTool('myJetSorter', SortOrder="ByPtDown", OutputLevel=3 )
grjets_calib = []
## Origin correction / Eta-Mass-JES hack
from JetSubStructure.mySetupJetCalibrators import doEtaMassJESCorrection
from JetCalibTools.MakeCalibSequences import calibTags
calibTags['ETAMASSJES'] = doEtaMassJESCorrection
mydoCalib = False
mycalibName = ''
if 'LCTopo' in myjetinput:
mydoCalib = True
if (myjetfinder + '%d'%(myjetdr*10) == 'AntiKt10') or (myjetfinder + '%d'%(myjetdr*10) == 'CamKt12'):
mycalibName = 'LC:ORIGIN_ETAMASSJES'
else:
mycalibName = 'LC:ORIGIN'
stdcaliblist = []
allowedcalib = ['AntiKt10LCTopoTrimmedJets', 'AntiKt10LCTopoTrimmedPtFrac3SmallR30Jets','AntiKt10LCTopoTrimmedPtFrac5SmallR30Jets','CamKt12LCTopoTrimmedPtFrac5SmallR30Jets']
for x in catNames:
author = myjetfinder + '%d'%(myjetdr*10) + myjetinput + x + 'Jets'
if author in allowedcalib :
grjets_calib += [JetSubStructure.JetAlgToolWrapper(name = 'calibtool_origin_etamassjes_'+x,
JetAlgTool = getStandardCalibTool(myjetfinder,myjetdr, myjetinput+x, doCalib=True, calibName='LC:ORIGIN_ETAMASSJES')[0],
GroomedjetsAuthor = [x] )]
else:
stdcaliblist += [x]
if stdcaliblist != [] :
grjets_calib += [JetSubStructure.JetAlgToolWrapper(name = 'calibtool_origin',
JetAlgTool = getStandardCalibTool(myjetfinder,myjetdr, myjetinput, doCalib=True, calibName='LC:ORIGIN')[0],
GroomedjetsAuthor = stdcaliblist )]
elif 'Topo' in myjetinput:
mydoCalib = True
mycalibName = 'EM:ORIGIN'
grjets_calib += getStandardCalibTool(myjetfinder,myjetdr, myjetinput, doCalib=True, calibName='EM:ORIGIN')
assoc_tools = []
if rec.doTruth():
truthcontname = myjetfinder + '%dTruthJets' % (myjetdr*10)
if hasattr(theseq, truthcontname):
truthj_assoc = JetSubStructure.JetJetAssociatorTool("Truth_JetJetAssociatorTool", ContainerName = truthcontname, AssociationName = "TruthJets", MatchOrigin = False)
trackjetcontname = myjetfinder + '%dTrackZJets' % (myjetdr*10)
if hasattr(theseq, trackjetcontname):
trkj_assoc = JetSubStructure.JetJetAssociatorTool("Trk_JetJetAssociatorTool", ContainerName = trackjetcontname, AssociationName = "TrackJets", MatchOrigin = True)
## batgging ##
subjets_names = [x for x in catNames if "Subjets" in x]
btag_tool = []
if subjets_names != '':
from JetRec.JetGetters import getStandardBTaggerTool
from JetRec.JetRecFlags import jetFlags
jetFlags.doBTagging = True
_btag_tool = getStandardBTaggerTool('AntiKt', 0.4, 'LCTopo')
if len(_btag_tool) > 0:
btag_tool += [ JetSubStructure.JetAlgToolWrapper(name = 'JetBTagger_' + ''.join(subjets_names), JetAlgTool = _btag_tool[0],
GroomedjetsAuthor = subjets_names ) ]
jetFlags.doBTagging = False
## btagging end ##
assoc_tool = JetSubStructure.JetAssociationTool(
name = 'JetAssocTool',
AssociatorTools = assoc_tools,
GroomingTools = myGroomingTools, UsedSignalState = 2,
JetAlgTools = grjets_calib + [sortertool] + btag_tool, OutputLevel = 3
)
myjetgetter = make_StandardJetGetter(myjetfinder, myjetdr, myjetinput, seq = theseq, doCalib=mydoCalib, calibName=mycalibName,addDefaultMoment=False)
contname = myjetgetter.outputKey()
# ------------------------------------------------
# Associate a vertex and set the JVF moment. Must be placed AFTER vertex correction
# ------------------------------------------------
from AthenaCommon.DetFlags import DetFlags
from AthenaCommon.AppMgr import ToolSvc
noVertex = jobproperties.Beam.beamType == 'cosmics' or jobproperties.Beam.beamType == 'singlebeam'
if DetFlags.detdescr.ID_on() and jetFlags.doJVF() and 'Truth' not in myjetinput and not noVertex:
from JetSubStructure.mySetupJetMomentTools import mygetJetVertexAssociationTool
myjvatool = mygetJetVertexAssociationTool(myjetfinder, myjetdr,myjetinput,'Custom%d'%(myjetdr*10))
add_jetMoments_to_JetAlg(myjetgetter, [myjvatool])
make_JetMomentGetter(contname , [assoc_tool], theseq )
return [ contname, catNames ]
def createJSJets( ParentDict, GroomedDicts, theseq = AlgSequence()) :
if type(ParentDict) != dict:
raise TypeError("ParentDict must be a dict!")
if type(GroomedDicts) != list:
raise TypeError("GroomedDicts must be a list!")
myjetfinder = ParentDict["JetFinder"]
myjetdr = ParentDict["JetdR"]
myjetinput = ParentDict["JetInput"]
if myjetinput == 'Truth':
return setupTruthJets(myjetfinder, myjetdr, GroomedDicts, theseq)
elif myjetinput == 'Track':
return setupTrackJets(myjetfinder, myjetdr, GroomedDicts, theseq)
else :
return setupCaloJets(myjetfinder, myjetdr, myjetinput, GroomedDicts, theseq)
# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
# $Id: PhysicsD3PDProdFlags.py 531461 2012-12-20 21:43:15Z nedwards $
#
# @file PhysicsD3PDMaker/python/PhysicsD3PDProdFlags.py
# @author scott snyder <snyder@bnl.gov>
# @date Jun, 2012
# @brief Define flags and configuration settings used when making
# Physics D3PDs from production transforms.
#
# Any objects here with a name of the form Write*D3PD that derive
# from JobProperty are added to D3PDProdFlags.
#
from AthenaCommon.JobProperties import JobProperty
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# $Id: SMWZLightTriggerBitsD3PDObject.py 467769 2011-11-11 22:36:30Z boonekam $
#
# @file PhysicsD3PDMaker/python/SMWZLightTriggerBitsD3PDObject.py
# @author Haifeng Li <Haifeng.Li@cern.ch>
# @date May, 2010
# @brief Define trigger bit blocks for SMWZ
#
import D3PDMakerCoreComps
import TriggerD3PDMaker
from TriggerD3PDMaker.defineTriggerBits import defineTriggerBits
from D3PDMakerCoreComps.D3PDObject import D3PDObject
from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags
#
# The maker function.
# We don't get any input from SG (directly).
#
def makeSMWZLightTriggerBitsD3PDObject (name,
prefix,
object_name,
getter = None,
sgkey = ''):
return D3PDMakerCoreComps.VoidObjFillerTool (name,
Prefix = prefix
)
# Create the object type.
SMWZLightTriggerBitsD3PDObject = \
D3PDObject (makeSMWZLightTriggerBitsD3PDObject,
default_name = 'SMWZLightTriggerBitsFiller')
######
# Define blocks.
if D3PDMakerFlags.DoTrigger():
defineTriggerBits (SMWZLightTriggerBitsD3PDObject, 0, ['EF_e*'])
defineTriggerBits (SMWZLightTriggerBitsD3PDObject, 0, ['EF_2e*'])
defineTriggerBits (SMWZLightTriggerBitsD3PDObject, 0, ['EF_g*'])
defineTriggerBits (SMWZLightTriggerBitsD3PDObject, 0, ['EF_2g*'])
defineTriggerBits (SMWZLightTriggerBitsD3PDObject, 0, ['EF_mu*'])
defineTriggerBits (SMWZLightTriggerBitsD3PDObject, 0, ['EF_2mu*'])
defineTriggerBits (SMWZLightTriggerBitsD3PDObject, 0, ['EF_xe*'])
defineTriggerBits (SMWZLightTriggerBitsD3PDObject, 0, ['EF_xs*'])
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# $Id$
#
# @file PhysicsD3PDMaker/python/SMWZTriggerBitsD3PDObject.py
# @author Haifeng Li <Haifeng.Li@cern.ch>
# @date May, 2010
# @brief Define trigger bit blocks for SMWZ
#
import D3PDMakerCoreComps
import TriggerD3PDMaker
from TriggerD3PDMaker.defineTriggerBits import defineTriggerBits
from D3PDMakerCoreComps.D3PDObject import D3PDObject
from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags
#
# The maker function.
# We don't get any input from SG (directly).
#
def makeSMWZTriggerBitsD3PDObject (name,
prefix,
object_name,
getter = None,
sgkey = ''):
return D3PDMakerCoreComps.VoidObjFillerTool (name,
Prefix = prefix
)
# Create the object type.
SMWZTriggerBitsD3PDObject = \
D3PDObject (makeSMWZTriggerBitsD3PDObject,
default_name = 'SMWZTriggerBitsFiller')
######
# Define blocks.
if D3PDMakerFlags.DoTrigger():
defineTriggerBits (SMWZTriggerBitsD3PDObject, 0,
['EF_.*'])
##bjet bits
defineTriggerBits (SMWZTriggerBitsD3PDObject, 0,
[ "L1_J10",
"L1_JE100",
"L1_JE140",
"L1_2J10_J50",
"L1_3J15",
"L1_3J20",
"L1_4J10",
"L1_4J15",
# Level 2
"L2_2b10_medium_L1JE100" ,
"L2_2b10_medium_L1JE140" ,
"L2_2b15_medium_3L1J15" ,
"L2_2b20_medium_3L1J20" ,
"L2_2b10_medium_4L1J10" ,
"L2_2b10_medium_L1_2J10J50",
"L2_3b10_loose_4L1J10",
"L2_3b15_loose_4L1J15",
# Event Filter
'EF_b*',
'EF_2b*',
'EF_3b*'
])
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
include.block( "PhysicsD3PDMaker/ElectronSelector.py" )
from ROOT import egammaPID
from ROOT import egammaParameters
from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags
from D2PDMaker.D2PDMakerConf import D2PDElectronSelector
from D2PDMaker.D2PDMakerConf import D2PDParticleCombiner
from AthenaCommon.AlgSequence import AlgSequence
preseq = AlgSequence (D3PDMakerFlags.PreD3PDAlgSeqName())
preseq += D2PDElectronSelector( "SMWZ_HighPtElectronFilter",
inputCollection = 'ElectronAODCollection',
outputCollection = 'HighPtElectrons',
etMin = 20.0*Units.GeV,
clusterEtaMin = -2.5,
clusterEtaMax = 2.5,
electronID = egammaPID.ElectronIDLoosePP,
minNumberPassed = 1
)
from RecExConfig.RecAlgsFlags import recAlgs
if recAlgs.doEgammaBremReco():
gsfElectronContainer = 'HighPtGSFElectrons'
preseq += D2PDElectronSelector( "SMWZ_HighPtGSFElectronFilter",
inputCollection = 'GSFElectronAODCollection',
outputCollection = 'HighPtGSFElectrons',
etMin = 20.0*Units.GeV,
clusterEtaMin = -2.5,
clusterEtaMax = 2.5,
electronID = egammaPID.ElectronIDLoosePP,
minNumberPassed = 1
)
else:
gsfElectronContainer = 'None'
include.block( "PhysicsD3PDMaker/JetSelector.py" )
from D2PDMaker.D2PDMakerConf import D2PDJetSelector
from AthenaCommon.AlgSequence import AlgSequence
preseq = AlgSequence (D3PDMakerFlags.PreD3PDAlgSeqName())
preseq += D2PDJetSelector( "SMWZ_HighPtJetFilter",
inputCollection = 'AntiKt4TopoEMJets',
outputCollection = 'HighPtJets',
ptMin = 20.0*Units.GeV )
preseq += D2PDJetSelector( "SMWZ_HighPtJetEM6Filter",
inputCollection = 'AntiKt6TopoEMJets',
outputCollection = 'HighPtJetsEM6',
ptMin = 20.0*Units.GeV )
preseq += D2PDJetSelector( "SMWZ_HighPtJetLC4Filter",
inputCollection = 'AntiKt4LCTopoJets',
outputCollection = 'HighPtJetsLC4',
ptMin = 20.0*Units.GeV )
preseq += D2PDJetSelector( "SMWZ_HighPtJetLC6Filter",
inputCollection = 'AntiKt4LCTopoJets',
outputCollection = 'HighPtJetsLC6',
ptMin = 20.0*Units.GeV )
include.block( "PhysicsD3PDMaker/LowPtElectronPairSelector.py" )
from ROOT import egammaPID
from ROOT import egammaParameters
from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags
from D2PDMaker.D2PDMakerConf import D2PDElectronSelector
from D2PDMaker.D2PDMakerConf import D2PDParticleCombiner
from AthenaCommon.AlgSequence import AlgSequence
preseq = AlgSequence (D3PDMakerFlags.PreD3PDAlgSeqName())
preseq += D2PDElectronSelector( "SMWZ_LowPtElectronFilter",
inputCollection = 'ElectronAODCollection',
outputCollection = 'LowPtElectrons',
clusterEtaMin = -2.5,
clusterEtaMax = 2.5,
electronID = egammaPID.ElectronIDMediumPP,
etMin = 5.0*Units.GeV )
preseq += D2PDElectronSelector( "SMWZ_MediumPtElectronFilter",
inputCollection = 'ElectronAODCollection',
outputCollection = 'MediumPtElectrons',
clusterEtaMin = -2.5,
clusterEtaMax = 2.5,
electronID = egammaPID.ElectronIDLoosePP,
etMin = 10.0*Units.GeV )
from RecExConfig.RecAlgsFlags import recAlgs
if recAlgs.doEgammaBremReco():
gsfElectronContainer = 'LowPtGSFElectrons'
preseq += D2PDElectronSelector( "SMWZ_LowPtGSFElectronFilter",
inputCollection = 'GSFElectronAODCollection',
outputCollection = 'LowPtGSFElectrons',
clusterEtaMin = -2.5,
clusterEtaMax = 2.5,
electronID = egammaPID.ElectronIDMediumPP,
etMin = 5.0*Units.GeV )
else:
gsfElectronContainer = 'None'
preseq += D2PDParticleCombiner( "SMWZ_JPsieeFilter",
inputCollectionList = [ 'LowPtElectrons', 'LowPtElectrons' ],
outputCollection = 'JPsieeSelection',
minNumberPassed = 1,
massMax = 15.0*Units.GeV )
preseq += D2PDParticleCombiner( "SMWZ_ZeeFilter",
inputCollectionList = [ 'MediumPtElectrons', 'MediumPtElectrons' ],
outputCollection = 'ZeeSelection',
minNumberPassed = 1,
massMin = 50.0*Units.GeV )
include.block( "PhysicsD3PDMaker/LowPtMuonPairSelector.py" )
from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags
from D2PDMaker.D2PDMakerConf import D2PDMuonSelector
from D2PDMaker.D2PDMakerConf import D2PDParticleCombiner
from AthenaCommon.AlgSequence import AlgSequence
preseq = AlgSequence (D3PDMakerFlags.PreD3PDAlgSeqName())
# STACO
preseq += D2PDMuonSelector( "SMWZ_LowPtMuonFilter",
inputCollection = 'StacoMuonCollection',
outputCollection = 'LowPtStacoMuons',
ptMin = 5.0*Units.GeV )
preseq += D2PDParticleCombiner( "SMWZ_JPsimumuStacoFilter",
inputCollectionList = [ 'LowPtStacoMuons', 'LowPtStacoMuons' ],
outputCollection = 'JPsimumuStacoSelection',
minNumberPassed = 1,
massMax = 15.0*Units.GeV )
preseq += D2PDParticleCombiner( "SMWZ_ZmumuStacoFilter",
inputCollectionList = [ 'LowPtStacoMuons', 'LowPtStacoMuons' ],
outputCollection = 'ZmumuStacoSelection',
minNumberPassed = 1,
massMin = 50.0*Units.GeV )
# MUID
preseq += D2PDMuonSelector( "SMWZ_LowPtMuidMuonFilter",
inputCollection = 'MuidMuonCollection',
outputCollection = 'LowPtMuidMuons',
ptMin = 5.0*Units.GeV )
preseq += D2PDParticleCombiner( "SMWZ_JPsimumuMuidFilter",
inputCollectionList = [ 'LowPtMuidMuons', 'LowPtMuidMuons' ],
outputCollection = 'JPsimumuMuidSelection',
minNumberPassed = 1,
massMax = 15.0*Units.GeV )
preseq += D2PDParticleCombiner( "SMWZ_ZmumuMuidFilter",
inputCollectionList = [ 'LowPtMuidMuons', 'LowPtMuidMuons' ],
outputCollection = 'ZmumuMuidSelection',
minNumberPassed = 1,
massMin = 50.0*Units.GeV )
include.block( "PhysicsD3PDMaker/MuonSelector.py" )
from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags
from D2PDMaker.D2PDMakerConf import D2PDMuonSelector
from D2PDMaker.D2PDMakerConf import D2PDParticleCombiner
from AthenaCommon.AlgSequence import AlgSequence
preseq = AlgSequence (D3PDMakerFlags.PreD3PDAlgSeqName())
# STACO
preseq += D2PDMuonSelector( "SMWZ_HighPtStacoMuonFilter",
inputCollection = 'StacoMuonCollection',
outputCollection = 'HighPtStacoMuons',
ptMin = 20.0*Units.GeV,
minNumberPassed = 1 )
# MUID
preseq += D2PDMuonSelector( "SMWZ_HighPtMuidMuonFilter",
inputCollection = 'MuidMuonCollection',
outputCollection = 'HighPtMuidMuons',
ptMin = 20.0*Units.GeV,
minNumberPassed = 1 )
# Call as UserAlgs
# Imports
from JetRec.JetRecConf import *
from JetRecTools.JetRecToolsConf import *
from JetRec.JetGetters import *
from JetCalibTools.JetCalibToolsConf import *
from AthenaCommon.SystemOfUnits import GeV
from RecExConfig.RecFlags import rec
from AthenaCommon.AlgSequence import AlgSequence
seq = AlgSequence()
if rec.doTruth():
# Needed for release 15 AntiKt6 truth jets
# make_StandardJetGetter('AntiKt', 0.6, 'Truth')
import D3PDMakerCoreComps
from D3PDMakerCoreComps.resolveSGKey import testSGKey
if not testSGKey ('JetCollection', 'AntiKt6TruthJets'):
make_StandardJetGetter('AntiKt', 0.6, 'Truth')
# Add truth jet collection that includes all final state particles (including muons and neutrinos)
antikt4truthAlgAll = make_StandardJetGetter('AntiKt',0.4,'Truth',disable=False,
outputCollectionName='AntiKt4TruthJets_ALL',
useInteractingOnly=False,
includeMuons=True
).jetAlgorithmHandle()
antikt6truthAlgAll = make_StandardJetGetter('AntiKt',0.6,'Truth',disable=False,
outputCollectionName='AntiKt6TruthJets_ALL',
useInteractingOnly=False,
includeMuons=True
).jetAlgorithmHandle()
# Configuration of this jetalgorithm adapted from TruthD3PDMaker/evgenD3PD.py
from TruthD3PDMaker.TruthJetFilterConfig import TruthJetFilterConfig
# Build Particle list
TruthJetFilterConfig (seq, writePartons = False, writeHadrons = True, excludeWZdecays = True, photonCone=0.1)
from ParticleBuilderOptions.AODFlags import AODFlags
AODFlags.MissingEtTruth = True
AODFlags.TruthParticleJet = True
AODFlags.McEventKey="GEN_EVENT"
# Add truth jet collection that includes all final state particles (including muons and neutrinos)
antikt4truthAlgWZ = make_StandardJetGetter('AntiKt',0.4,'Truth',disable=False,
inputCollectionNames=['FilteredD3PDTruth'],
outputCollectionName='AntiKt4TruthJets_WZ',
useInteractingOnly=False,
includeMuons=True
).jetAlgorithmHandle()
antikt6truthAlgWZ = make_StandardJetGetter('AntiKt',0.6,'Truth',disable=False,
inputCollectionNames=['FilteredD3PDTruth'],
outputCollectionName='AntiKt6TruthJets_WZ',
useInteractingOnly=False,
includeMuons=True
).jetAlgorithmHandle()
include.block( "PhysicsD3PDMaker/PhotonSelector.py" )
from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags
from D2PDMaker.D2PDMakerConf import D2PDPhotonSelector
from AthenaCommon.AlgSequence import AlgSequence
preseq = AlgSequence (D3PDMakerFlags.PreD3PDAlgSeqName())
preseq += D2PDPhotonSelector( "SMWZ_HighPtPhotonFilter",
inputCollection = 'PhotonAODCollection',
outputCollection = 'HighPtPhotons',
photonVetoAuthorList = [ 128 ],
photonID = egammaPID.PhotonIDLoose,
etMin = 10.0*Units.GeV )
def tmp_getJetVertexAssociationTool(finder, mainParam, input, toolName="JetVertexAssociation", **options):
from JetRec.JetAlgConfiguration import checkAndUpdateOptions
options=checkAndUpdateOptions(finder=finder, mainParam=mainParam, input=input, **options)
from JetMomentTools.JetMomentToolsConf import JetVertexAssociationTool, JetOriginCorrectionTool
jvaTool = JetVertexAssociationTool(toolName)
jvaTool.AssociateToHighestJVF = True
from JetRec.TrackSelectionForJets import getDefaultJetVtxTrackHelper
jvaTool.JetVtxTrackHelper = getDefaultJetVtxTrackHelper()
# origin correction tool
origCorr = JetOriginCorrectionTool("JetOriginCorrection")
origCorr.CellCalibrator = None
origCorr.UseGCW = False
origCorr.UseClusters = True
# Official Choice of Jet/MET Group : Primary Vertex
origCorr.UseJVA = False
origCorr.UsePrimaryVertex = True
origCorr.UseBeamSpot = True
jvaTool.OriginCorrectionTool = origCorr
return jvaTool
# simply use this as : momAlg = specialMoment('AntiKt4LCTopoJets')
def specialMoment(jetcollname):
gAssoc = ["TrackAssoc"]
if rec.doTruth():
gAssoc+=[ "TruthAssoc"]
from JetMomentTools.GhostAssociation import addGhostAssociation
momAlg = addGhostAssociation(jetcollname, gAssoc)
# make JVF calculation use the Ghost-associated tracks
# from JetMomentTools.SetupJetMomentTools import getJetVertexAssociationTool
# jvtxTool = getJetVertexAssociationTool('AntiKt', 0.4, 'LCTopo') # parameters don't matter
# use the tmp_ version as long as the default is not fixed
# jvtxTool = tmp_getJetVertexAssociationTool('AntiKt', 0.4, 'LCTopo', toolName=jetcollname+'JVAtool') # parameters don't matter
# jvtxTool.TrackAssocName = "TrackAssoc"
# jvtxTool.JetVtxTrackHelper.ptMin = 0.5*GeV
# momAlg.CalculatorTools += [ jvtxTool ]
# enable trackWIDDTH
from JetMomentTools.SetupJetMomentTools import getJetTracksMomentTool
tm = getJetTracksMomentTool( DoAllPV = True)
tm.DoAllPV = True
tm.MinPt = 1 *GeV
momAlg.CalculatorTools += [ tm ]
include.block( "SMEWTrilepSkim/SMTRILEP_ElectronSelector.py" )
from ROOT import egammaPID
from ROOT import egammaParameters
from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags
from D2PDMaker.D2PDMakerConf import D2PDElectronSelector
from D2PDMaker.D2PDMakerConf import D2PDParticleCombiner
from AthenaCommon.AlgSequence import AlgSequence
preseq = AlgSequence (D3PDMakerFlags.PreD3PDAlgSeqName())
preseq += D2PDElectronSelector( "SMTRILEP_TriLepElectronFilter",
inputCollection = 'ElectronAODCollection',
outputCollection = 'TrilepElectrons',
etMin = 4.0*Units.GeV,
clusterEtaMin = -5,
clusterEtaMax = 5,
#electronID = egammaPID.ElectronIDLoosePP,
minNumberPassed = 1
)
#from RecExConfig.RecAlgsFlags import recAlgs
#if recAlgs.doEgammaBremReco():
# gsfElectronContainer = 'HighPtGSFElectrons'
# preseq += D2PDElectronSelector( "SMTRILEP_HighPtGSFElectronFilter",
# inputCollection = 'GSFElectronAODCollection',
# outputCollection = 'HighPtGSFElectrons',
# etMin = 20.0*Units.GeV,
# clusterEtaMin = -2.5,
# clusterEtaMax = 2.5,
# electronID = egammaPID.ElectronIDLoosePP,
# minNumberPassed = 1
# )
#else:
# gsfElectronContainer = 'None'
include.block( "SMEWTrilepSkim/SMTRILEP_JetSelector.py" )
from D2PDMaker.D2PDMakerConf import D2PDJetSelector
from AthenaCommon.AlgSequence import AlgSequence
preseq = AlgSequence (D3PDMakerFlags.PreD3PDAlgSeqName())
preseq += D2PDJetSelector( "SMTRILEP_HighPtJetFilter",
inputCollection = 'AntiKt4TopoEMJets',
outputCollection = 'HighPtJets',
ptMin = 20.0*Units.GeV )
#preseq += D2PDJetSelector( "SMTRILEP_HighPtJetEM6Filter",
# inputCollection = 'AntiKt6TopoEMJets',
# outputCollection = 'HighPtJetsEM6',
# ptMin = 20.0*Units.GeV )
preseq += D2PDJetSelector( "SMTRILEP_HighPtJetLC4Filter",
inputCollection = 'AntiKt4LCTopoJets',
outputCollection = 'HighPtJetsLC4',
ptMin = 20.0*Units.GeV )
#preseq += D2PDJetSelector( "SMTRILEP_HighPtJetLC6Filter",
# inputCollection = 'AntiKt4LCTopoJets',
# outputCollection = 'HighPtJetsLC6',
# ptMin = 20.0*Units.GeV )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment