ATLAS Offline Software
Loading...
Searching...
No Matches
HIJetRecConfigCA Namespace Reference

Functions

 HIClusterMakerCfg (flags, save=False, **kwargs)
 HIClusterCopierCfg (flags, save=False, **kwargs)
 HICaloJetInputConstitSeq (flags, name="HICaloConstit", **kwargs)
 HICaloJetDef (flags, jetradius, **kwargs)
 HITrackJetInputConstit (flags, name="HITrack", **kwargs)
 HITrackJetDef (flags, jetradius, **kwargs)
 HIPseudoJetAlgCfg (flags, **kwargs)
 HIPseudoTrackJetAlgCfg (flags, name="TrackPseudoJets", **kwargs)
 HIJetClustererCfg (flags, name="builder", jetDef=None, **kwargs)
 HIJetAlgCfg (flags, jetDef, **kwargs)
 HIJetCopierCfg (flags, name="builder_copy", **kwargs)
 HIJetCopyAlgCfg (flags, jetDef_in, jetDef, **kwargs)
 updateStdJetModifier (flags, name, **kwargs)
 HIJetDefCloner (flags, jetDef_in, **kwargs)
 NullModulatorCfg ()
 HIModulatorCfg (flags, mod_key, suffix=None, **kwargs)
 HIJetClusterSubtractorCfg (flags, name="HIJetClusterSubtractor", **kwargs)
 HIJetCellSubtractorCfg (flags, name="HIJetCellSubtractor", **kwargs)
 HIJetSubtractorCfg (flags, useClusters, **kwargs)
 HIEventShapeJetIterationCfg (flags, suffix=None, useClusters=True, **kwargs)
 HITrackSelAlgCfg (flags, name="TrackSelAlgHI", **kwargs)
 HICaloClusterMomentsCfg (flags, name="HIClusterMoments", **kwargs)
 HISubtractionToCellsCfg (flags, name="HIClusterSubtraction", **kwargs)
 HISubtractionToClustersCfg (flags, name="HIClusterSubtraction", useClusters=True, **kwargs)
 HIJetRecCfg (flags)
 getHIJetRecAlg (jetdef, jetsName)

Variables

 __log = logging.getLogger('HIJetRecConfigCA')
 flags = initConfigFlags()
 Files
 AtlasVersion
 GlobalTag
 MaxEvents
 NumThreads
 strictMode
 python -m HIRecConfig.HIRecConfig HeavyIon.doGlobal="False" GeoModel.AtlasVersion="ATLAS-R3S-2021-03-01-00"
 acc = MainServicesCfg(flags)
 EMjet = AntiKt4EMTopo.clone()
 ghostdefs
 withDetails
 True
 summariseProps

Function Documentation

◆ getHIJetRecAlg()

HIJetRecConfigCA.getHIJetRecAlg ( jetdef,
jetsName )
Returns the configured HIJetRecAlg instance corresponding to jetdef

IMPORTANT : jetdef must have its dependencies solved (i.e. it must result from solveDependencies() )

Definition at line 755 of file HIJetRecConfigCA.py.

755def getHIJetRecAlg( jetdef, jetsName):
756 """Returns the configured HIJetRecAlg instance corresponding to jetdef
757
758 IMPORTANT : jetdef must have its dependencies solved (i.e. it must result from solveDependencies() )
759 """
760 pjContNames = jetdef._internalAtt['finalPJContainer']
761 jclust = CompFactory.JetClusterer(
762 "builder",
763 JetAlgorithm = jetdef.algorithm,
764 JetRadius = jetdef.radius,
765 PtMin = jetdef.ptmin,
766 InputPseudoJets = pjContNames,
767 GhostArea = 0.0,
768 JetInputType = int(jetdef.inputdef.jetinputtype),
769 RandomOption = 1,
770 )
771
772 mods = JetRecConfig.getJetModifierTools(jetdef)
773
774 jetname = jetsName
775 jra = CompFactory.JetRecAlg(
776 "jetrecalg_"+jetname,
777 Provider = jclust,
778 Modifiers = mods,
779 OutputContainer = jetname,
780 )
781 jra.ExtraOutputs = [('xAOD::JetContainer',f'{jetname}.Ghost{ghost}') for ghost in jetdef.ghostdefs]
782
783 return jra
784
785

◆ HICaloClusterMomentsCfg()

HIJetRecConfigCA.HICaloClusterMomentsCfg ( flags,
name = "HIClusterMoments",
** kwargs )
Provides tool for cluster moments.

Definition at line 465 of file HIJetRecConfigCA.py.

465def HICaloClusterMomentsCfg(flags, name="HIClusterMoments", **kwargs):
466 """Provides tool for cluster moments."""
467 acc = ComponentAccumulator()
468
469 kwargs.setdefault("MinBadLArQuality", 4000)
470 kwargs.setdefault("MomentsNames", ["CENTER_MAG",
471 "LONGITUDINAL",
472 "FIRST_ENG_DENS",
473 "SECOND_ENG_DENS",
474 "ENG_FRAC_EM",
475 "ENG_FRAC_MAX",
476 "ENG_FRAC_CORE",
477 "ENG_BAD_CELLS",
478 "N_BAD_CELLS",
479 "N_BAD_CELLS_CORR",
480 "BAD_CELLS_CORR_E",
481 "BADLARQ_FRAC",
482 "ENG_POS",
483 "SIGNIFICANCE",
484 "CELL_SIGNIFICANCE",
485 "CELL_SIG_SAMPLING",
486 "AVG_LAR_Q",
487 "AVG_TILE_Q",
488 "ENG_BAD_HV_CELLS",
489 "N_BAD_HV_CELLS"])
490
491 acc.setPrivateTools(CompFactory.CaloClusterMomentsMaker(name, **kwargs))
492 return acc
493
494

◆ HICaloJetDef()

HIJetRecConfigCA.HICaloJetDef ( flags,
jetradius,
** kwargs )
Returns jet definition for calo jets, with already resolved dependencies.

Definition at line 77 of file HIJetRecConfigCA.py.

