Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
physics_benchmarks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
EIC
benchmarks
physics_benchmarks
Commits
f1c0c4b0
Commit
f1c0c4b0
authored
4 years ago
by
Marshall Scott
Committed by
Sylvester Joosten
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Wrote plotting function, fairly sure that the benchmark is more or less complete.
parent
4afb2a16
Branches
mars_dis_benchmark
No related tags found
1 merge request
!37
Ongoing dis_electron Q2 analysis. An issue with Q2 being basically zero for the electrons.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
benchmarks/dis/analysis/dis_electrons.cxx
+56
-51
56 additions, 51 deletions
benchmarks/dis/analysis/dis_electrons.cxx
with
56 additions
and
51 deletions
benchmarks/dis/analysis/dis_electrons.cxx
+
56
−
51
View file @
f1c0c4b0
...
@@ -28,6 +28,51 @@ double pBeamEnergy;
...
@@ -28,6 +28,51 @@ double pBeamEnergy;
double
gausMean
;
double
gausMean
;
double
gausSTD
;
double
gausSTD
;
// Makes Resolution plots from the input histograms
void
plot_resolutions
(
ROOT
::
RDF
::
RResultPtr
<
TH1D
>
h_res
,
ROOT
::
RDF
::
RResultPtr
<
TH1D
>
h_rel_res
,
std
::
string
varName
,
std
::
string
detName
,
std
::
string
outputPREFIX
)
{
TCanvas
c
{
"canvas"
,
"canvas"
,
1200
,
1200
};
c
.
cd
();
// gPad->SetLogx(false);
gPad
->
SetLogy
(
true
);
auto
&
h1
=
*
h_res
;
auto
&
h2
=
*
h_rel_res
;
// histogram style
h1
.
SetLineColor
(
plot
::
kMpBlue
);
h1
.
SetLineWidth
(
2
);
h2
.
SetLineColor
(
plot
::
kMpOrange
);
h2
.
SetLineWidth
(
2
);
// axes
h1
.
GetXaxis
()
->
CenterTitle
();
h1
.
GetYaxis
()
->
CenterTitle
();
h2
.
GetXaxis
()
->
CenterTitle
();
h2
.
GetYaxis
()
->
CenterTitle
();
// draw h1
h1
.
DrawClone
(
"hist"
);
plot
::
draw_label
(
eBeamEnergy
,
pBeamEnergy
,
detName
);
TText
*
tptr1
;
auto
t1
=
new
TPaveText
(
.6
,
.8417
,
.9
,
.925
,
"NB NDC"
);
t1
->
SetFillColorAlpha
(
kWhite
,
0
);
t1
->
SetTextFont
(
43
);
t1
->
SetTextSize
(
25
);
tptr1
=
t1
->
AddText
((
varName
+
" Resolution"
).
c_str
());
tptr1
->
SetTextColor
(
plot
::
kMpBlue
);
t1
->
Draw
();
c
.
Print
(
fmt
::
format
(
"{}{}_resolution.png"
,
outputPREFIX
,
varName
).
c_str
());
t1
->
Clear
();
// draw h2
h2
.
DrawClone
(
"hist"
);
plot
::
draw_label
(
eBeamEnergy
,
pBeamEnergy
,
detName
);
t1
->
SetFillColorAlpha
(
kWhite
,
0
);
t1
->
SetTextFont
(
43
);
t1
->
SetTextSize
(
25
);
tptr1
=
t1
->
AddText
((
varName
+
" Relative Resolution"
).
c_str
());
tptr1
->
SetTextColor
(
plot
::
kMpOrange
);
t1
->
Draw
();
c
.
Print
(
fmt
::
format
(
"{}{}_rel_resolution.png"
,
outputPREFIX
,
varName
).
c_str
());
}
// Get a vector of 4-momenta from the reconstructed data.
// Get a vector of 4-momenta from the reconstructed data.
inline
auto
inline
auto
momenta_from_reconstruction_pid
(
const
std
::
vector
<
eic
::
ReconstructedParticleData
>&
parts
)
momenta_from_reconstruction_pid
(
const
std
::
vector
<
eic
::
ReconstructedParticleData
>&
parts
)
...
@@ -56,7 +101,7 @@ inline auto momenta_from_simulation_pid(const std::vector<dd4pod::Geant4Particle
...
@@ -56,7 +101,7 @@ inline auto momenta_from_simulation_pid(const std::vector<dd4pod::Geant4Particle
}
}
// Finds particle with highest momentum within the event and returns the 4 Vector
// Finds particle with highest momentum within the event and returns the 4 Vector
// Current
k
y there is a cut so that only electrons are retained, but that can be changed
// Current
l
y there is a cut so that only electrons are retained, but that can be changed
// by chaning the PID
// by chaning the PID
inline
auto
find_scat
(
const
std
::
vector
<
std
::
pair
<
ROOT
::
Math
::
PxPyPzEVector
,
int
>>&
mom
)
inline
auto
find_scat
(
const
std
::
vector
<
std
::
pair
<
ROOT
::
Math
::
PxPyPzEVector
,
int
>>&
mom
)
{
{
...
@@ -79,6 +124,7 @@ inline auto Q2(ROOT::Math::PxPyPzEVector& mom)
...
@@ -79,6 +124,7 @@ inline auto Q2(ROOT::Math::PxPyPzEVector& mom)
}
}
// Multiplies a double by a gaussian distributed number
// Multiplies a double by a gaussian distributed number
// The mean and sigma(STD) are set in teh code further down
inline
auto
randomize
(
double
&
inDouble
)
inline
auto
randomize
(
double
&
inDouble
)
{
{
TRandom3
rand
(
0
);
TRandom3
rand
(
0
);
...
@@ -117,7 +163,7 @@ int dis_electrons(const std::string& config_name)
...
@@ -117,7 +163,7 @@ int dis_electrons(const std::string& config_name)
{
"target"
,
"0.1"
}}};
{
"target"
,
"0.1"
}}};
// Run this in multi-threaded mode if desired
// Run this in multi-threaded mode if desired
//
ROOT::EnableImplicitMT(kNumThreads);
ROOT
::
EnableImplicitMT
(
kNumThreads
);
// PIDs for reference
// PIDs for reference
// electron = 11
// electron = 11
...
@@ -132,7 +178,7 @@ int dis_electrons(const std::string& config_name)
...
@@ -132,7 +178,7 @@ int dis_electrons(const std::string& config_name)
// Gausian variable declarations
// Gausian variable declarations
gausMean
=
1.0
;
gausMean
=
1.0
;
gausSTD
=
0.
2
;
gausSTD
=
0.
1
;
const
double
electron_mass
=
util
::
get_pdg_mass
(
"electron"
);
const
double
electron_mass
=
util
::
get_pdg_mass
(
"electron"
);
...
@@ -169,7 +215,6 @@ int dis_electrons(const std::string& config_name)
...
@@ -169,7 +215,6 @@ int dis_electrons(const std::string& config_name)
.
Define
(
"elec_sim_Q2"
,
Q2
,
{
"elec_sim"
})
.
Define
(
"elec_sim_Q2"
,
Q2
,
{
"elec_sim"
})
.
Define
(
"dQ2"
,
"elec_recon_Q2_rand - elec_sim_Q2"
)
.
Define
(
"dQ2"
,
"elec_recon_Q2_rand - elec_sim_Q2"
)
.
Define
(
"dQ2_relative"
,
"(elec_recon_Q2_rand - elec_sim_Q2)/elec_sim_Q2"
);
.
Define
(
"dQ2_relative"
,
"(elec_recon_Q2_rand - elec_sim_Q2)/elec_sim_Q2"
);
// Testing script
// Testing script
/*
/*
//auto dis = d0.Display({"pt_recon", "elec_sim_Q2", "elec_recon_Q2"});
//auto dis = d0.Display({"pt_recon", "elec_sim_Q2", "elec_recon_Q2"});
...
@@ -185,15 +230,15 @@ int dis_electrons(const std::string& config_name)
...
@@ -185,15 +230,15 @@ int dis_electrons(const std::string& config_name)
// auto h_mom_sim = d0.Histo1D({"h_mom_sim", "; GeV; counts", 100, 0, 50}, "mom_sim");
// auto h_mom_sim = d0.Histo1D({"h_mom_sim", "; GeV; counts", 100, 0, 50}, "mom_sim");
// auto h_mom_rec = d0.Histo1D({"h_mom_rec", "; GeV; counts", 100, 0, 50}, "mom_rec");
// auto h_mom_rec = d0.Histo1D({"h_mom_rec", "; GeV; counts", 100, 0, 50}, "mom_rec");
// Q2
// Q2
Histograms
auto
h_Q2_sim
=
d0
.
Histo1D
({
"h_Q2_sim"
,
"; GeV^{2}; Counts"
,
50
,
0
,
25
},
"elec_sim_Q2"
);
//
auto h_Q2_sim = d0.Histo1D({"h_Q2_sim", "; GeV^{2}; Counts", 50, 0, 25}, "elec_sim_Q2");
auto
h_Q2_rec
=
d0
.
Histo1D
({
"h_Q2_rec"
,
"; GeV^{2}; Counts"
,
50
,
0
,
25
},
"elec_recon_Q2_rand"
);
//
auto h_Q2_rec = d0.Histo1D({"h_Q2_rec", "; GeV^{2}; Counts", 50, 0, 25}, "elec_recon_Q2_rand");
auto
h_Q2_res
=
auto
h_Q2_res
=
d0
.
Histo1D
({
"h_Q2_res"
,
"; Q^{2} Resolution (GeV^{2}); Counts"
,
50
,
-
120
,
120
},
"dQ2"
);
d0
.
Histo1D
({
"h_Q2_res"
,
"; Q^{2} Resolution (GeV^{2}); Counts"
,
50
,
-
120
,
120
},
"dQ2"
);
auto
h_Q2_rel_res
=
d0
.
Histo1D
(
auto
h_Q2_rel_res
=
d0
.
Histo1D
(
{
"h_Q2_rel_res"
,
"; Q^{2} Relative Resolution ; Counts"
,
50
,
-
2
,
2
},
"dQ2_relative"
);
{
"h_Q2_rel_res"
,
"; Q^{2} Relative Resolution ; Counts"
,
50
,
-
2
,
2
},
"dQ2_relative"
);
TFitResultPtr
f1
=
h_Q2_res
->
Fit
(
"gaus"
,
"S"
);
TFitResultPtr
f1
=
h_Q2_
rel_
res
->
Fit
(
"gaus"
,
"S"
);
const
double
*
res
=
f1
->
GetParams
();
const
double
*
res
=
f1
->
GetParams
();
if
(
res
[
2
]
<=
0.1
)
{
if
(
res
[
2
]
<=
0.1
)
{
dis_Q2_resolution
.
pass
(
res
[
2
]);
dis_Q2_resolution
.
pass
(
res
[
2
]);
...
@@ -207,6 +252,7 @@ int dis_electrons(const std::string& config_name)
...
@@ -207,6 +252,7 @@ int dis_electrons(const std::string& config_name)
// Plot our histograms.
// Plot our histograms.
// TODO: to start I'm explicitly plotting the histograms, but want to
// TODO: to start I'm explicitly plotting the histograms, but want to
// factorize out the plotting code moving forward.
// factorize out the plotting code moving forward.
/*
{
{
TCanvas c{"canvas", "canvas", 1200, 1200};
TCanvas c{"canvas", "canvas", 1200, 1200};
c.cd();
c.cd();
...
@@ -242,50 +288,9 @@ int dis_electrons(const std::string& config_name)
...
@@ -242,50 +288,9 @@ int dis_electrons(const std::string& config_name)
c.Print(fmt::format("{}momentum.png", output_prefix).c_str());
c.Print(fmt::format("{}momentum.png", output_prefix).c_str());
}
}
// Plot Q2 and Relatitive Q2
*/
{
plot_resolutions
(
h_Q2_res
,
h_Q2_rel_res
,
"Q2"
,
detector
,
output_prefix
);
TCanvas
c
{
"canvas"
,
"canvas"
,
1200
,
1200
};
c
.
cd
();
// gPad->SetLogx(false);
gPad
->
SetLogy
(
true
);
// auto& h1 = *h_mom_sim;
// auto& h2 = *h_mom_rec;
auto
&
h1
=
*
h_Q2_res
;
auto
&
h2
=
*
h_Q2_rel_res
;
// histogram style
h1
.
SetLineColor
(
plot
::
kMpBlue
);
h1
.
SetLineWidth
(
2
);
h2
.
SetLineColor
(
plot
::
kMpOrange
);
h2
.
SetLineWidth
(
2
);
// axes
h1
.
GetXaxis
()
->
CenterTitle
();
h1
.
GetYaxis
()
->
CenterTitle
();
h2
.
GetXaxis
()
->
CenterTitle
();
h2
.
GetYaxis
()
->
CenterTitle
();
// draw everything
h1
.
DrawClone
(
"hist"
);
plot
::
draw_label
(
eBeamEnergy
,
pBeamEnergy
,
detector
);
TText
*
tptr1
;
auto
t1
=
new
TPaveText
(
.6
,
.8417
,
.9
,
.925
,
"NB NDC"
);
t1
->
SetFillColorAlpha
(
kWhite
,
0
);
t1
->
SetTextFont
(
43
);
t1
->
SetTextSize
(
25
);
tptr1
=
t1
->
AddText
(
"Q^{2} Resolution"
);
tptr1
->
SetTextColor
(
plot
::
kMpBlue
);
t1
->
Draw
();
c
.
Print
(
fmt
::
format
(
"{}Q2_resolution.png"
,
output_prefix
).
c_str
());
t1
->
Clear
();
h2
.
DrawClone
(
"hist"
);
plot
::
draw_label
(
eBeamEnergy
,
pBeamEnergy
,
detector
);
t1
->
SetFillColorAlpha
(
kWhite
,
0
);
t1
->
SetTextFont
(
43
);
t1
->
SetTextSize
(
25
);
tptr1
=
t1
->
AddText
(
"Q^{2} Relative Resolution"
);
tptr1
->
SetTextColor
(
plot
::
kMpOrange
);
t1
->
Draw
();
c
.
Print
(
fmt
::
format
(
"{}Q2_rel_resolution.png"
,
output_prefix
).
c_str
());
}
eic
::
util
::
write_test
({
dis_Q2_resolution
},
fmt
::
format
(
"{}dis_electrons.json"
,
output_prefix
));
eic
::
util
::
write_test
({
dis_Q2_resolution
},
fmt
::
format
(
"{}dis_electrons.json"
,
output_prefix
));
return
0
;
return
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment