ATLAS Offline Software
Loading...
Searching...
No Matches
TrigEgammaPrecisionPhotonCaloIsoHypoTool.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3from AthenaCommon.SystemOfUnits import GeV
4from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
5from AthenaConfiguration.ComponentFactory import CompFactory
6#
7# photon hypo alg
8#
9def createTrigEgammaPrecisionPhotonCaloIsoHypoAlg(name, sequenceOut, sequenceIn):
10
11 thePrecisionPhotonCaloIsoHypo = CompFactory.TrigEgammaPrecisionPhotonCaloIsoHypoAlg(name)
12 thePrecisionPhotonCaloIsoHypo.Photons = sequenceIn # Key of the input photon container
13 thePrecisionPhotonCaloIsoHypo.IsoPhotons = sequenceOut # key of the output isolated photon container
14 return thePrecisionPhotonCaloIsoHypo
15
16
17#
18# For photons
19#
21
22
23 # Below are the configuration of the calorimeter isolation selections
24 # The dictionary key is the working point (icaloloose, icalomedium and icalotight)
25 # The value is another dictionary specifying the corresponding cone sizes, pT shifts and isolation WPs.
26 #
27 # The isolation WPs have been updated for Run 4 as a result of ATR-31489.
28 # They correspond to efficiency of tight offline photons from H->yy with various isolation requirements.
29
30 __caloIsolationWPs = {
31 None : { 'cone_size' : None, 'offset' : None, 'wp' : None },
32 'icaloloose' : { 'cone_size' : 20, 'offset' : 0., 'wp' : 0.067 }, # 95% eff in offline photons with loose isolation
33 'icalomedium' : { 'cone_size' : 20, 'offset' : 0., 'wp' : 0.053 }, # 90% eff in offline photons with loose isolation
34 'icalotight' : { 'cone_size' : 40, 'offset' : 2.45*GeV, 'wp' : 0.063 }, # 95% eff in offline photons with tight isolation
35 }
36
37
38 def __init__(self, name, monGroups, cpart, tool=None):
39
40 from AthenaCommon.Logging import logging
41 self.__log = logging.getLogger('TrigEgammaPrecisionPhotonCaloIsoHypoTool')
42 self.__name = name
43 self.__isoinfo = cpart['isoInfo']
44 self.__monGroups = monGroups
45
46 if not tool:
47 tool = CompFactory.TrigEgammaPrecisionPhotonCaloIsoHypoTool( name )
48
49 tool.EtaBins = [0.0, 0.6, 0.8, 1.15, 1.37, 1.52, 1.81, 2.01, 2.37, 2.47]
50
51 self.__tool = tool
52 self.__log.debug( 'Chain :%s', self.__name )
53 self.__log.debug( 'isoinfo :%s', self.__isoinfo )
54
55
56 def isoInfo(self):
57 return self.__isoinfo
58
59 def tool(self):
60 return self.__tool
61
62 #
63 # Isolation and nominal cut
64 #
65 def isoCut(self):
66
67 if self.isoInfo() == 'noiso':
68 self.tool().AcceptAll = True
69 return
70 self.tool().RelTopoEtConeCut = self.__caloIsolationWPs[self.isoInfo()]['wp']
71 self.tool().Offset = self.__caloIsolationWPs[self.isoInfo()]['offset']
72 self.tool().TopoEtConeSize = self.__caloIsolationWPs[self.isoInfo()]['cone_size']
73
74
75
76 #
77 # Compile the chain
78 #
79 def compile(self, flags):
80
81 if self.isoInfo() != 'noiso':
82 if self.isoInfo() not in self.__caloIsolationWPs.keys():
83 self.__log.error('Isolation cut %s not defined!', self.isoInfo())
84
85 self.__log.debug('Configuring Isolation cut %s for topoetcone%d/et',
86 self.isoInfo(), self.__caloIsolationWPs[self.isoInfo()]['cone_size'])
87 self.__log.debug(' with values = %s and offsets = %s',
88 str(self.__caloIsolationWPs[self.isoInfo()]['wp']),
89 str(self.__caloIsolationWPs[self.isoInfo()]['offset']))
90 else:
91 self.__log.debug('Configuring Isolation to AcceptAll (not applying any cut)')
92 self.isoCut()
93
94
95 if hasattr(self.tool(), "MonTool"):
96
97 doValidationMonitoring = flags.Trigger.doValidationMonitoring # True to monitor all chains for validation purposes
98 monGroups = self.__monGroups
99
100 if (any('egammaMon:online' in group for group in monGroups) or doValidationMonitoring):
101 self.addMonitoring(flags)
102
103
104 #
105 # Monitoring code
106 #
107 def addMonitoring(self, flags):
108
109 monTool = GenericMonitoringTool(flags, "MonTool_"+self.__name,
110 HistPath = 'PrecisionPhotonCaloIsoHypo/'+self.__name)
111 monTool.defineHistogram('Et_em', type='TH1F', path='EXPERT', title="PrecisionPhotonCaloIso Hypo cluster E_{T}^{EM};E_{T}^{EM} [MeV]", xbins=50, xmin=-2000, xmax=100000)
112 monTool.defineHistogram('Eta', type='TH1F', path='EXPERT', title="PrecisionPhotonCaloIso Hypo entries per Eta;Eta", xbins=100, xmin=-2.5, xmax=2.5)
113 monTool.defineHistogram('Phi', type='TH1F', path='EXPERT', title="PrecisionPhotonCaloIso Hypo entries per Phi;Phi", xbins=128, xmin=-3.2, xmax=3.2)
114 monTool.defineHistogram('EtaBin', type='TH1I', path='EXPERT', title="PrecisionPhotonCaloIso Hypo entries per Eta bin;Eta bin no.", xbins=11, xmin=-0.5, xmax=10.5)
115
116 cuts=['Input','eta','Calo Iso']
117
118 monTool.defineHistogram('CutCounter', type='TH1I', path='EXPERT', title="PrecisionPhotonCaloIso Hypo Passed Cuts;Cut",
119 xbins=13, xmin=-1.5, xmax=12.5, opt="kCumulative", xlabels=cuts)
120
121 if flags.Trigger.doValidationMonitoring:
122 monTool.defineHistogram('etcone20',type='TH1F',path='EXPERT',title= "PrecisionPhotonCaloIso Hypo etcone20; etcone20;", xbins=50, xmin=0, xmax=5.0)
123 monTool.defineHistogram('topoetcone20',type='TH1F',path='EXPERT',title= "PrecisionPhotonCaloIso Hypo; topoetcone20;", xbins=50, xmin=-10, xmax=10)
124 monTool.defineHistogram('relEtCone20',type='TH1F',path='EXPERT',title= "PrecisionPhotonCaloIso Hypo etcone20/et; etcone20/et;", xbins=50, xmin=-0.5, xmax=0.5)
125 monTool.defineHistogram('reltopoetcone20',type='TH1F',path='EXPERT',title= "PrecisionPhotonCaloIso Hypo; topoetcone20/pt;", xbins=50, xmin=-0.5, xmax=0.5)
126
127 self.tool().MonTool = monTool
128
129
130
131def _IncTool( flags, name, monGroups, cpart, tool=None ):
132 config = TrigEgammaPrecisionPhotonCaloIsoHypoToolConfig(name, monGroups, cpart, tool=tool)
133 config.compile(flags)
134 return config.tool()
135
136
137
139 """ Use menu decoded chain dictionary to configure the tool """
140 cparts = [i for i in d['chainParts'] if ((i['signature']=='Electron') or (i['signature']=='Photon'))]
141 return _IncTool( flags, d['chainName'], d['monGroups'], cparts[0], tool=tool )
const bool debug