77def HICaloJetDef(flags, jetradius, **kwargs):
78 """Returns jet definition for calo jets, with already resolved dependencies."""
79
80 ptmin_dict = {2:7000, 3:7000, 4:7000, 6:7000, 10:50000}
81 if jetradius not in ptmin_dict and "ptmin" not in kwargs:
82 __log.warning("jetradius "+str(jetradius)+" is not in the dictionary for ptmin; setting ptmin to 7000")
83 kwargs.setdefault("ptmin", ptmin_dict.get(jetradius, 7000))
84 kwargs.setdefault("radius", float(jetradius)/10.)
85 kwargs.setdefault("inputdef", HICaloJetInputConstitSeq(flags))
86 kwargs.setdefault("algorithm", "AntiKt")
87 kwargs.setdefault("prefix", "")
88 kwargs.setdefault("suffix", "")
89
90 return solveDependencies(JetDefinition(**kwargs), flags)
91
92

◆ HICaloJetInputConstitSeq()

HIJetRecConfigCA.HICaloJetInputConstitSeq ( flags,
name = "HICaloConstit",
** kwargs )

Definition at line 62 of file HIJetRecConfigCA.py.

62def HICaloJetInputConstitSeq(flags, name="HICaloConstit", **kwargs):
63 kwargs.setdefault("objtype", xAODType.CaloCluster)
64 kwargs.setdefault("modifiers", [])
65 kwargs.setdefault("inputname", flags.HeavyIon.Jet.Internal.ClusterKey)
66 kwargs.setdefault("outputname", flags.HeavyIon.Jet.Internal.ClusterKey)
67 kwargs.setdefault("label", "HI")
68
69 jetConstit = JetInputConstitSeq(name, **kwargs)
70
71 from JetRecConfig.StandardJetConstits import stdConstitDic
72 stdConstitDic.setdefault(name, jetConstit)
73
74 return jetConstit
75
76

◆ HIClusterCopierCfg()

HIJetRecConfigCA.HIClusterCopierCfg ( flags,
save = False,
** kwargs )
Function to copy HI clusters to modify them in derivations.

Definition at line 48 of file HIJetRecConfigCA.py.

48def HIClusterCopierCfg(flags, save=False, **kwargs):
49 """Function to copy HI clusters to modify them in derivations."""
50
51 acc = ComponentAccumulator()
52
53 kwargs.setdefault("InputContainerKey", "HIClusters")
54 kwargs.setdefault("OutputContainerKey", flags.HeavyIon.Jet.Internal.ClusterKey)
55
56 HIClusterCopier = CompFactory.HIClusterCopier("HIClusterCopier",
57 **kwargs)
58
59 acc.addEventAlgo(HIClusterCopier, primary=True)
60 return acc
61

◆ HIClusterMakerCfg()

HIJetRecConfigCA.HIClusterMakerCfg ( flags,
save = False,
** kwargs )
Function to equip HI cluster builder from towers and cells, adds to output AOD stream.

Definition at line 20 of file HIJetRecConfigCA.py.

20def HIClusterMakerCfg(flags, save=False, **kwargs):
21 """Function to equip HI cluster builder from towers and cells, adds to output AOD stream."""
22
23 acc = ComponentAccumulator()
24
25 kwargs.setdefault("CaloCellContainerKey", "AllCalo")
26 kwargs.setdefault("OutputContainerKey", flags.HeavyIon.Jet.Internal.ClusterKey)
27
28 # get towers
29 from CaloRec.CaloRecoConfig import CaloRecoCfg
30 acc.merge(CaloRecoCfg(flags))
31 from CaloRec.CaloTowerMakerConfig import CaloTowerMakerCfg
32 towerMaker = acc.getPrimaryAndMerge(CaloTowerMakerCfg(flags))
33 tower_key = towerMaker.TowerContainerName
34
35 HIClusterMaker = CompFactory.HIClusterMaker("HIClusterMaker",
36 InputTowerKey=tower_key,
37 **kwargs)
38
39 if save:
40 output = ["xAOD::CaloClusterContainer#"+kwargs["OutputContainerKey"],
41 "xAOD::CaloClusterAuxContainer#"+kwargs["OutputContainerKey"]+"Aux."]
42 acc.merge(addToESD(flags, output))
43 acc.merge(addToAOD(flags, output))
44
45 acc.addEventAlgo(HIClusterMaker, primary=True)
46 return acc
47

◆ HIEventShapeJetIterationCfg()

HIJetRecConfigCA.HIEventShapeJetIterationCfg ( flags,
suffix = None,
useClusters = True,
** kwargs )
Provides tool for event shape iteration.
   Also saves some tool, so they can be used later.

Definition at line 405 of file HIJetRecConfigCA.py.

405def HIEventShapeJetIterationCfg(flags, suffix=None, useClusters=True, **kwargs):
406 """Provides tool for event shape iteration.
407 Also saves some tool, so they can be used later."""
408 acc = ComponentAccumulator()
409
410 kwargs.setdefault("InputEventShapeKey", "HIEventShape_Weighted")
411 kwargs.setdefault("CaloJetSeedContainerKey", "")
412
413 out_shape_name = kwargs["InputEventShapeKey"]
414 if suffix is not None:
415 out_shape_name += '_'+suffix
416 mod_shape_key = out_shape_name+'_Modulate'
417
418 if 'Modulator' not in kwargs:
419 modulator = acc.popToolsAndMerge(HIModulatorCfg(
420 flags, mod_key=mod_shape_key, suffix=suffix))
421 kwargs.setdefault('Modulator', modulator)
422 if "Subtractor" not in kwargs:
423 sub_tool = acc.popToolsAndMerge(HIJetSubtractorCfg(flags, useClusters))
424 kwargs.setdefault("Subtractor", sub_tool)
425 if "EventShapeMapTool" not in kwargs:
426 map_tool = acc.popToolsAndMerge(HIEventShapeMapToolCfg(flags))
427 kwargs.setdefault("EventShapeMapTool", map_tool)
428 kwargs.setdefault("OutputEventShapeKey", out_shape_name)
429 kwargs.setdefault("AssociationKey", flags.HeavyIon.Jet.Internal.ClusterKey+"_DR8Assoc")
430 kwargs.setdefault("ModulationScheme", 1)
431 kwargs.setdefault("RemodulateUE", True)
432 kwargs.setdefault("ShallowCopy", False)
433 kwargs.setdefault("ModulationEventShapeKey", mod_shape_key)
434 kwargs.setdefault("TrackJetSeedContainerKey", "")
435
436 acc.setPrivateTools(CompFactory.HIEventShapeJetIteration(
437 "HIJetIteration_"+out_shape_name, **kwargs))
438
439 # save some tools for later
440 jm_dict = {"Modulator": kwargs["Modulator"],
441 "EventShapeMapTool": kwargs["EventShapeMapTool"],
442 "Subtractor": kwargs["Subtractor"],
443 "EventShapeKey": kwargs["OutputEventShapeKey"]}
444
445 return jm_dict, acc
446
447

