ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1CaloMonitoring
python
test_FEX_BSEncoding.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
3
#
4
# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
5
#
6
7
8
# this test we will run the main job once to produce a raw file, then
9
# run it a second time to process that raw file
10
# then compare the monitoring histograms
11
12
13
import
tempfile
14
import
os
15
import
ROOT
16
17
testFile =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data24_13p6TeV.00475321.physics_Main.daq.RAW._lb0247._SFO-11._0006.data_150evt"
18
#testFile = "/eos/atlas/atlascerngroupdisk/det-l1calo/OfflineSoftware/TestFiles/data24_13p6TeV/data24_13p6TeV.00477048.physics_Main.daq.RAW._lb0821._SFO-20._0001.data"
19
20
def
runMonCmd
(inputFile,outputBSFile=None,outputMonFile=None):
21
cmdString = f
"l1calo-ath-mon --evtMax 150 --filesInput {inputFile} -- Trigger.CTP.UseEDMxAOD=False Trigger.L1.doeFex=True Trigger.L1.dojFex=True Trigger.L1.dogFex=True Trigger.enableL1CaloPhase1=False"
22
if
outputMonFile: cmdString += f
" Output.HISTFileName={outputMonFile}"
23
if
outputBSFile:
24
if
os.path.exists(outputBSFile): os.remove(outputBSFile)
25
cmdString += f
" Output.BSFileName=\"{outputBSFile}\""
26
print
(
"Executing: "
+ cmdString)
27
os.system(cmdString)
28
29
30
def
histosEqual
(h1, h2, tolerance=1e-3):
31
for
bin
in
range(h1.GetNcells()):
32
if
( abs(h1.GetBinContent(bin)-h2.GetBinContent(bin))>tolerance ):
33
print
(f
"Bin {bin} difference: {h1.GetBinContent(bin)} vs {h2.GetBinContent(bin)}"
)
34
return
False
35
return
True
36
37
38
def
histoEmpty
(h):
39
return
h.GetEntries() == 0
40
41
42
with
tempfile.TemporaryDirectory()
as
tmp:
43
bsFile =
"test.efex.raw"
# os.path.join(tmp, 'test.efex.raw')
44
runMonCmd
(inputFile = testFile,
45
outputBSFile=bsFile,
46
outputMonFile=
"monitoring.orig.root"
)
47
runMonCmd
(inputFile=bsFile,outputMonFile=
"monitoring.root"
)
48
49
50
# now c.f. the relevant histograms from the two monitoring files
51
f1 = ROOT.TFile(
"monitoring.orig.root"
)
52
f2 = ROOT.TFile(
"monitoring.root"
)
53
hists = [
54
"h_L1_eEMRoI_LowPtCut_EtaPhiMap"
,
55
"h_L1_eTauRoI_LowPtCut_EtaPhiMap"
,
56
"h_L1_eEMxRoI_LowPtCut_EtaPhiMap"
,
57
"h_L1_eTauxRoI_LowPtCut_EtaPhiMap"
,
58
"h_jJ_EtaPhiMap"
,
59
"h_jTAU_EtaPhiMap"
,
60
"h_jEM_EtaPhiMap"
,
61
"h_etaphiMapL1_gFexSRJetRoI_CutPt0"
,
62
"h_etaphiMapL1_gFexLRJetRoI_CutPt0"
,
63
"h_gFexMet"
,
64
"h_gFexSumEt"
,
65
]
66
for
h
in
hists:
67
h1 = f1.FindObjectAny(h)
68
if
not
h1:
69
print
(f
"Missing {h} from {f1.GetName()}"
)
70
exit(1)
71
h2 = f2.FindObjectAny(h)
72
if
not
h2:
73
print
(f
"Missing {h} from {f2.GetName()}"
)
74
exit(1)
75
if
histoEmpty
(h1):
76
print
(f
"{h} is empty in {f1.GetName()} - test needs more events to populate"
)
77
exit(1)
78
if
histoEmpty
(h2):
79
print
(f
"{h} is empty in {f2.GetName()} - test needs more events to populate"
)
80
exit(1)
81
if
not
histosEqual
(h1,h2):
82
print
(f
"{h} histograms differ"
)
83
exit(1)
if
if(pathvar)
Definition
SealSharedLib.cxx:168
print
void print(char *figname, TCanvas *c1)
Definition
TRTCalib_StrawStatusPlots.cxx:26
test_FEX_BSEncoding.histoEmpty
histoEmpty(h)
Definition
test_FEX_BSEncoding.py:38
test_FEX_BSEncoding.histosEqual
histosEqual(h1, h2, tolerance=1e-3)
Definition
test_FEX_BSEncoding.py:30
test_FEX_BSEncoding.runMonCmd
runMonCmd(inputFile, outputBSFile=None, outputMonFile=None)
Definition
test_FEX_BSEncoding.py:20
Generated on
for ATLAS Offline Software by
1.17.0