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",
"L1_gMETComponentsNoiseCut",
"L1_gMETComponentsRms",
"L1_gScalarENoiseCut",
"L1_gScalarERms"]
27 trigPath =
'Developer/Gfex/'
28 globTobVarDict = {
"gScalarEJwoj":[
"gFexMet",
"gFexSumEt"],
"gMETComponentsJwoj":[
"METx",
"METy"],
"gMHTComponentsJwoj":[
"MHTx",
"MHTy"],
"gMSTComponentsJwoj":[
"MSTx",
"MSTy"],
"gMETComponentsNoiseCut":[
"METx_NoiseCut",
"METy_NoiseCut"],
"gMETComponentsRms":[
"METx_Rms",
"METy_Rms"],
"gScalarENoiseCut":[
"gFexMet_NoiseCut",
"gFexSumEt_NoiseCut"],
"gScalarERms":[
"gFexMet_Rms",
"gFexSumEt_Rms"]}
29 keyDirPathMap = {
"gFexMet":
"gXE/",
"gFexSumEt":
"gTE/",
"METx":
"gXE/",
"METy":
"gXE/",
"MHTx":
"gMHT/",
"MHTy":
"gMHT/",
"MSTx":
"gMST/",
"MSTy":
"gMST/",
"METx_NoiseCut":
"gXE_NoiseCut/",
"METy_NoiseCut":
"gXE_NoiseCut/",
"METx_Rms":
"gXE_RMS/",
"METy_Rms":
"gXE_RMS/",
"gFexMet_NoiseCut":
"gXE_NoiseCut/",
"gFexSumEt_NoiseCut":
"gTE_NoiseCut/",
"gFexMet_Rms":
"gTE_RMS/",
"gFexSumEt_Rms":
"gTE_RMS/"}
30 globTobRangeDict = {
"gFexMet":[0, 6e5],
"gFexSumEt":[0, 5e6],
"METx":[-3e5, 3e5],
"METy":[-3e5, 3e5],
"MHTx":[-3e5, 3e5],
"MHTy":[-3e5, 3e5],
"MSTx":[-2e5, 2e5],
"MSTy":[-2e5, 2e5],
"METx_NoiseCut":[-6e5, 6e5],
"METy_NoiseCut":[-6e5, 6e5],
"METx_Rms":[-6e5, 6e5],
"METy_Rms":[-6e5, 6e5],
"gFexMet_NoiseCut":[-1e4, 1e6],
"gFexSumEt_NoiseCut":[0, 2.5e6],
"gFexMet_Rms":[-1e5, 1e6],
"gFexSumEt_Rms":[0, 2e6]}
33 ptCutValues = GfexMonAlg.ptCutValues
34 gFexJetTobKeyList = GfexMonAlg.gFexJetTobKeyList
35 gFexRhoTobKeyList = GfexMonAlg.gFexRhoTobKeyList
36 gFexGlobalTobKeyList = GfexMonAlg.gFexGlobalTobKeyList
39 for containerKey
in gFexJetTobKeyList:
40 for ptCut
in ptCutValues:
41 for pFPGA
in [
"",
"FPGAa",
"FPGAb",
"FPGAc"]:
43 ptCutString =
"_CutPt{:.0f}".
format(ptCut)
if (ptCut != -1)
else ""
44 containerKey = containerKey.split(
"+")[-1]
47 histKey = containerKey +
"{}" + ptCutString
48 histKey +=
";h_" + containerKey +
"{}" + ptCutString
49 tobTypeStr =
"gFex SRJet" if "SRJet" in containerKey
else "gFex LRJet"
50 ptStrTitle =
" - tobEt [200 MeV Scale]>{:.0f}".
format(ptCut)
if ptCut != -1
else ""
51 jPath =
"gFexSRJets" if "SRJet" in containerKey
else "gFexLRJets"
54 helper.defineHistogram(histKey.format(
"Eta{}".
format(pFPGA),
"Eta{}".
format(pFPGA)), title=
"{} {} #eta{}; #eta; counts".
format(tobTypeStr, pFPGA, ptStrTitle), type=
'TH1F', fillGroup=groupName, path=trigPath+
"{}/".
format(jPath), xbins=32,xmin=-3.3,xmax=3.3)
55 helper.defineHistogram(histKey.format(
"Phi{}".
format(pFPGA),
"Phi{}".
format(pFPGA)), title=
"{} {} #phi{}; #phi; counts".
format(tobTypeStr, pFPGA, ptStrTitle), type=
'TH1F', fillGroup=groupName, path=trigPath+
"{}/".
format(jPath), xbins=32,xmin=-math.pi,xmax=math.pi)
56 helper.defineHistogram(histKey.format(
"Pt{}".
format(pFPGA),
"Pt{}".
format(pFPGA)) , title=
"{} {} #Pt{} ; #Pt ; counts".
format(tobTypeStr, pFPGA, ptStrTitle), type=
'TH1F', fillGroup=groupName, path=trigPath+
"{}/".
format(jPath), xbins=100,xmin=-1,xmax=4096)
59 histKey = containerKey +
"{}" + ptCutString
60 etaKey = histKey.format(
"Eta{}".
format(pFPGA))
61 phiKey = histKey.format(
"Phi{}".
format(pFPGA))
62 helper.defineHistogram(
'{},{};h_{}{}'.
format(etaKey, phiKey, etaKey, phiKey), title=
"{} {} #eta vs #phi {}; #eta; #phi".
format(tobTypeStr, pFPGA, ptStrTitle), type=
'TH2F',fillGroup=groupName, path=trigPath+
"{}/".
format(jPath), xbins=32,xmin=-3.3,xmax=3.3,ybins=32,ymin=-math.pi,ymax=math.pi)
65 for containerKey
in gFexRhoTobKeyList:
66 helper.defineHistogram(
"{};h_{}".
format(containerKey, containerKey), title=
"{}; gFexRho Et [MeV]; counts".
format(containerKey), fillGroup=groupName, type=
"TH1F", path=trigPath+
"gRHO", xbins=100,xmin=-300000,xmax=300000)
69 for containerKey
in gFexGlobalTobKeyList:
70 for key, dictVal
in globTobVarDict.items():
71 if key
in containerKey:
72 varOne, varTwo = dictVal
75 xminOne, xmaxOne = globTobRangeDict.get(varOne, [0,1e6])
76 xminTwo, xmaxTwo = globTobRangeDict.get(varTwo, [0,1e6])
78 helper.defineHistogram(
"{};h_{}".
format(varOne, varOne), title=
"{}; {} [MeV]; counts".
format(varOne, varOne), type=
"TH1F", fillGroup=groupName, path=trigPath+keyDirPathMap.get(varOne,
"gFexGlob/"), xbins=100,xmin=xminOne,xmax=xmaxOne)
79 helper.defineHistogram(
"{};h_{}".
format(varTwo, varTwo), title=
"{}; {} [MeV]; counts".
format(varTwo, varTwo), type=
"TH1F", fillGroup=groupName, path=trigPath+keyDirPathMap.get(varTwo,
"gFexGlob/"), xbins=100,xmin=xminTwo,xmax=xmaxTwo)
85 if __name__==
'__main__':
87 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
91 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')
93 flags.Input.Files = inputs
94 flags.Output.HISTFileName =
'ExampleMonitorOutput.root'
98 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
99 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
104 cfg.merge(GfexMonitorCfg)
105 cfg.printConfig(withDetails=
False, summariseProps =
True)