◆ HIJetAlgCfg()

HIJetRecConfigCA.HIJetAlgCfg ( flags,
jetDef,
** kwargs )
Creates a jet reconstruction algorithm.

Definition at line 159 of file HIJetRecConfigCA.py.

159def HIJetAlgCfg(flags, jetDef, **kwargs):
160 """Creates a jet reconstruction algorithm."""
161 acc = ComponentAccumulator()
162
163 if "Provider" not in kwargs:
164 jclust = acc.popToolsAndMerge(HIJetClustererCfg(flags, jetDef=jetDef))
165 kwargs.setdefault("Provider", jclust)
166 if "Modifiers" not in kwargs:
167 kwargs.setdefault("Modifiers", JetRecConfig.getJetModifierTools(jetDef))
168 if "OutputContainer" not in kwargs:
169 kwargs.setdefault("OutputContainer", jetDef.fullname())
170 kwargs.setdefault("name", "JRA_build"+kwargs["OutputContainer"])
171
172 acc.addEventAlgo(CompFactory.JetRecAlg(**kwargs))
173 return acc
174
175

◆ HIJetCellSubtractorCfg()

HIJetRecConfigCA.HIJetCellSubtractorCfg ( flags,
name = "HIJetCellSubtractor",
** kwargs )
Provides tool for cell subtraction.

Definition at line 388 of file HIJetRecConfigCA.py.

388def HIJetCellSubtractorCfg(flags, name="HIJetCellSubtractor", **kwargs):
389 """Provides tool for cell subtraction."""
390 acc = ComponentAccumulator()
391
392 acc.setPrivateTools(CompFactory.HIJetCellSubtractorTool(name, **kwargs))
393 return acc
394
395

◆ HIJetClustererCfg()

HIJetRecConfigCA.HIJetClustererCfg ( flags,
name = "builder",
jetDef = None,
** kwargs )
Creates a tool for clustering.

Definition at line 144 of file HIJetRecConfigCA.py.

144def HIJetClustererCfg(flags, name="builder", jetDef=None, **kwargs):
145 """Creates a tool for clustering."""
146 acc = ComponentAccumulator()
147
148 if jetDef is not None:
149 kwargs.setdefault("JetAlgorithm", jetDef.algorithm)
150 kwargs.setdefault("JetRadius", jetDef.radius)
151 kwargs.setdefault("PtMin", jetDef.ptmin)
152 kwargs.setdefault("GhostArea", 0.01)
153 kwargs.setdefault("InputPseudoJets", "PseudoJet"+flags.HeavyIon.Jet.Internal.ClusterKey+"_GhostTracks")
154
155 acc.setPrivateTools(CompFactory.JetClusterer(name, **kwargs))
156 return acc
157
158

◆ HIJetClusterSubtractorCfg()

HIJetRecConfigCA.HIJetClusterSubtractorCfg ( flags,
name = "HIJetClusterSubtractor",
** kwargs )
Provides tool for cluster subtraction.

Definition at line 374 of file HIJetRecConfigCA.py.

374def HIJetClusterSubtractorCfg(flags, name="HIJetClusterSubtractor", **kwargs):
375 """Provides tool for cluster subtraction."""
376 acc = ComponentAccumulator()
377
378 kwargs.setdefault("ConfigDir", "HIJetCorrection/")
379 kwargs.setdefault("UseSamplings", False)
380 if "InputFile" not in kwargs:
381 from HIJetRec.HIJetRecUtilsCA import getHIClusterGeoWeightFile
382 kwargs.setdefault("InputFile", getHIClusterGeoWeightFile(flags))
383
384 acc.setPrivateTools(CompFactory.HIJetClusterSubtractorTool(name, **kwargs))
385 return acc
386
387

◆ HIJetCopierCfg()

HIJetRecConfigCA.HIJetCopierCfg ( flags,
name = "builder_copy",
** kwargs )
Creates a tool to copy jets.

Definition at line 176 of file HIJetRecConfigCA.py.

176def HIJetCopierCfg(flags, name="builder_copy", **kwargs):
177 """Creates a tool to copy jets."""
178 acc = ComponentAccumulator()
179
180 kwargs.setdefault("InputJets", "")
181 kwargs.setdefault("DecorDeps", [])
182 kwargs.setdefault("ShallowCopy", False)
183 kwargs.setdefault("ShallowIO", False)
184
185 acc.setPrivateTools(CompFactory.JetCopier(name, **kwargs))
186 return acc
187
188

◆ HIJetCopyAlgCfg()

HIJetRecConfigCA.HIJetCopyAlgCfg ( flags,
jetDef_in,
jetDef,
** kwargs )
Creates an algorithm to copy jets.

Definition at line 189 of file HIJetRecConfigCA.py.

189def HIJetCopyAlgCfg(flags, jetDef_in, jetDef, **kwargs):
190 """Creates an algorithm to copy jets."""
191 acc = ComponentAccumulator()
192
193 if "Provider" not in kwargs:
194 jcopy = acc.popToolsAndMerge(HIJetCopierCfg(flags, InputJets=jetDef_in.fullname()))
195 kwargs.setdefault("Provider", jcopy)
196 acc.merge(HIJetAlgCfg(flags, jetDef, **kwargs))
197 return acc
198
199

◆ HIJetDefCloner()

HIJetRecConfigCA.HIJetDefCloner ( flags,
jetDef_in,
** kwargs )
Clones jet definitions based on the template.
   Updates stdJetModifiers if necessary.
   Overwrites suffix and modifiers, and return jet definition with already resolved dependencies.

Definition at line 313 of file HIJetRecConfigCA.py.

313def HIJetDefCloner(flags, jetDef_in, **kwargs):
314 """Clones jet definitions based on the template.
315 Updates stdJetModifiers if necessary.
316 Overwrites suffix and modifiers, and return jet definition with already resolved dependencies."""
317
318 jetDef_new = jetDef_in.clone()
319
320 if "prefix" in kwargs:
321 jetDef_new.prefix = kwargs["prefix"]
322 if "suffix" in kwargs:
323 jetDef_new.suffix = kwargs["suffix"]
324 if "modifiers" in kwargs:
325 jetDef_new.modifiers = []
326 for modifier in kwargs["modifiers"]:
327 updateStdJetModifier(flags, modifier, jetDef=jetDef_new)
328 jetDef_new.modifiers.append(modifier)
329
330 return solveDependencies(jetDef_new,flags)
331
332

◆ HIJetRecCfg()

HIJetRecConfigCA.HIJetRecCfg ( flags)
Configures Heavy Ion Jet reconstruction.

Definition at line 530 of file HIJetRecConfigCA.py.

530def HIJetRecCfg(flags):
531 """Configures Heavy Ion Jet reconstruction."""
532 acc = ComponentAccumulator()
533
534 if not flags.HeavyIon.isDerivation:
535 # get HIClusters
536 acc.merge(HIClusterMakerCfg(flags))
537 else:
538 # copy HIClusters
539 acc.merge(HIClusterCopierCfg(flags))
540
541
542 # get weighted event shape
543 eventshapeKey = flags.HeavyIon.HIJetPrefix+"HIEventShapeWeighted"
544 acc.merge(HIEventShapeMakerCfg(flags,
545 name="HIEventShapeMaker_Weighted",
546 doWeighted=True,
547 InputTowerKey=flags.HeavyIon.Jet.Internal.ClusterKey,
548 OutputContainerKey=eventshapeKey))
549
550 # get jet definition
551 # R=0.2 calojets are use as seeds for UE subtraction
552 jetDef2 = HICaloJetDef(flags, jetradius=2, prefix=flags.HeavyIon.HIJetPrefix, suffix="_Unsubtracted")
553
554 # get jet definitions for physics
555 jetDef = []
556 jetRlist = flags.HeavyIon.Jet.RValues #Default [0.2,0.4], Others R's should be build in Derivations or pass in preExec
557 for jetR in jetRlist:
558 jetDef.append(HICaloJetDef(flags, jetradius=jetR, prefix=flags.HeavyIon.HIJetPrefix, suffix="_Unsubtracted"))
559 __log.info("HI Jet Collection for Reco: "+jetDef[-1].fullname())
560
561 # get calo pseudojets
562 acc.merge(HIPseudoJetAlgCfg(flags))
563
564 # HIJetTracks are used for GhostTracks association and later to build TrackJets seeds
565 pseudoTrkJetCont = "HIJetTracks"
566 pseudoGhostTrks = "PseudoJetGhostTracks"
567
568 acc.merge(HITrackSelAlgCfg(flags, OutputContainer=pseudoTrkJetCont))
569 acc.merge(HIPseudoTrackJetAlgCfg(
570 flags, name="GhostTrackPseudoJets", InputContainer=pseudoTrkJetCont, OutputContainer=pseudoGhostTrks, Label="GhostTrack"))
571
572
573
574 pjContNames = ["PseudoJet"+flags.HeavyIon.Jet.Internal.ClusterKey,pseudoGhostTrks]
575
576 mergeAlg = CompFactory.PseudoJetMerger(
577 "PJmerge_HIGhostTrack",
578 InputPJContainers = pjContNames,
579 OutputContainer = "PseudoJet"+flags.HeavyIon.Jet.Internal.ClusterKey+"_GhostTracks"
580 )
581 acc.addEventAlgo(mergeAlg)
582
583 # build jets
584 acc.merge(HIJetAlgCfg(flags, jetDef=jetDef2))
585 for jd in jetDef:
586 acc.merge(HIJetAlgCfg(flags, jetDef=jd))
587
588 # copy unsubtracted jets; create seed0
589 jetDef_seed0 = HIJetDefCloner(flags, jetDef_in=jetDef2,
590 prefix=flags.HeavyIon.HIJetPrefix,
591 suffix="_seed0",
592 modifiers=["HIJetAssoc", "HIJetMaxOverMean", "HIJetDiscrim", "Filter:5000"])
593 acc.merge(HIJetCopyAlgCfg(flags, jetDef2, jetDef_seed0))
594
595 # first iteration, iter0
596 jm_dict0, acc_iter0 = HIEventShapeJetIterationCfg(flags,
597 suffix="iter0",
598 InputEventShapeKey=eventshapeKey,
599 CaloJetSeedContainerKey=jetDef_seed0.fullname())
600 iter0 = acc.popToolsAndMerge(acc_iter0)
601 acc.addEventAlgo(CompFactory.JetAlgorithm("jetalgHI_iter0", Tools=[iter0]))
602
603 # jet modifier from the first iteration
604 updateStdJetModifier(flags, "subtr0", **jm_dict0)
605
606 # set jet energy scale configuration
607 calib_seq = "EtaJES"
608 if not flags.Input.isMC:
609 calib_seq += "_Insitu"
610
611 # copy jets from the first iteration; create seed1
612 jetDef_seed1 = HIJetDefCloner(flags, jetDef_in=jetDef2,
613 prefix=flags.HeavyIon.HIJetPrefix,
614 suffix="_seed1",
615 modifiers=["HIJetAssoc", "subtr0", "HIJetCalib:{}___{}___{}".format(2, calib_seq, not flags.Input.isMC), "Filter:{}".format(flags.HeavyIon.Jet.SeedPtMin)])
616 acc.merge(HIJetCopyAlgCfg(flags, jetDef2, jetDef_seed1))
617
618 # configuring track jets, seeds for second iteration
619 if flags.HeavyIon.Jet.doTrackJetSeed:
620 pseudoTrks = "PseudoTracks"
621
622 acc.merge(HIPseudoTrackJetAlgCfg(
623 flags, InputContainer=pseudoTrkJetCont, OutputContainer=pseudoTrks))
624
625 jetDef_trk = HITrackJetDef(flags,
626 jetradius=4,
627 modifiers=["HIJetAssoc", "Filter:{}".format(flags.HeavyIon.Jet.TrackJetPtMin),"Sort"])
628 trkJetSeedCont = jetDef_trk.fullname()
629
630 trkJetClust = acc.popToolsAndMerge(HIJetClustererCfg(flags,
631 jetDef=jetDef_trk,
632 InputPseudoJets=pseudoTrks))
633 acc.merge(HIJetAlgCfg(flags, jetDef_trk, Provider=trkJetClust))
634 else:
635 trkJetSeedCont = ""
636
637 # second iteration, iter1
638 jm_dict1, acc_iter1 = HIEventShapeJetIterationCfg(flags,
639 suffix="iter1",
640 InputEventShapeKey=eventshapeKey,
641 CaloJetSeedContainerKey=jetDef_seed1.fullname(),
642 TrackJetSeedContainerKey=trkJetSeedCont)
643 iter1 = acc.popToolsAndMerge(acc_iter1)
644 acc.addEventAlgo(CompFactory.JetAlgorithm("jetalgHI_iter1", Tools=[iter1]))
645
646 # event shape for egamma
647 jm_dict1_eg, acc_iter1_eg = HIEventShapeJetIterationCfg(flags,
648 suffix="iter_egamma",
649 useClusters=False,
650 InputEventShapeKey=flags.HeavyIon.Global.EventShape,
651 OutputEventShapeKey=flags.HeavyIon.Egamma.EventShape,
652 CaloJetSeedContainerKey=jetDef_seed1.fullname())
653 iter1_eg = acc.popToolsAndMerge(acc_iter1_eg)
654 acc.addEventAlgo(CompFactory.JetAlgorithm("jetalgHI_iter1_egamma", Tools=[iter1_eg]))
655
656 # constituents subtraction for egamma, cell-level
657 cluster_key_eGamma_deep = flags.HeavyIon.Jet.Internal.ClusterKey+"_eGamma_deep"
658 if not flags.HeavyIon.isDerivation:
659 subtrToCelltool = acc.popToolsAndMerge(
660 HISubtractionToCellsCfg(flags,
661 name="HIClusterSubtraction_egamma",
662 EventShapeKey=jm_dict1_eg["EventShapeKey"],
663 OutClusterKey=cluster_key_eGamma_deep,
664 Modulator=jm_dict1["Modulator"],
665 EventShapeMapTool=jm_dict1["EventShapeMapTool"],
666 SetMoments=True,
667 ApplyOriginCorrection=False)
668 )
669 acc.addEventAlgo(CompFactory.JetAlgorithm("jetalgHI_subtrToCellTool", Tools=[subtrToCelltool]))
670
671 # jet modifier from the second iteration
672 updateStdJetModifier(flags, "subtr1", **jm_dict1)
673
674 # constituents subtraction for jets, tower-level
675 clusterKey = cluster_key_eGamma_deep
676 if flags.HeavyIon.isDerivation:
677 clusterKey = flags.HeavyIon.Jet.Internal.ClusterKey
678 subtrToClusterTool = acc.popToolsAndMerge(
679 HISubtractionToClustersCfg(flags,
680 name="HIClusterSubtraction_final",
681 EventShapeKey=jm_dict1["EventShapeKey"],
682 ClusterKey=clusterKey,
683 OutClusterKey=flags.HeavyIon.Jet.ClusterKey,
684 Modulator=jm_dict1["Modulator"],
685 EventShapeMapTool=jm_dict1["EventShapeMapTool"],
686 ApplyOriginCorrection=False)
687 )
688 acc.addEventAlgo(CompFactory.JetAlgorithm(
689 "jetalgHI_subtrToClusterTool", Tools=[subtrToClusterTool]))
690
691 # jet modifier from the tower-level subtraction
692 updateStdJetModifier(flags, "consmod",
693 ClusterKey=flags.HeavyIon.Jet.ClusterKey,
694 Subtractor=jm_dict1["Subtractor"])
695
696 # store final version of HIClusters
697 if flags.HeavyIon.Jet.WriteHIClusters:
698 output_hicluster = ["xAOD::CaloClusterContainer#"+flags.HeavyIon.Jet.ClusterKey,
699 "xAOD::CaloClusterAuxContainer#"+flags.HeavyIon.Jet.ClusterKey+"Aux."]
700 acc.merge(addToESD(flags, output_hicluster))
701 acc.merge(addToAOD(flags, output_hicluster))
702
703 # configure final jets and store them
704 extramods = ["Sort","Width","CaloEnergies","LArHVCorr","CaloQuality","TrackMoments","JVF","JVT"]# adding modifiers to final jets
705 for jd in jetDef:
706 print("Printing flags: isDerivation: ", flags.HeavyIon.isDerivation, "doHIBTagging: ", flags.HeavyIon.doHIBTagging, "isMC: ", flags.Input.isMC, "jet radius: ", jd.radius)
707 if flags.HeavyIon.isDerivation and flags.HeavyIon.doHIBTagging and jd.radius==0.4:
708 extramods += flags.HeavyIon.FTagModifiers
709 if flags.Input.isMC:
710 extramods += flags.HeavyIon.FTagTruthModifiers
711 jetDef_final = HIJetDefCloner(flags,
712 jetDef_in=jd,
713 prefix=flags.HeavyIon.HIJetPrefix,
714 suffix="",
715 modifiers=["subtr1", "consmod", "HIJetCalib:{}___{}___{}".format(str(float(jd.radius)*10).replace('.0',''),calib_seq, not flags.Input.isMC), "Filter:{}".format(flags.HeavyIon.Jet.RecoOutputPtMin)]+extramods)
716 if flags.HeavyIon.isDerivation and flags.HeavyIon.doHIBTagging and flags.Input.isMC and jd.radius==0.4:
717 jetDef_final.ghostdefs += ["Truth","BHadronsInitial", "BHadronsFinal", "BQuarksFinal","CHadronsInitial", "CHadronsFinal", "CQuarksFinal","TausFinal", "TQuarksFinal","Partons"]
718 jetDef_final = solveDependencies(jetDef_final, flags)
719 pjaList = getPseudoJetAlgs(jetDef_final)
720 pjaList = pjaList[1:] # removing pseudoJets from HIClusters - already created
721 for pjalg in pjaList:
722 if pjalg.Label=='GhostTrack': #pseudo jet algorithm for ghost tracks crashing, reusing pj thost tracks from HI track jets
723 continue
724 pjalg.name="GhostTrackPseudoJets"
725 pjalg.InputContainer=pseudoTrkJetCont
726 pjalg.OutputContainer=pseudoGhostTrks
727 if pjalg.Label=='merged':
728 inpjcnt = pjalg.InputPJContainers
729 inpjcnt.remove('PseudoJetGhostJetSelectedTracks')
730 inpjcnt.append(pseudoGhostTrks)
731 pjalg.InputPJContainers = inpjcnt
732 acc.addEventAlgo(pjalg)
733 finalpjs = str(pjalg.OutputContainer)
734 # Set the name of the final PseudoJetContainer to be used as input :
735 jetDef_final._internalAtt['finalPJContainer'] = finalpjs
736 jetRecAlg = getHIJetRecAlg(jetDef_final, jetDef_final.fullname())
737 acc.addEventAlgo(jetRecAlg)
738 else:
739 acc.merge(HIJetCopyAlgCfg(flags, jd, jetDef_final))
740
741 output = ["xAOD::JetContainer#"+jetDef_final.fullname(),
742 "xAOD::JetAuxContainer#"+jetDef_final.fullname()+"Aux.-PseudoJet"]
743 acc.merge(addToESD(flags, output))
744 acc.merge(addToAOD(flags, output))
745
746 # store track jets
747 if flags.HeavyIon.Jet.doTrackJetSeed:
748 output = ["xAOD::JetContainer#"+jetDef_trk.fullname(),
749 "xAOD::JetAuxContainer#"+jetDef_trk.fullname()+"Aux.-PseudoJet"]
750 acc.merge(addToESD(flags, output))
751 acc.merge(addToAOD(flags, output))
752
753 return acc
754
void print(char *figname, TCanvas *c1)
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition hcg.cxx:310

◆ HIJetSubtractorCfg()

HIJetRecConfigCA.HIJetSubtractorCfg ( flags,
useClusters,
** kwargs )
Common function for clsuter and cell subtraction configuration.

Definition at line 396 of file HIJetRecConfigCA.py.

396def HIJetSubtractorCfg(flags, useClusters, **kwargs):
397 """Common function for clsuter and cell subtraction configuration."""
398
399 if useClusters:
400 return HIJetClusterSubtractorCfg(flags, **kwargs)
401 else:
402 return HIJetCellSubtractorCfg(flags, **kwargs)
403
404

◆ HIModulatorCfg()

HIJetRecConfigCA.HIModulatorCfg ( flags,
mod_key,
suffix = None,
** kwargs )
Provides modulator tool.

Definition at line 344 of file HIJetRecConfigCA.py.

344def HIModulatorCfg(flags, mod_key, suffix=None, **kwargs):
345 """Provides modulator tool."""
346
347 kwargs.setdefault("harmonics", flags.HeavyIon.Jet.HarmonicsForSubtraction)
348 if len(kwargs["harmonics"]) == 0:
349 return NullModulatorCfg()
350 acc = ComponentAccumulator()
351 kwargs.setdefault("name", "Modulator_"+mod_key+
352 "".join(["_V"+str(h) for h in kwargs["harmonics"]]))
353 if suffix is not None:
354 kwargs["name"] += '_'+suffix
355 kwargs.setdefault("DoV2", 2 in kwargs["harmonics"])
356 kwargs.setdefault("DoV3", 3 in kwargs["harmonics"])
357 kwargs.setdefault("DoV4", 4 in kwargs["harmonics"])
358 del kwargs["harmonics"]
359 kwargs.setdefault("EventShapeKey", mod_key)
360
361 acc.setPrivateTools(CompFactory.HIUEModulatorTool(**kwargs))
362
363 if 'label' in kwargs:
364 label = kwargs['label']
365 for key in kwargs:
366 if key not in ["name", "DoV2", "DoV3", "DoV4", "EventShapeKey"]:
367 del kwargs[key]
368
369 stdJetModifiers[label] = JetModifier("HIUEModulatorTool", **kwargs)
370
371 return acc
372
373

