Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
excercise3
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
Dowling Wong
excercise3
Commits
095b465a
Commit
095b465a
authored
6 months ago
by
Dowling_Wong
Browse files
Options
Downloads
Patches
Plain Diff
sync with jupyter server
parent
20a5bb1d
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ref/TP1_e3.ipynb
+73
-10
73 additions, 10 deletions
ref/TP1_e3.ipynb
ref/geant4_simulation/__pycache__/__init__.cpython-311.pyc
+0
-0
0 additions, 0 deletions
ref/geant4_simulation/__pycache__/__init__.cpython-311.pyc
ref/test.ipynb
+75
-0
75 additions, 0 deletions
ref/test.ipynb
with
148 additions
and
10 deletions
TP1_e3.ipynb
→
ref/
TP1_e3.ipynb
+
73
−
10
View file @
095b465a
...
...
@@ -5,17 +5,15 @@
"id": "a1c50278",
"metadata": {},
"source": [
"<hr style=\"height: 1px;\">\n",
"<i>This notebook was authored by the TP1 Course Team, Copyright 2024 KIT ETP All Rights Reserved.</i>\n",
"<hr style=\"height: 1px;\">\n",
"<br>\n",
"# Particle Physics 1\n",
"## Exercise 3: EMCAL in a Nutshell\n",
"**Institut für Experimentelle Teilchenphysik** <br>\n",
"Lecture: Prof. Dr. M. Klute, Dr. P. Goldenzweig <br>\n",
"Exercise: Dr. G. De Pietro <br>\n",
"Assistance: L. Reuter, J. Eppelt, S. Giappichini, dwong <br>\n",
"Hand-In: 16.11.2023\n",
"\n",
"<h1>(Draft)Exercise 3: EMCAL in a nutshell</h1>\n",
"\n",
"Some helpful links:<br>\n",
" * Google Colab (https://colab.research.google.com/): for Python development in your web-browser<br>\n",
" * Miniconda (https://docs.conda.io/en/latest/miniconda.html): a free minimal installer for conda<br>\n",
" * Numpy (https://numpy.org/doc/stable/user/quickstart.html): a widely used library for mathematical operations in Python<br>\n",
"\n",
"<h3>Navigation</h3>\n",
"\n",
...
...
@@ -35,6 +33,71 @@
"</table>"
]
},
{
"cell_type": "markdown",
"id": "b82039ad",
"metadata": {},
"source": [
"### Setup\n",
"\n",
"We will give a brief introduction to EMCAL and clustering. In the process, numpy, sklearn, uproot will be used."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b3619d05",
"metadata": {},
"outputs": [],
"source": [
"# !pip install sklearn\n",
"# !pip install uproot\n",
"import numpy as np\n",
"from sklearn.cluster import KMeans\n",
"import uproot\n",
"import matplotlib.pyplot as plt\n",
"import geant4_simulation as g4sim"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "329972a6",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "eea2907e",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "ad70f3aa-e25b-4929-b97b-b33325e649d8",
"metadata": {},
"source": [
"<a name='section_1_0'></a>\n",
"<hr style=\"height: 1px;\">\n",
"\n",
"\n",
"## <h2 style=\"border:1px; border-style:solid; padding: 0.25em; color: #FFFFFF; background-color: #FFA500\">Introduction to Geant4</h2>\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "78f00792-6cdd-4419-b204-cae3a4dd9a1f",
"metadata": {},
"outputs": [],
"source": [
"# Create an instance of the ApplicationManager class.\n",
"g4 = g4sim.ApplicationManager()"
]
},
{
"cell_type": "markdown",
"id": "47058a39",
...
...
@@ -332,7 +395,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.
15
"
"version": "3.9.
6
"
}
},
"nbformat": 4,
...
...
%% Cell type:markdown id:a1c50278 tags:
<hr
style=
"height: 1px;"
>
<i>
This notebook was authored by the TP1 Course Team, Copyright 2024 KIT ETP All Rights Reserved.
</i>
<hr
style=
"height: 1px;"
>
<br>
# Particle Physics 1
## Exercise 3: EMCAL in a Nutshell
**Institut für Experimentelle Teilchenphysik**
<br>
Lecture: Prof. Dr. M. Klute, Dr. P. Goldenzweig
<br>
Exercise: Dr. G. De Pietro
<br>
Assistance: L. Reuter, J. Eppelt, S. Giappichini, dwong
<br>
Hand-In: 16.11.2023
<h1>
(Draft)Exercise 3: EMCAL in a nutshell
</h1>
Some helpful links:
<br>
*
Google Colab (https://colab.research.google.com/): for Python development in your web-browser
<br>
*
Miniconda (https://docs.conda.io/en/latest/miniconda.html): a free minimal installer for conda
<br>
*
Numpy (https://numpy.org/doc/stable/user/quickstart.html): a widely used library for mathematical operations in Python
<br>
<h3>
Navigation
</h3>
<table
style=
"width:100%"
>
<tr>
<td
style=
"text-align: left; vertical-align: top; font-size: 10pt;"
><a
href=
"#section_4_1"
>
P4.1 Double Pendulum
</a></td>
<td
style=
"text-align: left; vertical-align: top; font-size: 10pt;"
><a
href=
"#problems_4_1"
>
P4.1 Problems
</a></td>
</tr>
<tr>
<td
style=
"text-align: left; vertical-align: top; font-size: 10pt;"
><a
href=
"#section_4_3"
>
P4.3 Maxwell-Boltzmann Distribution from Molecular Simulation
</a></td>
<td
style=
"text-align: left; vertical-align: top; font-size: 10pt;"
><a
href=
"#problems_4_3"
>
P4.3 Problems
</a></td>
</tr>
<tr>
<td
style=
"text-align: left; vertical-align: top; font-size: 10pt;"
><a
href=
"#section_4_4"
>
P4.4 Ideal Gas Law from Molecular Simulation
</a></td>
<td
style=
"text-align: left; vertical-align: top; font-size: 10pt;"
><a
href=
"#problems_4_4"
>
P4.4 Problems
</a></td>
</tr>
</table>
%% Cell type:markdown id:b82039ad tags:
### Setup
We will give a brief introduction to EMCAL and clustering. In the process, numpy, sklearn, uproot will be used.
%% Cell type:code id:b3619d05 tags:
```
python
# !pip install sklearn
# !pip install uproot
import
numpy
as
np
from
sklearn.cluster
import
KMeans
import
uproot
import
matplotlib.pyplot
as
plt
import
geant4_simulation
as
g4sim
```
%% Cell type:code id:329972a6 tags:
```
python
``
`
%%
Cell
type
:
code
id
:
eea2907e
tags
:
```
python
```
%% Cell type:markdown id:ad70f3aa-e25b-4929-b97b-b33325e649d8 tags:
<a name='section_1_0'></a>
<hr style="height: 1px;">
## <h2 style="border:1px; border-style:solid; padding: 0.25em; color: #FFFFFF; background-color: #FFA500">Introduction to Geant4</h2>
%% Cell type:code id:78f00792-6cdd-4419-b204-cae3a4dd9a1f tags:
```
python
# Create an instance of the ApplicationManager class.
g4 = g4sim.ApplicationManager()
```
%% Cell type:markdown id:47058a39 tags:
%% Cell type:markdown id:cce470a2 tags:
<a name='section_1_0'></a>
<hr style="height: 1px;">
## <h2 style="border:1px; border-style:solid; padding: 0.25em; color: #FFFFFF; background-color: #FFA500">Introduction to EMCAL</h2>
%% Cell type:code id:bb598536 tags:
```
python
```
%% Cell type:code id:e4377339 tags:
```
python
```
%% Cell type:code id:5fc30d71 tags:
```
python
```
%% Cell type:code id:7b666775 tags:
```
python
```
%% Cell type:markdown id:123fc926 tags:
<a name='section_2_0'></a>
<hr style="height: 1px;">
## <h2 style="border:1px; border-style:solid; padding: 0.25em; color: #FFFFFF; background-color: #FFA500">Particle hit shapes</h2>
%% Cell type:code id:edcf44c5 tags:
```
python
```
%% Cell type:markdown id:47da65a9 tags:
### Moments in statistics
The moments of a distribution provide useful information about its shape and spread. Below are the formulas for different moments:
- **1st order(raw)**$$\text{mean: }\mu := \mathbb{E}[X] = \frac{\mu_1}{1}
$$
- **2nd order(central)**: $$\text{variance: }\sigma^2 = \mathbb{E}[(X - \mu)^2] = \frac{\mu_2}{1^2} = \mu_2
$$
- **3rd order(standardized)**:$$\text{Skewness} = \mathbb{E} \left[ \left( \frac{X - \mu}{\sigma} \right)^3 \right] = \frac{\mathbb{E}[(X - \mu)^3]}{(\mathbb{E}[(X - \mu)^2])^{3/2}}
$$
- **4th order(standardized)**:$$\text{Kurtosis}g = \mathbb{E} \left[ \left( \frac{X - \mu}{\sigma} \right)^4 \right] = \frac{\mathbb{E}[(X - \mu)^4]}{(\mathbb{E}[(X - \mu)^2])^2}
$$
<span style="color:red">Bonus: What does Skewness/Kurtosis represent, why two expressions are equivalent?</span>
ans: hits on EMCAL plane also form a discrete probability distribution
%% Cell type:code id:627b99e7 tags:
```
python
```
%% Cell type:code id:00f7acae tags:
```
python
```
%% Cell type:code id:7fe9430c tags:
```
python
```
%% Cell type:markdown id:f7312bba tags:
<a name='section_3_0'></a>
<hr style="height: 1px;">
## <h2 style="border:1px; border-style:solid; padding: 0.25em; color: #FFFFFF; background-color: #FFA500">Clustering</h2>
%% Cell type:code id:8a84f2d5 tags:
```
python
```
%% Cell type:code id:47a42966 tags:
```
python
```
%% Cell type:markdown id:7807528d tags:
<a name='section_4_0'></a>
<hr style="height: 1px;">
## <h2 style="border:1px; border-style:solid; padding: 0.25em; color: #FFFFFF; background-color: #FFA500">Linkage methods</h2>
%% Cell type:code id:22c9d725 tags:
```
python
```
%% Cell type:code id:32c1dfac tags:
```
python
```
%% Cell type:code id:92f7c3b2 tags:
```
python
```
%% Cell type:code id:9cff34cf tags:
```
python
```
%% Cell type:code id:899dd92a tags:
```
python
```
%% Cell type:code id:1d5618ae tags:
```
python
```
%% Cell type:markdown id:139e1880 tags:
<a name='section_5_0'></a>
<hr style="height: 1px;">
## <h2 style="border:1px; border-style:solid; padding: 0.25em; color: #FFFFFF; background-color: #FFA500">Reading: ECAL at CMS</h2>
%% Cell type:markdown id:ebbcd7a3 tags:
<h3>CM-Solenoid: deal with cylindrical coordinates</h3>
%% Cell type:code id:454fe7c6 tags:
```
python
```
%% Cell type:code id:d1832fb7 tags:
```
python
```
%% Cell type:code id:822889bf tags:
```
python
```
%% Cell type:code id:af985ef4 tags:
```
python
```
%% Cell type:code id:fdc6e26b tags:
```
python
```
%% Cell type:code id:c881c954 tags:
```
python
```
%% Cell type:code id:61dad576 tags:
```
python
```
...
...
This diff is collapsed.
Click to expand it.
ref/geant4_simulation/__pycache__/__init__.cpython-311.pyc
0 → 100644
+
0
−
0
View file @
095b465a
File added
This diff is collapsed.
Click to expand it.
ref/test.ipynb
0 → 100644
+
75
−
0
View file @
095b465a
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"id": "de76542a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: scikit-learn in /opt/conda/lib/python3.9/site-packages (1.5.2)\n",
"Requirement already satisfied: joblib>=1.2.0 in /opt/conda/lib/python3.9/site-packages (from scikit-learn) (1.4.2)\n",
"Requirement already satisfied: scipy>=1.6.0 in /opt/conda/lib/python3.9/site-packages (from scikit-learn) (1.7.2)\n",
"Requirement already satisfied: numpy>=1.19.5 in /opt/conda/lib/python3.9/site-packages (from scikit-learn) (1.21.4)\n",
"Requirement already satisfied: threadpoolctl>=3.1.0 in /opt/conda/lib/python3.9/site-packages (from scikit-learn) (3.5.0)\n",
"Requirement already satisfied: uproot in /opt/conda/lib/python3.9/site-packages (5.4.1)\n",
"Requirement already satisfied: xxhash in /opt/conda/lib/python3.9/site-packages (from uproot) (3.5.0)\n",
"Requirement already satisfied: numpy in /opt/conda/lib/python3.9/site-packages (from uproot) (1.21.4)\n",
"Requirement already satisfied: fsspec in /opt/conda/lib/python3.9/site-packages (from uproot) (2024.10.0)\n",
"Requirement already satisfied: cramjam>=2.5.0 in /opt/conda/lib/python3.9/site-packages (from uproot) (2.9.0)\n",
"Requirement already satisfied: typing-extensions>=4.1.0 in /opt/conda/lib/python3.9/site-packages (from uproot) (4.12.2)\n",
"Requirement already satisfied: packaging in /opt/conda/lib/python3.9/site-packages (from uproot) (21.0)\n",
"Requirement already satisfied: awkward>=2.4.6 in /opt/conda/lib/python3.9/site-packages (from uproot) (2.6.9)\n",
"Requirement already satisfied: importlib-metadata>=4.13.0 in /opt/conda/lib/python3.9/site-packages (from awkward>=2.4.6->uproot) (8.5.0)\n",
"Requirement already satisfied: awkward-cpp==39 in /opt/conda/lib/python3.9/site-packages (from awkward>=2.4.6->uproot) (39)\n",
"Requirement already satisfied: zipp>=3.20 in /opt/conda/lib/python3.9/site-packages (from importlib-metadata>=4.13.0->awkward>=2.4.6->uproot) (3.20.2)\n",
"Requirement already satisfied: pyparsing>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->uproot) (2.4.7)\n"
]
}
],
"source": [
"# !pip install scikit-learn\n",
"# !pip install uproot\n",
"import numpy as np\n",
"from sklearn.cluster import KMeans\n",
"import uproot\n",
"import matplotlib.pyplot as plt\n",
"import geant4_simulation as g4sim"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d090ee8f",
"metadata": {},
"outputs": [],
"source": [
"g4 = g4sim.ApplicationManager()\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
%% Cell type:code id:de76542a tags:
```
python
# !pip install scikit-learn
# !pip install uproot
import
numpy
as
np
from
sklearn.cluster
import
KMeans
import
uproot
import
matplotlib.pyplot
as
plt
import
geant4_simulation
as
g4sim
```
%% Output
Requirement already satisfied: scikit-learn in /opt/conda/lib/python3.9/site-packages (1.5.2)
Requirement already satisfied: joblib>=1.2.0 in /opt/conda/lib/python3.9/site-packages (from scikit-learn) (1.4.2)
Requirement already satisfied: scipy>=1.6.0 in /opt/conda/lib/python3.9/site-packages (from scikit-learn) (1.7.2)
Requirement already satisfied: numpy>=1.19.5 in /opt/conda/lib/python3.9/site-packages (from scikit-learn) (1.21.4)
Requirement already satisfied: threadpoolctl>=3.1.0 in /opt/conda/lib/python3.9/site-packages (from scikit-learn) (3.5.0)
Requirement already satisfied: uproot in /opt/conda/lib/python3.9/site-packages (5.4.1)
Requirement already satisfied: xxhash in /opt/conda/lib/python3.9/site-packages (from uproot) (3.5.0)
Requirement already satisfied: numpy in /opt/conda/lib/python3.9/site-packages (from uproot) (1.21.4)
Requirement already satisfied: fsspec in /opt/conda/lib/python3.9/site-packages (from uproot) (2024.10.0)
Requirement already satisfied: cramjam>=2.5.0 in /opt/conda/lib/python3.9/site-packages (from uproot) (2.9.0)
Requirement already satisfied: typing-extensions>=4.1.0 in /opt/conda/lib/python3.9/site-packages (from uproot) (4.12.2)
Requirement already satisfied: packaging in /opt/conda/lib/python3.9/site-packages (from uproot) (21.0)
Requirement already satisfied: awkward>=2.4.6 in /opt/conda/lib/python3.9/site-packages (from uproot) (2.6.9)
Requirement already satisfied: importlib-metadata>=4.13.0 in /opt/conda/lib/python3.9/site-packages (from awkward>=2.4.6->uproot) (8.5.0)
Requirement already satisfied: awkward-cpp==39 in /opt/conda/lib/python3.9/site-packages (from awkward>=2.4.6->uproot) (39)
Requirement already satisfied: zipp>=3.20 in /opt/conda/lib/python3.9/site-packages (from importlib-metadata>=4.13.0->awkward>=2.4.6->uproot) (3.20.2)
Requirement already satisfied: pyparsing>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->uproot) (2.4.7)
%% Cell type:code id:d090ee8f tags:
```
python
g4
=
g4sim
.
ApplicationManager
()
```
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