Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CSD Detector Project
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
Container Registry
Model registry
Operate
Environments
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
CSD-team
CSD Detector Project
Commits
aeb6d6da
Commit
aeb6d6da
authored
6 years ago
by
unknown
Browse files
Options
Downloads
Patches
Plain Diff
Change from vector to angles
parent
9b1d66f9
No related branches found
No related tags found
No related merge requests found
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Detector.py
+47
-21
47 additions, 21 deletions
Detector.py
Documentation_Detector.md
+69
-32
69 additions, 32 deletions
Documentation_Detector.md
Documentation_Detector.rtf
+136
-131
136 additions, 131 deletions
Documentation_Detector.rtf
README.md
+1
-0
1 addition, 0 deletions
README.md
with
253 additions
and
184 deletions
Detector.py
+
47
−
21
View file @
aeb6d6da
class
CLayer
:
import
numpy
as
np
class
Layer
:
def
__init__
(
self
,
Position
):
def
__init__
(
self
,
Position
):
self
.
Position
=
Position
self
.
Position
=
Position
def
detect
(
self
,
(
x
,
y
,
z
)):
def
detect
(
self
,
(
phi
,
theta
)):
"""
Calculate for a given vector (x, y, z) the hit grid.
"""
Calculate for a given angles (phi, theta) the hit grid.
Numbered like a matrix with index i,j, starting with 1,1 in the left upper corner with view from the source
"""
Returns the angles from source to grid edge
"""
x
=
x
*
(
self
.
Position
/
z
)
# calculate the realitiv position of the vector in the z-Plane
y
=
y
*
(
self
.
Position
/
z
)
#define Dummyvalue - necessary for run
if
-
50
<
x
<
50
and
-
50
<
y
<
50
:
phiHigh
=
99
j
=
int
((
-
x
+
50
)
/
0.0025
+
1
)
# (-x+50) /0.0025 +1
phiLow
=
99
i
=
int
((
-
y
+
50
)
/
0.0025
+
1
)
# ^math correction of coordinate system ^each grid has 25 micrometer ^to i,j element [1,40.000]
thetaHigh
=
99
thetaLow
=
99
x
=
np
.
tan
(
phi
)
*
self
.
Position
#calculate position of hit with Layer
y
=
np
.
tan
(
theta
)
*
self
.
Position
if
0
<=
x
<
50
:
phiHigh
=
np
.
arctan
(
int
(
x
/
0.0025
+
1
)
*
0.0025
/
self
.
Position
)
#angel for z-axis to upper edge of hit grid
phiLow
=
np
.
arctan
(
int
(
x
/
0.0025
)
*
0.0025
/
self
.
Position
)
# phi = arctan(opposite/adjacent)
elif
-
50
<
x
<
0
:
phiHigh
=
np
.
arctan
(
int
(
x
/
0.0025
)
*
0.0025
/
self
.
Position
)
#np.arctan (int(x/0.0025)*0.0025/ self.Position)
phiLow
=
np
.
arctan
(
int
(
x
/
0.0025
-
1
)
*
0.0025
/
self
.
Position
)
#^arctan ^round x to next upper/lower 25 mikrometer ^adjacent
return
(
i
,
j
,
self
.
Position
)
else
:
return
None
# if the Layer is not hit, return "None"
if
0
<=
y
<
50
:
thetaHigh
=
np
.
arctan
(
int
(
y
/
0.0025
+
1
)
*
0.0025
/
self
.
Position
)
thetaLow
=
np
.
arctan
(
int
(
y
/
0.0025
)
*
0.0025
/
self
.
Position
)
elif
-
50
<
y
<
0
:
thetaHigh
=
np
.
arctan
(
int
(
y
/
0.0025
)
*
0.0025
/
self
.
Position
)
thetaLow
=
np
.
arctan
(
int
(
y
/
0.0025
-
1
)
*
0.0025
/
self
.
Position
)
else
:
return
None
return
((
phiHigh
,
phiLow
),
(
thetaHigh
,
thetaLow
))
class
C
Detector
:
class
Detector
:
def
__init__
(
self
):
def
__init__
(
self
):
"""
5 Layer of Tracker
"""
"""
5 Layer of Tracker
"""
self
.
Layer1
=
C
Layer
(
100
)
self
.
Layer1
=
Layer
(
100
)
self
.
Layer2
=
C
Layer
(
110
)
self
.
Layer2
=
Layer
(
110
)
self
.
Layer3
=
C
Layer
(
120
)
self
.
Layer3
=
Layer
(
120
)
self
.
Layer4
=
C
Layer
(
130
)
self
.
Layer4
=
Layer
(
130
)
self
.
Layer5
=
C
Layer
(
140
)
self
.
Layer5
=
Layer
(
140
)
def
detect
(
self
,
vector
):
def
detect
(
self
,
(
phi
,
theta
)):
"""
Calculate for a given vector (x, y, z) the hitted grid.
"""
Calculate for a given angles (phi, theta) the hitted grid.
Numbered like a matrix with index i,j, starting with 1,1 in the left upper corner with view from the source
Returns the angles from source to grid edge or
"
None
"
if the Layer is not hitted
"""
returns
"
None
"
if the Layer is not hitted
"""
result
=
[]
result
=
[]
for
Layer
in
[
self
.
Layer1
,
self
.
Layer2
,
self
.
Layer3
,
self
.
Layer4
,
self
.
Layer5
]:
for
Layer
in
[
self
.
Layer1
,
self
.
Layer2
,
self
.
Layer3
,
self
.
Layer4
,
self
.
Layer5
]:
result
.
append
(
Layer
.
detect
(
vector
))
result
.
append
(
Layer
.
detect
(
(
phi
,
theta
)
))
return
result
return
result
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Documentation_Detector.md
+
69
−
32
View file @
aeb6d6da
Module: Detector
============================
This module calculates the possible angles for a particle flying throw a 5 layer detector.
<br>
To use this module, it’s enough to create one instance of CDetector and use the function CDetector.detect (vector).
To use this module, it’s enough to create one instance of CDetector and use the function CDetector.detect (vector).
#Classes:
Classes:
CDetector
============================
CDetector
<br>
CLayer
CLayer
#CDetector:
**Functions:**
CDetector:
__init__
()
============================
Functions:
----------------------------
\_\_
init
\_\_
()
<br>
detect (vector)
detect (vector)
**
_
_init
_
_():**
**
\_\
_init
\_\
_():**
<br>
Creates 5 instances of CLayer with initvalues {100, 110, 120, 130, 140} which represents the (z-)position of the Layers.
Creates 5 instances of CLayer with initvalues {100, 110, 120, 130, 140} which represents the (z-)position of the Layers.
**detect (vector):**
**detect (vector):**
<br>
Loop over all Layers the function CLayer.detect (vector).
Loop over all Layers the function CLayer.detect (vector).
<br><br>
*Arguments:*
*Arguments:*
<br>
vector: Tuple of 3 Numbers describing a vector
phi, theta: represents the angles of the particle starting from the source
<br>
*Return:*
phi is for the x-axis [-pi,pi]
<br>
Returns a List of 5 Tuples, each Tuple has 3 Numbers: (i, j, Position)
theta is for the y-axis [-pi,pi]
<br><br>
(i,j) are the Number of the hit grid. It is numbered like a matrix – (1,1) in the upper left to (40.000,40.000) in the lower right corner
*Return:*
<br>
Position returns the Position of the Layer (z-coordinate)
Returns a List of 5 Tuples, each Tuple has 2 Tuples with a higher and a lower angle bound.
<br>
If a Layer is not hit, the Tuple is “None”
This means:
<br>
e.g. returnvalue
[
a
][
b
]
[c]
<br>
a – [0,4] select Layer
<br>
b – 0 is phi, 1 is theta
<br>
c – 0 is the upper bound, 1 the lower bound
<br><br>
If a Layer is not hit, the Tuple is “None”
<br>
e.g. returnvalue [a] is “None”
<br>
CLayer:
============================
Functions:
----------------------------
\_\_
init
\_\_
(Position)
<br>
#CLayer:
**Functions:**
__init__
(Position)
detect (vector)
detect (vector)
**__init__(Position):**
Just copy the argument.
*Arguments:*
**\_\_init\_\_(Position):**
<br>
Position: Location of the Layer at the z-axis
Just copy the argument.
<br><br>
**detect (vector):**
*Arguments:*
<br>
Calculate which grid of this Layer is hit.
Position: Location of the Layer at the z-axis
<br>
*Arguments:*
vector: Tuple of 3 Numbers describing a vector
**detect (vector):**
<br>
*Return:*
Calculate the bounds of hit grid.
<br><br>
Returns a Tuple with 3 Numbers: (i, j, Position)
*Arguments:*
<br>
(i,j) are the Number of the hit grid. It is numbered like a matrix – (1,1) in the upper left to (40.000,40.000) in the lower right corner
phi, theta: represents the angles of the particle starting from the source
<br>
Position returns the Position of the Layer (z-coordinate)
phi is for the x-axis [-pi,pi]
<br>
If this Layer is not hit, the Tuple is “None”
theta is for the y-axis [-pi,pi]
<br><br>
*Return:*
<br>
Returns 2 Tuples with a higher and a lower angle bound.
<br>
This means:
<br>
e.g. returnvalue
[
a
][
b
]
<br>
a – 0 is phi, 1 is theta
<br>
b – 0 is the upper bound, 1 the lower bound
<br><br>
If this Layer is not hit, the Tuple is “None”
<br>
This diff is collapsed.
Click to expand it.
Documentation_Detector.rtf
+
136
−
131
View file @
aeb6d6da
This diff is collapsed.
Click to expand it.
README.md
+
1
−
0
View file @
aeb6d6da
# CSD Detector Project
# CSD Detector Project
New
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