◆ HIPseudoJetAlgCfg()

HIJetRecConfigCA.HIPseudoJetAlgCfg ( flags,
** kwargs )
Creates a pseudo jet algorithm

Definition at line 116 of file HIJetRecConfigCA.py.

116def HIPseudoJetAlgCfg(flags, **kwargs):
117 """Creates a pseudo jet algorithm"""
118 acc = ComponentAccumulator()
119
120 kwargs.setdefault("name", "pjcs"+flags.HeavyIon.Jet.Internal.ClusterKey)
121 kwargs.setdefault("InputContainer", flags.HeavyIon.Jet.Internal.ClusterKey)
122 kwargs.setdefault("OutputContainer", "PseudoJet"+flags.HeavyIon.Jet.Internal.ClusterKey)
123 kwargs.setdefault("Label", "LCTopo")
124 kwargs.setdefault("SkipNegativeEnergy", False)
125 kwargs.setdefault("TreatNegativeEnergyAsGhost", True)
126
127 acc.addEventAlgo(CompFactory.PseudoJetAlgorithm(**kwargs))
128 return acc
129
130

◆ HIPseudoTrackJetAlgCfg()

HIJetRecConfigCA.HIPseudoTrackJetAlgCfg ( flags,
name = "TrackPseudoJets",
** kwargs )
Creates a pseudo track jet algorithm.

Definition at line 131 of file HIJetRecConfigCA.py.

131def HIPseudoTrackJetAlgCfg(flags, name="TrackPseudoJets", **kwargs):
132 """Creates a pseudo track jet algorithm."""
133 acc = ComponentAccumulator()
134
135 kwargs.setdefault("InputContainer", "HIJetTracks")
136 kwargs.setdefault("OutputContainer", "PseudoTracks")
137 kwargs.setdefault("Label", "Tracks")
138 kwargs.setdefault("SkipNegativeEnergy", True)
139
140 acc.addEventAlgo(CompFactory.PseudoJetAlgorithm(name, **kwargs))
141 return acc
142
143

◆ HISubtractionToCellsCfg()

HIJetRecConfigCA.HISubtractionToCellsCfg ( flags,
name = "HIClusterSubtraction",
** kwargs )
Provides tool for cell subtraction.
   Re-uses tool for cluster subtraction.

Definition at line 495 of file HIJetRecConfigCA.py.

495def HISubtractionToCellsCfg(flags, name="HIClusterSubtraction", **kwargs):
496 """Provides tool for cell subtraction.
497 Re-uses tool for cluster subtraction."""
498
499 return HISubtractionToClustersCfg(flags, name, useClusters=False, **kwargs)
500
501

◆ HISubtractionToClustersCfg()

HIJetRecConfigCA.HISubtractionToClustersCfg ( flags,
name = "HIClusterSubtraction",
useClusters = True,
** kwargs )
Provides tool for cluster subtraction.

