Skip to content
GitLab
About GitLab
GitLab: the DevOps platform
Explore GitLab
Install GitLab
How GitLab compares
Get started
GitLab docs
GitLab Learn
Pricing
Talk to an expert
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Projects
Groups
Snippets
Sign up now
Login
Sign in / Register
Toggle navigation
Menu
Open sidebar
EIC
benchmarks
reconstruction_benchmarks
Commits
d9a49def
Commit
d9a49def
authored
Jun 21, 2022
by
Wouter Deconinck
Browse files
ZDC analysis of reconstructed quantities
parent
3495a7dd
Changes
9
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
d9a49def
...
...
@@ -88,7 +88,7 @@ include:
final_report
:
stage
:
finish
needs
:
[
"
ecal_collect"
,
"
tracking_central_electrons"
,
"
clustering:results"
,
"
track_finding:collect"
,
"
track_fitting:collect"
]
needs
:
[
"
ecal_collect"
,
"
tracking_central_electrons"
,
"
clustering:results"
,
"
track_finding:collect"
,
"
track_fitting:collect"
,
"
far_forward:collect"
]
script
:
# disabled while we address ACTS issues
#- mkdir -p results/views && cd results/views && bash ../../bin/download_views
...
...
benchmarks/far_forward/analysis/analysis_zdc_neutrons.cxx
deleted
100644 → 0
View file @
3495a7dd
////////////////////////////////////////
// Read ROOT output file
// Plot variables
// Jihee Kim 09/2021
////////////////////////////////////////
#include
"ROOT/RDataFrame.hxx"
#include
<iostream>
#include
<vector>
#include
"edm4hep/MCParticleCollection.h"
#include
"edm4hep/SimCalorimeterHitCollection.h"
#include
"TCanvas.h"
#include
"TStyle.h"
#include
"TGaxis.h"
#include
"TPaveStats.h"
#include
"TMath.h"
#include
"TH1.h"
#include
"TF1.h"
#include
"TH1D.h"
#include
"TVector3.h"
R__LOAD_LIBRARY
(
libeicd
.
so
)
#include
"fmt/core.h"
#include
"DD4hep/Detector.h"
#include
"DDG4/Geant4Data.h"
#include
"DDRec/CellIDPositionConverter.h"
using
ROOT
::
RDataFrame
;
void
analysis_zdc_neutrons
(
const
char
*
input_fname
=
"sim_zdc_uniform_neutron.edm4hep.root"
)
{
// Setting for graphs
TStyle
*
kStyle
=
new
TStyle
(
"kStyle"
,
"Kim's Style"
);
kStyle
->
SetOptStat
(
"emr"
);
kStyle
->
SetOptTitle
(
0
);
kStyle
->
SetOptFit
(
1101
);
kStyle
->
SetStatColor
(
0
);
kStyle
->
SetStatW
(
0.15
);
kStyle
->
SetStatH
(
0.10
);
kStyle
->
SetStatX
(
0.9
);
kStyle
->
SetStatY
(
0.9
);
kStyle
->
SetStatBorderSize
(
1
);
kStyle
->
SetLabelSize
(
0.045
,
"xyz"
);
kStyle
->
SetTitleSize
(
0.045
,
"xyz"
);
kStyle
->
SetTitleOffset
(
1.2
,
"y"
);
kStyle
->
SetLineWidth
(
2
);
kStyle
->
SetTitleFont
(
42
,
"xyz"
);
kStyle
->
SetLabelFont
(
42
,
"xyz"
);
kStyle
->
SetCanvasDefW
(
700
);
kStyle
->
SetCanvasDefH
(
500
);
kStyle
->
SetCanvasColor
(
0
);
kStyle
->
SetPadTickX
(
1
);
kStyle
->
SetPadTickY
(
1
);
kStyle
->
SetPadGridX
(
1
);
kStyle
->
SetPadGridY
(
1
);
kStyle
->
SetPadLeftMargin
(
0.1
);
kStyle
->
SetPadRightMargin
(
0.1
);
kStyle
->
SetPadTopMargin
(
0.1
);
kStyle
->
SetPadBottomMargin
(
0.1
);
TGaxis
::
SetMaxDigits
(
3
);
gROOT
->
SetStyle
(
"kStyle"
);
ROOT
::
EnableImplicitMT
();
ROOT
::
RDataFrame
d0
(
"events"
,
input_fname
);
// Thrown Energy [GeV]
auto
Ethr
=
[](
const
std
::
vector
<
edm4hep
::
MCParticleData
>
&
input
)
{
auto
p
=
input
[
2
];
auto
energy
=
TMath
::
Sqrt
(
p
.
momentum
.
x
*
p
.
momentum
.
x
+
p
.
momentum
.
y
*
p
.
momentum
.
y
+
p
.
momentum
.
z
*
p
.
momentum
.
z
+
p
.
mass
*
p
.
mass
);
return
energy
;
};
// Theta [mrad]
auto
Thetathr
=
[](
const
std
::
vector
<
edm4hep
::
MCParticleData
>
&
input
)
{
auto
p
=
input
[
2
];
auto
theta
=
std
::
atan2
(
std
::
hypot
(
p
.
momentum
.
x
,
p
.
momentum
.
y
),
p
.
momentum
.
z
);
return
theta
*
1000.0
;
};
// Phi [rad]
auto
Phithr
=
[](
const
std
::
vector
<
edm4hep
::
MCParticleData
>
&
input
)
{
auto
p
=
input
[
2
];
auto
phi
=
std
::
atan2
(
p
.
momentum
.
y
,
p
.
momentum
.
x
);
return
phi
;
};
// Eta
auto
Etathr
=
[](
const
std
::
vector
<
edm4hep
::
MCParticleData
>
&
input
)
{
auto
p
=
input
[
2
];
auto
theta
=
std
::
atan2
(
std
::
hypot
(
p
.
momentum
.
x
,
p
.
momentum
.
y
),
p
.
momentum
.
z
);
auto
eta
=
-
std
::
log
(
std
::
tan
(
theta
/
2
));
return
eta
;
};
// Define variables
auto
d1
=
d0
.
Define
(
"Ethr"
,
Ethr
,
{
"MCParticles"
})
.
Define
(
"Thetathr"
,
Thetathr
,
{
"MCParticles"
})
.
Define
(
"Phithr"
,
Phithr
,
{
"MCParticles"
})
.
Define
(
"Etathr"
,
Etathr
,
{
"MCParticles"
})
;
// Define Histograms
auto
hEthr
=
d1
.
Histo1D
({
"hEthr"
,
"Thrown Energy; E_{thr} [GeV]; Events"
,
100
,
0.0
,
0.3
},
"Ethr"
);
auto
hThetathr
=
d1
.
Histo1D
({
"hThetathr"
,
"Thrown Theta; #theta_{thr} [mrad]; Events"
,
100
,
0.0
,
5.0
},
"Thetathr"
);
auto
hPhithr
=
d1
.
Histo1D
({
"hPhithr"
,
"Thrown Phi; #phi_{thr} [rad]; Events"
,
100
,
0.0
,
5.0
},
"Phithr"
);
auto
hEtathr
=
d1
.
Histo1D
({
"hEtathr"
,
"Thrown Eta; #eta_{thr}; Events"
,
100
,
6.0
,
15.0
},
"Etathr"
);
auto
hPhiThetathr
=
d1
.
Histo2D
({
"hPhiThetathr"
,
"Thrown Phi vs Theta; #theta_{thr} [mrad]; #phi_{thr}"
,
20
,
0.0
,
5.0
,
20
,
0.0
,
5.0
},
"Thetathr"
,
"Phithr"
);
// Event Counts
auto
nevents_thrown
=
d1
.
Count
();
std
::
cout
<<
"Number of Thrown Events: "
<<
(
*
nevents_thrown
)
<<
"
\n
"
;
// Draw Histograms
{
TCanvas
*
c1
=
new
TCanvas
(
"c1"
,
"c1"
);
auto
h
=
hEthr
->
DrawCopy
();
h
->
SetLineWidth
(
3
);
h
->
SetLineColor
(
kBlue
);
c1
->
SaveAs
(
"results/far_forward/zdc/zdc_neutron_Ethr.png"
);
c1
->
SaveAs
(
"results/far_forward/zdc/zdc_neutron_Ethr.pdf"
);
}
{
TCanvas
*
c2
=
new
TCanvas
(
"c2"
,
"c2"
);
auto
h
=
hThetathr
->
DrawCopy
();
h
->
SetLineWidth
(
3
);
h
->
SetLineColor
(
kBlue
);
c2
->
SaveAs
(
"results/far_forward/zdc/zdc_neutron_Thetathr.png"
);
c2
->
SaveAs
(
"results/far_forward/zdc/zdc_neutron_Thetathr.pdf"
);
}
{
TCanvas
*
c3
=
new
TCanvas
(
"c3"
,
"c3"
);
auto
h
=
hPhithr
->
DrawCopy
();
h
->
SetLineWidth
(
3
);
h
->
SetLineColor
(
kBlue
);
c3
->
SaveAs
(
"results/far_forward/zdc/zdc_neutron_Phithr.png"
);
c3
->
SaveAs
(
"results/far_forward/zdc/zdc_neutron_Phithr.pdf"
);
}
{
TCanvas
*
c4
=
new
TCanvas
(
"c4"
,
"c4"
);
auto
h
=
hEtathr
->
DrawCopy
();
h
->
SetLineWidth
(
3
);
h
->
SetLineColor
(
kBlue
);
c4
->
SaveAs
(
"results/far_forward/zdc/zdc_neutron_Etathr.png"
);
c4
->
SaveAs
(
"results/far_forward/zdc/zdc_neutron_Etathr.pdf"
);
}
{
TCanvas
*
c5
=
new
TCanvas
(
"c5"
,
"c5"
);
auto
h
=
hPhiThetathr
->
DrawCopy
(
"COLZ"
);
c5
->
SaveAs
(
"results/far_forward/zdc/zdc_neutron_PhiThetathr.png"
);
c5
->
SaveAs
(
"results/far_forward/zdc/zdc_neutron_PhiThetathr.pdf"
);
}
}
benchmarks/far_forward/analysis/analysis_zdc_particles.cxx
0 → 100644
View file @
d9a49def
////////////////////////////////////////
// Read ROOT output file
// Plot variables
// Jihee Kim 09/2021
////////////////////////////////////////
#include
"ROOT/RDataFrame.hxx"
#include
<iostream>
#include
<vector>
#include
"edm4hep/MCParticleCollection.h"
#include
"edm4hep/SimCalorimeterHitCollection.h"
#include
"eicd/ClusterCollection.h"
#include
"eicd/ClusterData.h"
#include
"TCanvas.h"
#include
"TStyle.h"
#include
"TGaxis.h"
#include
"TPaveStats.h"
#include
"TMath.h"
#include
"TH1.h"
#include
"TF1.h"
#include
"TH1D.h"
#include
"TVector3.h"
R__LOAD_LIBRARY
(
libeicd
.
so
)
#include
"fmt/core.h"
#include
"DD4hep/Detector.h"
#include
"DDG4/Geant4Data.h"
#include
"DDRec/CellIDPositionConverter.h"
using
ROOT
::
RDataFrame
;
void
analysis_zdc_particles
(
const
std
::
string
&
input_fname
=
"sim_zdc_uniform.edm4hep.root"
,
const
std
::
string
&
results_path
=
"results/far_forward/zdc/"
)
{
// Setting for graphs
TStyle
*
kStyle
=
new
TStyle
(
"kStyle"
,
"Kim's Style"
);
kStyle
->
SetOptStat
(
"emr"
);
kStyle
->
SetOptTitle
(
0
);
kStyle
->
SetOptFit
(
1101
);
kStyle
->
SetStatColor
(
0
);
kStyle
->
SetStatW
(
0.15
);
kStyle
->
SetStatH
(
0.10
);
kStyle
->
SetStatX
(
0.9
);
kStyle
->
SetStatY
(
0.9
);
kStyle
->
SetStatBorderSize
(
1
);
kStyle
->
SetLabelSize
(
0.045
,
"xyz"
);
kStyle
->
SetTitleSize
(
0.045
,
"xyz"
);
kStyle
->
SetTitleOffset
(
1.2
,
"y"
);
kStyle
->
SetLineWidth
(
2
);
kStyle
->
SetTitleFont
(
42
,
"xyz"
);
kStyle
->
SetLabelFont
(
42
,
"xyz"
);
kStyle
->
SetCanvasDefW
(
700
);
kStyle
->
SetCanvasDefH
(
500
);
kStyle
->
SetCanvasColor
(
0
);
kStyle
->
SetPadTickX
(
1
);
kStyle
->
SetPadTickY
(
1
);
kStyle
->
SetPadGridX
(
1
);
kStyle
->
SetPadGridY
(
1
);
kStyle
->
SetPadLeftMargin
(
0.1
);
kStyle
->
SetPadRightMargin
(
0.1
);
kStyle
->
SetPadTopMargin
(
0.1
);
kStyle
->
SetPadBottomMargin
(
0.1
);
TGaxis
::
SetMaxDigits
(
3
);
gROOT
->
SetStyle
(
"kStyle"
);
ROOT
::
EnableImplicitMT
();
ROOT
::
RDataFrame
d0
(
"events"
,
input_fname
);
// Thrown Energy [GeV]
auto
E_gen
=
[](
const
std
::
vector
<
edm4hep
::
MCParticleData
>
&
input
)
{
auto
p
=
input
[
2
];
auto
energy
=
TMath
::
Sqrt
(
p
.
momentum
.
x
*
p
.
momentum
.
x
+
p
.
momentum
.
y
*
p
.
momentum
.
y
+
p
.
momentum
.
z
*
p
.
momentum
.
z
+
p
.
mass
*
p
.
mass
);
return
energy
;
};
// Theta [rad]
auto
Theta_gen
=
[](
const
std
::
vector
<
edm4hep
::
MCParticleData
>
&
input
)
{
auto
p
=
input
[
2
];
auto
theta
=
std
::
atan2
(
std
::
hypot
(
p
.
momentum
.
x
,
p
.
momentum
.
y
),
p
.
momentum
.
z
);
return
theta
;
};
auto
Thetarec
=
[](
const
std
::
vector
<
eicd
::
ClusterData
>
&
input
)
{
std
::
vector
<
float
>
output
;
for
(
const
auto
&
c
:
input
)
{
auto
r
=
c
.
position
;
auto
theta
=
std
::
atan2
(
std
::
hypot
(
r
.
x
,
r
.
y
),
r
.
z
);
output
.
push_back
(
theta
);
}
return
output
;
};
// Phi [rad]
auto
Phi_gen
=
[](
const
std
::
vector
<
edm4hep
::
MCParticleData
>
&
input
)
{
auto
p
=
input
[
2
];
auto
phi
=
std
::
atan2
(
p
.
momentum
.
y
,
p
.
momentum
.
x
);
if
(
phi
<
0
)
phi
+=
2.
*
M_PI
;
return
phi
;
};
auto
Phirec
=
[](
const
std
::
vector
<
eicd
::
ClusterData
>
&
input
)
{
std
::
vector
<
float
>
output
;
for
(
const
auto
&
c
:
input
)
{
auto
r
=
c
.
position
;
auto
phi
=
std
::
atan2
(
r
.
y
,
r
.
x
);
if
(
phi
<
0
)
phi
+=
2.
*
M_PI
;
output
.
push_back
(
phi
);
}
return
output
;
};
// Eta
auto
Eta_gen
=
[](
const
std
::
vector
<
edm4hep
::
MCParticleData
>
&
input
)
{
auto
p
=
input
[
2
];
auto
theta
=
std
::
atan2
(
std
::
hypot
(
p
.
momentum
.
x
,
p
.
momentum
.
y
),
p
.
momentum
.
z
);
auto
eta
=
-
std
::
log
(
std
::
tan
(
theta
/
2
));
return
eta
;
};
auto
Etarec
=
[](
const
std
::
vector
<
eicd
::
ClusterData
>
&
input
)
{
std
::
vector
<
float
>
output
;
for
(
const
auto
&
c
:
input
)
{
auto
r
=
c
.
position
;
auto
theta
=
std
::
atan2
(
std
::
hypot
(
r
.
x
,
r
.
y
),
r
.
z
);
auto
eta
=
-
std
::
log
(
std
::
tan
(
theta
/
2
));
output
.
push_back
(
eta
);
}
return
output
;
};
// Define variables
auto
d1
=
d0
// Truth
.
Define
(
"E_gen"
,
E_gen
,
{
"MCParticles"
})
.
Define
(
"Theta_gen"
,
Theta_gen
,
{
"MCParticles"
})
.
Define
(
"Phi_gen"
,
Phi_gen
,
{
"MCParticles"
})
.
Define
(
"Eta_gen"
,
Eta_gen
,
{
"MCParticles"
})
// Ecal
.
Define
(
"E_Ecal"
,
{
"ZDCEcalClusters.energy"
})
.
Define
(
"Theta_Ecal"
,
Thetarec
,
{
"ZDCEcalClusters"
})
.
Define
(
"Phi_Ecal"
,
Phirec
,
{
"ZDCEcalClusters"
})
.
Define
(
"Eta_Ecal"
,
Etarec
,
{
"ZDCEcalClusters"
})
// HCal
.
Define
(
"E_Hcal"
,
{
"ZDCHcalClusters.energy"
})
.
Define
(
"Theta_Hcal"
,
Thetarec
,
{
"ZDCHcalClusters"
})
.
Define
(
"Phi_Hcal"
,
Phirec
,
{
"ZDCHcalClusters"
})
.
Define
(
"Eta_Hcal"
,
Etarec
,
{
"ZDCHcalClusters"
})
;
// Histogram boundaries
const
auto
E_nbins
=
100
;
const
auto
E_max
=
50.0
;
const
auto
theta_nbins
=
50
;
const
auto
theta_max
=
0.050
;
const
auto
phi_nbins
=
90
;
const
auto
phi_min
=
0.0
;
const
auto
phi_max
=
2.
*
M_PI
;
const
auto
eta_nbins
=
40
;
const
auto
eta_min
=
6.0
;
const
auto
eta_max
=
10.0
;
// Define Histograms
auto
hE_gen
=
d1
.
Histo1D
({
"hE_gen"
,
"Thrown Energy; E_{gen} [GeV]; Events"
,
E_nbins
,
0.0
,
E_max
},
"E_gen"
);
auto
hTheta_gen
=
d1
.
Histo1D
({
"hTheta_gen"
,
"Thrown Theta; #theta_{gen} [rad]; Events"
,
theta_nbins
,
0.0
,
theta_max
},
"Theta_gen"
);
auto
hPhi_gen
=
d1
.
Histo1D
({
"hPhi_gen"
,
"Thrown Phi; #phi_{gen} [rad]; Events"
,
phi_nbins
,
phi_min
,
phi_max
},
"Phi_gen"
);
auto
hEta_gen
=
d1
.
Histo1D
({
"hEta_gen"
,
"Thrown Eta; #eta_{gen}; Events"
,
eta_nbins
,
eta_min
,
eta_max
},
"Eta_gen"
);
auto
hPhiTheta_gen
=
d1
.
Histo2D
({
"hPhiTheta_gen"
,
"Thrown Phi vs Theta; #theta_{gen} [rad]; #phi_{gen}"
,
theta_nbins
,
0.0
,
theta_max
,
phi_nbins
,
phi_min
,
phi_max
},
"Theta_gen"
,
"Phi_gen"
);
auto
hE_Ecal
=
d1
.
Histo1D
({
"hE_Ecal"
,
"Reconstructed Ecal Energy; E_{rec} [GeV]; Events"
,
E_nbins
,
0.0
,
E_max
},
"E_Ecal"
);
auto
hTheta_Ecal
=
d1
.
Histo1D
({
"hTheta_Ecal"
,
"Reconstructed Ecal Theta; #theta_{rec} [rad]; Events"
,
theta_nbins
,
0.0
,
theta_max
},
"Theta_Ecal"
);
auto
hPhi_Ecal
=
d1
.
Histo1D
({
"hPhi_Ecal"
,
"Reconstructed Ecal Phi; #phi_{rec} [rad]; Events"
,
phi_nbins
,
phi_min
,
phi_max
},
"Phi_Ecal"
);
auto
hEta_Ecal
=
d1
.
Histo1D
({
"hEta_Ecal"
,
"Reconstructed Ecal Eta; #eta_{rec}; Events"
,
eta_nbins
,
eta_min
,
eta_max
},
"Eta_Ecal"
);
auto
hPhiTheta_Ecal
=
d1
.
Histo2D
({
"hPhiTheta_Ecal"
,
"Reconstructed Ecal Phi vs Theta; #theta_{rec} [rad]; #phi_{rec}"
,
theta_nbins
,
0.0
,
theta_max
,
phi_nbins
,
phi_min
,
phi_max
},
"Theta_Ecal"
,
"Phi_Ecal"
);
auto
hE_Hcal
=
d1
.
Histo1D
({
"hE_Hcal"
,
"Reconstructed Hcal Energy; E_{rec} [GeV]; Events"
,
E_nbins
,
0.0
,
E_max
},
"E_Hcal"
);
auto
hTheta_Hcal
=
d1
.
Histo1D
({
"hTheta_Hcal"
,
"Reconstructed Hcal Theta; #theta_{rec} [rad]; Events"
,
theta_nbins
,
0.0
,
theta_max
},
"Theta_Hcal"
);
auto
hPhi_Hcal
=
d1
.
Histo1D
({
"hPhi_Hcal"
,
"Reconstructed Hcal Phi; #phi_{rec} [rad]; Events"
,
phi_nbins
,
phi_min
,
phi_max
},
"Phi_Hcal"
);
auto
hEta_Hcal
=
d1
.
Histo1D
({
"hEta_Hcal"
,
"Reconstructed Hcal Eta; #eta_{rec}; Events"
,
eta_nbins
,
eta_min
,
eta_max
},
"Eta_Hcal"
);
auto
hPhiTheta_Hcal
=
d1
.
Histo2D
({
"hPhiTheta_Hcal"
,
"Reconstructed Hcal Phi vs Theta; #theta_{rec} [rad]; #phi_{rec}"
,
theta_nbins
,
0.0
,
theta_max
,
phi_nbins
,
phi_min
,
phi_max
},
"Theta_Hcal"
,
"Phi_Hcal"
);
// Event Counts
auto
nevents_thrown
=
d1
.
Count
();
std
::
cout
<<
"Number of Thrown Events: "
<<
(
*
nevents_thrown
)
<<
"
\n
"
;
// Draw Histograms
{
TCanvas
*
c1
=
new
TCanvas
(
"c1"
,
"c1"
);
auto
h
=
hE_gen
->
DrawCopy
();
h
->
SetLineWidth
(
3
);
h
->
SetLineColor
(
kBlue
);
c1
->
SaveAs
(
TString
(
results_path
+
"/zdc_E_gen.png"
));
c1
->
SaveAs
(
TString
(
results_path
+
"/zdc_E_gen.pdf"
));
}
{
TCanvas
*
c2
=
new
TCanvas
(
"c2"
,
"c2"
);
auto
h
=
hTheta_gen
->
DrawCopy
();
h
->
SetLineWidth
(
3
);
h
->
SetLineColor
(
kBlue
);
c2
->
SaveAs
(
TString
(
results_path
+
"/zdc_Theta_gen.png"
));
c2
->
SaveAs
(
TString
(
results_path
+
"/zdc_Theta_gen.pdf"
));
}
{
TCanvas
*
c3
=
new
TCanvas
(
"c3"
,
"c3"
);
auto
h
=
hPhi_gen
->
DrawCopy
();
h
->
SetLineWidth
(
3
);
h
->
SetLineColor
(
kBlue
);
c3
->
SaveAs
(
TString
(
results_path
+
"/zdc_Phi_gen.png"
));
c3
->
SaveAs
(
TString
(
results_path
+
"/zdc_Phi_gen.pdf"
));
}
{
TCanvas
*
c4
=
new
TCanvas
(
"c4"
,
"c4"
);
auto
h
=
hEta_gen
->
DrawCopy
();
h
->
SetLineWidth
(
3
);
h
->
SetLineColor
(
kBlue
);
c4
->
SaveAs
(
TString
(
results_path
+
"/zdc_Eta_gen.png"
));
c4
->
SaveAs
(
TString
(
results_path
+
"/zdc_Eta_gen.pdf"
));
}
{
TCanvas
*
c5
=
new
TCanvas
(
"c5"
,
"c5"
);
auto
h
=
hPhiTheta_gen
->
DrawCopy
(
"COLZ"
);
c5
->
SaveAs
(
TString
(
results_path
+
"/zdc_PhiTheta_gen.png"
));
c5
->
SaveAs
(
TString
(
results_path
+
"/zdc_PhiTheta_gen.pdf"
));
}
// Draw Histograms Ecal
{
TCanvas
*
c1
=
new
TCanvas
(
"c1"
,
"c1"
);
auto
h
=
hE_Ecal
->
DrawCopy
();
h
->
SetLineWidth
(
3
);
h
->
SetLineColor
(
kBlue
);
c1
->
SaveAs
(
TString
(
results_path
+
"/zdc_E_Ecal.png"
));
c1
->
SaveAs
(
TString
(
results_path
+
"/zdc_E_Ecal.pdf"
));
}
{
TCanvas
*
c2
=
new
TCanvas
(
"c2"
,
"c2"
);
auto
h
=
hTheta_Ecal
->
DrawCopy
();
h
->
SetLineWidth
(
3
);
h
->
SetLineColor
(
kBlue
);
c2
->
SaveAs
(
TString
(
results_path
+
"/zdc_Theta_Ecal.png"
));
c2
->
SaveAs
(
TString
(
results_path
+
"/zdc_Theta_Ecal.pdf"
));
}
{
TCanvas
*
c3
=
new
TCanvas
(
"c3"
,
"c3"
);
auto
h
=
hPhi_Ecal
->
DrawCopy
();
h
->
SetLineWidth
(
3
);
h
->
SetLineColor
(
kBlue
);
c3
->
SaveAs
(
TString
(
results_path
+
"/zdc_Phi_Ecal.png"
));
c3
->
SaveAs
(
TString
(
results_path
+
"/zdc_Phi_Ecal.pdf"
));
}
{
TCanvas
*
c4
=
new
TCanvas
(
"c4"
,
"c4"
);
auto
h
=
hEta_Ecal
->
DrawCopy
();
h
->
SetLineWidth
(
3
);
h
->
SetLineColor
(
kBlue
);
c4
->
SaveAs
(
TString
(
results_path
+
"/zdc_Eta_Ecal.png"
));
c4
->
SaveAs
(
TString
(
results_path
+
"/zdc_Eta_Ecal.pdf"
));
}
{
TCanvas
*
c5
=
new
TCanvas
(
"c5"
,
"c5"
);
auto
h
=
hPhiTheta_Ecal
->
DrawCopy
(
"COLZ"
);
c5
->
SaveAs
(
TString
(
results_path
+
"/zdc_PhiTheta_Ecal.png"
));
c5
->
SaveAs
(
TString
(
results_path
+
"/zdc_PhiTheta_Ecal.pdf"
));
}
// Draw Histograms Hcal
{
TCanvas
*
c1
=
new
TCanvas
(
"c1"
,
"c1"
);
auto
h
=
hE_Hcal
->
DrawCopy
();
h
->
SetLineWidth
(
3
);
h
->
SetLineColor
(
kBlue
);
c1
->
SaveAs
(
TString
(
results_path
+
"/zdc_E_Hcal.png"
));
c1
->
SaveAs
(
TString
(
results_path
+
"/zdc_E_Hcal.pdf"
));
}
{
TCanvas
*
c2
=
new
TCanvas
(
"c2"
,
"c2"
);
auto
h
=
hTheta_Hcal
->
DrawCopy
();
h
->
SetLineWidth
(
3
);
h
->
SetLineColor
(
kBlue
);
c2
->
SaveAs
(
TString
(
results_path
+
"/zdc_Theta_Hcal.png"
));
c2
->
SaveAs
(
TString
(
results_path
+
"/zdc_Theta_Hcal.pdf"
));
}
{
TCanvas
*
c3
=
new
TCanvas
(
"c3"
,
"c3"
);
auto
h
=
hPhi_Hcal
->
DrawCopy
();
h
->
SetLineWidth
(
3
);
h
->
SetLineColor
(
kBlue
);
c3
->
SaveAs
(
TString
(
results_path
+
"/zdc_Phi_Hcal.png"
));
c3
->
SaveAs
(
TString
(
results_path
+
"/zdc_Phi_Hcal.pdf"
));
}
{
TCanvas
*
c4
=
new
TCanvas
(
"c4"
,
"c4"
);
auto
h
=
hEta_Hcal
->
DrawCopy
();
h
->
SetLineWidth
(
3
);
h
->
SetLineColor
(
kBlue
);
c4
->
SaveAs
(
TString
(
results_path
+
"/zdc_Eta_Hcal.png"
));
c4
->
SaveAs
(
TString
(
results_path
+
"/zdc_Eta_Hcal.pdf"
));
}
{
TCanvas
*
c5
=
new
TCanvas
(
"c5"
,
"c5"
);
auto
h
=
hPhiTheta_Hcal
->
DrawCopy
(
"COLZ"
);
c5
->
SaveAs
(
TString
(
results_path
+
"/zdc_PhiTheta_Hcal.png"
));
c5
->
SaveAs
(
TString
(
results_path
+
"/zdc_PhiTheta_Hcal.pdf"
));
}
}
benchmarks/far_forward/analysis/analysis_zdc_photons.cxx
deleted
100644 → 0
View file @
3495a7dd
////////////////////////////////////////
// Read ROOT output file
// Plot variables
// Jihee Kim 09/2021
////////////////////////////////////////
#include
"ROOT/RDataFrame.hxx"
#include
<iostream>
#include
<vector>
#include
"edm4hep/MCParticleCollection.h"
#include
"edm4hep/CalorimeterHitCollection.h"
#include
"TCanvas.h"
#include
"TStyle.h"
#include
"TGaxis.h"
#include
"TPaveStats.h"
#include
"TMath.h"
#include
"TH1.h"
#include
"TF1.h"
#include
"TH1D.h"
#include
"TVector3.h"
R__LOAD_LIBRARY
(
libeicd
.
so
)
#include
"fmt/core.h"
#include
"DD4hep/Detector.h"
#include
"DDG4/Geant4Data.h"
#include
"DDRec/CellIDPositionConverter.h"
using
ROOT
::
RDataFrame
;
void
analysis_zdc_photons
(
const
char
*
input_fname
=
"sim_zdc_uniform_photon.edm4hep.root"
)
{
// Setting for graphs
TStyle
*
kStyle
=
new
TStyle
(
"kStyle"
,
"Kim's Style"
);
kStyle
->
SetOptStat
(
"emr"
);
kStyle
->
SetOptTitle
(
0
);
kStyle
->
SetOptFit
(
1101
);
kStyle
->
SetStatColor
(
0
);
kStyle
->
SetStatW
(
0.15
);
kStyle
->
SetStatH
(
0.10
);
kStyle
->
SetStatX
(
0.9
);
kStyle
->
SetStatY
(
0.9
);
kStyle
->
SetStatBorderSize
(
1
);
kStyle
->
SetLabelSize
(
0.045
,
"xyz"
);
kStyle
->
SetTitleSize
(
0.045
,
"xyz"
);
kStyle
->
SetTitleOffset
(
1.2
,
"y"
);
kStyle
->
SetLineWidth
(
2
);
kStyle
->
SetTitleFont
(
42
,
"xyz"
);
kStyle
->
SetLabelFont
(
42
,
"xyz"
);
kStyle
->
SetCanvasDefW
(
700
);
kStyle
->
SetCanvasDefH
(
500
);
kStyle
->
SetCanvasColor
(
0
);
kStyle
->
SetPadTickX
(
1
);
kStyle
->
SetPadTickY
(
1
);
kStyle
->
SetPadGridX
(
1
);
kStyle
->
SetPadGridY
(
1
);
kStyle
->
SetPadLeftMargin
(
0.1
);
kStyle
->
SetPadRightMargin
(
0.1
);
kStyle
->
SetPadTopMargin
(
0.1
);
kStyle
->
SetPadBottomMargin
(
0.1
);
TGaxis
::
SetMaxDigits
(
3
);
gROOT
->
SetStyle
(
"kStyle"
);
ROOT
::
EnableImplicitMT
();
ROOT
::
RDataFrame
d0
(
"events"
,
input_fname
);
// Thrown Energy [GeV]
auto
Ethr
=
[](
const
std
::
vector
<
edm4hep
::
MCParticleData
>
&
input
)
{
auto
p
=
input
[
2
];
auto
energy
=
TMath
::
Sqrt
(
p
.
momentum
.
x
*
p
.
momentum
.
x
+
p
.
momentum
.
y
*
p
.
momentum
.
y
+
p
.
momentum
.
z
*
p
.
momentum
.
z
+
p
.
mass
*
p
.
mass
);
return
energy
;
};
// Theta [mrad]
auto
Thetathr
=
[](
const
std
::
vector
<
edm4hep
::
MCParticleData
>
&
input
)
{
auto
p
=
input
[
2
];
auto
theta
=
std
::
atan2
(
std
::
hypot
(
p
.
momentum
.
x
,
p
.
momentum
.
y
),
p
.
momentum
.
z
);
return
theta
*
1000.0
;
};
// Phi [rad]
auto
Phithr
=
[](
const
std
::
vector
<
edm4hep
::
MCParticleData
>
&
input
)
{
auto
p
=
input
[
2
];
auto
phi
=
std
::
atan2
(
p
.
momentum
.
y
,
p
.
momentum
.
x
);
return
phi
;
};
// Eta
auto
Etathr
=
[](
const
std
::
vector
<
edm4hep
::
MCParticleData
>
&
input
)
{
auto
p
=
input
[
2
];
auto
theta
=
std
::
atan2
(
std
::
hypot
(
p
.
momentum
.
x
,
p
.
momentum
.
y
),
p
.
momentum
.
z
);
auto
eta
=
-
std
::
log
(
std
::
tan
(
theta
/
2
));
return
eta
;
};