Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LHCb
Allen
Commits
87e0df64
Commit
87e0df64
authored
Jun 21, 2019
by
Daniel Hugo Campora Perez
Browse files
Merge branch 'dovombru_fix_nice_plotting' into 'master'
fix nice plotting See merge request lhcb-parallelization/Allen!163
parents
eb496908
487eb30c
Pipeline
#933804
failed with stages
in 14 minutes and 1 second
Changes
7
Pipelines
6
Hide whitespace changes
Inline
Side-by-side
checker/plotting/common/ConfigHistos.py
View file @
87e0df64
...
...
@@ -31,7 +31,7 @@ def ghostHistoDict():
basedict
=
{
"eta"
:
{},
"nPV"
:
{}}
basedict
[
"eta"
][
"xTitle"
]
=
"#eta"
basedict
[
"eta"
][
"variable"
]
=
"
E
ta"
basedict
[
"eta"
][
"variable"
]
=
"
e
ta"
basedict
[
"nPV"
][
"xTitle"
]
=
"# of PVs"
basedict
[
"nPV"
][
"variable"
]
=
"nPV"
...
...
@@ -41,6 +41,7 @@ def ghostHistoDict():
def
getCuts
():
basedict
=
{
"Velo"
:
{},
"Upstream"
:
{},
"Forward"
:
{}}
# basedict["Forward"] = [
# "Long_eta25", "LongFromB_eta25"
# ]
...
...
checker/plotting/common/LHCbStyle.py
View file @
87e0df64
...
...
@@ -44,7 +44,7 @@ def setLHCbStyle():
# set the paper & margin sizes
lhcbStyle
.
SetPaperSize
(
20
,
26
)
lhcbStyle
.
SetPadTopMargin
(
0.05
)
lhcbStyle
.
SetPadRightMargin
(
0.0
8
)
# increase for colz plots
lhcbStyle
.
SetPadRightMargin
(
0.
1
0
)
# increase for colz plots
lhcbStyle
.
SetPadBottomMargin
(
0.16
)
lhcbStyle
.
SetPadLeftMargin
(
0.14
)
...
...
checker/plotting/common/Legend.py
View file @
87e0df64
...
...
@@ -116,7 +116,7 @@ def place_legend(canvas,
return
canvas
.
BuildLegend
(
0.5
,
0.67
,
0.88
,
0.88
,
header
,
option
)
def
find_place
(
canvas
,
x1
=
None
,
y1
=
None
,
x2
=
None
,
y2
=
None
):
def
find_place
(
canvas
,
default
=
3
,
x1
=
None
,
y1
=
None
,
x2
=
None
,
y2
=
None
):
# Make sure all objects are correctly registered
canvas
.
Update
()
...
...
@@ -135,7 +135,7 @@ def find_place(canvas, x1=None, y1=None, x2=None, y2=None):
continue
return
place
return
PLACES
[
3
]
# fallback solution
return
PLACES
[
default
]
# fallback solution
# Monkey patch ROOT objects to make it all work
...
...
checker/plotting/muon/muon_id_efficiency_plots.py
View file @
87e0df64
...
...
@@ -16,6 +16,7 @@ import ROOT
from
ROOT
import
gStyle
from
ROOT
import
gROOT
from
ROOT
import
TStyle
from
ROOT
import
TLegend
from
ROOT
import
gPad
from
ROOT
import
TMultiGraph
...
...
@@ -100,7 +101,33 @@ for category in muonCategories:
g_efficiency
.
GetYaxis
().
SetTitle
(
muonCatDict
[
category
][
"title"
])
g_efficiency
.
GetYaxis
().
SetRangeUser
(
0
,
1
)
# draw variable distribution in same canvas
norm
=
0.9
/
numerator
.
GetMaximum
()
numerator
.
Scale
(
norm
)
numerator
.
SetTitle
(
efficiencyHistoDict
[
histo
][
"title"
]
+
" distribution"
)
numerator
.
SetFillColorAlpha
(
ROOT
.
kBlack
,
0.2
)
numerator
.
SetLineColor
(
ROOT
.
kWhite
)
numerator
.
Draw
(
"hist bar same"
)
if
(
category
==
"matched_isMuon"
):
place
=
find_place
(
canvas
,
3
)
else
:
place
=
PLACES
[
0
]
#place = find_place(canvas, 0)
legend
=
TLegend
(
place
[
0
],
place
[
1
],
place
[
2
],
place
[
3
])
legend
.
AddEntry
(
g_efficiency
,
muonCatDict
[
category
][
"title"
],
"ep"
)
legend
.
AddEntry
(
numerator
,
efficiencyHistoDict
[
histo
][
"title"
]
+
" distribution"
,
"f"
)
legend
.
SetFillColorAlpha
(
ROOT
.
kWhite
,
0.
)
legend
.
Draw
(
"same"
)
canvas
.
Write
()
cleantitle
=
muonCatDict
[
category
][
"title"
].
replace
(
" "
,
""
).
replace
(
","
,
"_"
).
replace
(
"<"
,
"_"
)
canvas
.
SaveAs
(
"../../../plotsfornote/muonID_isMuon_"
+
histo
+
"_"
+
cleantitle
+
".pdf"
)
# ghost histos
for
histo
in
ghostHistos
:
...
...
@@ -127,6 +154,21 @@ for histo in ghostHistos:
g_efficiency
.
Draw
(
"ap"
)
g_efficiency
.
GetYaxis
().
SetRangeUser
(
0
,
1
)
# draw variable distribution in same canvas
norm
=
0.9
/
numerator
.
GetMaximum
()
numerator
.
Scale
(
norm
)
numerator
.
SetTitle
(
efficiencyHistoDict
[
histo
][
"title"
]
+
" distribution"
)
numerator
.
SetFillColorAlpha
(
ROOT
.
kBlack
,
0.2
)
numerator
.
SetLineColor
(
ROOT
.
kWhite
)
numerator
.
Draw
(
"hist bar same"
)
place
=
find_place
(
canvas
,
0
)
legend
=
TLegend
(
place
[
0
],
place
[
1
],
place
[
2
],
place
[
3
])
legend
.
AddEntry
(
g_efficiency
,
"muon ID in ghost tracks"
,
"ep"
)
legend
.
AddEntry
(
numerator
,
efficiencyHistoDict
[
histo
][
"title"
]
+
" distribution"
,
"f"
)
legend
.
Draw
(
"same"
)
canvas
.
Write
()
canvas
.
SaveAs
(
"../../../plotsfornote/muonID_isMuon_ghosts_"
+
histo
+
".pdf"
)
...
...
checker/plotting/tracking/efficiency_plots.py
View file @
87e0df64
...
...
@@ -21,6 +21,7 @@ from ROOT import TLegend
from
ROOT
import
gPad
from
ROOT
import
TMultiGraph
from
ROOT
import
THStack
from
ROOT
import
TMath
sys
.
path
.
append
(
'../'
)
from
common.LHCbStyle
import
*
...
...
@@ -39,7 +40,7 @@ def getTrackers():
def
getGhostHistoNames
():
#
return ["
eta
", "
nPV
"] # currently no eta information available from track
#return ["
nPV
", "
eta
"] # currently no eta information available from track
return
[
"nPV"
]
...
...
@@ -160,7 +161,7 @@ for tracker in trackers:
else
:
variable
.
SetTitle
(
efficiencyHistoDict
[
histo
][
"title"
]
+
" distribution"
)
variable
.
SetLineColor
(
ROOT
.
k
Black
)
variable
.
SetLineColor
(
ROOT
.
k
White
)
variable
.
SetFillColorAlpha
(
ROOT
.
kBlack
,
0.2
)
variable
.
Draw
(
"hist bar same"
)
...
...
@@ -175,11 +176,11 @@ for tracker in trackers:
variable_electrons
.
Scale
(
norm
)
variable_electrons
.
SetTitle
(
efficiencyHistoDict
[
histo
][
"title"
]
+
" distribution, electrons"
)
variable_electrons
.
SetLineColor
(
ROOT
.
k
Azure
-
3
)
variable_electrons
.
SetLineColor
(
ROOT
.
k
White
)
variable_electrons
.
SetFillColorAlpha
(
ROOT
.
kAzure
-
3
,
0.2
)
variable_electrons
.
Draw
(
"hist bar same"
)
place
=
find_place
(
canvas
)
place
=
find_place
(
canvas
,
3
)
legend
=
TLegend
(
place
[
0
],
place
[
1
],
place
[
2
],
place
[
3
])
if
categories
[
tracker
][
cut
][
"plotElectrons"
]:
legend
.
AddEntry
(
g_efficiency_notElectrons
,
...
...
@@ -202,8 +203,6 @@ for tracker in trackers:
" distribution, electrons"
,
"f"
)
legend
.
SetFillColorAlpha
(
ROOT
.
kWhite
,
0.
)
legend
.
Draw
(
"same"
)
#canvas.PlaceLegend("f")
#place_legend(canvas)
canvas
.
Write
()
cleantitle
=
categories
[
tracker
][
cut
][
"title"
].
replace
(
...
...
@@ -242,6 +241,26 @@ for tracker in trackers:
g_efficiency
.
GetYaxis
().
SetTitle
(
"ghost rate"
)
g_efficiency
.
Draw
(
"ap"
)
# draw variable distribution in same canvas
max_point
=
TMath
.
MaxElement
(
g_efficiency
.
GetN
(),
g_efficiency
.
GetY
())
norm
=
max_point
/
numerator
.
GetMaximum
()
print
(
"norm:"
)
print
(
norm
)
numerator
.
Scale
(
norm
)
numerator
.
SetTitle
(
efficiencyHistoDict
[
histo
][
"title"
]
+
" distribution"
)
numerator
.
SetFillColorAlpha
(
ROOT
.
kBlack
,
0.2
)
numerator
.
SetLineColor
(
ROOT
.
kWhite
)
numerator
.
Draw
(
"hist bar same"
)
place
=
find_place
(
canvas
)
legend
=
TLegend
(
place
[
0
],
place
[
1
],
place
[
2
],
place
[
3
])
legend
.
AddEntry
(
g_efficiency
,
"ghost rate"
,
"ep"
)
legend
.
AddEntry
(
numerator
,
efficiencyHistoDict
[
histo
][
"title"
]
+
" distribution"
,
"f"
)
legend
.
Draw
(
"same"
)
canvas
.
Write
()
canvas
.
SaveAs
(
"../../../plotsfornote/"
+
tracker
+
"GhostRate.pdf"
)
#canvas.Print("../../../output/checkerplots/forreviewdoc/"+histoBaseName.replace("/","_")+ghostHistoDict[histo]["variable"]+"_ghost.pdf")
...
...
checker/plotting/tracking/momentum_resolution.py
View file @
87e0df64
...
...
@@ -16,6 +16,8 @@ from ROOT import TStyle
from
ROOT
import
gPad
from
ROOT
import
TGraphErrors
from
array
import
array
from
ROOT
import
TMath
from
ROOT
import
TLegend
sys
.
path
.
append
(
'../'
)
from
common.LHCbStyle
import
*
...
...
@@ -100,9 +102,7 @@ def getResolutionInSlices(histo2D, var, var_dict):
gr
.
SetTitle
(
""
)
gr
.
SetName
(
name
)
gr
.
Write
()
canvas
.
Write
()
canvas
.
SaveAs
(
"../../../plotsfornote/"
+
tracker
+
"MomResVsP.pdf"
)
#gr.Write()
#name = "dp_vs_p_rms"
#title = "dp vs p, histogram RMS"
...
...
@@ -121,6 +121,19 @@ def getResolutionInSlices(histo2D, var, var_dict):
# overall momentum resolution
histo1D
=
histo2D
.
ProjectionY
(
"_py"
)
histo1D
.
Write
()
# plot distribution in same canvas
max_point
=
TMath
.
MaxElement
(
gr
.
GetN
(),
gr
.
GetY
())
norm
=
max_point
/
histo1D
.
GetMaximum
()
histo1D
.
Scale
(
norm
)
histo1D
.
SetFillColorAlpha
(
ROOT
.
kBlack
,
0.2
)
histo1D
.
SetLineColor
(
ROOT
.
kWhite
)
#histo1D.Draw("hist bar same")
canvas
.
Write
()
canvas
.
SaveAs
(
"../../../plotsfornote/"
+
tracker
+
"MomResVs"
+
var
+
".pdf"
)
histo1D
.
Fit
(
"gaus"
)
sigma_p
=
histo1D
.
GetFunction
(
"gaus"
).
GetParameter
(
2
)
delta_sigma_p
=
histo1D
.
GetFunction
(
"gaus"
).
GetParError
(
2
)
...
...
checker/tracking/src/TrackCheckerHistos.cpp
View file @
87e0df64
...
...
@@ -95,15 +95,10 @@ TrackCheckerHistos::TrackCheckerHistos(const std::vector<HistoCategory>& histo_c
std
::
make_unique
<
TH1D
>
(
"matched_isMuon_P_reconstructed"
,
"matched_isMuon_P_reconstructed"
,
10
,
0.
,
100000.
);
h_not_matched_isMuon_P_reconstructed
=
std
::
make_unique
<
TH1D
>
(
"not_matched_isMuon_P_reconstructed"
,
"not_matched_isMuon_P_reconstructed"
,
10
,
0.
,
100000.
);
h_muon_Pt_reconstructible
=
std
::
make_unique
<
TH1D
>
(
"muon_Pt_reconstructible"
,
"muon_Pt_reconstructible"
,
30
,
0.
,
100000.
);
h_not_muon_Pt_reconstructible
=
std
::
make_unique
<
TH1D
>
(
"not_muon_Pt_reconstructible"
,
"not_muon_Pt_reconstructible"
,
30
,
0.
,
100000.
);
h_matched_isMuon_Pt_reconstructed
=
std
::
make_unique
<
TH1D
>
(
"matched_isMuon_Pt_reconstructed"
,
"matched_isMuon_Pt_reconstructed"
,
30
,
0.
,
100000.
);
h_not_matched_isMuon_Pt_reconstructed
=
std
::
make_unique
<
TH1D
>
(
"not_matched_isMuon_Pt_reconstructed"
,
"not_matched_isMuon_Pt_reconstructed"
,
30
,
0.
,
100000.
);
h_muon_Pt_reconstructible
=
std
::
make_unique
<
TH1D
>
(
"muon_Pt_reconstructible"
,
"muon_Pt_reconstructible"
,
30
,
0.
,
5000.
);
h_not_muon_Pt_reconstructible
=
std
::
make_unique
<
TH1D
>
(
"not_muon_Pt_reconstructible"
,
"not_muon_Pt_reconstructible"
,
30
,
0.
,
5000.
);
h_matched_isMuon_Pt_reconstructed
=
std
::
make_unique
<
TH1D
>
(
"matched_isMuon_Pt_reconstructed"
,
"matched_isMuon_Pt_reconstructed"
,
30
,
0.
,
5000.
);
h_not_matched_isMuon_Pt_reconstructed
=
std
::
make_unique
<
TH1D
>
(
"not_matched_isMuon_Pt_reconstructed"
,
"not_matched_isMuon_Pt_reconstructed"
,
30
,
0.
,
5000.
);
h_muon_Phi_reconstructible
=
std
::
make_unique
<
TH1D
>
(
"muon_Phi_reconstructible"
,
"muon_Phi_reconstructible"
,
15
,
-
3.142
,
3.142
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment