Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
allpix-squared
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
Benoit, Mathieu
allpix-squared
Commits
22109937
Commit
22109937
authored
1 year ago
by
Simon Spannagel
Browse files
Options
Downloads
Patches
Plain Diff
SupportLayer: Make Location an enum class
parent
ee1af7c2
No related branches found
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
src/core/geometry/DetectorModel.cpp
+5
-9
5 additions, 9 deletions
src/core/geometry/DetectorModel.cpp
src/core/geometry/DetectorModel.hpp
+1
-2
1 addition, 2 deletions
src/core/geometry/DetectorModel.hpp
src/core/geometry/SupportLayer.hpp
+9
-3
9 additions, 3 deletions
src/core/geometry/SupportLayer.hpp
with
15 additions
and
14 deletions
src/core/geometry/DetectorModel.cpp
+
5
−
9
View file @
22109937
...
...
@@ -106,14 +106,10 @@ DetectorModel::DetectorModel(std::string type, std::shared_ptr<DetectorAssembly>
for
(
auto
&
support_config
:
reader_
.
getConfigurations
(
"support"
))
{
auto
thickness
=
support_config
.
get
<
double
>
(
"thickness"
);
auto
size
=
support_config
.
get
<
XYVector
>
(
"size"
);
auto
location
=
support_config
.
get
<
std
::
string
>
(
"location"
,
"chip"
);
std
::
transform
(
location
.
begin
(),
location
.
end
(),
location
.
begin
(),
::
tolower
);
if
(
location
!=
"sensor"
&&
location
!=
"chip"
&&
location
!=
"absolute"
)
{
throw
InvalidValueError
(
support_config
,
"location"
,
"location of the support should be 'chip', 'sensor' or 'absolute'"
);
}
auto
location
=
support_config
.
get
<
SupportLayer
::
Location
>
(
"location"
,
SupportLayer
::
Location
::
CHIP
);
XYZVector
offset
;
if
(
location
==
"absolute"
)
{
if
(
location
==
SupportLayer
::
Location
::
ABSOLUTE
)
{
offset
=
support_config
.
get
<
XYZVector
>
(
"offset"
);
}
else
{
auto
xy_offset
=
support_config
.
get
<
XYVector
>
(
"offset"
,
{
0
,
0
});
...
...
@@ -278,10 +274,10 @@ std::vector<SupportLayer> DetectorModel::getSupportLayers() const {
auto
chip_offset
=
getSensorSize
().
z
()
/
2.0
+
getChipSize
().
z
()
+
assembly_
->
getChipOffset
().
z
();
for
(
auto
&
layer
:
ret_layers
)
{
ROOT
::
Math
::
XYZVector
offset
=
layer
.
offset_
;
if
(
layer
.
location_
==
"sensor"
)
{
if
(
layer
.
location_
==
SupportLayer
::
Location
::
SENSOR
)
{
offset
.
SetZ
(
sensor_offset
-
layer
.
size_
.
z
()
/
2.0
);
sensor_offset
-=
layer
.
size_
.
z
();
}
else
if
(
layer
.
location_
==
"chip"
)
{
}
else
if
(
layer
.
location_
==
SupportLayer
::
Location
::
CHIP
)
{
offset
.
SetZ
(
chip_offset
+
layer
.
size_
.
z
()
/
2.0
);
chip_offset
+=
layer
.
size_
.
z
();
}
...
...
This diff is collapsed.
Click to expand it.
src/core/geometry/DetectorModel.hpp
+
1
−
2
View file @
22109937
...
...
@@ -552,13 +552,12 @@ namespace allpix {
* @param hole_size Size of the optional hole in the support
* @param hole_offset Offset of the hole from its default position
*/
// FIXME: Location (and material) should probably be an enum instead
void
addSupportLayer
(
const
ROOT
::
Math
::
XYVector
&
size
,
double
thickness
,
ROOT
::
Math
::
XYZVector
offset
,
std
::
string
material
,
std
::
string
type
,
std
::
string
location
,
const
SupportLayer
::
Location
location
,
const
ROOT
::
Math
::
XYVector
&
hole_size
,
ROOT
::
Math
::
XYVector
hole_offset
)
{
ROOT
::
Math
::
XYZVector
full_size
(
size
.
x
(),
size
.
y
(),
thickness
);
...
...
This diff is collapsed.
Click to expand it.
src/core/geometry/SupportLayer.hpp
+
9
−
3
View file @
22109937
...
...
@@ -25,6 +25,12 @@ namespace allpix {
friend
class
DetectorModel
;
public:
enum
class
Location
{
SENSOR
,
///< Support layer is located on the sensor side of the assembly
CHIP
,
///< Support layer is located on the chip side of the assembly
ABSOLUTE
///< Support layer location provided as absolute position
};
/**
* @brief Get the center of the support layer
* @return Center of the support layer
...
...
@@ -67,7 +73,7 @@ namespace allpix {
/**
* @brief Get the location of the support layer
*/
const
std
::
string
&
getLocation
()
const
{
return
location_
;
}
const
Location
&
getLocation
()
const
{
return
location_
;
}
private
:
/**
...
...
@@ -84,7 +90,7 @@ namespace allpix {
ROOT
::
Math
::
XYZVector
offset
,
std
::
string
material
,
std
::
string
type
,
std
::
string
location
,
const
Location
location
,
ROOT
::
Math
::
XYZVector
hole_size
,
ROOT
::
Math
::
XYVector
hole_offset
)
:
size_
(
std
::
move
(
size
)),
material_
(
std
::
move
(
material
)),
type_
(
std
::
move
(
type
)),
...
...
@@ -101,7 +107,7 @@ namespace allpix {
// Internal parameters to calculate return parameters
ROOT
::
Math
::
XYZVector
offset_
;
ROOT
::
Math
::
XYVector
hole_offset_
;
std
::
string
location_
;
Location
location_
;
};
}
// namespace allpix
...
...
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