ATLAS Offline Software
IDCalibHypoConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 import re
4 
5 from AthenaCommon.Logging import logging
6 from AthenaConfiguration.ComponentFactory import CompFactory
7 from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
8 
9 def createIDCalibHypoAlg(flags, name):
10  # Monitoring
11  monTool = GenericMonitoringTool(flags, "IM_MonTool"+name,
12  HistPath = 'IDCalibHypoAlg')
13  monTool.defineHistogram('pt', type='TH1F', path='EXPERT', title="p_{T};p_{T} [GeV];Nevents", xbins=50, xmin=0, xmax=100)
14 
15  # Setup the hypothesis algorithm
16  theHypo = CompFactory.IDCalibHypoAlg(name,
17  MonTool = monTool)
18  return theHypo
19 
20 
21 def IDCalibHypoToolFromDict( chainDict ):
22 
23  log = logging.getLogger('IDCalibHypoTool')
24 
25  """ Use menu decoded chain dictionary to configure the tool """
26  cparts = [i for i in chainDict['chainParts'] if i['signature']=='Calib']
27 
28  name = "default_chain_name"
29  if 'chainName' in chainDict:
30  name = chainDict['chainName']
31  else:
32  log.error("chainName not in chain dictionary")
33 
34  # set thresholds
35  m = re.search(r'trk(\d+)',[ cpart['hypo'] for cpart in cparts ][0])
36  threshold = m.group(1)
37 
38  mult = [ cpart['multiplicity'] for cpart in cparts ][0]
39  thresholds = [ float(threshold) for x in range(0,int(mult)) ]
40  log.debug("Threshold values are: %s", ", ".join(str(THR) for THR in thresholds))
41 
42  tool = CompFactory.IDCalibHypoTool(name,
43  cutTrackPtGeV = thresholds)
44  return tool
python.IDCalibHypoConfig.IDCalibHypoToolFromDict
def IDCalibHypoToolFromDict(chainDict)
Definition: IDCalibHypoConfig.py:21
python.IDCalibHypoConfig.createIDCalibHypoAlg
def createIDCalibHypoAlg(flags, name)
Definition: IDCalibHypoConfig.py:9
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
GenericMonitoringTool
Definition: GenericMonitoringTool.py:1
str
Definition: BTagTrackIpAccessor.cxx:11
readCCLHist.float
float
Definition: readCCLHist.py:83