ATLAS Offline Software
TrigEgammaPrecisionCaloHypoTool.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
4 from AthenaCommon.SystemOfUnits import GeV
5 
6 def _IncTool(flags, name, monGroups, threshold, sel, tool=None):
7 
8 
9  if not tool:
10  from AthenaConfiguration.ComponentFactory import CompFactory
11  tool = CompFactory.TrigEgammaPrecisionCaloHypoTool(name)
12 
13  if hasattr(tool, "MonTool"):
14 
15  doValidationMonitoring = flags.Trigger.doValidationMonitoring # True to monitor all chains for validation purposes
16 
17  if (any('egammaMon:online' in group for group in monGroups) or doValidationMonitoring):
18  monTool = GenericMonitoringTool(flags, "MonTool_"+name,
19  HistPath = 'PrecisionCaloHypo/'+tool.getName())
20  monTool.defineHistogram('dEta', type='TH1F', path='EXPERT', title="PrecisionCalo Hypo #Delta#eta_{L2 L1}; #Delta#eta_{L2 L1}", xbins=80, xmin=-0.01, xmax=0.01)
21  monTool.defineHistogram('dPhi', type='TH1F', path='EXPERT', title="PrecisionCalo Hypo #Delta#phi_{L2 L1}; #Delta#phi_{L2 L1}", xbins=80, xmin=-0.01, xmax=0.01)
22  monTool.defineHistogram('Eta', type='TH1F', path='EXPERT', title="PrecisionCalo Hypo entries per Eta;Eta", xbins=100, xmin=-2.5, xmax=2.5)
23  monTool.defineHistogram('Phi', type='TH1F', path='EXPERT', title="PrecisionCalo Hypo entries per Phi;Phi", xbins=128, xmin=-3.2, xmax=3.2)
24  monTool.defineHistogram('Et_em', type='TH1F', path='EXPERT', title="PrecisionCalo Hypo cluster E_{T}^{EM};E_{T}^{EM} [MeV]", xbins=50, xmin=-2000, xmax=100000)
25 
26  cuts=['Input','#Delta #eta L2-L1', '#Delta #phi L2-L1','eta','E_{T}^{EM}']
27 
28  monTool.defineHistogram('CutCounter', type='TH1I', path='EXPERT', title="PrecisionCalo Hypo Passed Cuts;Cut",
29  xbins=13, xmin=-1.5, xmax=12.5, opt="kCumulative", xlabels=cuts)
30 
31  tool.MonTool = monTool
32 
33 
34  tool.EtaBins = [0.0, 0.6, 0.8, 1.15, 1.37, 1.52, 1.81, 2.01, 2.37, 2.47]
35  def same( val ):
36  return [val]*( len( tool.EtaBins ) - 1 )
37 
38  tool.ETthr = same( float(threshold)*GeV )
39  tool.dETACLUSTERthr = 0.1
40  tool.dPHICLUSTERthr = 0.1
41  tool.ET2thr = same( 90.0*GeV )
42 
43  if sel == 'nocut':
44  tool.AcceptAll = True
45  tool.ETthr = same( float( threshold )*GeV )
46  tool.dETACLUSTERthr = 9999.
47  tool.dPHICLUSTERthr = 9999.
48 
49  if sel == 'etcut' or sel == 'nopid' or sel == 'ion':
50  tool.ETthr = same( float( threshold )*GeV )
51  tool.dETACLUSTERthr = 9999.
52  tool.dPHICLUSTERthr = 9999.
53 
54 
55  return tool
56 
57 
58 def TrigEgammaPrecisionCaloHypoToolFromDict( flags, d, tool=None ):
59  """ Use menu decoded chain dictionary to configure the tool """
60  cparts = [i for i in d['chainParts'] if ((i['signature']=='Electron') or (i['signature']=='Photon'))]
61 
62  def __th(cpart):
63  return cpart['threshold']
64 
65  def __sel(cpart):
66  return 'ion' if 'ion' in cpart['extra'] else (cpart['addInfo'][0] if cpart['addInfo'] else cpart['IDinfo'])
67 
68  return _IncTool(flags, d['chainName'], d['monGroups'], __th( cparts[0]), __sel( cparts[0] ) , tool=tool)
SystemOfUnits
python.TrigEgammaFastCaloHypoTool.same
def same(val, tool)
Definition: TrigEgammaFastCaloHypoTool.py:12
python.TrigEgammaPrecisionCaloHypoTool.TrigEgammaPrecisionCaloHypoToolFromDict
def TrigEgammaPrecisionCaloHypoToolFromDict(flags, d, tool=None)
Definition: TrigEgammaPrecisionCaloHypoTool.py:58
python.TrigEgammaPrecisionCaloHypoTool._IncTool
def _IncTool(flags, name, monGroups, threshold, sel, tool=None)
Definition: TrigEgammaPrecisionCaloHypoTool.py:6
GenericMonitoringTool
Definition: GenericMonitoringTool.py:1
readCCLHist.float
float
Definition: readCCLHist.py:83