Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cbmroot
Manage
Activity
Members
Labels
Plan
Wiki
Redmine
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
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
Computing
cbmroot
Commits
3459c5cf
Commit
3459c5cf
authored
2 years ago
by
Sergei Zharko
Committed by
Sergey Gorbunov
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
L1: added NaN checkers to tracking detector interfaces
parent
4caaab79
No related branches found
No related tags found
1 merge request
!983
L1: validity checks for the tracking detector interfaces are introduced
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/base/CbmTrackingDetectorInterfaceBase.cxx
+67
-32
67 additions, 32 deletions
core/base/CbmTrackingDetectorInterfaceBase.cxx
core/base/CbmTrackingDetectorInterfaceBase.h
+4
-0
4 additions, 0 deletions
core/base/CbmTrackingDetectorInterfaceBase.h
with
71 additions
and
32 deletions
core/base/CbmTrackingDetectorInterfaceBase.cxx
+
67
−
32
View file @
3459c5cf
...
@@ -17,75 +17,110 @@
...
@@ -17,75 +17,110 @@
bool
CbmTrackingDetectorInterfaceBase
::
Check
()
const
bool
CbmTrackingDetectorInterfaceBase
::
Check
()
const
{
{
bool
res
=
true
;
bool
res
=
true
;
std
::
string
prefix
=
std
::
string
(
"Detector interface for "
)
+
this
->
GetDetectorName
()
+
": "
;
std
::
stringstream
msg
;
msg
<<
"Errors in the detector interface initialization for "
<<
this
->
GetDetectorName
()
<<
":
\n
"
;
// Number of stations
// Number of stations
if
(
this
->
GetNtrackingStations
()
<
1
)
{
if
(
this
->
GetNtrackingStations
()
<
1
)
{
LOG
(
error
)
<<
prefix
<<
"
Number of stations is less then 1("
<<
this
->
GetNtrackingStations
()
<<
")"
;
msg
<<
"
\t
-
Number of stations is less then 1("
<<
this
->
GetNtrackingStations
()
<<
")"
;
res
=
false
&&
res
;
res
=
false
&&
res
;
}
}
else
{
else
{
// Position along beam axis
std
::
vector
<
double
>
zPositions
(
this
->
GetNtrackingStations
());
// Station individual parameters check
for
(
int
iSt
=
0
;
iSt
<
this
->
GetNtrackingStations
();
++
iSt
)
{
for
(
int
iSt
=
0
;
iSt
<
this
->
GetNtrackingStations
();
++
iSt
)
{
zPositions
[
iSt
]
=
this
->
GetZ
(
iSt
);
std
::
string
prefix
=
std
::
string
(
"
\t
- Station "
)
+
std
::
to_string
(
iSt
)
+
" has "
;
}
// Position along Z-axis
std
::
set
<
double
>
zPositionSet
(
zPositions
.
begin
(),
zPositions
.
end
());
if
(
std
::
isnan
(
this
->
GetZ
(
iSt
)))
{
if
(
zPositions
.
size
()
!=
zPositionSet
.
size
())
{
msg
<<
prefix
<<
" NaN component along Z-axis ("
<<
this
->
GetZ
(
iSt
)
<<
" cm)
\n
"
;
LOG
(
error
)
<<
prefix
<<
"Some of stations have the same z position component:"
;
res
=
false
&&
res
;
for
(
size_t
iSt
=
0
;
iSt
<
zPositions
.
size
();
++
iSt
)
{
LOG
(
error
)
<<
"
\t
station "
<<
iSt
<<
", z = "
<<
zPositions
[
iSt
]
<<
" cm"
;
}
}
res
=
false
&&
res
;
}
// Station sizes check
for
(
int
iSt
=
0
;
iSt
<
this
->
GetNtrackingStations
();
++
iSt
)
{
// Size along X-axis
// Size along X-axis
if
(
this
->
GetXmax
(
iSt
)
<
std
::
numeric_limits
<
double
>::
epsilon
())
{
auto
xMax
=
this
->
GetXmax
(
iSt
);
LOG
(
error
)
<<
prefix
<<
"Station "
<<
iSt
<<
" has zero or negative X-size ("
<<
this
->
GetXmax
(
iSt
)
<<
" cm)"
;
if
(
xMax
<
std
::
numeric_limits
<
double
>::
epsilon
()
||
std
::
isnan
(
xMax
))
{
msg
<<
prefix
<<
" zero, negative or NaN X-size ("
<<
xMax
<<
" cm)
\n
"
;
res
=
false
&&
res
;
res
=
false
&&
res
;
}
}
// Size along Y-axis
// Size along Y-axis
if
(
this
->
GetYmax
(
iSt
)
<
std
::
numeric_limits
<
double
>::
epsilon
())
{
auto
yMax
=
this
->
GetYmax
(
iSt
);
LOG
(
error
)
<<
prefix
<<
"Station "
<<
iSt
<<
" has zero or negative Y-size ("
<<
this
->
GetYmax
(
iSt
)
<<
" cm)"
;
if
(
yMax
<
std
::
numeric_limits
<
double
>::
epsilon
()
||
std
::
isnan
(
yMax
))
{
msg
<<
prefix
<<
" zero, negative or NaN Y-size ("
<<
yMax
<<
" cm)
\n
"
;
res
=
false
&&
res
;
res
=
false
&&
res
;
}
}
// Max station radius
// Max station radius
if
(
this
->
GetRmax
(
iSt
)
<
std
::
numeric_limits
<
double
>::
epsilon
())
{
auto
rMax
=
this
->
GetRmax
(
iSt
)
;
LOG
(
error
)
<<
prefix
<<
"Station "
<<
iSt
<<
" has zero or negative outer radius ("
<<
this
->
GetRmax
(
iSt
)
if
(
rMax
<
std
::
numeric_limits
<
double
>::
epsilon
()
||
std
::
isnan
(
rMax
))
{
<<
" cm)"
;
msg
<<
prefix
<<
" zero, negative or NaN outer radius ("
<<
rMax
<<
" cm)
\n
"
;
res
=
false
&&
res
;
res
=
false
&&
res
;
}
}
// Min station radius
// Min station radius
if
(
this
->
GetRmin
(
iSt
)
<
0
)
{
auto
rMin
=
this
->
GetRmin
(
iSt
);
LOG
(
error
)
<<
prefix
<<
"Station "
<<
iSt
<<
" has negative inner radius ("
<<
this
->
GetRmin
(
iSt
)
<<
" cm)"
;
if
(
rMin
<
0
||
std
::
isnan
(
rMin
))
{
msg
<<
prefix
<<
" negative or NaN inner radius ("
<<
rMin
<<
" cm)
\n
"
;
res
=
false
&&
res
;
}
// Front strips stereo angle
auto
angleF
=
this
->
GetStripsStereoAngleFront
(
iSt
);
if
(
std
::
isnan
(
angleF
))
{
msg
<<
prefix
<<
" NaN front strips stereo angle ("
<<
angleF
<<
" rad)
\n
"
;
res
=
false
&&
res
;
}
// Back strips stereo angle
auto
angleB
=
this
->
GetStripsStereoAngleBack
(
iSt
);
if
(
std
::
isnan
(
angleF
))
{
msg
<<
prefix
<<
" NaN back strips stereo angle ("
<<
angleB
<<
" rad)
\n
"
;
res
=
false
&&
res
;
res
=
false
&&
res
;
}
}
// Front strips spatial resolution
// Front strips spatial resolution
if
(
this
->
GetStripsSpatialRmsFront
(
iSt
)
<
std
::
numeric_limits
<
double
>::
epsilon
())
{
auto
rmsF
=
this
->
GetStripsSpatialRmsFront
(
iSt
)
;
LOG
(
error
)
<<
prefix
<<
"Station "
<<
iSt
<<
" has zero or negative front strips spatial resolution ("
if
(
rmsF
<
std
::
numeric_limits
<
double
>::
epsilon
()
||
std
::
isnan
(
rmsF
))
{
<<
this
->
GetS
trips
S
patial
RmsFront
(
iSt
)
<<
" cm)"
;
msg
<<
prefix
<<
" zero, negative or NaN front s
trips
s
patial
resolution ("
<<
rmsF
<<
" cm)
\n
"
;
res
=
false
&&
res
;
res
=
false
&&
res
;
}
}
// Back strips spatial resolution
// Back strips spatial resolution
if
(
this
->
GetStripsSpatialRmsBack
(
iSt
)
<
std
::
numeric_limits
<
double
>::
epsilon
())
{
auto
rmsB
=
this
->
GetStripsSpatialRmsBack
(
iSt
)
;
LOG
(
error
)
<<
prefix
<<
"Station "
<<
iSt
<<
" has zero or negative back strips spatial resolution ("
if
(
rmsB
<
std
::
numeric_limits
<
double
>::
epsilon
()
||
std
::
isnan
(
rmsB
))
{
<<
this
->
GetS
trips
S
patial
RmsBack
(
iSt
)
<<
" cm)"
;
msg
<<
prefix
<<
" zero, negative or NaN back s
trips
s
patial
resolution ("
<<
rmsB
<<
" cm)
\n
"
;
res
=
false
&&
res
;
res
=
false
&&
res
;
}
}
// Time resolution
auto
timeRes
=
this
->
GetTimeResolution
(
iSt
);
if
(
timeRes
<
std
::
numeric_limits
<
double
>::
epsilon
()
||
std
::
isnan
(
timeRes
))
{
msg
<<
prefix
<<
" zero, negative or NaN time resolution ("
<<
timeRes
<<
" cm)
\n
"
;
res
=
false
&&
res
;
}
}
// Position along beam axis
std
::
vector
<
double
>
zPositions
(
this
->
GetNtrackingStations
());
for
(
int
iSt
=
0
;
iSt
<
this
->
GetNtrackingStations
();
++
iSt
)
{
zPositions
[
iSt
]
=
this
->
GetZ
(
iSt
);
}
std
::
set
<
double
>
zPositionSet
(
zPositions
.
begin
(),
zPositions
.
end
());
if
(
zPositions
.
size
()
!=
zPositionSet
.
size
())
{
msg
<<
"
\t
- Some of stations have the same z position component:
\n
"
;
for
(
size_t
iSt
=
0
;
iSt
<
zPositions
.
size
();
++
iSt
)
{
msg
<<
"
\t\t
station "
<<
iSt
<<
", z = "
<<
zPositions
[
iSt
]
<<
" cm
\n
"
;
}
res
=
false
&&
res
;
}
}
}
}
if
(
!
res
)
{
if
(
!
res
)
{
LOG
(
error
)
<<
"
\033
[4mErrors above mean that CA tracking cannot be used for the current version of "
LOG
(
error
)
<<
msg
.
str
()
<<
"
\033
[4mErrors above mean that CA tracking cannot be used for the current version of "
<<
this
->
GetDetectorName
()
<<
" setup. Please, check if the "
<<
this
->
GetDetectorName
()
<<
this
->
GetDetectorName
()
<<
" setup. Please, check if the "
<<
this
->
GetDetectorName
()
<<
" setup parameters and the corresponding tracking detector interface are initialized properly
\033
[0m"
;
<<
" setup parameters and the corresponding tracking detector interface are initialized properly
\033
[0m"
;
}
}
return
res
;
return
res
;
}
}
This diff is collapsed.
Click to expand it.
core/base/CbmTrackingDetectorInterfaceBase.h
+
4
−
0
View file @
3459c5cf
...
@@ -29,6 +29,10 @@ public:
...
@@ -29,6 +29,10 @@ public:
/// Gets actual number of stations, provided by the current geometry setup
/// Gets actual number of stations, provided by the current geometry setup
virtual
int
GetNtrackingStations
()
const
=
0
;
virtual
int
GetNtrackingStations
()
const
=
0
;
// TODO: SZh 17.10.2022: At the moment the radiation length and the station thickness are not used for the tracking
// initialization as soon as the material budget maps are in use. Should we keep these
// accessors here, or just remove them from the interfaces?
/// Gets station radiation length
/// Gets station radiation length
/// \param stationId Tracking station ID in the setup (NOTE: must be in range [0..GetNstations()-1])
/// \param stationId Tracking station ID in the setup (NOTE: must be in range [0..GetNstations()-1])
/// \return Radiation length [cm]
/// \return Radiation length [cm]
...
...
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