3 from AthenaCommon.Logging
import logging
5 from AthenaMonitoringKernel.GenericMonitoringTool
import GenericMonitoringTool
6 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
7 from AthenaConfiguration.ComponentFactory
import CompFactory
11 return [val]*( len( tool.EtaBins ) - 1 )
19 theFastCaloHypo = CompFactory.TrigEgammaFastCaloHypoAlg(name)
20 theFastCaloHypo.CaloClusters = sequenceOut
21 theFastCaloHypo.PidNames = [
"tight",
"medium",
"loose",
"vloose"]
25 monTool.defineHistogram(
'TIME_exec', type=
'TH1F', path=
'EXPERT', title=
"Fast Calo Hypo Algtime; time [ us ] ; Nruns", xbins=80, xmin=0.0, xmax=8000.0)
26 monTool.defineHistogram(
'TIME_NN_exec', type=
'TH1F', path=
'EXPERT', title=
"Fast Calo Hypo NN Algtime; time [ us ] ; Nruns", xbins=50, xmin=0.0, xmax=50)
28 theFastCaloHypo.MonTool=monTool
29 return theFastCaloHypo
36 theFastCaloHypo = CompFactory.TrigEgammaFastCaloHypoAlg(name)
37 theFastCaloHypo.CaloClusters = sequenceOut
38 theFastCaloHypo.PidNames = [
"tight",
"medium",
"loose"]
42 monTool.defineHistogram(
'TIME_exec', type=
'TH1F', path=
'EXPERT', title=
"Fast Calo Hypo Algtime; time [ us ] ; Nruns", xbins=80, xmin=0.0, xmax=8000.0)
43 monTool.defineHistogram(
'TIME_NN_exec', type=
'TH1F', path=
'EXPERT', title=
"Fast Calo Hypo NN Algtime; time [ us ] ; Nruns", xbins=50, xmin=0.0, xmax=50)
45 theFastCaloHypo.MonTool=monTool
46 return theFastCaloHypo
51 if 'Electron' in name:
53 elif 'Photon' in name:
69 theFastCaloHypo = CompFactory.TrigEgammaFastCaloHypoAlg(name)
70 theFastCaloHypo.CaloClusters = sequenceOut
73 theFastCaloHypo.PidNames = []
74 theFastCaloHypo.RingerNNSelectorTools = []
78 HistPath =
'FastCaloL2EgammaHypo/'+name)
79 monTool.defineHistogram(
'TIME_exec', type=
'TH1F', path=
'EXPERT', title=
"Fast Calo Hypo Algtime; time [ us ] ; Nruns", xbins=80, xmin=0.0, xmax=8000.0)
80 monTool.defineHistogram(
'TIME_NN_exec', type=
'TH1F', path=
'EXPERT', title=
"Fast Calo Hypo NN Algtime; time [ us ] ; Nruns", xbins=20, xmin=0.0, xmax=1000.0)
82 theFastCaloHypo.MonTool=monTool
83 return theFastCaloHypo
88 if 'tight' in pidname:
90 elif 'medium' in pidname:
93 elif 'vloose' in pidname:
103 __operation_points = [
'tight' ,
118 def __init__(self, flags, name, monGroups, cpart, tool=None):
120 self.
__log = logging.getLogger(
'TrigEgammaFastCaloHypoTool')
124 self.
__sel =
'ion' if 'ion' in cpart[
'extra']
else (cpart[
'addInfo'][0]
if cpart[
'addInfo']
else cpart[
'IDinfo'])
125 self.
__gsfinfo = cpart[
'gsfInfo']
if cpart[
'trigType']==
'e' and cpart[
'gsfInfo']
else ''
126 self.
__idperfinfo = cpart[
'idperfInfo']
if cpart[
'trigType']==
'e' and cpart[
'idperfInfo']
else ''
133 tool = CompFactory.TrigEgammaFastCaloHypoTool( name )
135 tool.AcceptAll =
False
136 tool.UseRinger =
False
137 tool.EtaBins = [0.0, 0.6, 0.8, 1.15, 1.37, 1.52, 1.81, 2.01, 2.37, 2.47]
139 tool.dETACLUSTERthr = 0.1
140 tool.dPHICLUSTERthr = 0.1
141 tool.F1thr =
same( 0.005 , tool)
142 tool.ET2thr =
same( 90.0*GeV, tool )
143 tool.HADET2thr =
same( 999.0 , tool)
144 tool.HADETthr =
same( 0.058 , tool)
145 tool.WETA2thr =
same( 99999. , tool)
146 tool.WSTOTthr =
same( 99999. , tool)
147 tool.F3thr =
same( 99999. , tool)
148 tool.CARCOREthr =
same( -9999. , tool)
149 tool.CAERATIOthr =
same( -9999. , tool)
192 self.
tool().AcceptAll =
True
193 self.
tool().UseRinger =
False
195 self.
tool().dETACLUSTERthr = 9999.
196 self.
tool().dPHICLUSTERthr = 9999.
205 self.
__log.
debug(
'Configure etcut or nopid' )
206 self.
tool().UseRinger =
False
208 self.
tool().dETACLUSTERthr = 9999.
209 self.
tool().dPHICLUSTERthr = 9999.
219 from TrigEgammaHypo.TrigEgammaFastCutDefs
import TrigFastCaloElectronCutMaps
220 self.
tool().UseRinger =
False
222 self.
tool().HADETthr = TrigFastCaloElectronCutMaps( self.
etthr() ).MapsHADETthr[self.
pidname()]
223 self.
tool().CARCOREthr = TrigFastCaloElectronCutMaps( self.
etthr() ).MapsCARCOREthr[self.
pidname()]
224 self.
tool().CAERATIOthr = TrigFastCaloElectronCutMaps( self.
etthr() ).MapsCAERATIOthr[self.
pidname()]
230 self.
tool().UseRinger =
True
233 self.
__log.fatal(
"Bad selection name: %s" % self.
pidname())
242 if self.
pidname()
in (
'etcut',
'ion',
'nopid'):
256 elif self.
etthr()==0:
259 if hasattr(self.
tool(),
"MonTool"):
261 doValidationMonitoring = flags.Trigger.doValidationMonitoring
264 if (any(
'egammaMon:online' in group
for group
in monGroups)
or doValidationMonitoring):
273 if self.
tool().UseRinger:
275 monTool.defineHistogram(
'Eta', type=
'TH1F', path=
'EXPERT',title=
"#eta of Clusters; #eta; number of RoIs", xbins=50,xmin=-2.5,xmax=2.5)
276 monTool.defineHistogram(
'Phi',type=
'TH1F', path=
'EXPERT',title=
"#phi of Clusters; #phi; number of RoIs", xbins=64,xmin=-3.2,xmax=3.2)
277 monTool.defineHistogram(
'Et',type=
'TH1F', path=
'EXPERT',title=
"E_{T} of Clusters; E_{T} [MeV]; number of RoIs", xbins=60,xmin=0,xmax=5e4)
278 monTool.defineHistogram(
'NNOutput',type=
'TH1F', path=
'EXPERT',title=
"NN Output; NN; Count", xbins=17,xmin=-8,xmax=+8)
280 monTool.HistPath=
'FastCaloL2EgammaHypo/'+self.
__name
281 self.
tool().MonTool=monTool
286 HistPath =
'FastCaloL2EgammaHypo/'+self.
__name)
287 monTool.defineHistogram(
'dEta', type=
'TH1F', path=
'EXPERT', title=
"L2Calo Hypo #Delta#eta_{L2 L1}; #Delta#eta_{L2 L1}",
288 xbins=80, xmin=-0.01, xmax=0.01)
289 monTool.defineHistogram(
'dPhi', type=
'TH1F', path=
'EXPERT', title=
"L2Calo Hypo #Delta#phi_{L2 L1}; #Delta#phi_{L2 L1}",
290 xbins=80, xmin=-0.01, xmax=0.01)
291 monTool.defineHistogram(
'Et_em', type=
'TH1F', path=
'EXPERT', title=
"L2Calo Hypo cluster E_{T}^{EM};E_{T}^{EM} [MeV]",
292 xbins=50, xmin=-2000, xmax=100000)
293 monTool.defineHistogram(
'Eta', type=
'TH1F', path=
'EXPERT', title=
"L2Calo Hypo entries per Eta;Eta", xbins=100, xmin=-2.5, xmax=2.5)
294 monTool.defineHistogram(
'Phi', type=
'TH1F', path=
'EXPERT', title=
"L2Calo Hypo entries per Phi;Phi", xbins=128, xmin=-3.2, xmax=3.2)
296 cuts=[
'Input',
'has one TrigEMCluster',
'#Delta #eta L2-L1',
'#Delta #phi L2-L1',
'eta',
'rCore',
297 'eRatio',
'E_{T}^{EM}',
'E_{T}^{Had}',
'f_{1}',
'Weta2',
'Wstot',
'F3']
299 monTool.defineHistogram(
'CutCounter', type=
'TH1I', path=
'EXPERT', title=
"L2Calo Hypo Passed Cuts;Cut",
300 xbins=13, xmin=-1.5, xmax=12.5, opt=
"kCumulative", xlabels=cuts)
302 if flags.Trigger.doValidationMonitoring:
303 monTool.defineHistogram(
'Et_had', type=
'TH1F', path=
'EXPERT', title=
"L2Calo Hypo E_{T}^{had} in first layer;E_{T}^{had} [MeV]",
304 xbins=50, xmin=-2000, xmax=100000)
305 monTool.defineHistogram(
'RCore', type=
'TH1F', path=
'EXPERT', title=
"L2Calo Hypo R_{core};E^{3x7}/E^{7x7} in sampling 2",
306 xbins=48, xmin=-0.1, xmax=1.1)
307 monTool.defineHistogram(
'Eratio', type=
'TH1F', path=
'EXPERT',
308 title=
"L2Calo Hypo E_{ratio};E^{max1}-E^{max2}/E^{max1}+E^{max2} in sampling 1 (excl.crack)",
309 xbins=64, xmin=-0.1, xmax=1.5)
310 monTool.defineHistogram(
'EtaBin', type=
'TH1I', path=
'EXPERT', title=
"L2Calo Hypo entries per Eta bin;Eta bin no.",
311 xbins=11, xmin=-0.5, xmax=10.5)
312 monTool.defineHistogram(
'F1', type=
'TH1F', path=
'EXPERT', title=
"L2Calo Hypo f_{1};f_{1}", xbins=34, xmin=-0.5, xmax=1.2)
313 monTool.defineHistogram(
'Weta2', type=
'TH1F', path=
'EXPERT', title=
"L2Calo Hypo Weta2; E Width in sampling 2",
314 xbins=96, xmin=-0.1, xmax=0.61)
315 monTool.defineHistogram(
'Wstot', type=
'TH1F', path=
'EXPERT', title=
"L2Calo Hypo Wstot; E Width in sampling 1",
316 xbins=48, xmin=-0.1, xmax=11.)
317 monTool.defineHistogram(
'F3', type=
'TH1F', path=
'EXPERT', title=
"L2Calo Hypo F3; E3/(E0+E1+E2+E3)",
318 xbins=96, xmin=-0.1, xmax=1.1)
321 self.
tool().MonTool = monTool
325 def _IncTool(flags, name, monGroups, cpart, tool=None):
327 config.compile(flags)
332 """ Use menu decoded chain dictionary to configure the tool """
333 cparts = [i
for i
in chainDict[
'chainParts']
if ((i[
'signature']==
'Electron')
or (i[
'signature']==
'Photon'))]
334 return _IncTool( flags, chainDict[
'chainName'], chainDict[
'monGroups'], cparts[0], tool=tool)
340 if not ConfigFilePath:
341 ConfigFilePath = flags.Trigger.egamma.ringerVersion
345 'tight' :
'AsgElectronFastCaloRingerTightSelectorTool',
346 'medium' :
'AsgElectronFastCaloRingerMediumSelectorTool',
347 'loose' :
'AsgElectronFastCaloRingerLooseSelectorTool',
348 'vloose' :
'AsgElectronFastCaloRingerVeryLooseSelectorTool',
353 'tight' :[
'ElectronRingerTightTriggerConfig.conf' ],
354 'medium' :[
'ElectronRingerMediumTriggerConfig.conf' ],
355 'loose' :[
'ElectronRingerLooseTriggerConfig.conf' ],
356 'vloose' :[
'ElectronRingerVeryLooseTriggerConfig.conf'],
361 for pidname , name
in SelectorNames.items():
362 SelectorTool=CompFactory.Ringer.AsgRingerSelectorTool(name)
363 SelectorTool.ConfigFiles = [ (ConfigFilePath+
'/'+path)
for path
in ToolConfigFile[pidname] ]
364 selectors.append(SelectorTool)
371 if not ConfigFilePath:
372 ConfigFilePath = flags.Trigger.egamma.photonRingerVersion
376 'tight' :
'AsgPhotonFastCaloRingerTightSelectorTool',
377 'medium' :
'AsgPhotonFastCaloRingerMediumSelectorTool',
378 'loose' :
'AsgPhotonFastCaloRingerLooseSelectorTool',
383 'tight' :[
'PhotonRingerTightTriggerConfig.conf' ],
384 'medium' :[
'PhotonRingerMediumTriggerConfig.conf' ],
385 'loose' :[
'PhotonRingerLooseTriggerConfig.conf' ],
390 for pidname , name
in SelectorNames.items():
391 SelectorTool=CompFactory.Ringer.AsgRingerSelectorTool(name)
392 SelectorTool.UseTansigOutput =
True
393 SelectorTool.ConfigFiles = [ (ConfigFilePath+
'/'+path)
for path
in ToolConfigFile[pidname] ]
394 selectors.append(SelectorTool)