ATLAS Offline Software
Loading...
Searching...
No Matches
PhotonVertexSelectionConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5
6
7def PhotonPointingToolCfg(flags, name="PhotonPointingTool", **kwargs):
8 acc = ComponentAccumulator()
9 kwargs.setdefault("isSimulation", flags.Input.isMC)
10 acc.setPrivateTools(CompFactory.CP.PhotonPointingTool(name, **kwargs))
11 return acc
12
13
15 flags, name="PhotonVertexSelectionTool", **kwargs):
16 acc = ComponentAccumulator()
17 acc.setPrivateTools(CompFactory.CP.PhotonVertexSelectionTool(**kwargs))
18 return acc
19
20
21def DecoratePhotonPointingAlgCfg(flags, name="DecoratePhotonPointingAlg", **kwargs):
22 acc = ComponentAccumulator()
23
24 kwargs.setdefault("PhotonContainerKey", "Photons")
25
26 if "PhotonPointingTool" not in kwargs:
27 toolAcc = PhotonPointingToolCfg(flags, ContainerName=kwargs['PhotonContainerKey'])
28 tool = toolAcc.popPrivateTools()
29 acc.merge(toolAcc)
30 kwargs["PhotonPointingTool"] = tool
31 if "PhotonVertexSelectionTool" not in kwargs:
32 from TrkConfig.VertexFindingFlags import VertexSortingSetup
33 pvContainer = "PrimaryVertices_initial" if flags.Tracking.PriVertex.sortingSetup is VertexSortingSetup.GNNSorting else "PrimaryVertices"
34 kwargs.setdefault("PhotonVertexSelectionTool", acc.popToolsAndMerge(PhotonVertexSelectionToolCfg(flags, VertexContainer=pvContainer)))
35
36 alg = CompFactory.DecoratePhotonPointingAlg("DecoratePhotonPointingAlg", **kwargs)
37 acc.addEventAlgo(alg)
38 return acc
39
40
41def BuildVertexPointingAlgCfg(flags, name="BuildVertexPointingAlg", **kwargs):
42 from AthenaCommon.SystemOfUnits import GeV
43
44 acc = ComponentAccumulator()
45 kwargs.setdefault(
46 "selectionTool",
47 CompFactory.CP.AsgPtEtaSelectionTool(
48 "CutPhotonPtEta",
49 minPt=20 * GeV,
50 maxEta=2.37,
51 etaGapLow=1.37,
52 etaGapHigh=1.52,
53 useClusterEta=True,
54 ),
55 )
56 kwargs.setdefault(
57 "goodPhotonSelectionTool",
58 CompFactory.CP.AsgFlagSelectionTool(
59 "GoodPhotonSelectionTool",
60 selectionFlags=[
61 "Tight"
62 ], # TODO: why not DFCommonPhotonsIsEMTight (not working)?
63 ),
64 )
65 kwargs.setdefault("nphotonsToUse", 2)
66 kwargs.setdefault("PhotonContainerKey", "Photons")
67 alg = CompFactory.BuildVertexPointingAlg("BuildVertexPointingAlg", **kwargs)
68 acc.addEventAlgo(alg)
69 return acc
70
DecoratePhotonPointingAlgCfg(flags, name="DecoratePhotonPointingAlg", **kwargs)
PhotonVertexSelectionToolCfg(flags, name="PhotonVertexSelectionTool", **kwargs)
PhotonPointingToolCfg(flags, name="PhotonPointingTool", **kwargs)
BuildVertexPointingAlgCfg(flags, name="BuildVertexPointingAlg", **kwargs)