Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
detector_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
detector_benchmarks
Commits
11f59db3
Commit
11f59db3
authored
4 years ago
by
Jihee Kim
Browse files
Options
Downloads
Patches
Plain Diff
Added new variable detID and Modified volID.
parent
8f347391
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
calorimeters/simple_info_plot_histograms.cxx
+37
-8
37 additions, 8 deletions
calorimeters/simple_info_plot_histograms.cxx
with
37 additions
and
8 deletions
calorimeters/simple_info_plot_histograms.cxx
+
37
−
8
View file @
11f59db3
...
@@ -52,12 +52,13 @@ void simple_info_plot_histograms(const char* fname = "sim_output/output_zdc_phot
...
@@ -52,12 +52,13 @@ void simple_info_plot_histograms(const char* fname = "sim_output/output_zdc_phot
ROOT
::
RDataFrame
d0
(
*
t
);
//, {"ZDCHits","MCParticles"});
ROOT
::
RDataFrame
d0
(
*
t
);
//, {"ZDCHits","MCParticles"});
// Detector
dd4hep
::
Detector
&
detector
=
dd4hep
::
Detector
::
getInstance
();
dd4hep
::
Detector
&
detector
=
dd4hep
::
Detector
::
getInstance
();
detector
.
fromCompact
(
"./calorimeters/ZDC_example.xml"
);
detector
.
fromCompact
(
"./calorimeters/ZDC_example.xml"
);
// Volume
//dd4hep::VolumeManager volman = detector.volumeManager();
//volman.getVolumeManager(detector);
dd4hep
::
VolumeManager
volman
=
dd4hep
::
VolumeManager
::
getVolumeManager
(
detector
);
dd4hep
::
VolumeManager
volman
=
dd4hep
::
VolumeManager
::
getVolumeManager
(
detector
);
// CellID Coverter
dd4hep
::
rec
::
CellIDPositionConverter
cellid_converter
(
detector
);
// Number of hits
// Number of hits
auto
nhits
=
[]
(
std
::
vector
<
dd4hep
::
sim
::
Geant4Calorimeter
::
Hit
*>&
hits
){
return
(
int
)
hits
.
size
();
};
auto
nhits
=
[]
(
std
::
vector
<
dd4hep
::
sim
::
Geant4Calorimeter
::
Hit
*>&
hits
){
return
(
int
)
hits
.
size
();
};
...
@@ -72,6 +73,24 @@ void simple_info_plot_histograms(const char* fname = "sim_output/output_zdc_phot
...
@@ -72,6 +73,24 @@ void simple_info_plot_histograms(const char* fname = "sim_output/output_zdc_phot
// Volume ID
// Volume ID
auto
volID
=
[
&
]
(
const
std
::
vector
<
dd4hep
::
sim
::
Geant4Calorimeter
::
Hit
*>&
hits
)
{
auto
volID
=
[
&
]
(
const
std
::
vector
<
dd4hep
::
sim
::
Geant4Calorimeter
::
Hit
*>&
hits
)
{
std
::
vector
<
double
>
result
;
for
(
const
auto
&
h
:
hits
)
{
// method 1: use cell ID to get volume ID
auto
volcontext
=
cellid_converter
.
findContext
(
h
->
cellID
);
//auto volid = volcontext->identifier;
// method 2: use detector element, readout, segmentation, then volume ID
//dd4hep::Readout r = cellid_converter.findReadout(volcontext->element);
//dd4hep::Segmentation seg = r.segmentation();
//auto volid = seg.volumeID(h->cellID);
result
.
push_back
(
volcontext
->
identifier
);
}
return
result
;
};
// Detector ID
auto
detID
=
[
&
]
(
const
std
::
vector
<
dd4hep
::
sim
::
Geant4Calorimeter
::
Hit
*>&
hits
)
{
std
::
vector
<
double
>
result
;
std
::
vector
<
double
>
result
;
for
(
const
auto
&
h
:
hits
)
{
for
(
const
auto
&
h
:
hits
)
{
auto
detelement
=
volman
.
lookupDetector
(
h
->
cellID
);
auto
detelement
=
volman
.
lookupDetector
(
h
->
cellID
);
...
@@ -115,6 +134,7 @@ void simple_info_plot_histograms(const char* fname = "sim_output/output_zdc_phot
...
@@ -115,6 +134,7 @@ void simple_info_plot_histograms(const char* fname = "sim_output/output_zdc_phot
auto
d1
=
d0
.
Define
(
"nhits"
,
nhits
,
{
"ZDCHits"
})
auto
d1
=
d0
.
Define
(
"nhits"
,
nhits
,
{
"ZDCHits"
})
.
Define
(
"cellID"
,
cellID
,
{
"ZDCHits"
})
.
Define
(
"cellID"
,
cellID
,
{
"ZDCHits"
})
.
Define
(
"volID"
,
volID
,
{
"ZDCHits"
})
.
Define
(
"volID"
,
volID
,
{
"ZDCHits"
})
.
Define
(
"detID"
,
detID
,
{
"ZDCHits"
})
.
Define
(
"hit_x_position"
,
hit_x_position
,
{
"ZDCHits"
})
.
Define
(
"hit_x_position"
,
hit_x_position
,
{
"ZDCHits"
})
.
Define
(
"hit_y_position"
,
hit_y_position
,
{
"ZDCHits"
})
.
Define
(
"hit_y_position"
,
hit_y_position
,
{
"ZDCHits"
})
.
Define
(
"hit_z_position"
,
hit_z_position
,
{
"ZDCHits"
})
.
Define
(
"hit_z_position"
,
hit_z_position
,
{
"ZDCHits"
})
...
@@ -123,11 +143,12 @@ void simple_info_plot_histograms(const char* fname = "sim_output/output_zdc_phot
...
@@ -123,11 +143,12 @@ void simple_info_plot_histograms(const char* fname = "sim_output/output_zdc_phot
// Define Histograms
// Define Histograms
auto
h0
=
d1
.
Histo1D
({
"h0"
,
"nhits histogram; nhits; Events"
,
100
,
0
,
5000
},
"nhits"
);
auto
h0
=
d1
.
Histo1D
({
"h0"
,
"nhits histogram; nhits; Events"
,
100
,
0
,
5000
},
"nhits"
);
auto
h1
=
d1
.
Histo1D
({
"h1"
,
"hit
_x_
position histogram; hit
X
position [mm]; Events"
,
60
,
-
30
,
30
},
"hit_x_position"
);
auto
h1
=
d1
.
Histo1D
({
"h1"
,
"hit
position
X
histogram; hit position
X
[mm]; Events"
,
60
,
-
30
,
30
},
"hit_x_position"
);
auto
h2
=
d1
.
Histo1D
({
"h2"
,
"hit
_y_
position histogram; hit
Y
position [mm]; Events"
,
100
,
-
30
,
80
},
"hit_y_position"
);
auto
h2
=
d1
.
Histo1D
({
"h2"
,
"hit
position
Y
histogram; hit position
Y
[mm]; Events"
,
100
,
-
30
,
80
},
"hit_y_position"
);
auto
h3
=
d1
.
Histo1D
({
"h3"
,
"hit
_z_
position histogram; hit
Z
position [mm]; Events"
,
100
,
1000
,
1300
},
"hit_z_position"
);
auto
h3
=
d1
.
Histo1D
({
"h3"
,
"hit
position
Z
histogram; hit position
Z
[mm]; Events"
,
100
,
1000
,
1300
},
"hit_z_position"
);
auto
h4
=
d1
.
Histo1D
({
"h4"
,
"energy deposition histogram; energy deposition [GeV]; Events"
,
100
,
0
,
300
},
"e_dep"
);
auto
h4
=
d1
.
Histo1D
({
"h4"
,
"energy deposition histogram; energy deposition [GeV]; Events"
,
100
,
0
,
300
},
"e_dep"
);
auto
h5
=
d1
.
Histo1D
({
"h5"
,
"volume ID; volumeID; Events"
,
92
,
-
0.5
,
92.5
},
"volID"
);
auto
h5
=
d1
.
Histo1D
({
"h5"
,
"detector ID; detector ID; Events"
,
3
,
-
0.5
,
2.5
},
"detID"
);
auto
h6
=
d1
.
Histo1D
({
"h6"
,
"volume ID; volume ID; Events"
,
100
,
0
,
50000000
},
"volID"
);
auto
n0
=
d1
.
Filter
([](
int
n
){
return
(
n
>
0
);
},{
"nhits"
}).
Count
();
auto
n0
=
d1
.
Filter
([](
int
n
){
return
(
n
>
0
);
},{
"nhits"
}).
Count
();
...
@@ -173,12 +194,20 @@ void simple_info_plot_histograms(const char* fname = "sim_output/output_zdc_phot
...
@@ -173,12 +194,20 @@ void simple_info_plot_histograms(const char* fname = "sim_output/output_zdc_phot
c3
->
SaveAs
(
"sim_output/edep_histo_zdc_photons.png"
);
c3
->
SaveAs
(
"sim_output/edep_histo_zdc_photons.png"
);
TCanvas
*
c4
=
new
TCanvas
(
"c4"
,
"c4"
,
600
,
600
);
TCanvas
*
c4
=
new
TCanvas
(
"c4"
,
"c4"
,
600
,
600
);
c4
->
Divide
(
2
,
1
);
c4
->
SetLogy
(
0
);
c4
->
SetLogy
(
0
);
c4
->
cd
(
1
);
h5
->
GetYaxis
()
->
SetTitleOffset
(
2.0
);
h5
->
GetYaxis
()
->
SetTitleOffset
(
2.0
);
h5
->
SetLineWidth
(
2
);
h5
->
SetLineWidth
(
2
);
h5
->
SetLineColor
(
kBlack
);
h5
->
SetLineColor
(
kBlack
);
h5
->
DrawClone
();
h5
->
DrawClone
();
c4
->
SaveAs
(
"sim_output/volID_histo_zdc_photons.png"
);
c4
->
cd
(
2
);
h6
->
GetYaxis
()
->
SetTitleOffset
(
2.0
);
h6
->
SetLineWidth
(
2
);
h6
->
SetLineColor
(
kBlack
);
h6
->
DrawClone
();
c4
->
SaveAs
(
"sim_output/detID_volID_histo_zdc_photons.png"
);
if
(
*
n0
<
5
)
{
if
(
*
n0
<
5
)
{
std
::
quick_exit
(
1
);
std
::
quick_exit
(
1
);
...
...
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