3 from AthenaCommon.Logging
import logging
5 from AthenaMonitoringKernel.GenericMonitoringTool
import GenericMonitoringTool
6 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
7 from AthenaConfiguration.ComponentFactory
import CompFactory
13 return [val]*( len( tool.EtaBins ) - 1 )
21 theFastCaloHypo = CompFactory.TrigEgammaFastCaloHypoAlg(name)
22 theFastCaloHypo.CaloClusters = sequenceOut
23 theFastCaloHypo.PidNames = [
"tight",
"medium",
"loose",
"vloose"]
27 monTool.defineHistogram(
'TIME_exec', type=
'TH1F', path=
'EXPERT', title=
"Fast Calo Hypo Algtime; time [ us ] ; Nruns", xbins=80, xmin=0.0, xmax=8000.0)
28 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)
30 theFastCaloHypo.MonTool=monTool
31 return theFastCaloHypo
38 theFastCaloHypo = CompFactory.TrigEgammaFastCaloHypoAlg(name)
39 theFastCaloHypo.CaloClusters = sequenceOut
40 theFastCaloHypo.PidNames = [
"tight",
"medium",
"loose"]
44 monTool.defineHistogram(
'TIME_exec', type=
'TH1F', path=
'EXPERT', title=
"Fast Calo Hypo Algtime; time [ us ] ; Nruns", xbins=80, xmin=0.0, xmax=8000.0)
45 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)
47 theFastCaloHypo.MonTool=monTool
48 return theFastCaloHypo
53 if 'Electron' in name:
55 elif 'Photon' in name:
71 theFastCaloHypo = CompFactory.TrigEgammaFastCaloHypoAlg(name)
72 theFastCaloHypo.CaloClusters = sequenceOut
75 theFastCaloHypo.PidNames = []
76 theFastCaloHypo.RingerNNSelectorTools = []
80 HistPath =
'FastCaloL2EgammaHypo/'+name)
81 monTool.defineHistogram(
'TIME_exec', type=
'TH1F', path=
'EXPERT', title=
"Fast Calo Hypo Algtime; time [ us ] ; Nruns", xbins=80, xmin=0.0, xmax=8000.0)
82 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)
84 theFastCaloHypo.MonTool=monTool
85 return theFastCaloHypo
90 if 'tight' in pidname:
92 elif 'medium' in pidname:
95 elif 'vloose' in pidname:
105 __operation_points = [
'tight' ,
120 def __init__(self, flags, name, monGroups, cpart, tool=None):
122 self.
__log = logging.getLogger(
'TrigEgammaFastCaloHypoTool')
126 self.
__sel =
'ion' if 'ion' in cpart[
'extra']
else (cpart[
'addInfo'][0]
if cpart[
'addInfo']
else cpart[
'IDinfo'])
127 self.
__gsfinfo = cpart[
'gsfInfo']
if cpart[
'trigType']==
'e' and cpart[
'gsfInfo']
else ''
128 self.
__idperfinfo = cpart[
'idperfInfo']
if cpart[
'trigType']==
'e' and cpart[
'idperfInfo']
else ''
135 tool = CompFactory.TrigEgammaFastCaloHypoTool( name )
137 tool.AcceptAll =
False
138 tool.UseRinger =
False
139 tool.EtaBins = [0.0, 0.6, 0.8, 1.15, 1.37, 1.52, 1.81, 2.01, 2.37, 2.47]
141 tool.dETACLUSTERthr = 0.1
142 tool.dPHICLUSTERthr = 0.1
143 tool.F1thr =
same( 0.005 , tool)
144 tool.ET2thr =
same( 90.0*GeV, tool )
145 tool.HADET2thr =
same( 999.0 , tool)
146 tool.HADETthr =
same( 0.058 , tool)
147 tool.WETA2thr =
same( 99999. , tool)
148 tool.WSTOTthr =
same( 99999. , tool)
149 tool.F3thr =
same( 99999. , tool)
150 tool.CARCOREthr =
same( -9999. , tool)
151 tool.CAERATIOthr =
same( -9999. , tool)
194 self.
tool().AcceptAll =
True
195 self.
tool().UseRinger =
False
197 self.
tool().dETACLUSTERthr = 9999.
198 self.
tool().dPHICLUSTERthr = 9999.
207 self.
__log.
debug(
'Configure etcut or nopid' )
208 self.
tool().UseRinger =
False
210 self.
tool().dETACLUSTERthr = 9999.
211 self.
tool().dPHICLUSTERthr = 9999.
221 from TrigEgammaHypo.TrigEgammaFastCutDefs
import TrigFastCaloElectronCutMaps
222 self.
tool().UseRinger =
False
224 self.
tool().HADETthr = TrigFastCaloElectronCutMaps( self.
etthr() ).MapsHADETthr[self.
pidname()]
225 self.
tool().CARCOREthr = TrigFastCaloElectronCutMaps( self.
etthr() ).MapsCARCOREthr[self.
pidname()]
226 self.
tool().CAERATIOthr = TrigFastCaloElectronCutMaps( self.
etthr() ).MapsCAERATIOthr[self.
pidname()]
232 self.
tool().UseRinger =
True
235 self.
__log.fatal(
"Bad selection name: %s" % self.
pidname())
244 if self.
pidname()
in (
'etcut',
'ion',
'nopid'):
258 elif self.
etthr()==0:
261 if hasattr(self.
tool(),
"MonTool"):
263 doValidationMonitoring = flags.Trigger.doValidationMonitoring
266 if (any(
'egammaMon:online' in group
for group
in monGroups)
or doValidationMonitoring):
275 if self.
tool().UseRinger:
277 monTool.defineHistogram(
'Eta', type=
'TH1F', path=
'EXPERT',title=
"#eta of Clusters; #eta; number of RoIs", xbins=50,xmin=-2.5,xmax=2.5)
278 monTool.defineHistogram(
'Phi',type=
'TH1F', path=
'EXPERT',title=
"#phi of Clusters; #phi; number of RoIs", xbins=64,xmin=-3.2,xmax=3.2)
279 monTool.defineHistogram(
'Et',type=
'TH1F', path=
'EXPERT',title=
"E_{T} of Clusters; E_{T} [MeV]; number of RoIs", xbins=60,xmin=0,xmax=5e4)
280 monTool.defineHistogram(
'NNOutput',type=
'TH1F', path=
'EXPERT',title=
"NN Output; NN; Count", xbins=17,xmin=-8,xmax=+8)
282 monTool.HistPath=
'FastCaloL2EgammaHypo/'+self.
__name
283 self.
tool().MonTool=monTool
288 HistPath =
'FastCaloL2EgammaHypo/'+self.
__name)
289 monTool.defineHistogram(
'dEta', type=
'TH1F', path=
'EXPERT', title=
"L2Calo Hypo #Delta#eta_{L2 L1}; #Delta#eta_{L2 L1}",
290 xbins=80, xmin=-0.01, xmax=0.01)
291 monTool.defineHistogram(
'dPhi', type=
'TH1F', path=
'EXPERT', title=
"L2Calo Hypo #Delta#phi_{L2 L1}; #Delta#phi_{L2 L1}",
292 xbins=80, xmin=-0.01, xmax=0.01)
293 monTool.defineHistogram(
'Et_em', type=
'TH1F', path=
'EXPERT', title=
"L2Calo Hypo cluster E_{T}^{EM};E_{T}^{EM} [MeV]",
294 xbins=50, xmin=-2000, xmax=100000)
295 monTool.defineHistogram(
'Eta', type=
'TH1F', path=
'EXPERT', title=
"L2Calo Hypo entries per Eta;Eta", xbins=100, xmin=-2.5, xmax=2.5)
296 monTool.defineHistogram(
'Phi', type=
'TH1F', path=
'EXPERT', title=
"L2Calo Hypo entries per Phi;Phi", xbins=128, xmin=-3.2, xmax=3.2)
298 cuts=[
'Input',
'has one TrigEMCluster',
'#Delta #eta L2-L1',
'#Delta #phi L2-L1',
'eta',
'rCore',
299 'eRatio',
'E_{T}^{EM}',
'E_{T}^{Had}',
'f_{1}',
'Weta2',
'Wstot',
'F3']
301 monTool.defineHistogram(
'CutCounter', type=
'TH1I', path=
'EXPERT', title=
"L2Calo Hypo Passed Cuts;Cut",
302 xbins=13, xmin=-1.5, xmax=12.5, opt=
"kCumulative", xlabels=cuts)
304 if flags.Trigger.doValidationMonitoring:
305 monTool.defineHistogram(
'Et_had', type=
'TH1F', path=
'EXPERT', title=
"L2Calo Hypo E_{T}^{had} in first layer;E_{T}^{had} [MeV]",
306 xbins=50, xmin=-2000, xmax=100000)
307 monTool.defineHistogram(
'RCore', type=
'TH1F', path=
'EXPERT', title=
"L2Calo Hypo R_{core};E^{3x7}/E^{7x7} in sampling 2",
308 xbins=48, xmin=-0.1, xmax=1.1)
309 monTool.defineHistogram(
'Eratio', type=
'TH1F', path=
'EXPERT',
310 title=
"L2Calo Hypo E_{ratio};E^{max1}-E^{max2}/E^{max1}+E^{max2} in sampling 1 (excl.crack)",
311 xbins=64, xmin=-0.1, xmax=1.5)
312 monTool.defineHistogram(
'EtaBin', type=
'TH1I', path=
'EXPERT', title=
"L2Calo Hypo entries per Eta bin;Eta bin no.",
313 xbins=11, xmin=-0.5, xmax=10.5)
314 monTool.defineHistogram(
'F1', type=
'TH1F', path=
'EXPERT', title=
"L2Calo Hypo f_{1};f_{1}", xbins=34, xmin=-0.5, xmax=1.2)
315 monTool.defineHistogram(
'Weta2', type=
'TH1F', path=
'EXPERT', title=
"L2Calo Hypo Weta2; E Width in sampling 2",
316 xbins=96, xmin=-0.1, xmax=0.61)
317 monTool.defineHistogram(
'Wstot', type=
'TH1F', path=
'EXPERT', title=
"L2Calo Hypo Wstot; E Width in sampling 1",
318 xbins=48, xmin=-0.1, xmax=11.)
319 monTool.defineHistogram(
'F3', type=
'TH1F', path=
'EXPERT', title=
"L2Calo Hypo F3; E3/(E0+E1+E2+E3)",
320 xbins=96, xmin=-0.1, xmax=1.1)
323 self.
tool().MonTool = monTool
327 def _IncTool(flags, name, monGroups, cpart, tool=None):
329 config.compile(flags)
334 """ Use menu decoded chain dictionary to configure the tool """
335 cparts = [i
for i
in chainDict[
'chainParts']
if ((i[
'signature']==
'Electron')
or (i[
'signature']==
'Photon'))]
336 return _IncTool( flags, chainDict[
'chainName'], chainDict[
'monGroups'], cparts[0], tool=tool)
342 if not ConfigFilePath:
343 ConfigFilePath = flags.Trigger.egamma.ringerVersion
346 SelectorNames = collections.OrderedDict({
347 'tight' :
'AsgElectronFastCaloRingerTightSelectorTool',
348 'medium' :
'AsgElectronFastCaloRingerMediumSelectorTool',
349 'loose' :
'AsgElectronFastCaloRingerLooseSelectorTool',
350 'vloose' :
'AsgElectronFastCaloRingerVeryLooseSelectorTool',
354 ToolConfigFile = collections.OrderedDict({
355 'tight' :[
'ElectronRingerTightTriggerConfig.conf' ],
356 'medium' :[
'ElectronRingerMediumTriggerConfig.conf' ],
357 'loose' :[
'ElectronRingerLooseTriggerConfig.conf' ],
358 'vloose' :[
'ElectronRingerVeryLooseTriggerConfig.conf'],
363 for pidname , name
in SelectorNames.items():
364 SelectorTool=CompFactory.Ringer.AsgRingerSelectorTool(name)
365 SelectorTool.ConfigFiles = [ (ConfigFilePath+
'/'+path)
for path
in ToolConfigFile[pidname] ]
366 selectors.append(SelectorTool)
373 if not ConfigFilePath:
374 ConfigFilePath = flags.Trigger.egamma.photonRingerVersion
377 SelectorNames = collections.OrderedDict({
378 'tight' :
'AsgPhotonFastCaloRingerTightSelectorTool',
379 'medium' :
'AsgPhotonFastCaloRingerMediumSelectorTool',
380 'loose' :
'AsgPhotonFastCaloRingerLooseSelectorTool',
384 ToolConfigFile = collections.OrderedDict({
385 'tight' :[
'PhotonRingerTightTriggerConfig.conf' ],
386 'medium' :[
'PhotonRingerMediumTriggerConfig.conf' ],
387 'loose' :[
'PhotonRingerLooseTriggerConfig.conf' ],
392 for pidname , name
in SelectorNames.items():
393 SelectorTool=CompFactory.Ringer.AsgRingerSelectorTool(name)
394 SelectorTool.UseTansigOutput =
True
395 SelectorTool.ConfigFiles = [ (ConfigFilePath+
'/'+path)
for path
in ToolConfigFile[pidname] ]
396 selectors.append(SelectorTool)