5 '''Function to configure LVL1 Gfex algorithm in the monitoring system.'''
8 from AthenaConfiguration.ComponentFactory
import CompFactory
9 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
14 from TrigT1CaloMonitoring.LVL1CaloMonitoringConfig
import L1CaloMonitorCfgHelper
15 helper = L1CaloMonitorCfgHelper(flags,CompFactory.GfexMonitorAlgorithm,
'GfexMonAlg')
16 GfexMonAlg = helper.alg
19 groupName =
'GfexMonitor'
20 GfexMonAlg.PackageName = groupName
22 GfexMonAlg.gFexJetTobKeyList = [
"L1_gFexLRJetRoI",
"L1_gFexSRJetRoI"]
23 GfexMonAlg.gFexRhoTobKeyList = [
"L1_gFexRhoRoI"]
24 GfexMonAlg.gFexGlobalTobKeyList = [
"L1_gScalarEJwoj",
"L1_gMETComponentsJwoj",
"L1_gMHTComponentsJwoj",
"L1_gMSTComponentsJwoj"]
27 devPath =
'Developer/GfexOutput/'
28 expertPath =
'Expert/Outputs/'
29 globTobVarDict = {
"gScalarEJwoj":[
"gFexMet",
"gFexSumEt"],
"gMETComponentsJwoj":[
"METx",
"METy"],
"gMHTComponentsJwoj":[
"MHTx",
"MHTy"],
"gMSTComponentsJwoj":[
"MSTx",
"MSTy"]}
33 keyDirPathMap = {
"gFexMet":
"gXE/",
"gFexSumEt":
"gTE/",
"METx":
"gXE/",
"METy":
"gXE/",
"MHTx":
"gMHT/",
"MHTy":
"gMHT/",
"MSTx":
"gMST/",
"MSTy":
"gMST/"}
37 globTobRangeDict = {
"gFexMet":[0, 4e5],
"gFexSumEt":[0, 2e6],
"METx":[-3e5, 3e5],
"METy":[-3e5, 3e5],
"MHTx":[-3e5, 3e5],
"MHTy":[-3e5, 3e5],
"MSTx":[-2e5, 2e5],
"MSTy":[-2e5, 2e5]}
44 ptCutValuesgLJ = GfexMonAlg.ptCutValuesgLJ
45 ptCutValuesgJ = GfexMonAlg.ptCutValuesgJ
46 gFexJetTobKeyList = GfexMonAlg.gFexJetTobKeyList
47 gFexRhoTobKeyList = GfexMonAlg.gFexRhoTobKeyList
48 gFexGlobalTobKeyList = GfexMonAlg.gFexGlobalTobKeyList
52 eta_bins = [-4.9, -4.1,-3.5,-3.25,-3.2,-3.1,-2.9,-2.7,-2.5,2.5,2.7,2.9,3.1,3.3,3.25,3.5,4.1,4.9 ]
53 for eta
in np.arange (-2.2,2.4,0.2):
56 eta_bins =
sorted(eta_bins)
61 helper.defineDQAlgorithm(
"Gfex_etaPhiMapFilled_gJ",
62 hanConfig={
"libname":
"libdqm_summaries.so",
"name":
"Bins_Equal_Threshold",
"BinThreshold":
"0"},
63 thresholdConfig={
"NBins":[0,nbins_total]},
66 helper.defineDQAlgorithm(
"Gfex_etaPhiMapFilled_gLJ",
67 hanConfig={
"libname":
"libdqm_summaries.so",
"name":
"Bins_Equal_Threshold",
"BinThreshold":
"0"},
68 thresholdConfig={
"NBins":[0,nbins_total]},
72 for containerKey
in gFexJetTobKeyList:
73 ptCutValues = ptCutValuesgLJ
if "LRJet" in containerKey
else ptCutValuesgJ
74 for ptCut
in ptCutValues:
76 ptCutString =
"_CutPt{:.0f}".
format(ptCut)
if (ptCut != -1)
else ""
77 containerKey = containerKey.split(
"+")[-1]
80 tobTypeStr =
"gFex SRJet" if "SRJet" in containerKey
else "gFex LRJet"
82 ptStrTitle = f
" - tobEt [200 MeV Scale]>{ptCut}" if ptCut != -1
else ""
83 gPath =
"gJ" if "SRJet" in containerKey
else "gLJ"
85 helper.defineHistogram(f
"{containerKey}Eta{ptCutString};h_{containerKey}Eta{ptCutString}", title=
"{} #eta{}; #eta; counts".
format(tobTypeStr, ptStrTitle), type=
'TH1F', fillGroup=groupName, path=f
"{devPath}{gPath}/", xbins=eta_bins)
86 helper.defineHistogram(f
"{containerKey}Phi{ptCutString};h_{containerKey}Phi{ptCutString}", title=
"{} #phi{}; #phi; counts".
format(tobTypeStr, ptStrTitle), type=
'TH1F', fillGroup=groupName, path=f
"{devPath}{gPath}", xbins=32,xmin=-math.pi,xmax=math.pi)
87 helper.defineHistogram(f
"{containerKey}Pt{ptCutString};h_{containerKey}Pt{ptCutString}" , title=
"{} Pt{} ; Pt [MeV] ; counts".
format(tobTypeStr, ptStrTitle), type=
'TH1F', fillGroup=groupName,path=f
"{devPath}{gPath}",xbins=100,xmin=-1,xmax=4096)
91 helper.defineHistogram(f
"{containerKey}Eta{ptCutString},{containerKey}Phi{ptCutString};h_etaphiMap{containerKey}{ptCutString}", title=
"{} {} #eta vs #phi ; #eta; #phi".
format(tobTypeStr, ptStrTitle),
92 type=
'TH2F',fillGroup=groupName, path=f
"{expertPath}{gPath}/",
94 "algorithm":
"Gfex_etaPhiMapFilled_gJ",
95 "description":f
"Inspect for hot/cold spots - check <a href='./detail/h_{containerKey}{ptCutString}_posVsLBN'>detail timeseries</a>",
96 "display":
"SetPalette(55),Draw=COL1Z"
98 opt=[
'kAlwaysCreate'],
99 xbins=eta_bins,ybins=32,ymin=-3.2,ymax=3.2)
102 helper.defineHistogram(f
"{containerKey}LBN{ptCutString},{containerKey}binNumber{ptCutString};h_{containerKey}{ptCutString}_posVsLBN",title=
"{} {} LBN vs 40(y-1)+x; LBN; 40(y-1)+x".
format(tobTypeStr, ptStrTitle),
103 path=f
"{expertPath}{gPath}/detail",
104 fillGroup = groupName,
105 hanConfig={
"description":f
"x and y correspond to axis bin numbers on <a href='../h_etaphiMap{containerKey}{ptCutString}'/>eta-phi plot</a>. Use this plot to check if hotspot/coldspots affected whole or part of run: turn on Projection X1 to see 1D hist of individual locations"},
107 xbins=1,xmin=0,xmax=10,
108 ybins=40*32,ymin=0.5,ymax=40*32+0.5,
109 opt=[
'kAddBinsDynamically',
'kAlwaysCreate'],merge=
"merge")
112 helper.defineHistogram(f
"{containerKey}Eta{ptCutString},{containerKey}Phi{ptCutString};h_etaphiMap{containerKey}{ptCutString}", title=
"{} {} #eta vs #phi ; #eta; #phi".
format(tobTypeStr, ptStrTitle),
113 type=
'TH2F',fillGroup=groupName, path=f
"{expertPath}{gPath}/",
115 "algorithm":
"Gfex_etaPhiMapFilled_gLJ",
116 "description":f
"Inspect for hot/cold spots - check <a href='./detail/h_{containerKey}{ptCutString}_posVsLBN'>detail timeseries</a>",
117 "display":
"SetPalette(55),Draw=COL1Z"
119 opt=[
'kAlwaysCreate'],
120 xbins=eta_bins, ybins=32,ymin=-3.2,ymax=3.2)
122 helper.defineHistogram(f
"{containerKey}LBN{ptCutString},{containerKey}binNumber{ptCutString};h_{containerKey}{ptCutString}_posVsLBN",title=
"{} {} LBN vs 40(y-1)+x; LBN; 40(y-1)+x".
format(tobTypeStr, ptStrTitle),
123 path=f
"{expertPath}{gPath}/detail",
124 fillGroup = groupName,
125 hanConfig={
"description":f
"x and y correspond to axis bin numbers on <a href='../h_etaphiMap{containerKey}{ptCutString}'/>eta-phi plot</a>. Use this plot to check if hotspot/coldspots affected whole or part of run: turn on Projection X1 to see 1D hist of individual locations"},
127 xbins=1,xmin=0,xmax=10,
128 ybins=40*32,ymin=0.5,ymax=40*32+0.5,
129 opt=[
'kAddBinsDynamically',
'kAlwaysCreate'],merge=
"merge")
133 for containerKey
in gFexRhoTobKeyList:
134 helper.defineHistogram(f
"{containerKey};h_{containerKey}", title=f
"{containerKey}; gFexRho Et [MeV]; counts", fillGroup=groupName, type=
"TH1F", path=f
"{devPath}gRHO", xbins=100,xmin=0,xmax=100000)
137 for containerKey
in gFexGlobalTobKeyList:
138 for key, dictVal
in globTobVarDict.items():
139 if key
in containerKey:
140 varOne, varTwo = dictVal
143 xminOne, xmaxOne = globTobRangeDict.get(varOne, [0,1e6])
144 xminTwo, xmaxTwo = globTobRangeDict.get(varTwo, [0,1e6])
146 helper.defineHistogram(
"{};h_{}".
format(varOne, varOne), title=
"{}; {} [MeV]; counts".
format(varOne, varOne), type=
"TH1F", fillGroup=groupName, path=devPath+keyDirPathMap.get(varOne,
"gFexGlob/"), xbins=100,xmin=xminOne,xmax=xmaxOne)
147 helper.defineHistogram(
"{};h_{}".
format(varTwo, varTwo), title=
"{}; {} [MeV]; counts".
format(varTwo, varTwo), type=
"TH1F", fillGroup=groupName, path=devPath+keyDirPathMap.get(varTwo,
"gFexGlob/"), xbins=100,xmin=xminTwo,xmax=xmaxTwo)
150 acc = helper.result()
154 if __name__==
'__main__':
156 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
160 inputs = glob.glob(
'/afs/cern.ch/user/t/thompson/work/public/LVL1_monbatch/run_sim/l1calo.361106.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zee.ESD.eFex_2021-05-16T2101.root')
162 flags.Input.Files = inputs
163 flags.Output.HISTFileName =
'ExampleMonitorOutput.root'
167 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
168 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
173 cfg.merge(GfexMonitorCfg)
174 cfg.printConfig(withDetails=
False, summariseProps =
True)