Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LHCbPR2HD
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LHCb Core Software
LHCbPR2HD
Merge requests
!191
WIP: new handler to check difference between two root files
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
WIP: new handler to check difference between two root files
DEV_DC
into
master
Overview
1
Commits
1
Pipelines
0
Changes
1
Closed
Yingrui Hou
requested to merge
DEV_DC
into
master
4 years ago
Overview
1
Commits
1
Pipelines
0
Changes
1
Expand
new handler to check the difference between two root files
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
d1448103
1 commit,
4 years ago
1 file
+
1055
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
handlers/PrCheckerMRDifferenceHandler.py
0 → 100644
+
1055
−
0
Options
# Handler for summarizing the output of PrChecker2.
#
# It extracts the most interesting histograms and also
# produces efficiency histograms of reconstructed vs
# reconstructible tracks for different tracking categories.
#
# The 1D efficiencies are calculated usig TGraphAsymmErrors
# and Bayesian error bars
# The 2D efficiencies are calculated via TH2 and using standard error calculation.
#
# Based on: PrCheckerEfficieincyHandler and _HLT2
# author: Miroslav Saur (miroslav.saur@cern.ch) & Suzanne Klaver (suzanne.klaver@cern.ch)
# Version:
# - 0.1 (2020/01): basic plots and efficiencies as in LHCb-FIGURE-2019-
# - 0.2 (2020/04): updated to work with python3
# - 0.3 (2020/06): removal of basic plots, adding efficiecies for different track types
#
import
os
,
sys
import
argparse
import
ROOT
import
math
from
ROOT
import
gStyle
from
ROOT
import
gROOT
from
ROOT
import
TStyle
from
ROOT
import
gPad
from
.BaseHandler
import
BaseHandler
from
.gaussValidation
import
grepPattern
from
collectRunResults
import
urlopen
import
logging
import
subprocess
from
collections
import
defaultdict
def
effPlotsDict_long
()
:
basedict
=
{
"
Pt
"
:
{},
"
P
"
:
{},
"
Eta
"
:
{},
"
nPV
"
:
{},
}
basedict
[
"
Pt
"
][
"
path
"
]
=
"
Track/BestLongMCCheck/BestLong/01_long_Pt
"
basedict
[
"
P
"
][
"
path
"
]
=
"
Track/BestLongMCCheck/BestLong/01_long_P
"
basedict
[
"
Eta
"
][
"
path
"
]
=
"
Track/BestLongMCCheck/BestLong/01_long_Eta
"
basedict
[
"
nPV
"
][
"
path
"
]
=
"
Track/BestLongMCCheck/BestLong/01_long_nPV
"
basedict
[
"
Pt
"
][
"
unit
"
]
=
"
pT [MeV]
"
basedict
[
"
P
"
][
"
unit
"
]
=
"
p [MeV]
"
basedict
[
"
Eta
"
][
"
unit
"
]
=
"
#eta [-]
"
basedict
[
"
nPV
"
][
"
unit
"
]
=
"
nPV [-]
"
basedict
[
"
Pt
"
][
"
unit_y
"
]
=
"
Effciency [-]
"
basedict
[
"
P
"
][
"
unit_y
"
]
=
"
Effciency [-]
"
basedict
[
"
Eta
"
][
"
unit_y
"
]
=
"
Effciency [-]
"
basedict
[
"
nPV
"
][
"
unit_y
"
]
=
"
Effciency [-]
"
basedict
[
"
Pt
"
][
"
cut
"
]
=
10.0
basedict
[
"
P
"
][
"
cut
"
]
=
10.0
basedict
[
"
Eta
"
][
"
cut
"
]
=
10.0
basedict
[
"
nPV
"
][
"
cut
"
]
=
10.0
return
basedict
def
getEffPlots_long
()
:
return
[
"
Pt
"
,
"
P
"
,
"
Eta
"
,
"
nPV
"
]
def
effPlotsDict_down
()
:
basedict
=
{
"
Pt
"
:
{},
"
P
"
:
{},
"
Eta
"
:
{},
"
nPV
"
:
{},
}
basedict
[
"
Pt
"
][
"
path
"
]
=
"
Track/BestDownMCCheck/BestDown/01_UT+T_Pt
"
basedict
[
"
P
"
][
"
path
"
]
=
"
Track/BestDownMCCheck/BestDown/01_UT+T_P
"
basedict
[
"
Eta
"
][
"
path
"
]
=
"
Track/BestDownMCCheck/BestDown/01_UT+T_Eta
"
basedict
[
"
nPV
"
][
"
path
"
]
=
"
Track/BestDownMCCheck/BestDown/01_UT+T_nPV
"
basedict
[
"
Pt
"
][
"
unit
"
]
=
"
pT [MeV]
"
basedict
[
"
P
"
][
"
unit
"
]
=
"
p [MeV]
"
basedict
[
"
Eta
"
][
"
unit
"
]
=
"
#eta [-]
"
basedict
[
"
nPV
"
][
"
unit
"
]
=
"
nPV [-]
"
basedict
[
"
Pt
"
][
"
unit_y
"
]
=
"
Effciency [-]
"
basedict
[
"
P
"
][
"
unit_y
"
]
=
"
Effciency [-]
"
basedict
[
"
Eta
"
][
"
unit_y
"
]
=
"
Effciency [-]
"
basedict
[
"
nPV
"
][
"
unit_y
"
]
=
"
Effciency [-]
"
basedict
[
"
Pt
"
][
"
cut
"
]
=
10.0
basedict
[
"
P
"
][
"
cut
"
]
=
10.0
basedict
[
"
Eta
"
][
"
cut
"
]
=
10.0
basedict
[
"
nPV
"
][
"
cut
"
]
=
10.0
return
basedict
def
getEffPlots_down
()
:
return
[
"
Pt
"
,
"
P
"
,
"
Eta
"
,
"
nPV
"
]
def
effPlotsDict_forward
()
:
basedict
=
{
"
Pt
"
:
{},
"
P
"
:
{},
"
Eta
"
:
{},
"
nPV
"
:
{},
}
basedict
[
"
Pt
"
][
"
path
"
]
=
"
Track/ForwardBestMCCheck/Forward/01_long_Pt
"
basedict
[
"
P
"
][
"
path
"
]
=
"
Track/ForwardBestMCCheck/Forward/01_long_P
"
basedict
[
"
Eta
"
][
"
path
"
]
=
"
Track/ForwardBestMCCheck/Forward/01_long_Eta
"
basedict
[
"
nPV
"
][
"
path
"
]
=
"
Track/ForwardBestMCCheck/Forward/01_long_nPV
"
basedict
[
"
Pt
"
][
"
unit
"
]
=
"
pT [MeV]
"
basedict
[
"
P
"
][
"
unit
"
]
=
"
p [MeV]
"
basedict
[
"
Eta
"
][
"
unit
"
]
=
"
#eta [-]
"
basedict
[
"
nPV
"
][
"
unit
"
]
=
"
nPV [-]
"
basedict
[
"
Pt
"
][
"
unit_y
"
]
=
"
Effciency [-]
"
basedict
[
"
P
"
][
"
unit_y
"
]
=
"
Effciency [-]
"
basedict
[
"
Eta
"
][
"
unit_y
"
]
=
"
Effciency [-]
"
basedict
[
"
nPV
"
][
"
unit_y
"
]
=
"
Effciency [-]
"
basedict
[
"
Pt
"
][
"
cut
"
]
=
10.0
basedict
[
"
P
"
][
"
cut
"
]
=
10.0
basedict
[
"
Eta
"
][
"
cut
"
]
=
10.0
basedict
[
"
nPV
"
][
"
cut
"
]
=
10.0
return
basedict
def
getEffPlots_forward
()
:
return
[
"
Pt
"
,
"
P
"
,
"
Eta
"
,
"
nPV
"
]
def
effPlotsDict_velo
()
:
basedict
=
{
"
Pt
"
:
{},
"
P
"
:
{},
"
Eta
"
:
{},
"
nPV
"
:
{},
}
basedict
[
"
Pt
"
][
"
path
"
]
=
"
Track/VeloFullMCCheck/Velo/01_notElectron_Velo_Pt
"
basedict
[
"
P
"
][
"
path
"
]
=
"
Track/VeloFullMCCheck/Velo/01_notElectron_Velo_P
"
basedict
[
"
Eta
"
][
"
path
"
]
=
"
Track/VeloFullMCCheck/Velo/01_notElectron_Velo_Eta
"
basedict
[
"
nPV
"
][
"
path
"
]
=
"
Track/VeloFullMCCheck/Velo/01_notElectron_Velo_nPV
"
basedict
[
"
Pt
"
][
"
unit
"
]
=
"
pT [MeV]
"
basedict
[
"
P
"
][
"
unit
"
]
=
"
p [MeV]
"
basedict
[
"
Eta
"
][
"
unit
"
]
=
"
#eta [-]
"
basedict
[
"
nPV
"
][
"
unit
"
]
=
"
nPV [-]
"
basedict
[
"
Pt
"
][
"
unit_y
"
]
=
"
Effciency [-]
"
basedict
[
"
P
"
][
"
unit_y
"
]
=
"
Effciency [-]
"
basedict
[
"
Eta
"
][
"
unit_y
"
]
=
"
Effciency [-]
"
basedict
[
"
nPV
"
][
"
unit_y
"
]
=
"
Effciency [-]
"
basedict
[
"
Pt
"
][
"
cut
"
]
=
10.0
basedict
[
"
P
"
][
"
cut
"
]
=
10.0
basedict
[
"
Eta
"
][
"
cut
"
]
=
10.0
basedict
[
"
nPV
"
][
"
cut
"
]
=
10.0
return
basedict
def
getEffPlots_velo
()
:
return
[
"
Pt
"
,
"
P
"
,
"
Eta
"
,
"
nPV
"
]
def
effPlotsDict_ttrack
()
:
basedict
=
{
"
Pt
"
:
{},
"
P
"
:
{},
"
Eta
"
:
{},
"
nPV
"
:
{},
}
basedict
[
"
Pt
"
][
"
path
"
]
=
"
Track/TMCCheck/TTrack/01_hasT_Pt
"
basedict
[
"
P
"
][
"
path
"
]
=
"
Track/TMCCheck/TTrack/01_hasT_P
"
basedict
[
"
Eta
"
][
"
path
"
]
=
"
Track/TMCCheck/TTrack/01_hasT_Eta
"
basedict
[
"
nPV
"
][
"
path
"
]
=
"
Track/TMCCheck/TTrack/01_hasT_nPV
"
basedict
[
"
Pt
"
][
"
unit
"
]
=
"
pT [MeV]
"
basedict
[
"
P
"
][
"
unit
"
]
=
"
p [MeV]
"
basedict
[
"
Eta
"
][
"
unit
"
]
=
"
#eta [-]
"
basedict
[
"
nPV
"
][
"
unit
"
]
=
"
nPV [-]
"
basedict
[
"
Pt
"
][
"
unit_y
"
]
=
"
Effciency [-]
"
basedict
[
"
P
"
][
"
unit_y
"
]
=
"
Effciency [-]
"
basedict
[
"
Eta
"
][
"
unit_y
"
]
=
"
Effciency [-]
"
basedict
[
"
nPV
"
][
"
unit_y
"
]
=
"
Effciency [-]
"
basedict
[
"
Pt
"
][
"
cut
"
]
=
10.0
basedict
[
"
P
"
][
"
cut
"
]
=
10.0
basedict
[
"
Eta
"
][
"
cut
"
]
=
10.0
basedict
[
"
nPV
"
][
"
cut
"
]
=
10.0
return
basedict
def
getEffPlots_ttrack
()
:
return
[
"
Pt
"
,
"
P
"
,
"
Eta
"
,
"
nPV
"
]
def
effPlotsDict_2D_long
()
:
basedict
=
{
"
EtaP
"
:
{},
"
EtaPhi
"
:
{},
}
basedict
[
"
EtaP
"
][
"
path
"
]
=
"
Track/BestLongMCCheck/BestLong/01_long_EtaP
"
basedict
[
"
EtaPhi
"
][
"
path
"
]
=
"
Track/BestLongMCCheck/BestLong/01_long_EtaPhi
"
basedict
[
"
EtaP
"
][
"
unit
"
]
=
"
#eta [-]
"
basedict
[
"
EtaPhi
"
][
"
unit
"
]
=
"
#eta [-]
"
basedict
[
"
EtaP
"
][
"
unit_y
"
]
=
"
p [MeV]
"
basedict
[
"
EtaPhi
"
][
"
unit_y
"
]
=
"
#phi [-]
"
basedict
[
"
EtaP
"
][
"
cut
"
]
=
10.0
basedict
[
"
EtaPhi
"
][
"
cut
"
]
=
10.0
return
basedict
def
getEffPlots_2D_long
()
:
return
[
"
EtaP
"
,
"
EtaPhi
"
]
def
effPlotsDict_2D_down
()
:
basedict
=
{
"
EtaP
"
:
{},
"
EtaPhi
"
:
{},
}
basedict
[
"
EtaP
"
][
"
path
"
]
=
"
Track/BestDownMCCheck/BestDown/01_UT+T_EtaP
"
basedict
[
"
EtaPhi
"
][
"
path
"
]
=
"
Track/BestDownMCCheck/BestDown/01_UT+T_EtaPhi
"
basedict
[
"
EtaP
"
][
"
unit
"
]
=
"
#eta [-]
"
basedict
[
"
EtaPhi
"
][
"
unit
"
]
=
"
#eta [-]
"
basedict
[
"
EtaP
"
][
"
unit_y
"
]
=
"
p [MeV]
"
basedict
[
"
EtaPhi
"
][
"
unit_y
"
]
=
"
#phi [-]
"
basedict
[
"
EtaP
"
][
"
cut
"
]
=
10.0
basedict
[
"
EtaPhi
"
][
"
cut
"
]
=
10.0
return
basedict
def
getEffPlots_2D_down
()
:
return
[
"
EtaP
"
,
"
EtaPhi
"
]
def
effPlotsDict_2D_forward
()
:
basedict
=
{
"
EtaP
"
:
{},
"
EtaPhi
"
:
{},
}
basedict
[
"
EtaP
"
][
"
path
"
]
=
"
Track/ForwardBestMCCheck/Forward/01_long_EtaP
"
basedict
[
"
EtaPhi
"
][
"
path
"
]
=
"
Track/ForwardBestMCCheck/Forward/01_long_EtaPhi
"
basedict
[
"
EtaP
"
][
"
unit
"
]
=
"
#eta [-]
"
basedict
[
"
EtaPhi
"
][
"
unit
"
]
=
"
#eta [-]
"
basedict
[
"
EtaP
"
][
"
unit_y
"
]
=
"
p [MeV]
"
basedict
[
"
EtaPhi
"
][
"
unit_y
"
]
=
"
#phi [-]
"
basedict
[
"
EtaP
"
][
"
cut
"
]
=
10.0
basedict
[
"
EtaPhi
"
][
"
cut
"
]
=
10.0
return
basedict
def
getEffPlots_2D_forward
()
:
return
[
"
EtaP
"
,
"
EtaPhi
"
]
def
effPlotsDict_2D_velo
()
:
basedict
=
{
"
EtaP
"
:
{},
"
EtaPhi
"
:
{},
}
basedict
[
"
EtaP
"
][
"
path
"
]
=
"
Track/VeloFullMCCheck/Velo/01_notElectron_Velo_EtaP
"
basedict
[
"
EtaPhi
"
][
"
path
"
]
=
"
Track/VeloFullMCCheck/Velo/01_notElectron_Velo_EtaPhi
"
basedict
[
"
EtaP
"
][
"
unit
"
]
=
"
#eta [-]
"
basedict
[
"
EtaPhi
"
][
"
unit
"
]
=
"
#eta [-]
"
basedict
[
"
EtaP
"
][
"
unit_y
"
]
=
"
p [MeV]
"
basedict
[
"
EtaPhi
"
][
"
unit_y
"
]
=
"
#phi [-]
"
basedict
[
"
EtaP
"
][
"
cut
"
]
=
10.0
basedict
[
"
EtaPhi
"
][
"
cut
"
]
=
10.0
return
basedict
def
getEffPlots_2D_velo
()
:
return
[
"
EtaP
"
,
"
EtaPhi
"
]
def
effPlotsDict_2D_ttrack
()
:
basedict
=
{
"
EtaP
"
:
{},
"
EtaPhi
"
:
{},
}
basedict
[
"
EtaP
"
][
"
path
"
]
=
"
Track/TMCCheck/TTrack/01_hasT_EtaP
"
basedict
[
"
EtaPhi
"
][
"
path
"
]
=
"
Track/TMCCheck/TTrack/01_hasT_EtaPhi
"
basedict
[
"
EtaP
"
][
"
unit
"
]
=
"
#eta [-]
"
basedict
[
"
EtaPhi
"
][
"
unit
"
]
=
"
#eta [-]
"
basedict
[
"
EtaP
"
][
"
unit_y
"
]
=
"
p [MeV]
"
basedict
[
"
EtaPhi
"
][
"
unit_y
"
]
=
"
#phi [-]
"
basedict
[
"
EtaP
"
][
"
cut
"
]
=
10.0
basedict
[
"
EtaPhi
"
][
"
cut
"
]
=
10.0
return
basedict
def
getEffPlots_2D_ttrack
()
:
return
[
"
EtaP
"
,
"
EtaPhi
"
]
def
effPlotsDict_basic
()
:
basedict
=
{
"
#Tracks
"
:
{},
"
chi2/ndof_long
"
:
{},
"
momentum_long
"
:
{},
"
chi2/ndof_down
"
:
{},
"
momentum_down
"
:
{},
"
#Tracks/Event
"
:
{},
"
dy
"
:
{},
"
dz
"
:
{},
}
basedict
[
"
#Tracks
"
][
"
path
"
]
=
"
Track/TrackMonitor/1
"
basedict
[
"
chi2/ndof_long
"
][
"
path
"
]
=
"
Track/TrackMonitor/Long/3
"
basedict
[
"
momentum_long
"
][
"
path
"
]
=
"
Track/TrackMonitor/Long/5
"
basedict
[
"
chi2/ndof_down
"
][
"
path
"
]
=
"
Track/TrackMonitor/Downstream/3
"
basedict
[
"
momentum_down
"
][
"
path
"
]
=
"
Track/TrackMonitor/Downstream/5
"
basedict
[
"
#Tracks/Event
"
][
"
path
"
]
=
"
RICH/RiLongTrkEff/nTracks
"
basedict
[
"
dy
"
][
"
path
"
]
=
"
PVChecker/1022
"
basedict
[
"
dz
"
][
"
path
"
]
=
"
PVChecker/1023
"
basedict
[
"
#Tracks
"
][
"
unit
"
]
=
"
number of tracks
"
basedict
[
"
#Tracks
"
][
"
unit_y
"
]
=
""
basedict
[
"
chi2/ndof_long
"
][
"
unit
"
]
=
""
basedict
[
"
chi2/ndof_long
"
][
"
unit_y
"
]
=
""
basedict
[
"
momentum_long
"
][
"
unit
"
]
=
"
P [MeV]
"
basedict
[
"
momentum_long
"
][
"
unit_y
"
]
=
""
basedict
[
"
chi2/ndof_down
"
][
"
unit
"
]
=
""
basedict
[
"
chi2/ndof_down
"
][
"
unit_y
"
]
=
""
basedict
[
"
momentum_down
"
][
"
unit
"
]
=
"
P [MeV]
"
basedict
[
"
momentum_down
"
][
"
unit_y
"
]
=
""
basedict
[
"
#Tracks/Event
"
][
"
unit
"
]
=
"
number of tracks per event
"
basedict
[
"
#Tracks/Event
"
][
"
unit_y
"
]
=
""
basedict
[
"
dy
"
][
"
unit
"
]
=
"
dy
"
basedict
[
"
dy
"
][
"
unit_y
"
]
=
""
basedict
[
"
dz
"
][
"
unit
"
]
=
"
dz
"
basedict
[
"
dz
"
][
"
unit_y
"
]
=
""
basedict
[
"
#Tracks
"
][
"
cut
"
]
=
10.0
basedict
[
"
chi2/ndof_long
"
][
"
cut
"
]
=
10.0
basedict
[
"
momentum_long
"
][
"
cut
"
]
=
10.0
basedict
[
"
chi2/ndof_down
"
][
"
cut
"
]
=
10.0
basedict
[
"
momentum_down
"
][
"
cut
"
]
=
10.0
basedict
[
"
#Tracks/Event
"
][
"
cut
"
]
=
10.0
basedict
[
"
dy
"
][
"
cut
"
]
=
10.0
basedict
[
"
dz
"
][
"
cut
"
]
=
10.0
return
basedict
def
getEffPlots_basic
()
:
return
[
"
#Tracks
"
,
"
chi2/ndof_long
"
,
"
momentum_long
"
,
"
chi2/ndof_down
"
,
"
momentum_down
"
,
"
#Tracks/Event
"
,
"
dy
"
,
"
dz
"
]
def
diff_1DG
(
h1
,
h2
)
:
n
=
h1
.
GetN
()
V
=
0.0
d1
=
h1
.
GetY
()
d2
=
h2
.
GetY
()
for
i
in
range
(
n
):
v1
=
d1
[
i
]
v2
=
d2
[
i
]
V
+=
math
.
fabs
(
v1
-
v2
)
#print("v1dg=",v1,"v2dg=",v2,"diffdg=",V)
return
V
def
draw_diff
(
h1
,
h2
)
:
n
=
h1
.
GetN
()
x
=
h1
.
GetX
()
d1
=
h1
.
GetY
()
d2
=
h2
.
GetY
()
y
=
h1
.
GetY
()
x1err_u
=
h1
.
GetEXhigh
()
x1err_d
=
h1
.
GetEXlow
()
x2err_u
=
h2
.
GetEXhigh
()
x2err_d
=
h2
.
GetEXlow
()
d1err_u
=
h1
.
GetEYhigh
()
d1err_d
=
h1
.
GetEYlow
()
d2err_u
=
h2
.
GetEYhigh
()
d2err_d
=
h2
.
GetEYlow
()
yerr_u
=
h1
.
GetEYhigh
()
yerr_d
=
h1
.
GetEYlow
()
xerr_u
=
h1
.
GetEXhigh
()
xerr_d
=
h1
.
GetEXlow
()
for
i
in
range
(
n
):
y
[
i
]
=
d1
[
i
]
-
d2
[
i
]
yerr_u
[
i
]
=
math
.
sqrt
(
d1err_u
[
i
]
*
d1err_u
[
i
]
+
d2err_u
[
i
]
*
d2err_u
[
i
])
yerr_d
[
i
]
=
math
.
sqrt
(
d1err_d
[
i
]
*
d1err_d
[
i
]
+
d2err_d
[
i
]
*
d2err_d
[
i
])
xerr_u
[
i
]
=
math
.
sqrt
(
x1err_u
[
i
]
*
x1err_u
[
i
]
+
x2err_u
[
i
]
*
x2err_u
[
i
])
xerr_d
[
i
]
=
math
.
sqrt
(
x1err_d
[
i
]
*
x1err_d
[
i
]
+
x2err_d
[
i
]
*
x2err_d
[
i
])
D
=
ROOT
.
TGraphAsymmErrors
(
n
,
x
,
y
,
xerr_d
,
xerr_u
,
yerr_d
,
yerr_u
)
return
D
def
diff2_1DG
(
h1
,
h2
)
:
n
=
h1
.
GetN
()
V
=
0.0
d1
=
h1
.
GetY
()
d2
=
h2
.
GetY
()
for
i
in
range
(
n
):
v1
=
d1
[
i
]
v2
=
d2
[
i
]
V
+=
(
v1
-
v2
)
*
(
v1
-
v2
)
return
V
def
diff_1DH
(
h1
,
h2
)
:
n
=
h1
.
GetNbinsX
()
V
=
0.0
for
i
in
range
(
n
):
v1
=
h1
.
GetBinContent
(
i
+
1
)
v2
=
h2
.
GetBinContent
(
i
+
1
)
V
+=
math
.
fabs
(
v1
-
v2
)
#print("v1dh=",v1,"v2dg=",v2,"diffdh=",V)
return
V
def
diff2_1DH
(
h1
,
h2
)
:
n
=
h1
.
GetNbinsX
()
V
=
0.0
for
i
in
range
(
n
):
v1
=
h1
.
GetBinContent
(
i
+
1
)
v2
=
h2
.
GetBinContent
(
i
+
1
)
V
+=
(
v1
-
v2
)
*
(
v1
-
v2
)
return
V
def
diff_2D
(
h1
,
h2
)
:
n1
=
h1
.
GetNbinsX
()
n2
=
h1
.
GetNbinsY
()
V
=
0.0
for
i
in
range
(
n1
)
:
for
j
in
range
(
n2
)
:
v1
=
h1
.
GetBinContent
(
i
+
1
,
j
+
1
)
v2
=
h2
.
GetBinContent
(
i
+
1
,
j
+
1
)
V
+=
math
.
fabs
(
v1
-
v2
)
#print("v12d=",v1,"v22d=",v2,"diff2d=",V)
return
V
def
diff2_2D
(
h1
,
h2
)
:
n1
=
h1
.
GetNbinsX
()
n2
=
h1
.
GetNbinsY
()
V
=
0.0
for
i
in
range
(
n1
)
:
for
j
in
range
(
n2
)
:
v1
=
h1
.
GetBinContent
(
i
+
1
,
j
+
1
)
v2
=
h2
.
GetBinContent
(
i
+
1
,
j
+
1
)
V
+=
(
v1
-
v2
)
*
(
v1
-
v2
)
return
V
class
PrCheckerMRDifferenceHandler
(
BaseHandler
):
def
__init__
(
self
):
super
(
self
.
__class__
,
self
).
__init__
()
def
collectResultsExt
(
self
,
directory
,
project
,
version
,
platform
,
hostname
,
cpu_info
,
memoryinfo
,
startTime
,
endTime
,
options
):
#logfile = os.path.join(directory, 'run.log')
#rootfile = grepPattern('INFO Writing ROOT histograms to: (\S+)' , open(logfile, 'r', encoding='ISO-8859-1').read() )
#inputfile = ROOT.TFile.Open(os.path.join(directory,rootfile), 'read')
inputfile1
=
ROOT
.
TFile
.
Open
(
os
.
path
.
join
(
directory
,
'
Brunel-1000ev-histos_20201110_def.root
'
),
'
read
'
)
inputfile2
=
ROOT
.
TFile
.
Open
(
os
.
path
.
join
(
directory
,
'
Brunel-1000ev-histos_20201203_misaligned.root
'
),
'
read
'
)
outputfile2
=
ROOT
.
TFile
(
"
PrCheckerMRDifference_plots_diff.root
"
,
"
recreate
"
)
outputfile3
=
ROOT
.
TFile
(
"
PrCheckerMRDifference_plots_ldiff.root
"
,
"
recreate
"
)
from
.utils.LHCbStyle
import
setLHCbStyle
from
.utils.Legend
import
place_legend
setLHCbStyle
()
latex
=
ROOT
.
TLatex
()
latex
.
SetNDC
()
latex
.
SetTextSize
(
0.03
)
outputfile2
.
mkdir
(
'
long
'
)
outputfile2
.
mkdir
(
'
down
'
)
outputfile2
.
mkdir
(
'
forward
'
)
outputfile2
.
mkdir
(
'
velo
'
)
outputfile2
.
mkdir
(
'
ttrack
'
)
outputfile2
.
mkdir
(
'
basic
'
)
outputfile3
.
mkdir
(
'
long
'
)
outputfile3
.
mkdir
(
'
down
'
)
outputfile3
.
mkdir
(
'
forward
'
)
outputfile3
.
mkdir
(
'
velo
'
)
outputfile3
.
mkdir
(
'
ttrack
'
)
outputfile3
.
mkdir
(
'
basic
'
)
effPlots_long
=
getEffPlots_long
()
eff_dict_long
=
effPlotsDict_long
()
effPlots_down
=
getEffPlots_down
()
eff_dict_down
=
effPlotsDict_down
()
effPlots_forward
=
getEffPlots_forward
()
eff_dict_forward
=
effPlotsDict_forward
()
effPlots_velo
=
getEffPlots_velo
()
eff_dict_velo
=
effPlotsDict_velo
()
effPlots_ttrack
=
getEffPlots_ttrack
()
eff_dict_ttrack
=
effPlotsDict_ttrack
()
effPlots_2D_long
=
getEffPlots_2D_long
()
eff_dict_2D_long
=
effPlotsDict_2D_long
()
effPlots_2D_down
=
getEffPlots_2D_down
()
eff_dict_2D_down
=
effPlotsDict_2D_down
()
effPlots_2D_forward
=
getEffPlots_2D_forward
()
eff_dict_2D_forward
=
effPlotsDict_2D_forward
()
effPlots_2D_velo
=
getEffPlots_2D_velo
()
eff_dict_2D_velo
=
effPlotsDict_2D_velo
()
effPlots_2D_ttrack
=
getEffPlots_2D_ttrack
()
eff_dict_2D_ttrack
=
effPlotsDict_2D_ttrack
()
effPlots_basic
=
getEffPlots_basic
()
eff_dict_basic
=
effPlotsDict_basic
()
for
effPlot
in
effPlots_long
:
##UPDATE
effNom1
=
inputfile1
.
Get
(
eff_dict_long
[
effPlot
][
"
path
"
]
+
"
_reconstructed
"
)
effDenom1
=
inputfile1
.
Get
(
eff_dict_long
[
effPlot
][
"
path
"
]
+
"
_reconstructible
"
)
canvas_eff
=
ROOT
.
TCanvas
(
effPlot
,
effPlot
)
efficiency1
=
ROOT
.
TGraphAsymmErrors
()
efficiency1
.
SetName
(
effPlot
+
"
_tracking_efficiency
"
)
efficiency1
.
Divide
(
effNom1
,
effDenom1
,
"
w
"
)
effNom2
=
inputfile2
.
Get
(
eff_dict_long
[
effPlot
][
"
path
"
]
+
"
_reconstructed
"
)
effDenom2
=
inputfile2
.
Get
(
eff_dict_long
[
effPlot
][
"
path
"
]
+
"
_reconstructible
"
)
efficiency2
=
ROOT
.
TGraphAsymmErrors
()
efficiency2
.
SetName
(
effPlot
+
"
_tracking_efficiency
"
)
efficiency2
.
Divide
(
effNom2
,
effDenom2
,
"
w
"
)
efficiency1
.
SetMarkerSize
(
0.5
)
efficiency1
.
SetLineWidth
(
0
)
efficiency1
.
SetMarkerColor
(
ROOT
.
kBlack
)
efficiency1
.
SetMarkerStyle
(
5
)
efficiency1
.
GetXaxis
().
SetLabelFont
(
132
)
efficiency1
.
GetXaxis
().
SetLabelSize
(
0.04
)
efficiency1
.
GetXaxis
().
SetTitleFont
(
132
)
efficiency1
.
GetXaxis
().
SetTitleSize
(
0.06
)
efficiency1
.
GetXaxis
().
SetTitleOffset
(
0.8
)
efficiency1
.
GetYaxis
().
SetLabelFont
(
132
)
efficiency1
.
GetYaxis
().
SetLabelSize
(
0.04
)
efficiency1
.
GetYaxis
().
SetTitleFont
(
132
)
efficiency1
.
GetYaxis
().
SetTitleSize
(
0.06
)
efficiency1
.
GetYaxis
().
SetDecimals
()
efficiency1
.
GetYaxis
().
SetTitleOffset
(
0.7
)
efficiency1
.
GetXaxis
().
SetTitle
(
eff_dict_long
[
effPlot
][
"
unit
"
])
efficiency1
.
GetYaxis
().
SetTitle
(
eff_dict_long
[
effPlot
][
"
unit_y
"
])
efficiency1
.
SetTitle
(
"
{path} reconstructed / reconstructible
"
.
format
(
path
=
eff_dict_long
[
effPlot
][
"
path
"
]))
efficiency2
.
SetMarkerColor
(
ROOT
.
kRed
)
diff1
=
diff_1DG
(
efficiency1
,
efficiency2
)
#diff2 = diff2_1DG(efficiency1,efficiency2)
if
diff1
>
0.0
:
outputfile2
.
cd
(
"
long
"
)
diff_graph
=
draw_diff
(
efficiency1
,
efficiency2
)
diff_graph
.
Draw
()
canvas_eff
.
Update
()
print
(
effPlot
,
"
_long
"
,
"
:
"
,
diff1
)
diff_graph
.
Write
(
effPlot
+
"
_tgraph
"
)
canvas_eff
.
Write
(
effPlot
+
"
_canvas
"
)
if
diff1
>
eff_dict_long
[
effPlot
][
"
cut
"
]
:
outputfile3
.
cd
(
"
long
"
)
print
(
effPlot
,
"
_long
"
,
"
:
"
,
diff1
)
diff_graph
.
Write
(
effPlot
+
"
_tgraph
"
)
canvas_eff
.
Write
(
effPlot
+
"
_canvas
"
)
for
effPlot
in
effPlots_down
:
effNom1
=
inputfile1
.
Get
(
eff_dict_down
[
effPlot
][
"
path
"
]
+
"
_reconstructed
"
)
effDenom1
=
inputfile1
.
Get
(
eff_dict_down
[
effPlot
][
"
path
"
]
+
"
_reconstructible
"
)
canvas_eff
=
ROOT
.
TCanvas
(
effPlot
,
effPlot
)
efficiency1
=
ROOT
.
TGraphAsymmErrors
()
efficiency1
.
SetName
(
effPlot
+
"
_tracking_efficiency
"
)
efficiency1
.
Divide
(
effNom1
,
effDenom1
,
"
w
"
)
effNom2
=
inputfile2
.
Get
(
eff_dict_down
[
effPlot
][
"
path
"
]
+
"
_reconstructed
"
)
effDenom2
=
inputfile2
.
Get
(
eff_dict_down
[
effPlot
][
"
path
"
]
+
"
_reconstructible
"
)
efficiency2
=
ROOT
.
TGraphAsymmErrors
()
efficiency2
.
SetName
(
effPlot
+
"
_tracking_efficiency
"
)
efficiency2
.
Divide
(
effNom2
,
effDenom2
,
"
w
"
)
efficiency1
.
SetMarkerSize
(
0.5
)
efficiency1
.
SetLineWidth
(
0
)
efficiency1
.
SetMarkerColor
(
ROOT
.
kBlack
)
efficiency1
.
SetMarkerStyle
(
5
)
efficiency1
.
GetXaxis
().
SetLabelFont
(
132
)
efficiency1
.
GetXaxis
().
SetLabelSize
(
0.04
)
efficiency1
.
GetXaxis
().
SetTitleFont
(
132
)
efficiency1
.
GetXaxis
().
SetTitleSize
(
0.06
)
efficiency1
.
GetXaxis
().
SetTitleOffset
(
0.8
)
efficiency1
.
GetYaxis
().
SetLabelFont
(
132
)
efficiency1
.
GetYaxis
().
SetLabelSize
(
0.04
)
efficiency1
.
GetYaxis
().
SetTitleFont
(
132
)
efficiency1
.
GetYaxis
().
SetTitleSize
(
0.06
)
efficiency1
.
GetYaxis
().
SetDecimals
()
efficiency1
.
GetYaxis
().
SetTitleOffset
(
0.7
)
efficiency1
.
GetXaxis
().
SetTitle
(
eff_dict_down
[
effPlot
][
"
unit
"
])
efficiency1
.
GetYaxis
().
SetTitle
(
eff_dict_down
[
effPlot
][
"
unit_y
"
])
efficiency1
.
SetTitle
(
"
{path} reconstructed / reconstructible
"
.
format
(
path
=
eff_dict_down
[
effPlot
][
"
path
"
]))
efficiency2
.
SetMarkerColor
(
ROOT
.
kRed
)
diff1
=
diff_1DG
(
efficiency1
,
efficiency2
)
#diff2 = diff2_1DG(efficiency1,efficiency2)
if
diff1
>
0.0
:
outputfile2
.
cd
(
"
down
"
)
diff_graph
=
draw_diff
(
efficiency1
,
efficiency2
)
print
(
effPlot
,
"
_down
"
,
"
:
"
,
diff1
)
diff_graph
.
Draw
()
canvas_eff
.
Update
()
diff_graph
.
Write
(
effPlot
+
"
_tgraph
"
)
canvas_eff
.
Write
(
effPlot
+
"
_canvas
"
)
if
diff1
>
eff_dict_down
[
effPlot
][
"
cut
"
]
:
outputfile3
.
cd
(
"
down
"
)
print
(
effPlot
,
"
_down
"
,
"
:
"
,
diff1
)
diff_graph
.
Write
(
effPlot
+
"
_tgraph
"
)
canvas_eff
.
Write
(
effPlot
+
"
_canvas
"
)
for
effPlot
in
effPlots_forward
:
effNom1
=
inputfile1
.
Get
(
eff_dict_forward
[
effPlot
][
"
path
"
]
+
"
_reconstructed
"
)
effDenom1
=
inputfile1
.
Get
(
eff_dict_forward
[
effPlot
][
"
path
"
]
+
"
_reconstructible
"
)
canvas_eff
=
ROOT
.
TCanvas
(
effPlot
,
effPlot
)
efficiency1
=
ROOT
.
TGraphAsymmErrors
()
efficiency1
.
SetName
(
effPlot
+
"
_tracking_efficiency
"
)
efficiency1
.
Divide
(
effNom1
,
effDenom1
,
"
w
"
)
effNom2
=
inputfile2
.
Get
(
eff_dict_forward
[
effPlot
][
"
path
"
]
+
"
_reconstructed
"
)
effDenom2
=
inputfile2
.
Get
(
eff_dict_forward
[
effPlot
][
"
path
"
]
+
"
_reconstructible
"
)
efficiency2
=
ROOT
.
TGraphAsymmErrors
()
efficiency2
.
SetName
(
effPlot
+
"
_tracking_efficiency
"
)
efficiency2
.
Divide
(
effNom2
,
effDenom2
,
"
w
"
)
efficiency1
.
SetMarkerSize
(
0.5
)
efficiency1
.
SetLineWidth
(
0
)
efficiency1
.
SetMarkerColor
(
ROOT
.
kBlack
)
efficiency1
.
SetMarkerStyle
(
5
)
efficiency1
.
GetXaxis
().
SetLabelFont
(
132
)
efficiency1
.
GetXaxis
().
SetLabelSize
(
0.04
)
efficiency1
.
GetXaxis
().
SetTitleFont
(
132
)
efficiency1
.
GetXaxis
().
SetTitleSize
(
0.06
)
efficiency1
.
GetXaxis
().
SetTitleOffset
(
0.8
)
efficiency1
.
GetYaxis
().
SetLabelFont
(
132
)
efficiency1
.
GetYaxis
().
SetLabelSize
(
0.04
)
efficiency1
.
GetYaxis
().
SetTitleFont
(
132
)
efficiency1
.
GetYaxis
().
SetTitleSize
(
0.06
)
efficiency1
.
GetYaxis
().
SetDecimals
()
efficiency1
.
GetYaxis
().
SetTitleOffset
(
0.7
)
efficiency1
.
GetXaxis
().
SetTitle
(
eff_dict_forward
[
effPlot
][
"
unit
"
])
efficiency1
.
GetYaxis
().
SetTitle
(
eff_dict_forward
[
effPlot
][
"
unit_y
"
])
efficiency1
.
SetTitle
(
"
{path} reconstructed / reconstructible
"
.
format
(
path
=
eff_dict_forward
[
effPlot
][
"
path
"
]))
diff1
=
diff_1DG
(
efficiency1
,
efficiency2
)
#diff2 = diff2_1DG(efficiency1,efficiency2)
if
diff1
>
0.0
:
outputfile2
.
cd
(
"
forward
"
)
diff_graph
=
draw_diff
(
efficiency1
,
efficiency2
)
diff_graph
.
Draw
()
canvas_eff
.
Update
()
print
(
effPlot
,
"
_forward
"
,
"
:
"
,
diff1
)
diff_graph
.
Write
(
effPlot
+
"
_tgraph
"
)
canvas_eff
.
Write
(
effPlot
+
"
_canvas
"
)
if
diff1
>
eff_dict_forward
[
effPlot
][
"
cut
"
]
:
outputfile3
.
cd
(
"
forward
"
)
print
(
effPlot
,
"
_forward
"
,
"
:
"
,
diff1
)
diff_graph
.
Write
(
effPlot
+
"
_tgraph
"
)
canvas_eff
.
Write
(
effPlot
+
"
_canvas
"
)
for
effPlot
in
effPlots_velo
:
effNom1
=
inputfile1
.
Get
(
eff_dict_velo
[
effPlot
][
"
path
"
]
+
"
_reconstructed
"
)
effDenom1
=
inputfile1
.
Get
(
eff_dict_velo
[
effPlot
][
"
path
"
]
+
"
_reconstructible
"
)
canvas_eff
=
ROOT
.
TCanvas
(
effPlot
,
effPlot
)
efficiency1
=
ROOT
.
TGraphAsymmErrors
()
efficiency1
.
SetName
(
effPlot
+
"
_tracking_efficiency
"
)
efficiency1
.
Divide
(
effNom1
,
effDenom1
,
"
w
"
)
effNom2
=
inputfile2
.
Get
(
eff_dict_velo
[
effPlot
][
"
path
"
]
+
"
_reconstructed
"
)
effDenom2
=
inputfile2
.
Get
(
eff_dict_velo
[
effPlot
][
"
path
"
]
+
"
_reconstructible
"
)
efficiency2
=
ROOT
.
TGraphAsymmErrors
()
efficiency2
.
SetName
(
effPlot
+
"
_tracking_efficiency
"
)
efficiency2
.
Divide
(
effNom2
,
effDenom2
,
"
w
"
)
efficiency1
.
SetMarkerSize
(
0.5
)
efficiency1
.
SetLineWidth
(
0
)
efficiency1
.
SetMarkerColor
(
ROOT
.
kBlack
)
efficiency1
.
SetMarkerStyle
(
5
)
efficiency1
.
GetXaxis
().
SetLabelFont
(
132
)
efficiency1
.
GetXaxis
().
SetLabelSize
(
0.04
)
efficiency1
.
GetXaxis
().
SetTitleFont
(
132
)
efficiency1
.
GetXaxis
().
SetTitleSize
(
0.06
)
efficiency1
.
GetXaxis
().
SetTitleOffset
(
0.8
)
efficiency1
.
GetYaxis
().
SetLabelFont
(
132
)
efficiency1
.
GetYaxis
().
SetLabelSize
(
0.04
)
efficiency1
.
GetYaxis
().
SetTitleFont
(
132
)
efficiency1
.
GetYaxis
().
SetTitleSize
(
0.06
)
efficiency1
.
GetYaxis
().
SetDecimals
()
efficiency1
.
GetYaxis
().
SetTitleOffset
(
0.7
)
efficiency1
.
GetXaxis
().
SetTitle
(
eff_dict_velo
[
effPlot
][
"
unit
"
])
efficiency1
.
GetYaxis
().
SetTitle
(
eff_dict_velo
[
effPlot
][
"
unit_y
"
])
efficiency1
.
SetTitle
(
"
{path} reconstructed / reconstructible
"
.
format
(
path
=
eff_dict_velo
[
effPlot
][
"
path
"
]))
diff1
=
diff_1DG
(
efficiency1
,
efficiency2
)
#diff2 = diff2_1DG(efficiency1,efficiency2)
if
diff1
>
0.0
:
outputfile2
.
cd
(
"
velo
"
)
diff_graph
=
draw_diff
(
efficiency1
,
efficiency2
)
diff_graph
.
Draw
()
canvas_eff
.
Update
()
print
(
effPlot
,
"
_velo
"
,
"
:
"
,
diff1
)
diff_graph
.
Write
(
effPlot
+
"
_tgraph
"
)
canvas_eff
.
Write
(
effPlot
+
"
_canvas
"
)
if
diff1
>
eff_dict_velo
[
effPlot
][
"
cut
"
]
:
outputfile3
.
cd
(
"
velo
"
)
print
(
effPlot
,
"
_velo
"
,
"
:
"
,
diff1
)
diff_graph
.
Write
(
effPlot
+
"
_tgraph
"
)
canvas_eff
.
Write
(
effPlot
+
"
_canvas
"
)
for
effPlot
in
effPlots_ttrack
:
effNom1
=
inputfile1
.
Get
(
eff_dict_ttrack
[
effPlot
][
"
path
"
]
+
"
_reconstructed
"
)
effDenom1
=
inputfile1
.
Get
(
eff_dict_ttrack
[
effPlot
][
"
path
"
]
+
"
_reconstructible
"
)
canvas_eff
=
ROOT
.
TCanvas
(
effPlot
,
effPlot
)
efficiency1
=
ROOT
.
TGraphAsymmErrors
()
efficiency1
.
SetName
(
effPlot
+
"
_tracking_efficiency
"
)
efficiency1
.
Divide
(
effNom1
,
effDenom1
,
"
w
"
)
effNom2
=
inputfile2
.
Get
(
eff_dict_ttrack
[
effPlot
][
"
path
"
]
+
"
_reconstructed
"
)
effDenom2
=
inputfile2
.
Get
(
eff_dict_ttrack
[
effPlot
][
"
path
"
]
+
"
_reconstructible
"
)
efficiency2
=
ROOT
.
TGraphAsymmErrors
()
efficiency2
.
SetName
(
effPlot
+
"
_tracking_efficiency
"
)
efficiency2
.
Divide
(
effNom2
,
effDenom2
,
"
w
"
)
efficiency1
.
SetMarkerSize
(
0.5
)
efficiency1
.
SetLineWidth
(
0
)
efficiency1
.
SetMarkerColor
(
ROOT
.
kBlack
)
efficiency1
.
SetMarkerStyle
(
5
)
efficiency1
.
GetXaxis
().
SetLabelFont
(
132
)
efficiency1
.
GetXaxis
().
SetLabelSize
(
0.04
)
efficiency1
.
GetXaxis
().
SetTitleFont
(
132
)
efficiency1
.
GetXaxis
().
SetTitleSize
(
0.06
)
efficiency1
.
GetXaxis
().
SetTitleOffset
(
0.8
)
efficiency1
.
GetYaxis
().
SetLabelFont
(
132
)
efficiency1
.
GetYaxis
().
SetLabelSize
(
0.04
)
efficiency1
.
GetYaxis
().
SetTitleFont
(
132
)
efficiency1
.
GetYaxis
().
SetTitleSize
(
0.06
)
efficiency1
.
GetYaxis
().
SetDecimals
()
efficiency1
.
GetYaxis
().
SetTitleOffset
(
0.7
)
efficiency1
.
GetXaxis
().
SetTitle
(
eff_dict_ttrack
[
effPlot
][
"
unit
"
])
efficiency1
.
GetYaxis
().
SetTitle
(
eff_dict_ttrack
[
effPlot
][
"
unit_y
"
])
efficiency1
.
SetTitle
(
"
{path} reconstructed / reconstructible
"
.
format
(
path
=
eff_dict_ttrack
[
effPlot
][
"
path
"
]))
diff1
=
diff_1DG
(
efficiency1
,
efficiency2
)
#diff2 = diff2_1D(efficiency1,efficiency2)
if
diff1
>
0.0
:
outputfile2
.
cd
(
"
ttrack
"
)
diff_graph
=
draw_diff
(
efficiency1
,
efficiency2
)
diff_graph
.
Draw
()
canvas_eff
.
Update
()
print
(
effPlot
,
"
_ttrack
"
,
"
:
"
,
diff1
)
diff_graph
.
Write
(
effPlot
+
"
_tgraph
"
)
canvas_eff
.
Write
(
effPlot
+
"
_canvas
"
)
if
diff1
>
eff_dict_ttrack
[
effPlot
][
"
cut
"
]
:
outputfile3
.
cd
(
"
ttrack
"
)
print
(
effPlot
,
"
_ttrack
"
,
"
:
"
,
diff1
)
diff_graph
.
Write
(
effPlot
+
"
_tgraph
"
)
canvas_eff
.
Write
(
effPlot
+
"
_canvas
"
)
for
effPlot
in
effPlots_2D_long
:
effNom1
=
inputfile1
.
Get
(
eff_dict_2D_long
[
effPlot
][
"
path
"
]
+
"
_reconstructed
"
)
effDenom1
=
inputfile1
.
Get
(
eff_dict_2D_long
[
effPlot
][
"
path
"
]
+
"
_reconstructible
"
)
effNom1
.
Sumw2
()
effDenom1
.
Sumw2
()
canvas_eff
=
ROOT
.
TCanvas
(
effPlot
,
effPlot
)
efficiency1
=
effNom1
.
Clone
()
efficiency1
.
Divide
(
effDenom1
)
efficiency1
.
SetName
(
effPlot
+
"
_tracking_efficiency
"
)
effNom2
=
inputfile2
.
Get
(
eff_dict_2D_long
[
effPlot
][
"
path
"
]
+
"
_reconstructed
"
)
effDenom2
=
inputfile2
.
Get
(
eff_dict_2D_long
[
effPlot
][
"
path
"
]
+
"
_reconstructible
"
)
effNom2
.
Sumw2
()
effDenom2
.
Sumw2
()
efficiency2
=
effNom2
.
Clone
()
efficiency2
.
Divide
(
effDenom2
)
efficiency2
.
SetName
(
effPlot
+
"
_tracking_efficiency
"
)
efficiency1
.
SetMarkerSize
(
0.5
)
efficiency1
.
SetLineWidth
(
0
)
efficiency1
.
SetMarkerColor
(
ROOT
.
kBlack
)
efficiency1
.
SetMarkerStyle
(
5
)
efficiency1
.
GetXaxis
().
SetLabelFont
(
132
)
efficiency1
.
GetXaxis
().
SetLabelSize
(
0.04
)
efficiency1
.
GetXaxis
().
SetTitleFont
(
132
)
efficiency1
.
GetXaxis
().
SetTitleSize
(
0.06
)
efficiency1
.
GetXaxis
().
SetTitleOffset
(
0.8
)
efficiency1
.
GetYaxis
().
SetLabelFont
(
132
)
efficiency1
.
GetYaxis
().
SetLabelSize
(
0.04
)
efficiency1
.
GetYaxis
().
SetTitleFont
(
132
)
efficiency1
.
GetYaxis
().
SetTitleSize
(
0.06
)
efficiency1
.
GetYaxis
().
SetDecimals
()
efficiency1
.
GetYaxis
().
SetTitleOffset
(
0.7
)
efficiency1
.
GetXaxis
().
SetTitle
(
eff_dict_2D_long
[
effPlot
][
"
unit
"
])
efficiency1
.
GetYaxis
().
SetTitle
(
eff_dict_2D_long
[
effPlot
][
"
unit_y
"
])
efficiency1
.
SetTitle
(
"
{path} reconstructed / reconstructible
"
.
format
(
path
=
eff_dict_2D_long
[
effPlot
][
"
path
"
]))
diff1
=
diff_2D
(
efficiency1
,
efficiency2
)
#diff2 = diff2_2D(efficiency1,efficiency2)
if
diff1
>
0.0
:
outputfile2
.
cd
(
"
long
"
)
efficiency1
.
Add
(
efficiency2
,
-
1
)
efficiency1
.
Draw
(
"
colz
"
)
canvas_eff
.
Update
()
print
(
effPlot
,
"
_2Dlong
"
,
"
:
"
,
diff1
)
efficiency1
.
Write
(
effPlot
+
"
_tgraph
"
)
canvas_eff
.
Write
(
effPlot
+
"
_canvas
"
)
if
diff1
>
eff_dict_2D_long
[
effPlot
][
"
cut
"
]
:
outputfile3
.
cd
(
"
long
"
)
print
(
effPlot
,
"
_2Dlong
"
,
"
:
"
,
diff1
)
efficiency1
.
Write
(
effPlot
+
"
_tgraph
"
)
canvas_eff
.
Write
(
effPlot
+
"
_canvas
"
)
for
effPlot
in
effPlots_2D_down
:
effNom1
=
inputfile1
.
Get
(
eff_dict_2D_down
[
effPlot
][
"
path
"
]
+
"
_reconstructed
"
)
effDenom1
=
inputfile1
.
Get
(
eff_dict_2D_down
[
effPlot
][
"
path
"
]
+
"
_reconstructible
"
)
canvas_eff
=
ROOT
.
TCanvas
(
effPlot
,
effPlot
)
efficiency1
=
effNom1
.
Clone
()
efficiency1
.
Divide
(
effDenom1
)
efficiency1
.
SetName
(
effPlot
+
"
_tracking_efficiency
"
)
effNom2
=
inputfile2
.
Get
(
eff_dict_2D_down
[
effPlot
][
"
path
"
]
+
"
_reconstructed
"
)
effDenom2
=
inputfile2
.
Get
(
eff_dict_2D_down
[
effPlot
][
"
path
"
]
+
"
_reconstructible
"
)
efficiency2
=
effNom2
.
Clone
()
efficiency2
.
Divide
(
effDenom2
)
efficiency2
.
SetName
(
effPlot
+
"
_tracking_efficiency
"
)
efficiency1
.
SetMarkerSize
(
0.5
)
efficiency1
.
SetLineWidth
(
0
)
efficiency1
.
SetMarkerColor
(
ROOT
.
kBlack
)
efficiency1
.
SetMarkerStyle
(
5
)
efficiency1
.
GetXaxis
().
SetLabelFont
(
132
)
efficiency1
.
GetXaxis
().
SetLabelSize
(
0.04
)
efficiency1
.
GetXaxis
().
SetTitleFont
(
132
)
efficiency1
.
GetXaxis
().
SetTitleSize
(
0.06
)
efficiency1
.
GetXaxis
().
SetTitleOffset
(
0.8
)
efficiency1
.
GetYaxis
().
SetLabelFont
(
132
)
efficiency1
.
GetYaxis
().
SetLabelSize
(
0.04
)
efficiency1
.
GetYaxis
().
SetTitleFont
(
132
)
efficiency1
.
GetYaxis
().
SetTitleSize
(
0.06
)
efficiency1
.
GetYaxis
().
SetDecimals
()
efficiency1
.
GetYaxis
().
SetTitleOffset
(
0.7
)
efficiency1
.
GetXaxis
().
SetTitle
(
eff_dict_2D_down
[
effPlot
][
"
unit
"
])
efficiency1
.
GetYaxis
().
SetTitle
(
eff_dict_2D_down
[
effPlot
][
"
unit_y
"
])
efficiency1
.
SetTitle
(
"
{path} reconstructed / reconstructible
"
.
format
(
path
=
eff_dict_2D_down
[
effPlot
][
"
path
"
]))
diff1
=
diff_2D
(
efficiency1
,
efficiency2
)
#diff2 = diff2_2D(efficiency1,efficiency2)
if
diff1
>
0.0
:
outputfile2
.
cd
(
"
down
"
)
efficiency1
.
Add
(
efficiency2
,
-
1
)
efficiency1
.
Draw
(
"
colz
"
)
canvas_eff
.
Update
()
print
(
effPlot
,
"
_2Ddown
"
,
"
:
"
,
diff1
)
efficiency1
.
Write
(
effPlot
+
"
_tgraph
"
)
canvas_eff
.
Write
(
effPlot
+
"
_canvas
"
)
if
diff1
>
eff_dict_2D_down
[
effPlot
][
"
cut
"
]
:
outputfile3
.
cd
(
"
down
"
)
print
(
effPlot
,
"
_2Ddown
"
,
"
:
"
,
diff1
)
efficiency1
.
Write
(
effPlot
+
"
_tgraph
"
)
canvas_eff
.
Write
(
effPlot
+
"
_canvas
"
)
for
effPlot
in
effPlots_2D_forward
:
effNom1
=
inputfile1
.
Get
(
eff_dict_2D_forward
[
effPlot
][
"
path
"
]
+
"
_reconstructed
"
)
effDenom1
=
inputfile1
.
Get
(
eff_dict_2D_forward
[
effPlot
][
"
path
"
]
+
"
_reconstructible
"
)
canvas_eff
=
ROOT
.
TCanvas
(
effPlot
,
effPlot
)
efficiency1
=
effNom1
.
Clone
()
efficiency1
.
Divide
(
effDenom1
)
efficiency1
.
SetName
(
effPlot
+
"
_tracking_efficiency
"
)
effNom2
=
inputfile2
.
Get
(
eff_dict_2D_forward
[
effPlot
][
"
path
"
]
+
"
_reconstructed
"
)
effDenom2
=
inputfile2
.
Get
(
eff_dict_2D_forward
[
effPlot
][
"
path
"
]
+
"
_reconstructible
"
)
efficiency2
=
effNom2
.
Clone
()
efficiency2
.
Divide
(
effDenom2
)
efficiency2
.
SetName
(
effPlot
+
"
_tracking_efficiency
"
)
efficiency1
.
SetMarkerSize
(
0.5
)
efficiency1
.
SetLineWidth
(
0
)
efficiency1
.
SetMarkerColor
(
ROOT
.
kBlack
)
efficiency1
.
SetMarkerStyle
(
5
)
efficiency1
.
GetXaxis
().
SetLabelFont
(
132
)
efficiency1
.
GetXaxis
().
SetLabelSize
(
0.04
)
efficiency1
.
GetXaxis
().
SetTitleFont
(
132
)
efficiency1
.
GetXaxis
().
SetTitleSize
(
0.06
)
efficiency1
.
GetXaxis
().
SetTitleOffset
(
0.8
)
efficiency1
.
GetYaxis
().
SetLabelFont
(
132
)
efficiency1
.
GetYaxis
().
SetLabelSize
(
0.04
)
efficiency1
.
GetYaxis
().
SetTitleFont
(
132
)
efficiency1
.
GetYaxis
().
SetTitleSize
(
0.06
)
efficiency1
.
GetYaxis
().
SetDecimals
()
efficiency1
.
GetYaxis
().
SetTitleOffset
(
0.7
)
efficiency1
.
GetXaxis
().
SetTitle
(
eff_dict_2D_forward
[
effPlot
][
"
unit
"
])
efficiency1
.
GetYaxis
().
SetTitle
(
eff_dict_2D_forward
[
effPlot
][
"
unit_y
"
])
efficiency1
.
SetTitle
(
"
{path} reconstructed / reconstructible
"
.
format
(
path
=
eff_dict_2D_forward
[
effPlot
][
"
path
"
]))
diff1
=
diff_2D
(
efficiency1
,
efficiency2
)
#diff2 = diff2_2D(efficiency1,efficiency2)
if
diff1
>
0.0
:
outputfile2
.
cd
(
"
forward
"
)
efficiency1
.
Add
(
efficiency2
,
-
1
)
efficiency1
.
Draw
(
"
colz
"
)
canvas_eff
.
Update
()
print
(
effPlot
,
"
_2Dforward
"
,
"
:
"
,
diff1
)
efficiency1
.
Write
(
effPlot
+
"
_tgraph
"
)
canvas_eff
.
Write
(
effPlot
+
"
_canvas
"
)
if
diff1
>
eff_dict_2D_forward
[
effPlot
][
"
cut
"
]
:
outputfile3
.
cd
(
"
forward
"
)
print
(
effPlot
,
"
_2Dforward
"
,
"
:
"
,
diff1
)
efficiency1
.
Write
(
effPlot
+
"
_tgraph
"
)
canvas_eff
.
Write
(
effPlot
+
"
_canvas
"
)
for
effPlot
in
effPlots_2D_velo
:
effNom1
=
inputfile1
.
Get
(
eff_dict_2D_velo
[
effPlot
][
"
path
"
]
+
"
_reconstructed
"
)
effDenom1
=
inputfile1
.
Get
(
eff_dict_2D_velo
[
effPlot
][
"
path
"
]
+
"
_reconstructible
"
)
canvas_eff
=
ROOT
.
TCanvas
(
effPlot
,
effPlot
)
efficiency1
=
effNom1
.
Clone
()
efficiency1
.
Divide
(
effDenom1
)
efficiency1
.
SetName
(
effPlot
+
"
_tracking_efficiency
"
)
effNom2
=
inputfile2
.
Get
(
eff_dict_2D_velo
[
effPlot
][
"
path
"
]
+
"
_reconstructed
"
)
effDenom2
=
inputfile2
.
Get
(
eff_dict_2D_velo
[
effPlot
][
"
path
"
]
+
"
_reconstructible
"
)
efficiency2
=
effNom2
.
Clone
()
efficiency2
.
Divide
(
effDenom2
)
efficiency2
.
SetName
(
effPlot
+
"
_tracking_efficiency
"
)
efficiency1
.
SetMarkerSize
(
0.5
)
efficiency1
.
SetLineWidth
(
0
)
efficiency1
.
SetMarkerColor
(
ROOT
.
kBlack
)
efficiency1
.
SetMarkerStyle
(
5
)
efficiency1
.
GetXaxis
().
SetLabelFont
(
132
)
efficiency1
.
GetXaxis
().
SetLabelSize
(
0.04
)
efficiency1
.
GetXaxis
().
SetTitleFont
(
132
)
efficiency1
.
GetXaxis
().
SetTitleSize
(
0.06
)
efficiency1
.
GetXaxis
().
SetTitleOffset
(
0.8
)
efficiency1
.
GetYaxis
().
SetLabelFont
(
132
)
efficiency1
.
GetYaxis
().
SetLabelSize
(
0.04
)
efficiency1
.
GetYaxis
().
SetTitleFont
(
132
)
efficiency1
.
GetYaxis
().
SetTitleSize
(
0.06
)
efficiency1
.
GetYaxis
().
SetDecimals
()
efficiency1
.
GetYaxis
().
SetTitleOffset
(
0.7
)
efficiency1
.
GetXaxis
().
SetTitle
(
eff_dict_2D_velo
[
effPlot
][
"
unit
"
])
efficiency1
.
GetYaxis
().
SetTitle
(
eff_dict_2D_velo
[
effPlot
][
"
unit_y
"
])
efficiency1
.
SetTitle
(
"
{path} reconstructed / reconstructible
"
.
format
(
path
=
eff_dict_2D_velo
[
effPlot
][
"
path
"
]))
efficiency2
.
SetMarkerColor
(
ROOT
.
kRed
)
diff1
=
diff_2D
(
efficiency1
,
efficiency2
)
#diff2 = diff2_2D(efficiency1,efficiency2)
if
diff1
>
0.0
:
outputfile2
.
cd
(
"
velo
"
)
efficiency1
.
Add
(
efficiency2
,
-
1
)
efficiency1
.
Draw
(
"
colz
"
)
canvas_eff
.
Update
()
print
(
effPlot
,
"
_2Dvelo
"
,
"
:
"
,
diff1
)
efficiency1
.
Write
(
effPlot
+
"
_tgraph
"
)
canvas_eff
.
Write
(
effPlot
+
"
_canvas
"
)
if
diff1
>
eff_dict_2D_velo
[
effPlot
][
"
cut
"
]
:
outputfile3
.
cd
(
"
velo
"
)
print
(
effPlot
,
"
_2Dvelo
"
,
"
:
"
,
diff1
)
efficiency1
.
Write
(
effPlot
+
"
_tgraph
"
)
canvas_eff
.
Write
(
effPlot
+
"
_canvas
"
)
for
effPlot
in
effPlots_2D_ttrack
:
effNom1
=
inputfile1
.
Get
(
eff_dict_2D_ttrack
[
effPlot
][
"
path
"
]
+
"
_reconstructed
"
)
effDenom1
=
inputfile1
.
Get
(
eff_dict_2D_ttrack
[
effPlot
][
"
path
"
]
+
"
_reconstructible
"
)
canvas_eff
=
ROOT
.
TCanvas
(
effPlot
,
effPlot
)
efficiency1
=
effNom1
.
Clone
()
efficiency1
.
Divide
(
effDenom1
)
efficiency1
.
SetName
(
effPlot
+
"
_tracking_efficiency
"
)
effNom2
=
inputfile2
.
Get
(
eff_dict_2D_ttrack
[
effPlot
][
"
path
"
]
+
"
_reconstructed
"
)
effDenom2
=
inputfile2
.
Get
(
eff_dict_2D_ttrack
[
effPlot
][
"
path
"
]
+
"
_reconstructible
"
)
efficiency2
=
effNom2
.
Clone
()
efficiency2
.
Divide
(
effDenom2
)
efficiency2
.
SetName
(
effPlot
+
"
_tracking_efficiency
"
)
efficiency1
.
SetMarkerSize
(
0.5
)
efficiency1
.
SetLineWidth
(
2
)
efficiency1
.
SetMarkerColor
(
ROOT
.
kBlack
)
efficiency1
.
SetMarkerStyle
(
5
)
efficiency1
.
GetXaxis
().
SetLabelFont
(
132
)
efficiency1
.
GetXaxis
().
SetLabelSize
(
0.04
)
efficiency1
.
GetXaxis
().
SetTitleFont
(
132
)
efficiency1
.
GetXaxis
().
SetTitleSize
(
0.06
)
efficiency1
.
GetXaxis
().
SetTitleOffset
(
0.8
)
efficiency1
.
GetYaxis
().
SetLabelFont
(
132
)
efficiency1
.
GetYaxis
().
SetLabelSize
(
0.04
)
efficiency1
.
GetYaxis
().
SetTitleFont
(
132
)
efficiency1
.
GetYaxis
().
SetTitleSize
(
0.06
)
efficiency1
.
GetYaxis
().
SetDecimals
()
efficiency1
.
GetYaxis
().
SetTitleOffset
(
0.7
)
efficiency1
.
GetXaxis
().
SetTitle
(
eff_dict_2D_ttrack
[
effPlot
][
"
unit
"
])
efficiency1
.
GetYaxis
().
SetTitle
(
eff_dict_2D_ttrack
[
effPlot
][
"
unit_y
"
])
efficiency1
.
SetTitle
(
"
{path} reconstructed / reconstructible
"
.
format
(
path
=
eff_dict_2D_ttrack
[
effPlot
][
"
path
"
]))
diff1
=
diff_2D
(
efficiency1
,
efficiency2
)
#diff2 = diff2_2D(efficiency1,efficiency2)
if
diff1
>
0.0
:
outputfile2
.
cd
(
"
ttrack
"
)
efficiency1
.
Add
(
efficiency2
,
-
1
)
efficiency1
.
Draw
(
"
colz
"
)
canvas_eff
.
Update
()
print
(
effPlot
,
"
_2Dttrack
"
,
"
:
"
,
diff1
)
efficiency1
.
Write
(
effPlot
+
"
_tgraph
"
)
canvas_eff
.
Write
(
effPlot
+
"
_canvas
"
)
if
diff1
>
eff_dict_2D_ttrack
[
effPlot
][
"
cut
"
]
:
outputfile3
.
cd
(
"
ttrack
"
)
print
(
effPlot
,
"
_2Dttrack
"
,
"
:
"
,
diff1
)
efficiency1
.
Write
(
effPlot
+
"
_tgraph
"
)
canvas_eff
.
Write
(
effPlot
+
"
_canvas
"
)
for
effPlot
in
effPlots_basic
:
effNom1
=
inputfile1
.
Get
(
eff_dict_basic
[
effPlot
][
"
path
"
])
canvas_eff
=
ROOT
.
TCanvas
(
effPlot
,
effPlot
)
efficiency1
=
effNom1
.
Clone
()
efficiency1
.
SetName
(
effPlot
)
effNom2
=
inputfile2
.
Get
(
eff_dict_basic
[
effPlot
][
"
path
"
])
efficiency2
=
effNom2
.
Clone
()
efficiency2
.
SetName
(
effPlot
)
efficiency1
.
SetMarkerSize
(
0.5
)
efficiency1
.
SetLineWidth
(
2
)
efficiency1
.
SetMarkerColor
(
ROOT
.
kBlack
)
efficiency1
.
SetMarkerStyle
(
5
)
efficiency1
.
GetXaxis
().
SetLabelFont
(
132
)
efficiency1
.
GetXaxis
().
SetLabelSize
(
0.04
)
efficiency1
.
GetXaxis
().
SetTitleFont
(
132
)
efficiency1
.
GetXaxis
().
SetTitleSize
(
0.06
)
efficiency1
.
GetXaxis
().
SetTitleOffset
(
0.8
)
efficiency1
.
GetYaxis
().
SetLabelFont
(
132
)
efficiency1
.
GetYaxis
().
SetLabelSize
(
0.04
)
efficiency1
.
GetYaxis
().
SetTitleFont
(
132
)
efficiency1
.
GetYaxis
().
SetTitleSize
(
0.06
)
efficiency1
.
GetYaxis
().
SetDecimals
()
efficiency1
.
GetYaxis
().
SetTitleOffset
(
0.7
)
efficiency1
.
GetXaxis
().
SetTitle
(
eff_dict_basic
[
effPlot
][
"
unit
"
])
efficiency1
.
GetYaxis
().
SetTitle
(
eff_dict_basic
[
effPlot
][
"
unit_y
"
])
efficiency1
.
SetTitle
(
"
{path}
"
.
format
(
path
=
eff_dict_basic
[
effPlot
][
"
path
"
]))
diff1
=
diff_1DH
(
efficiency1
,
efficiency2
)
#diff2 = diff2_1DH(efficiency1,efficiency2)
if
diff1
>
0.0
:
outputfile2
.
cd
(
"
basic
"
)
efficiency1
.
Add
(
efficiency2
,
-
1
)
efficiency1
.
Draw
(
""
)
canvas_eff
.
Update
()
print
(
effPlot
,
"
:
"
,
diff1
)
efficiency1
.
Write
(
effPlot
+
"
_tgraph
"
)
canvas_eff
.
Write
(
effPlot
+
"
_canvas
"
)
if
diff1
>
eff_dict_basic
[
effPlot
][
"
cut
"
]
:
outputfile3
.
cd
(
"
basic
"
)
print
(
effPlot
,
"
:
"
,
diff1
)
efficiency1
.
Write
(
effPlot
+
"
_tgraph
"
)
canvas_eff
.
Write
(
effPlot
+
"
_canvas
"
)
outputfile2
.
Write
()
outputfile2
.
Close
()
outputfile3
.
Write
()
outputfile3
.
Close
()
inputfile1
.
Close
()
inputfile2
.
Close
()
self
.
saveFile
(
'
PrCheckerMRDifference
'
,
'
PrCheckerMRDifference_plots_diff.root
'
)
self
.
saveFile
(
'
PrCheckerMRDifference
'
,
'
PrCheckerMRDifference_plots_ldiff.root
'
)
Loading