CbmRoot
Loading...
Searching...
No Matches
KfTarget.cxx
Go to the documentation of this file.
1
/* Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2
SPDX-License-Identifier: GPL-3.0-only
3
Authors: Sergei Zharko [committer] */
4
9
10
#include "
KfTarget.h
"
11
12
#include <sstream>
13
14
using
cbm::algo::kf::MaterialMap
;
15
using
cbm::algo::kf::Target
;
16
17
// ---------------------------------------------------------------------------------------------------------------------
18
//
19
template
<
typename
T>
20
Target<T>::Target
(
double
x
,
double
y
,
double
z,
double
dz,
double
r)
21
: fX(utils::simd::Cast<double, T>(
x
))
22
, fY(utils::simd::Cast<double, T>(
y
))
23
, fZ(utils::simd::Cast<double, T>(z))
24
, fDz(utils::simd::Cast<double, T>(dz))
25
, fR(utils::simd::Cast<double, T>(r))
26
{
27
}
28
29
// ---------------------------------------------------------------------------------------------------------------------
30
//
31
template
<
typename
T>
32
void
Target<T>::SetMaterial
(
const
MaterialMap
& material)
33
{
34
if
(material.
IsUndefined
()) {
35
throw
std::logic_error(
"Target:ReceiveMaterial(): attempt to pass an undefined instance of the material map"
);
36
}
37
fMaterial = material;
38
}
39
40
// ---------------------------------------------------------------------------------------------------------------------
41
//
42
template
<
typename
T>
43
void
Target<T>::SetMaterial
(
MaterialMap
&& material)
44
{
45
if
(material.IsUndefined()) {
46
throw
std::logic_error(
"Target:ReceiveMaterial(): attempt to pass an undefined instance of the material map"
);
47
}
48
fMaterial = std::move(material);
49
}
50
51
// ---------------------------------------------------------------------------------------------------------------------
52
//
53
template
<
typename
T>
54
std::string
Target<T>::ToString
(
int
indentLevel,
int
verbose)
const
55
{
56
constexpr
char
IndentChar =
'\t'
;
57
std::stringstream msg;
58
std::string indent(indentLevel, IndentChar);
59
auto
Cnv = [&](
const
auto
& val) {
return
utils::simd::Cast<T, Literal_t<T>
>(val); };
// alias for the conversion fn
60
msg << indent <<
"position: {"
<< Cnv(fX) <<
", "
<< Cnv(fY) <<
", "
<< Cnv(fZ) <<
"} [cm]\n"
;
61
msg << indent <<
"half-thickness: "
<< Cnv(fDz) <<
" [cm]\n"
;
62
msg << indent <<
"material:\n"
<< indent << IndentChar <<
" "
<< fMaterial.ToString(verbose);
63
return
msg.str();
64
}
65
66
67
namespace
cbm::algo::kf
68
{
69
template
class
Target<float>
;
70
template
class
Target<double>
;
71
template
class
Target<fvec>
;
72
}
// namespace cbm::algo::kf
y
Double_t y
Definition
CbmMvdSensorDigiToHitTask.cxx:64
x
Double_t x
Definition
CbmMvdSensorDigiToHitTask.cxx:64
KfTarget.h
A target layer in the KF-setup (header)
cbm::algo::kf::MaterialMap
A map of station thickness in units of radiation length (X0) to the specific point in XY plane.
Definition
KfMaterialMap.h:27
cbm::algo::kf::MaterialMap::IsUndefined
bool IsUndefined() const
Function to test the instance for NaN.
Definition
KfMaterialMap.h:132
cbm::algo::kf::Target
A geometry layer in the target region.
Definition
KfTarget.h:25
cbm::algo::kf::Target::Target
friend class Target
Definition
KfTarget.h:27
cbm::algo::kf::Target::ToString
std::string ToString(int indentLevel=0, int vebose=1) const
String representation of the class.
Definition
KfTarget.cxx:54
cbm::algo::kf::Target::SetMaterial
void SetMaterial(const MaterialMap &material)
Sets material map.
Definition
KfTarget.cxx:32
cbm::algo::kf::utils::simd::Cast
DataOut Cast(const DataT &val)
Converts a value of type DataT to type DataOut.
Definition
KfUtils.h:212
cbm::algo::kf
Definition
KfMeasurementTime.cxx:14
algo
kf
core
geo
KfTarget.cxx
Generated on Sun Dec 22 2024 23:04:04 for CbmRoot by
1.12.0