 |
ATLAS Offline Software
|
|
def | JetRecCfg (flags, jetdef, returnConfiguredDef=False) |
| Top level functions returning ComponentAccumulator out of JetDefinition. More...
|
|
def | JetInputCfg (flags, jetOrConstitdef, context="default") |
|
def | PseudoJetCfg (jetdef) |
|
def | getJetDefAlgs (flags, jetdef, returnConfiguredDef=False, monTool=None) |
| Mid level functions returning list of algs out of JetDefinition. More...
|
|
def | getJetGroomAlgs (flags, groomdef, returnConfiguredDef=False, monTool=None) |
|
def | getJetAlgs (flags, jetdef, returnConfiguredDef=False, monTool=None) |
|
def | getPseudoJetAlgs (jetdef) |
| Mid level functions returning specific type of algs out of JetDefinition functions below assumines the JetDefinition has its dependencies solved by a call to solveDependencies() More...
|
|
def | mergedPJId (pjList) |
|
def | getInputAlgs (jetOrConstitdef, flags, context="default", monTool=None) |
|
def | getPJContName (jetOrConstitdef, suffix=None, parent_jetdef=None) |
|
def | getConstitPJGAlg (constitdef, suffix=None, flags=None, parent_jetdef=None) |
|
def | getGhostPJGAlg (ghostdef, parentjetdef=None) |
|
def | getJetRecAlg (jetdef, monTool=None, ftf_suffix='', extraOutputs=[]) |
|
def | getJetRecGroomAlg (groomdef, monTool=None, extraOutputs=[]) |
|
def | getJetCopyAlg (jetsin, jetsoutdef, decorations=[], shallowcopy=True, shallowIO=True, monTool=None) |
|
def | getConstitModAlg (parentjetdef, constitSeq, monTool=None) |
|
def | getConstitModAlg_nojetdef (constitSeq, flags, context="default", monTool=None) |
|
def | getJetModifierTools (jetdef) |
|
def | getModifier (jetdef, moddef, modspec, flags=None) |
|
def | removeComponentFailingConditions (jetdef, flags=None, raiseOnFailure=True) |
|
def | removeGroomModifFailingConditions (groomdef, flags, raiseOnFailure=True) |
|
def | filterJetDefList (jetdef, inList, compType, raiseOnFailure, flags) |
|
def | isComponentPassingConditions (component, flags, jetdef) |
|
def | isAnalysisRelease () |
|
def | reOrderAlgs (algs) |
|
def | registerAsInputConstit (jetdef) |
|
def | removeFromList (l, o) |
|
def | JetRecConfigTest (flags=None) |
|
◆ filterJetDefList()
def python.JetRecConfig.filterJetDefList |
( |
|
jetdef, |
|
|
|
inList, |
|
|
|
compType, |
|
|
|
raiseOnFailure, |
|
|
|
flags |
|
) |
| |
Definition at line 749 of file JetRecConfig.py.
753 basekey= compType+
':' if compType!=
"" else ""
755 fullname = jetdef.fullname()
759 fullkey = basekey+comp
760 cInstance = jetdef._prereqDic[fullkey]
764 raise Exception(
"JetDefinition {} can NOT be scheduled. Failure of {} {} reason={}".
format(
765 jetdef, compType, comp, reason) )
768 jetlog.info(f
"{fullname} : removing {compType} {comp} reason={reason}")
769 if fullkey
in jetdef._prereqOrder:
770 jetdef._prereqOrder.remove(fullkey)
771 if compType==
'ghost':
777 jetlog.info(
" *** Number of {} filtered components = {} final list={}".
format(compType, nOut, outList) )
◆ getConstitModAlg()
def python.JetRecConfig.getConstitModAlg |
( |
|
parentjetdef, |
|
|
|
constitSeq, |
|
|
|
monTool = None |
|
) |
| |
returns a configured JetConstituentModSequence or None if constit.modifiers == []
The JetConstituentModSequence is determined by the JetInputConstitSeq constitSeq .
However, details of the configuration of the JetConstituentModSequence may depends on which JetDefinition
this JetConstituentModSequence is intended for. Thus the function also requires a parentjetdef JetDefinition input
IMPORTANT : parentjetdef & constitSeq must have their dependencies solved (i.e. they must result from solveDependencies() )
See also getConstitModAlg_nojetdef
Definition at line 542 of file JetRecConfig.py.
543 """returns a configured JetConstituentModSequence or None if constit.modifiers == []
545 The JetConstituentModSequence is determined by the JetInputConstitSeq constitSeq .
546 However, details of the configuration of the JetConstituentModSequence may depends on which JetDefinition
547 this JetConstituentModSequence is intended for. Thus the function also requires a parentjetdef JetDefinition input
549 IMPORTANT : parentjetdef & constitSeq must have their dependencies solved (i.e. they must result from solveDependencies() )
551 See also getConstitModAlg_nojetdef
556 if not isinstance(constitSeq, JetInputConstitSeq):
return
559 inputtype = constitSeq.basetype
561 sequence = constitSeq.modifiers
566 if constitSeq.inputname == constitSeq.containername:
return
568 for step
in sequence:
569 modInstance = parentjetdef._prereqDic[ f
'cmod:{step}' ]
570 if not modInstance.tooltype:
continue
572 toolclass = getattr( CompFactory, modInstance.tooltype)
575 for k,v
in modInstance.properties.items():
577 modInstance.properties[k ] =
v(parentjetdef, constitSeq )
579 tool = toolclass(modInstance.name,**modInstance.properties)
581 if (inputtype == xAODType.FlowElement
or inputtype == xAODType.ParticleFlow)
and modInstance.tooltype
not in [
"CorrectPFOTool",
"ChargedHadronSubtractionTool"]:
582 tool.IgnoreChargedPFO=
True
583 tool.ApplyToChargedPFO=
False
584 tool.InputType = inputtype
587 sequenceshort =
"".
join(sequence)
588 seqname =
"ConstitMod{0}_{1}".
format(sequenceshort,constitSeq.name)
589 inputcontainer =
str(constitSeq.inputname)
590 outputcontainer =
str(constitSeq.containername)
592 if (inputtype == xAODType.FlowElement
or inputtype == xAODType.ParticleFlow):
595 def chopPFO(thestring):
596 pfostr =
"ParticleFlowObjects"
597 if thestring.endswith(pfostr):
598 return thestring[:-len(pfostr)]
600 inputcontainer = chopPFO(inputcontainer)
601 outputcontainer = chopPFO(outputcontainer)
603 doByVertex = constitSeq.byVertex
605 inChargedFEDecorKeys = []
606 inNeutralFEDecorKeys = []
620 inChargedFEDecorKeys += [
"cellCPData",
"FE_ElectronLinks",
"FE_PhotonLinks",
"FE_MuonLinks"]
621 inNeutralFEDecorKeys += [
"calpfo_NLeadingTruthParticleBarcodeEnergyPairs",
"FE_ElectronLinks",
"FE_PhotonLinks",
"FE_MuonLinks"]
623 modseq = CompFactory.JetConstituentModSequence(seqname,
625 OutputContainer = outputcontainer,
626 InputContainer= inputcontainer,
627 InChargedFEDecorKeys = inChargedFEDecorKeys,
628 InNeutralFEDecorKeys = inNeutralFEDecorKeys,
630 DoByVertex = doByVertex
633 modseq.MonTool = monTool
635 constitmodalg = CompFactory.JetAlgorithm(
"jetalg_{0}".
format(modseq.getName()))
636 constitmodalg.Tools = [modseq]
◆ getConstitModAlg_nojetdef()
def python.JetRecConfig.getConstitModAlg_nojetdef |
( |
|
constitSeq, |
|
|
|
flags, |
|
|
|
context = "default" , |
|
|
|
monTool = None |
|
) |
| |
Same as getConstitModAlg.
This is a convenient function to obtain a JetConstituentModSequence when it is certain, no JetDef is needed.
This function just builds a dummy JetDefinition then calls getConstitModAlg
Needed in the trigger config.
Definition at line 640 of file JetRecConfig.py.
641 """Same as getConstitModAlg.
642 This is a convenient function to obtain a JetConstituentModSequence when it is certain, no JetDef is needed.
643 This function just builds a dummy JetDefinition then calls getConstitModAlg
644 Needed in the trigger config.
646 jetdef =
solveDependencies( JetDefinition(
'Kt', 0., constitSeq, context=context) , flags)
647 constitSeq = jetdef._prereqDic[
'input:'+constitSeq.name]
◆ getConstitPJGAlg()
def python.JetRecConfig.getConstitPJGAlg |
( |
|
constitdef, |
|
|
|
suffix = None , |
|
|
|
flags = None , |
|
|
|
parent_jetdef = None |
|
) |
| |
returns a configured PseudoJetAlgorithm which converts the inputs defined by constitdef into fastjet::PseudoJet
IMPORTANT : constitdef must have its dependencies solved (i.e. it must result from a solveDependencies() call)
the flags argument is TEMPORARY and will be removed once further dev on PseudoJetAlgorithm is done (see comment below)
Definition at line 350 of file JetRecConfig.py.
350 def getConstitPJGAlg(constitdef, suffix=None, flags=None, parent_jetdef = None):
351 """returns a configured PseudoJetAlgorithm which converts the inputs defined by constitdef into fastjet::PseudoJet
353 IMPORTANT : constitdef must have its dependencies solved (i.e. it must result from a solveDependencies() call)
355 the flags argument is TEMPORARY and will be removed once further dev on PseudoJetAlgorithm is done (see comment below)
357 _str_containername = constitdef.containername(parent_jetdef).
split(
':')[-1]
if callable(constitdef.containername)
else constitdef.containername
358 jetlog.debug(
"Getting PseudoJetAlg for label {0} from {1}".
format(constitdef.name,constitdef.inputname))
359 end =
'' if suffix
is None else f
'_{suffix}'
360 full_label = constitdef.label + end
361 pjgalg = CompFactory.PseudoJetAlgorithm(
362 "pjgalg_"+_str_containername+end,
363 InputContainer = _str_containername,
364 OutputContainer =
getPJContName(constitdef, suffix = suffix, parent_jetdef = parent_jetdef),
366 SkipNegativeEnergy=
True,
367 DoByVertex=constitdef.byVertex
374 if flags
is not None:
375 from AthenaConfiguration.Enums
import BeamType
376 pjgalg.UseChargedPV = (flags.Beam.Type == BeamType.Collisions)
379 pjgalg.UseChargedPV=
False
380 pjgalg.UseChargedPUsideband=
True
381 elif suffix ==
'Neut':
382 pjgalg.UseCharged=
False
◆ getGhostPJGAlg()
def python.JetRecConfig.getGhostPJGAlg |
( |
|
ghostdef, |
|
|
|
parentjetdef = None |
|
) |
| |
returns a configured PseudoJetAlgorithm which converts the inputs defined by constitdef into fastjet::PseudoJet
The difference for the above is this is dedicated to ghosts which need variations for the Label and the muon segment cases.
IMPORTANT : ghostdef must have its dependencies solved (i.e. it must result from a solveDependencies() call)
Definition at line 387 of file JetRecConfig.py.
388 """returns a configured PseudoJetAlgorithm which converts the inputs defined by constitdef into fastjet::PseudoJet
390 The difference for the above is this is dedicated to ghosts which need variations for the Label and the muon segment cases.
392 IMPORTANT : ghostdef must have its dependencies solved (i.e. it must result from a solveDependencies() call)
394 label =
"Ghost"+ghostdef.label
395 _container_name = ghostdef.containername(parentjetdef).
split(
":")[1]
if callable(ghostdef.containername)
else ghostdef.containername
396 _output_cont_name_suffix =
"" if parentjetdef.context ==
"default" or _container_name.endswith(parentjetdef.context)
else (
"_" + parentjetdef.context)
399 InputContainer = _container_name,
400 OutputContainer=
"PseudoJetGhost"+_container_name + _output_cont_name_suffix,
402 SkipNegativeEnergy=
True,
405 pjaclass = CompFactory.PseudoJetAlgorithm
406 if ghostdef.basetype==
"MuonSegment" or ghostdef.basetype==
"UnAssocMuonSegment":
408 pjaclass = CompFactory.MuonSegmentPseudoJetAlgorithm
409 kwargs.update( Pt =1e-20 )
410 kwargs.pop(
'SkipNegativeEnergy')
412 pjgalg = pjaclass(
"pjgalg_" + label +
"_" + parentjetdef.context, **kwargs )
◆ getInputAlgs()
def python.JetRecConfig.getInputAlgs |
( |
|
jetOrConstitdef, |
|
|
|
flags, |
|
|
|
context = "default" , |
|
|
|
monTool = None |
|
) |
| |
Returns the list of configured algs needed to build inputs to jet finding as defined by jetOrConstitdef
jetOrConstitdef can either be
* a JetDefinition : this happens when called from JetRecCfg or getJetDefAlgs then the jetdef._prereqDic/Order are used.
* a JetInputConstit : to allow scheduling the corresponding constituents algs independently of any jet alg.
context is only used if jetOrConstitdef is not a JetDefinition and must refer to a context in StandardJetContext.
The returned list may contain several algs, including constituent modifications algs, track selection, copying of
input truth particles and event density calculations
It may also contain ComponentAccumulator, only (?) in reco from RDO/RAW when we need to build externals such as clusters or tracks : in this case we call the main config functions from external packages)
Definition at line 279 of file JetRecConfig.py.
279 def getInputAlgs(jetOrConstitdef, flags, context="default", monTool=None):
280 """Returns the list of configured algs needed to build inputs to jet finding as defined by jetOrConstitdef
282 jetOrConstitdef can either be
283 * a JetDefinition : this happens when called from JetRecCfg or getJetDefAlgs then the jetdef._prereqDic/Order are used.
284 * a JetInputConstit : to allow scheduling the corresponding constituents algs independently of any jet alg.
286 context is only used if jetOrConstitdef is not a JetDefinition and must refer to a context in StandardJetContext.
288 The returned list may contain several algs, including constituent modifications algs, track selection, copying of
289 input truth particles and event density calculations
290 It may also contain ComponentAccumulator, only (?) in reco from RDO/RAW when we need to build externals such as clusters or tracks : in this case we call the main config functions from external packages)
294 from .JetDefinition
import JetInputConstit, JetDefinition
295 if isinstance(jetOrConstitdef, JetInputConstit):
297 jetlog.info(
"Setting up jet inputs from JetInputConstit : "+jetOrConstitdef.name)
298 jetdef =
solveDependencies( JetDefinition(
'Kt', 0., jetOrConstitdef, context=context), flags )
303 jetdef = jetOrConstitdef
305 jetlog.info(
"Inspecting input file contents")
309 filecontents = jetdef._cflags.Input.Collections
314 cname = c.containername
if isinstance(c, JetInputConstit)
else c.containername(jetdef,c.specs)
315 return cname
in filecontents
318 inputdeps = [ inputkey
for inputkey
in jetdef._prereqOrder
if inputkey.startswith(
'input:')
or inputkey.startswith(
'extinput:') ]
320 for inputfull
in inputdeps:
321 inputInstance = jetdef._prereqDic[inputfull]
322 if isInInput( inputInstance ):
323 jetlog.info(f
"Input container for {inputInstance} already in input file.")
327 if isinstance(inputInstance, JetInputConstit):
330 alg = inputInstance.algoBuilder( jetdef, inputInstance.specs )
◆ getJetAlgs()
def python.JetRecConfig.getJetAlgs |
( |
|
flags, |
|
|
|
jetdef, |
|
|
|
returnConfiguredDef = False , |
|
|
|
monTool = None |
|
) |
| |
Definition at line 216 of file JetRecConfig.py.
216 def getJetAlgs(flags, jetdef, returnConfiguredDef=False, monTool=None):
218 if isinstance(jetdef, JetDefinition):
220 elif isinstance(jetdef, GroomingDefinition):
221 func = getJetGroomAlgs
223 return func(flags, jetdef, returnConfiguredDef, monTool)
◆ getJetCopyAlg()
def python.JetRecConfig.getJetCopyAlg |
( |
|
jetsin, |
|
|
|
jetsoutdef, |
|
|
|
decorations = [] , |
|
|
|
shallowcopy = True , |
|
|
|
shallowIO = True , |
|
|
|
monTool = None |
|
) |
| |
Get a JetRecAlg set up to copy a jet collection and apply mods
In this setup we do not resolve dependencies because typically
these may be set up already in the original jet collection
In future we may wish to add a toggle.
The decoration list can be set in order for the decorations
(jet moments) on the original jets to be propagated to the
copy collection. Beware of circular dependencies!
Definition at line 504 of file JetRecConfig.py.
504 def getJetCopyAlg(jetsin, jetsoutdef, decorations=[], shallowcopy=True, shallowIO=True, monTool=None):
506 Get a JetRecAlg set up to copy a jet collection and apply mods
507 In this setup we do not resolve dependencies because typically
508 these may be set up already in the original jet collection
509 In future we may wish to add a toggle.
511 The decoration list can be set in order for the decorations
512 (jet moments) on the original jets to be propagated to the
513 copy collection. Beware of circular dependencies!
515 jcopy = CompFactory.JetCopier(
518 DecorDeps=decorations,
519 ShallowCopy=shallowcopy,
524 for mod
in jetsoutdef.modifiers:
526 mods.append(
getModifier(jetsoutdef,moddef,moddef.modspec))
528 jetsoutname = jetsoutdef.fullname()
529 jra = CompFactory.JetRecAlg(
530 "jetrecalg_copy_"+jetsoutname,
533 OutputContainer = jetsoutname)
535 jra.MonTool = monTool
◆ getJetDefAlgs()
def python.JetRecConfig.getJetDefAlgs |
( |
|
flags, |
|
|
|
jetdef, |
|
|
|
returnConfiguredDef = False , |
|
|
|
monTool = None |
|
) |
| |
Mid level functions returning list of algs out of JetDefinition.
Create the algorithms necessary to build the jet collection defined by jetdef.
This internally finds all the dependencies declared into jetdef (through input, ghosts & modifiers)
and returns a list of all necessary algs.
if returnConfiguredDef==True, also returns the fully configured clone of jetdef containing solved dependencies (debugging)
monTool is to allow the trigger config to pass a monitoring tool.
returns a list containing either algs or ComponentAccumulator
(ComponentAccumulator occurs only (?) in reco from RDO/RAW when we need to build externals such as clusters or tracks : in this case we call the main config functions from external packages)
Definition at line 122 of file JetRecConfig.py.
122 def getJetDefAlgs(flags, jetdef , returnConfiguredDef=False, monTool=None):
123 """ Create the algorithms necessary to build the jet collection defined by jetdef.
125 This internally finds all the dependencies declared into jetdef (through input, ghosts & modifiers)
126 and returns a list of all necessary algs.
128 if returnConfiguredDef==True, also returns the fully configured clone of jetdef containing solved dependencies (debugging)
130 monTool is to allow the trigger config to pass a monitoring tool.
132 returns a list containing either algs or ComponentAccumulator
133 (ComponentAccumulator occurs only (?) in reco from RDO/RAW when we need to build externals such as clusters or tracks : in this case we call the main config functions from external packages)
147 if returnConfiguredDef:
164 jetlog.info(
"Scheduled JetAlgorithm instance \"jetalg_{0}\"".
format(jetdef_i.fullname()))
166 if returnConfiguredDef:
167 return algs, jetdef_i
◆ getJetGroomAlgs()
def python.JetRecConfig.getJetGroomAlgs |
( |
|
flags, |
|
|
|
groomdef, |
|
|
|
returnConfiguredDef = False , |
|
|
|
monTool = None |
|
) |
| |
Instantiate and schedule all the algorithms needed to run the grooming alg 'groomdef' and
add them in the ComponentAccumulator 'components'
This function is meant to be called from the top-level JetRecConfig.JetRecCfg
(groomdef is expected to be non locked and will be modified).
monTool is to allow the trigger config to pass a monitoring tool.
Definition at line 170 of file JetRecConfig.py.
170 def getJetGroomAlgs(flags, groomdef, returnConfiguredDef=False, monTool=None):
171 """Instantiate and schedule all the algorithms needed to run the grooming alg 'groomdef' and
172 add them in the ComponentAccumulator 'components'
174 This function is meant to be called from the top-level JetRecConfig.JetRecCfg
175 (groomdef is expected to be non locked and will be modified).
177 monTool is to allow the trigger config to pass a monitoring tool.
186 for prereq
in groomdef_i._prereqOrder:
188 if len(prereq.split(
':')) > 2:
190 reqType, reqKey = prereq.split(
':')
192 groomdef_i.ungroomeddef.ghostdefs.append(reqKey)
193 elif reqType.endswith(
'input') :
194 groomdef_i.ungroomeddef.extrainputs.append(reqKey)
196 jetlog.info(
"Scheduling parent alg {} for {} ".
format(groomdef.ungroomeddef.fullname(), groomdef.fullname()))
201 algs, ungroomeddef_i =
getJetDefAlgs(flags, groomdef_i.ungroomeddef ,
True)
202 groomdef_i._ungroomeddef = ungroomeddef_i
210 jetlog.info(
"Scheduled JetAlgorithm instance \"jetalg_{0}\"".
format(groomdef_i.fullname()))
212 if returnConfiguredDef:
return algs, groomdef_i
◆ getJetModifierTools()
def python.JetRecConfig.getJetModifierTools |
( |
|
jetdef | ) |
|
returns the list of configured JetModifier tools needed by this jetdef.
This is done by instantiating the actual C++ tool as ordered in jetdef._prereqOrder
Definition at line 651 of file JetRecConfig.py.
652 """returns the list of configured JetModifier tools needed by this jetdef.
653 This is done by instantiating the actual C++ tool as ordered in jetdef._prereqOrder
655 modlist = [ key
for key
in jetdef._prereqOrder
if key.startswith(
'mod:')]
658 for modkey
in modlist:
659 moddef = jetdef._prereqDic[modkey]
661 modspec =
'' if ':' not in modkey
else modkey.split(
':',1)[1]
◆ getJetRecAlg()
def python.JetRecConfig.getJetRecAlg |
( |
|
jetdef, |
|
|
|
monTool = None , |
|
|
|
ftf_suffix = '' , |
|
|
|
extraOutputs = [] |
|
) |
| |
Returns the configured JetRecAlg instance corresponding to jetdef
IMPORTANT : jetdef must have its dependencies solved (i.e. it must result from solveDependencies() )
Definition at line 416 of file JetRecConfig.py.
416 def getJetRecAlg( jetdef, monTool = None, ftf_suffix = '', extraOutputs = []):
417 """Returns the configured JetRecAlg instance corresponding to jetdef
419 IMPORTANT : jetdef must have its dependencies solved (i.e. it must result from solveDependencies() )
421 pjContNames = jetdef._internalAtt[
'finalPJContainer']
424 "JetAlgorithm": jetdef.algorithm,
425 "JetRadius": jetdef.radius,
426 "PtMin": jetdef.ptmin,
427 "InputPseudoJets": pjContNames,
428 "GhostArea": jetdef.ghostarea,
429 "JetInputType":
int(jetdef.inputdef.jetinputtype),
431 "VariableRMinRadius": jetdef.VRMinRadius,
432 "VariableRMassScale": jetdef.VRMassScale
435 jetname = jetdef.fullname()
437 jclust = CompFactory.JetClustererByVertex(
442 jclust = CompFactory.JetClusterer(
449 jra = CompFactory.JetRecAlg(
450 "jetrecalg_"+jetname+ftf_suffix,
453 OutputContainer = jetname+ftf_suffix,
457 jra.MonTool = monTool
460 jra.ExtraOutputs = extraOutputs + [
461 (
'xAOD::JetContainer',f
'{jetname}.Ghost{ghost}')
for ghost
in jetdef.ghostdefs
◆ getJetRecGroomAlg()
def python.JetRecConfig.getJetRecGroomAlg |
( |
|
groomdef, |
|
|
|
monTool = None , |
|
|
|
extraOutputs = [] |
|
) |
| |
Returns a configured JetRecAlg set-up to perform the grooming defined by 'groomdef'
('monTool' is a temporary placeholder, it is expected to be used in the trigger in the future)
Definition at line 466 of file JetRecConfig.py.
467 """Returns a configured JetRecAlg set-up to perform the grooming defined by 'groomdef'
468 ('monTool' is a temporary placeholder, it is expected to be used in the trigger in the future)
470 jetlog.debug(
"Configuring grooming alg \"jetalg_{0}\"".
format(groomdef.fullname()))
474 groomClass = CompFactory.getComp(groomdef.tooltype)
475 groomer = groomClass(groomdef.groomalg,
476 UngroomedJets = groomdef.ungroomeddef.fullname(),
477 ParentPseudoJets = groomdef.ungroomeddef._internalAtt[
'finalPJContainer'],
478 **groomdef.properties)
484 jetname = groomdef.fullname()
485 jra = CompFactory.JetRecAlg(
486 "jetrecalg_"+jetname,
489 ParentDecor =
"Parent",
490 OutputContainer = jetname)
493 jra.MonTool = monTool
496 jra.ExtraOutputs = extraOutputs + [
497 (
'xAOD::JetContainer',f
'{jetname}.Ghost{ghost}')
for ghost
in groomdef.ungroomeddef.ghostdefs
◆ getModifier()
def python.JetRecConfig.getModifier |
( |
|
jetdef, |
|
|
|
moddef, |
|
|
|
modspec, |
|
|
|
flags = None |
|
) |
| |
Translate JetModifier into a concrete tool
Definition at line 668 of file JetRecConfig.py.
668 def getModifier(jetdef, moddef, modspec, flags=None):
669 """Translate JetModifier into a concrete tool"""
670 jetlog.verbose(
"Retrieving modifier {0}".
format(
str(moddef)))
672 if flags
is not None:
674 jetdef = jetdef.clone()
675 jetdef._cflags = flags
676 jetdef._contextDic = flags.Jet.Context[jetdef.context]
680 modtool = moddef.createfn(jetdef, modspec)
681 except Exception
as e:
682 jetlog.error( f
"Unhandled modifier specification {modspec} for mod {moddef} acting on jet def {jetdef.basename}!")
683 jetlog.error( f
"Received exception \"{e}\"" )
684 jetlog.error( f
"Helper function is \"{moddef.createfn}\"" )
685 raise ValueError( f
"JetModConfig unable to handle mod {moddef} with spec \"{modspec}\"")
690 for k,v
in moddef.properties.items():
693 v =
v(jetdef, modspec)
694 setattr(modtool, k, v)
◆ getPJContName()
def python.JetRecConfig.getPJContName |
( |
|
jetOrConstitdef, |
|
|
|
suffix = None , |
|
|
|
parent_jetdef = None |
|
) |
| |
Construct the name of the PseudoJetContainer defined by the given JetDef or JetInputConstit.
This name has to be constructed from various places, so we factorize the definition here.
Definition at line 341 of file JetRecConfig.py.
341 def getPJContName( jetOrConstitdef, suffix=None, parent_jetdef = None):
342 """Construct the name of the PseudoJetContainer defined by the given JetDef or JetInputConstit.
343 This name has to be constructed from various places, so we factorize the definition here.
345 cdef = jetOrConstitdef
if isinstance(jetOrConstitdef, JetInputConstit)
else jetOrConstitdef.inputdef
346 _str_containername = cdef.containername(parent_jetdef).
split(
':')[-1]
if callable(cdef.containername)
else cdef.containername
347 end =
'' if suffix
is None else f
'_{suffix}'
348 return f
'PseudoJet{_str_containername}{end}'
◆ getPseudoJetAlgs()
def python.JetRecConfig.getPseudoJetAlgs |
( |
|
jetdef | ) |
|
Mid level functions returning specific type of algs out of JetDefinition functions below assumines the JetDefinition has its dependencies solved by a call to solveDependencies()
Builds the list of configured PseudoJetAlgorithm needed for this jetdef.
THIS updates jetdef._internalAtt['finalPJContainer']
(this function is factorized out of PseudoJetCfg so it can be used standalone in the trigger config)
Definition at line 233 of file JetRecConfig.py.
234 """ Builds the list of configured PseudoJetAlgorithm needed for this jetdef.
235 THIS updates jetdef._internalAtt['finalPJContainer']
236 (this function is factorized out of PseudoJetCfg so it can be used standalone in the trigger config)
239 constitpjalg =
getConstitPJGAlg(jetdef.inputdef , suffix=
None , flags=jetdef._cflags, parent_jetdef = jetdef)
241 finalPJContainer =
str(constitpjalg.OutputContainer)
242 pjalglist = [constitpjalg]
245 ghostlist = [ key
for key
in jetdef._prereqOrder
if key.startswith(
'ghost:')]
248 pjContNames = [finalPJContainer]
249 for ghostkey
in sorted(ghostlist):
250 ghostdef = jetdef._prereqDic[ghostkey]
252 pjalglist.append(ghostpjalg)
253 pjContNames.append(
str(ghostpjalg.OutputContainer) )
257 finalPJContainer =
str(finalPJContainer)+
"_merged"+mergeId
258 mergerName =
"PJMerger_id"+mergeId
259 mergeAlg =CompFactory.PseudoJetMerger(
261 InputPJContainers = pjContNames,
262 OutputContainer = finalPJContainer,
264 pjalglist.append(mergeAlg)
267 jetdef._internalAtt[
'finalPJContainer'] = finalPJContainer
◆ isAnalysisRelease()
def python.JetRecConfig.isAnalysisRelease |
( |
| ) |
|
Definition at line 801 of file JetRecConfig.py.
802 from AthenaConfiguration.Enums
import Project
803 return Project.determine() in( Project.AnalysisBase, Project.AthAnalysis)
◆ isComponentPassingConditions()
def python.JetRecConfig.isComponentPassingConditions |
( |
|
component, |
|
|
|
flags, |
|
|
|
jetdef |
|
) |
| |
Test if component is compatible with flags.
This is done by calling component.filterfn AND testing all its prereqs.
Definition at line 784 of file JetRecConfig.py.
785 """Test if component is compatible with flags.
786 This is done by calling component.filterfn AND testing all its prereqs.
788 for req
in component.prereqs:
789 _str_req = req(jetdef)
if callable(req)
else req
790 if _str_req
not in jetdef._prereqDic:
791 return False,
"prereq "+_str_req+
" not available"
792 reqInstance = jetdef._prereqDic[_str_req]
795 return False,
"prereq "+
str(reqInstance)+
" failed because : "+reason
797 ok, reason = component.filterfn(flags)
◆ JetInputCfg()
def python.JetRecConfig.JetInputCfg |
( |
|
flags, |
|
|
|
jetOrConstitdef, |
|
|
|
context = "default" |
|
) |
| |
Returns a ComponentAccumulator containing algs needed to build inputs to jet finding as defined by jetOrConstitdef
jetOrConstitdef can either be
* a JetDefinition : this happens when called from JetRecCfg, then the jetdef._prereqDic/Order are used.
* a JetInputConstit : to allow scheduling the corresponding constituents algs independently of any jet alg.
context is only used if jetOrConstitdef is not a JetDefinition and must refer to a context in StandardJetContext
Definition at line 83 of file JetRecConfig.py.
83 def JetInputCfg(flags,jetOrConstitdef , context="default"):
84 """Returns a ComponentAccumulator containing algs needed to build inputs to jet finding as defined by jetOrConstitdef
86 jetOrConstitdef can either be
87 * a JetDefinition : this happens when called from JetRecCfg, then the jetdef._prereqDic/Order are used.
88 * a JetInputConstit : to allow scheduling the corresponding constituents algs independently of any jet alg.
90 context is only used if jetOrConstitdef is not a JetDefinition and must refer to a context in StandardJetContext
98 if isinstance(a, ComponentAccumulator):
101 components.addEventAlgo(a)
◆ JetRecCfg()
def python.JetRecConfig.JetRecCfg |
( |
|
flags, |
|
|
|
jetdef, |
|
|
|
returnConfiguredDef = False |
|
) |
| |
Top level functions returning ComponentAccumulator out of JetDefinition.
Top-level function for running jet finding or grooming.
This returns a ComponentAccumulator that can be merged with others
from elsewhere in the job and which provides everything needed to
reconstruct one jet collection.
arguments :
- jetdef : jet or grooming definition
- flags : the configuration flags instance, mainly for input file
peeking such that we don't attempt to reproduce stuff that's already
in the input file. And also to be able to invoke building of inputs outside of Jet domain during reco from RAW/RDO.
- returnConfiguredDef : is for debugging. It will also returns the cloned JetDefinition which contains the calculated dependencies.
Definition at line 36 of file JetRecConfig.py.
36 def JetRecCfg( flags, jetdef, returnConfiguredDef=False):
37 """Top-level function for running jet finding or grooming.
39 This returns a ComponentAccumulator that can be merged with others
40 from elsewhere in the job and which provides everything needed to
41 reconstruct one jet collection.
44 - jetdef : jet or grooming definition
45 - flags : the configuration flags instance, mainly for input file
46 peeking such that we don't attempt to reproduce stuff that's already
47 in the input file. And also to be able to invoke building of inputs outside of Jet domain during reco from RAW/RDO.
48 - returnConfiguredDef : is for debugging. It will also returns the cloned JetDefinition which contains the calculated dependencies.
52 sequenceName = jetdef.fullname()
53 jetlog.info(
"******************")
54 jetlog.info(
"Setting up to find {0}".
format(sequenceName))
57 from AthenaCommon.CFElements
import parOR
58 components.addSequence(
parOR(sequenceName) )
61 if isinstance(jetdef, JetDefinition):
63 elif isinstance(jetdef, GroomingDefinition):
67 if flags.Concurrency.NumThreads <= 0:
68 jetlog.info(
"Reordering algorithms in sequence {0}".
format(sequenceName))
74 if isinstance(a, ComponentAccumulator):
77 components.addEventAlgo( a , sequenceName = sequenceName )
79 if returnConfiguredDef:
return components, jetdef_i
◆ JetRecConfigTest()
def python.JetRecConfig.JetRecConfigTest |
( |
|
flags = None | ) |
|
Definition at line 884 of file JetRecConfig.py.
888 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
891 from AthenaConfiguration.TestDefaults
import defaultTestFiles, defaultConditionsTags
892 flags.Input.Files = defaultTestFiles.LATEST_AOD_MC
893 flags.IOVDb.GlobalTag = defaultConditionsTags.LATEST_MC
898 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
902 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
906 from JetRecConfig.StandardSmallRJets
import AntiKt4EMTopo
907 cfg.merge(
JetRecCfg(flags, AntiKt4EMTopo))
909 cfg.printConfig(withDetails=
False,summariseProps=
True)
◆ mergedPJId()
def python.JetRecConfig.mergedPJId |
( |
|
pjList | ) |
|
returns a simple unique ID for the list of PseudoJet container in pjList
Definition at line 272 of file JetRecConfig.py.
273 """returns a simple unique ID for the list of PseudoJet container in pjList"""
274 t = tuple(
str(n)
for n
in pjList)
275 currentSize = len(_mergedPJContainers)
276 return str(_mergedPJContainers.setdefault(t, currentSize))
◆ PseudoJetCfg()
def python.JetRecConfig.PseudoJetCfg |
( |
|
jetdef | ) |
|
Builds a ComponentAccumulator for creating PseudoJetContainer needed by jetdef.
THIS updates jetdef._internalAtt['finalPJContainer']
Definition at line 105 of file JetRecConfig.py.
106 """Builds a ComponentAccumulator for creating PseudoJetContainer needed by jetdef.
107 THIS updates jetdef._internalAtt['finalPJContainer']
111 for pjalg
in pjalglist:
112 components.addEventAlgo(pjalg)
◆ registerAsInputConstit()
def python.JetRecConfig.registerAsInputConstit |
( |
|
jetdef | ) |
|
Make the jet collection described by jetdef available as constituents to other jet finding
Technically : create JetInputExternal and JetInputConstit and register them in the relevant look-up dictionnaries.
the JetInputConstit will have a algoBuilder to generate the JetContainer described by jetdef
Definition at line 862 of file JetRecConfig.py.
863 """Make the jet collection described by jetdef available as constituents to other jet finding
865 Technically : create JetInputExternal and JetInputConstit and register them in the relevant look-up dictionnaries.
866 the JetInputConstit will have a algoBuilder to generate the JetContainer described by jetdef
868 from .StandardJetConstits
import stdConstitDic, stdInputExtDic
869 jetname = jetdef.fullname()
872 def jetBuilder(largejetdef,spec):
873 return JetRecCfg(largejetdef._cflags, jetdef)
875 stdInputExtDic[jetname] = JetInputExternal( jetname, jetname, algoBuilder=jetBuilder)
876 stdConstitDic[jetname] = JetInputConstit(jetname, xAODType.Jet, jetname )
◆ removeComponentFailingConditions()
def python.JetRecConfig.removeComponentFailingConditions |
( |
|
jetdef, |
|
|
|
flags = None , |
|
|
|
raiseOnFailure = True |
|
) |
| |
Filters the lists jetdef.modifiers and jetdef.ghosts (and jetdef._prereqOrder), so only the components
comptatible with flags are selected.
If flags==None : assume jetdef._cflags is properly set (this is done by higher-level functions)
The compatibility is ultimately tested using the component 'filterfn' attributes.
Internally calls the function isComponentPassingConditions() (see below)
Definition at line 701 of file JetRecConfig.py.
702 """Filters the lists jetdef.modifiers and jetdef.ghosts (and jetdef._prereqOrder), so only the components
703 comptatible with flags are selected.
704 If flags==None : assume jetdef._cflags is properly set (this is done by higher-level functions)
705 The compatibility is ultimately tested using the component 'filterfn' attributes.
706 Internally calls the function isComponentPassingConditions() (see below)
708 jetlog.info(
"Standard Reco mode : filtering components in "+
str(jetdef))
710 if jetdef._cflags
is None:
711 jetdef._cflags = flags
722 raise Exception(f
"JetDefinition {jetdef} can NOT be scheduled. Failure of input {jetdef.inputdef.name} reason={reason}" )
723 jetlog.info(f
"IMPORTANT : removing {jetdef} because input incompatible with job conditions. Reason={reason} ")
726 if isinstance( jetdef.inputdef, JetInputConstitSeq):
728 jetdef.inputdef.modifiers =
filterJetDefList(jetdef, jetdef.inputdef.modifiers,
'cmod', raiseOnFailure, jetdef._cflags)
733 jetdef.ghostdefs =
filterJetDefList(jetdef, jetdef.ghostdefs,
"ghost", raiseOnFailure, jetdef._cflags)
734 jetdef.modifiers =
filterJetDefList(jetdef, jetdef.modifiers,
"mod", raiseOnFailure, jetdef._cflags)
◆ removeFromList()
def python.JetRecConfig.removeFromList |
( |
|
l, |
|
|
|
o |
|
) |
| |
◆ removeGroomModifFailingConditions()
def python.JetRecConfig.removeGroomModifFailingConditions |
( |
|
groomdef, |
|
|
|
flags, |
|
|
|
raiseOnFailure = True |
|
) |
| |
◆ reOrderAlgs()
def python.JetRecConfig.reOrderAlgs |
( |
|
algs | ) |
|
In runIII the scheduler automatically orders algs, so the JetRecConfig helpers do not try to enforce the correct ordering.
This is not the case in runII config for which this jobO is intended --> This function makes sure some jet-related algs are well ordered.
Definition at line 806 of file JetRecConfig.py.
807 """In runIII the scheduler automatically orders algs, so the JetRecConfig helpers do not try to enforce the correct ordering.
808 This is not the case in runII config for which this jobO is intended --> This function makes sure some jet-related algs are well ordered.
810 def _flatten_CA(cfg, sequence_name="AthAlgSeq"):
811 from AthenaConfiguration.ComponentAccumulator
import ConfigurationError
812 if not isinstance(cfg, ComponentAccumulator):
813 raise ConfigurationError(
'It is not allowed to flatten with multiple top sequences')
815 if len(cfg._allSequences) != 1:
816 raise ConfigurationError(
'It is not allowed to flatten with multiple top sequences')
818 sequence = cfg.getSequence(sequence_name)
819 if sequence.Sequential:
820 raise ConfigurationError(
'It is not allowed to flatten sequential sequences')
823 for member
in sequence.Members:
824 if isinstance(member, CompFactory.AthSequencer):
825 members.extend(_flatten_CA(cfg, member.getName()))
827 members.append(member)
829 sequence.Members = members
835 if not isinstance(a, ComponentAccumulator) :
839 ca_algs =
list(a._algorithms.keys())
841 algs_tmp.append(a.popEventAlgo(algo))
845 evtDensityAlgs = [(i, alg)
for (i, alg)
in enumerate(algs)
if alg
and alg.getType() ==
'EventDensityAthAlg' ]
846 pjAlgs = [(i, alg)
for (i, alg)
in enumerate(algs)
if alg
and alg.getType() ==
'PseudoJetAlgorithm' ]
848 for i, edalg
in evtDensityAlgs:
849 edInput = edalg.EventDensityTool.InputContainer
850 for j, pjalg
in pjAlgs:
853 if edInput ==
str(pjalg.OutputContainer):
854 pairsToswap.append((i, j))
855 for i, j
in pairsToswap:
856 algs[i], algs[j] = algs[j], algs[i]
◆ __all__
list python.JetRecConfig.__all__ = ["JetRecCfg", "JetInputCfg"] |
|
private |
◆ _mergedPJContainers
python.JetRecConfig._mergedPJContainers = dict() |
|
private |
◆ jetlog
python.JetRecConfig.jetlog = Logging.logging.getLogger('JetRecConfig') |
std::vector< typename R::value_type > sorted(const R &r, PROJ proj={})
Helper function to create a sorted vector from an unsorted range.
def getInputAlgs(jetOrConstitdef, flags, context="default", monTool=None)
def getJetRecAlg(jetdef, monTool=None, ftf_suffix='', extraOutputs=[])
def getConstitModAlg(parentjetdef, constitSeq, monTool=None)
def getModifier(jetdef, moddef, modspec, flags=None)
def getJetAlgs(flags, jetdef, returnConfiguredDef=False, monTool=None)
def getJetGroomAlgs(flags, groomdef, returnConfiguredDef=False, monTool=None)
def filterJetDefList(jetdef, inList, compType, raiseOnFailure, flags)
def registerAsInputConstit(jetdef)
def removeComponentFailingConditions(jetdef, flags=None, raiseOnFailure=True)
def getConstitModAlg_nojetdef(constitSeq, flags, context="default", monTool=None)
def aliasToModDef(alias, parentjetdef)
def getJetModifierTools(jetdef)
def JetRecCfg(flags, jetdef, returnConfiguredDef=False)
Top level functions returning ComponentAccumulator out of JetDefinition.
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
def getGhostPJGAlg(ghostdef, parentjetdef=None)
def getJetDefAlgs(flags, jetdef, returnConfiguredDef=False, monTool=None)
Mid level functions returning list of algs out of JetDefinition.
def solveDependencies(jetdef0, flags)
std::string join(const std::vector< std::string > &v, const char c=',')
def getPJContName(jetOrConstitdef, suffix=None, parent_jetdef=None)
def getConstitPJGAlg(constitdef, suffix=None, flags=None, parent_jetdef=None)
def JetInputCfg(flags, jetOrConstitdef, context="default")
def removeGroomModifFailingConditions(groomdef, flags, raiseOnFailure=True)
def getJetCopyAlg(jetsin, jetsoutdef, decorations=[], shallowcopy=True, shallowIO=True, monTool=None)
def solveGroomingDependencies(groomdef0, flags)
def getPseudoJetAlgs(jetdef)
Mid level functions returning specific type of algs out of JetDefinition functions below assumines th...
def isComponentPassingConditions(component, flags, jetdef)
def JetRecConfigTest(flags=None)
def getJetRecGroomAlg(groomdef, monTool=None, extraOutputs=[])