Definition at line 502 of file HIJetRecConfigCA.py.

502def HISubtractionToClustersCfg(flags, name="HIClusterSubtraction", useClusters=True, **kwargs):
503 """Provides tool for cluster subtraction."""
504 acc = ComponentAccumulator()
505
506 kwargs.setdefault('EventShapeKey', 'EventShapeKey')
507 kwargs.setdefault('ClusterKey', flags.HeavyIon.Jet.Internal.ClusterKey)
508 kwargs.setdefault('OutClusterKey', 'ClusterKey_deep')
509 kwargs.setdefault('UpdateOnly', False)
510 kwargs.setdefault('ApplyOriginCorrection', True)
511 kwargs.setdefault('SetMoments', False)
512 if 'Modulator' not in kwargs:
513 modulator = acc.popToolsAndMerge(NullModulatorCfg())
514 kwargs.setdefault('Modulator', modulator)
515 if "EventShapeMapTool" not in kwargs:
516 map_tool = acc.popToolsAndMerge(HIEventShapeMapToolCfg(flags))
517 kwargs.setdefault("EventShapeMapTool", map_tool)
518 if "Subtractor" not in kwargs:
519 sub_tool = acc.popToolsAndMerge(HIJetSubtractorCfg(flags, useClusters))
520 kwargs.setdefault("Subtractor", sub_tool)
521 if kwargs["SetMoments"] and "ClusterCorrectionTools" not in kwargs:
522 clusterCorrectionTools = acc.popToolsAndMerge(
523 HICaloClusterMomentsCfg(flags, "HIClusterMoments"))
524 kwargs.setdefault("ClusterCorrectionTools", [clusterCorrectionTools])
525
526 acc.setPrivateTools(CompFactory.HIClusterSubtraction(name, **kwargs))
527 return acc
528
529

◆ HITrackJetDef()

HIJetRecConfigCA.HITrackJetDef ( flags,
jetradius,
** kwargs )
Returns jet definition for track jets, with already resolved dependencies.

Definition at line 101 of file HIJetRecConfigCA.py.

101def HITrackJetDef(flags, jetradius, **kwargs):
102 """Returns jet definition for track jets, with already resolved dependencies."""
103
104 import JetRecTools.JetRecToolsConfig as jrtcfg
105 JetInputExternal("JetSelectedTracks",
106 xAODType.TrackParticle,
107 # in std context, this is InDetTrackParticles (see StandardJetContext)
108 prereqs=["InDetTrackParticles"],
109 algoBuilder=lambda jdef, _: jrtcfg.getTrackSelAlg(jdef, trackSelOpt=False))
110 kwargs.setdefault("ptmin", 5000)
111 kwargs.setdefault("inputdef", HITrackJetInputConstit(flags))
112
113 return HICaloJetDef(flags, jetradius=jetradius, **kwargs)
114
115

◆ HITrackJetInputConstit()

HIJetRecConfigCA.HITrackJetInputConstit ( flags,
name = "HITrack",
** kwargs )

Definition at line 93 of file HIJetRecConfigCA.py.

93def HITrackJetInputConstit(flags, name="HITrack", **kwargs):
94 kwargs.setdefault("objtype", xAODType.TrackParticle)
95 kwargs.setdefault("containername", "JetSelectedTracks")
96
97 jetConstit = JetInputConstit(name, **kwargs)
98 return jetConstit
99
100

◆ HITrackSelAlgCfg()

HIJetRecConfigCA.HITrackSelAlgCfg ( flags,
name = "TrackSelAlgHI",
** kwargs )
Provides track selection algorithm for track jet reconstruction.

Definition at line 448 of file HIJetRecConfigCA.py.

448def HITrackSelAlgCfg(flags, name="TrackSelAlgHI", **kwargs):
449 """Provides track selection algorithm for track jet reconstruction."""
450 acc = ComponentAccumulator()
451
452 if "TrackSelector" not in kwargs:
453 from InDetTrackSelectionTool.InDetTrackSelectionToolConfig import (
454 HI_InDetTrackSelectionToolForHITrackJetsCfg)
455 tracksel = acc.popToolsAndMerge(HI_InDetTrackSelectionToolForHITrackJetsCfg(flags))
456 kwargs.setdefault("TrackSelector", tracksel)
457 kwargs.setdefault("InputContainer", "InDetTrackParticles")
458 kwargs.setdefault("OutputContainer", "HIJetTracks")
459 kwargs.setdefault("DecorDeps", [])
460
461 acc.addEventAlgo(CompFactory.JetTrackSelectionAlg(name, **kwargs))
462 return acc
463
464

◆ NullModulatorCfg()

HIJetRecConfigCA.NullModulatorCfg ( )
Provides modulator tool without any modulations.

Definition at line 333 of file HIJetRecConfigCA.py.

333def NullModulatorCfg():
334 """Provides modulator tool without any modulations."""
335 acc = ComponentAccumulator()
336 acc.setPrivateTools(CompFactory.HIUEModulatorTool('NullUEModulator',
337 EventShapeKey='',
338 DoV2=False,
339 DoV3=False,
340 DoV4=False))
341 return acc
342
343

◆ updateStdJetModifier()

HIJetRecConfigCA.updateStdJetModifier ( flags,
name,
** kwargs )
Updates the stdJetModifiers dictionary, based on the provided name. 
   Some of the modifiers expect certain kwargs. 
   Some of the modifiers ignore kwargs which makes the code simpler.

Definition at line 200 of file HIJetRecConfigCA.py.

200def updateStdJetModifier(flags, name, **kwargs):
201 """Updates the stdJetModifiers dictionary, based on the provided name.
202 Some of the modifiers expect certain kwargs.
203 Some of the modifiers ignore kwargs which makes the code simpler."""
204
205 if "Filter:" in name:
206 # already there, do nothing
207 return
208 if "JetDeltaRLabel:" in name:
209 # already there, do nothing
210 return
211 if "JetDeltaRInitialLabel:" in name:
212 # already there, do nothing
213 return
214 if "HIJetCalib:" in name:
215 # add generic "HIJetCalib" modifier
216 if "HIJetCalib" not in stdJetModifiers:
217 updateStdJetModifier(flags, "HIJetCalib", **kwargs)
218 return
219 if name in stdJetModifiers:
220 # already there, do nothing
221 return
222
223 if name == "HIJetAssoc":
224 stdJetModifiers.update(
225 HIJetAssoc=JetModifier("HIJetDRAssociationTool",
226 "HIJetDRAssociation",
227 ContainerKey=flags.HeavyIon.Jet.Internal.ClusterKey,
228 DeltaR=0.8,
229 AssociationName=flags.HeavyIon.Jet.Internal.ClusterKey+"_DR8Assoc"))
230 return
231
232 if name == "HIJetMaxOverMean":
233 if "jetDef" not in kwargs:
234 __log.warning(
235 "HIJetMaxOverMean needs 'jetDef' in its kwargs; HIJetMaxOverMean is not added to stdJetModifiers")
236 return
237 stdJetModifiers.update(
238 HIJetMaxOverMean=JetModifier("HIJetMaxOverMeanTool",
239 "HIJetMaxOverMean",
240 JetContainer=kwargs["jetDef"].fullname()))
241 return
242
243 if name == "HIJetDiscrim":
244 stdJetModifiers.update(
245 HIJetDiscrim=JetModifier("HIJetDiscriminatorTool",
246 "HIJetDiscriminator",
247 MaxOverMeanCut=4,
248 MinimumETMaxCut=3000))
249 return
250
251 if name == "subtr0":
252 if "Modulator" not in kwargs or "EventShapeMapTool" not in kwargs or \
253 "Subtractor" not in kwargs or "EventShapeKey" not in kwargs:
254 __log.warning(
255 "subtr0 needs 'Modulator', 'EventShapeMapTool', 'Subtractor', and 'EventShapeKey' in its kwargs; subtr0 is not added to stdJetModifiers")
256 return
257
258 stdJetModifiers.update(
259 subtr0=JetModifier("HIJetConstituentSubtractionTool",
260 "HICS_HIEventShapeWeighted_iter0",
261 MomentName="JetSubtractedScaleMomentum",
262 SetMomentOnly=False,
263 ApplyOriginCorrection=True,
264 **kwargs))
265 return
266
267 if name == "HIJetCalib":
268 stdJetModifiers.update(
269 HIJetCalib=JetModifier("JetCalibrationTool",
270 "HICalibTool_{modspec}",
271 JetCollection=lambda _, modspec: "AntiKt{}HI".format(modspec.split('___')[0]) if modspec.split('___')[0] in flags.HeavyIon.Jet.CaliRValues else "AntiKt4HI",
272 PrimaryVerticesContainerName="",
273 ConfigFile='JES_MC16_HI_Jan2021_5TeV.config', # JES_MC16_HI_Jan2021_5TeV.config JES_MC15c_HI_Nov2016.config
274 CalibSequence=lambda _, modspec: modspec.split('___')[1],
275 IsData=lambda _, modspec: modspec.split('___')[2] == 'True'))
276 return
277
278 if name == "subtr1":
279 if "Modulator" not in kwargs or "EventShapeMapTool" not in kwargs or \
280 "Subtractor" not in kwargs or "EventShapeKey" not in kwargs:
281 __log.warning(
282 "subtr1 needs 'Modulator', 'EventShapeMapTool', 'Subtractor', and 'EventShapeKey' in its kwargs; subtr1 is not added to stdJetModifiers")
283 return
284
285 stdJetModifiers.update(
286 subtr1=JetModifier("HIJetConstituentSubtractionTool",
287 "HICS_HIEventShapeWeighted_iter1",
288 MomentName="JetSubtractedScaleMomentum",
289 SetMomentOnly=False,
290 ApplyOriginCorrection=True,
291 **kwargs))
292 return
293
294 if name == "consmod":
295 if "ClusterKey" not in kwargs or "Subtractor" not in kwargs:
296 __log.warning(
297 "consmod needs 'ClusterKey' and 'Subtractor' in its kwargs; consmod is not added to stdJetModifiers")
298 return
299
300 stdJetModifiers.update(
301 consmod=JetModifier(
302 "HIJetConstituentModifierTool",
303 "HIJetConstituentModifierTool_final",
304 ApplyOriginCorrection=True,
305 **kwargs))
306 return
307
308 __log.warning("updateStdJetModifier does not know modifier "+
309 name+"; it is not added to stdJetModifiers")
310 return
311
312

Variable Documentation

◆ __log

HIJetRecConfigCA.__log = logging.getLogger('HIJetRecConfigCA')
private

Definition at line 17 of file HIJetRecConfigCA.py.

◆ acc

HIJetRecConfigCA.acc = MainServicesCfg(flags)

Definition at line 803 of file HIJetRecConfigCA.py.

◆ AtlasVersion

HIJetRecConfigCA.AtlasVersion

Definition at line 791 of file HIJetRecConfigCA.py.

◆ EMjet

HIJetRecConfigCA.EMjet = AntiKt4EMTopo.clone()

Definition at line 811 of file HIJetRecConfigCA.py.

◆ Files

HIJetRecConfigCA.Files

Definition at line 790 of file HIJetRecConfigCA.py.

◆ flags

HIJetRecConfigCA.flags = initConfigFlags()

Definition at line 789 of file HIJetRecConfigCA.py.

◆ ghostdefs

HIJetRecConfigCA.ghostdefs

Definition at line 812 of file HIJetRecConfigCA.py.

◆ GlobalTag

HIJetRecConfigCA.GlobalTag

Definition at line 792 of file HIJetRecConfigCA.py.

◆ MaxEvents

HIJetRecConfigCA.MaxEvents

Definition at line 793 of file HIJetRecConfigCA.py.

◆ NumThreads

HIJetRecConfigCA.NumThreads

Definition at line 794 of file HIJetRecConfigCA.py.

◆ strictMode

HIJetRecConfigCA.strictMode

python -m HIRecConfig.HIRecConfig HeavyIon.doGlobal="False" GeoModel.AtlasVersion="ATLAS-R3S-2021-03-01-00"

Definition at line 799 of file HIJetRecConfigCA.py.

◆ summariseProps

HIJetRecConfigCA.summariseProps

Definition at line 820 of file HIJetRecConfigCA.py.

◆ True

HIJetRecConfigCA.True

Definition at line 820 of file HIJetRecConfigCA.py.

◆ withDetails

HIJetRecConfigCA.withDetails

Definition at line 820 of file HIJetRecConfigCA.py.