BmnRoot
26.10.0-210-gc52d34b0
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
BmnParamLayout.cxx
Go to the documentation of this file.
1
/*
2
BM@N alignment routine
3
BM@N experiment at NICA complex, JINR, 2025
4
5
Department: Math & Soft Group of HEP lab
6
Author: Claude (Opus 5)
7
Supervisor: Igor Polev, polev@jinr.int
8
9
BmnParamLayout::Rebuild implementation
10
11
Out of line because the layout and the hierarchy each need the other: the
12
hierarchy owns a layout, and rebuilding a layout reads the hierarchy.
13
*/
14
15
#include "
BmnParamLayout.h
"
16
17
#include "
BmnAlignDefines.h
"
18
#include "
BmnAlignHierarchy.h
"
19
20
#include <utility>
21
22
const
std::vector<std::string>&
BmnParamLayout::ParamNames
()
23
{
24
static
const
std::vector<std::string> names{
"dX"
,
"dY"
,
"dZ"
,
"phi"
,
"theta"
,
"psi"
};
25
return
names;
26
}
27
28
const
char
*
BmnParamLayout::ParamName
(
Int_t
p)
29
{
30
return
(p >= 0 && p <
BMN_GLOBAL_PARAMS_PD
) ?
ParamNames
()[p].c_str() :
""
;
31
}
32
33
Int_t
BmnParamLayout::ParamIndex
(
const
std::string& name)
34
{
35
const
std::vector<std::string>& names{
ParamNames
()};
36
for
(
Int_t
p = 0; p <
BMN_GLOBAL_PARAMS_PD
; p++)
37
if
(name == names[p])
38
return
p;
39
return
-1;
40
}
41
42
void
BmnParamLayout::Rebuild
(
const
BmnAlignHierarchy
& hierarchy)
43
{
44
fAll
.clear();
45
fLeaves
.clear();
46
fComposites
.clear();
47
fByNode
.clear();
48
if
(!hierarchy.
Ready
())
49
return
;
50
51
// Filled by index rather than by push_back: the node order is an
52
// implementation detail of the hierarchy, while the full layout is defined
53
// by the parameter base of each node, and the config files depend on it.
54
fAll
.resize(hierarchy.
AllParams
());
55
for
(
const
BmnAlignHierarchy::Node_t
& node : hierarchy.
Nodes
()) {
56
const
Int_t
base{node.leaf >= 0 ? node.leaf *
BMN_GLOBAL_PARAMS_PD
57
: hierarchy.
CompositeParamBase
() + node.composite *
BMN_GLOBAL_PARAMS_PD
};
58
for
(
Int_t
p = 0; p <
BMN_GLOBAL_PARAMS_PD
; p++) {
59
ParamRef
& ref{
fAll
[base + p]};
60
ref.
full
= base + p;
61
ref.
leaf
= node.leaf;
62
ref.
comp
= node.composite < 0 ? -1 : node.composite *
BMN_GLOBAL_PARAMS_PD
+ p;
63
ref.
node
= base /
BMN_GLOBAL_PARAMS_PD
;
64
ref.
prm
= p;
65
ref.
level
= node.level;
66
ref.
nodeName
= node.name.c_str();
67
ref.
prmName
=
ParamName
(p);
68
}
69
}
70
71
fLeaves
.reserve(hierarchy.
LeafParams
());
72
fComposites
.reserve(hierarchy.
CompositeParams
());
73
for
(
const
ParamRef
& ref :
fAll
) {
74
if
(ref.IsComposite())
75
fComposites
.push_back(ref);
76
else
77
fLeaves
.push_back(ref);
78
}
79
80
// full-layout order puts the six corrections of one object side by side,
81
// so the groups are just consecutive slices of fAll
82
fByNode
.reserve(
fAll
.size() /
BMN_GLOBAL_PARAMS_PD
);
83
for
(std::size_t
i
= 0;
i
<
fAll
.size();
i
+=
BMN_GLOBAL_PARAMS_PD
) {
84
NodeRef
node;
85
node.
name
=
fAll
[
i
].nodeName;
86
node.
level
=
fAll
[
i
].level;
87
node.
leaf
=
fAll
[
i
].leaf;
88
node.
params
.assign(
fAll
.begin() +
i
,
fAll
.begin() +
i
+
BMN_GLOBAL_PARAMS_PD
);
89
fByNode
.push_back(std::move(node));
90
}
91
}
BmnAlignDefines.h
BMN_GLOBAL_PARAMS_PD
#define BMN_GLOBAL_PARAMS_PD
Definition
BmnAlignDefines.h:20
BmnAlignHierarchy.h
BmnParamLayout.h
i
int i
Definition
P4_F32vec4.h:22
Int_t
int Int_t
BmnAlignHierarchy
Definition
BmnAlignHierarchy.h:89
BmnAlignHierarchy::LeafParams
Int_t LeafParams() const noexcept
Definition
BmnAlignHierarchy.h:127
BmnAlignHierarchy::Nodes
const std::vector< Node_t > & Nodes() const noexcept
Definition
BmnAlignHierarchy.h:136
BmnAlignHierarchy::AllParams
Int_t AllParams() const noexcept
Definition
BmnAlignHierarchy.h:129
BmnAlignHierarchy::CompositeParams
Int_t CompositeParams() const noexcept
Definition
BmnAlignHierarchy.h:128
BmnAlignHierarchy::Ready
Bool_t Ready() const noexcept
Definition
BmnAlignHierarchy.h:120
BmnAlignHierarchy::CompositeParamBase
Int_t CompositeParamBase() const noexcept
Definition
BmnAlignHierarchy.h:130
BmnParamLayout::ParamIndex
static Int_t ParamIndex(const std::string &name)
Definition
BmnParamLayout.cxx:33
BmnParamLayout::ParamName
static const char * ParamName(Int_t p)
Definition
BmnParamLayout.cxx:28
BmnParamLayout::fComposites
Range_t fComposites
Definition
BmnParamLayout.h:111
BmnParamLayout::fLeaves
Range_t fLeaves
Definition
BmnParamLayout.h:111
BmnParamLayout::fAll
Range_t fAll
Definition
BmnParamLayout.h:111
BmnParamLayout::fByNode
Nodes_t fByNode
Definition
BmnParamLayout.h:112
BmnParamLayout::Rebuild
void Rebuild(const BmnAlignHierarchy &hierarchy)
Definition
BmnParamLayout.cxx:42
BmnParamLayout::ParamNames
static const std::vector< std::string > & ParamNames()
Definition
BmnParamLayout.cxx:22
BmnAlignHierarchy::Node_t
Definition
BmnAlignHierarchy.h:92
NodeRef
Definition
BmnParamLayout.h:63
NodeRef::name
const char * name
Definition
BmnParamLayout.h:64
NodeRef::leaf
Int_t leaf
Definition
BmnParamLayout.h:66
NodeRef::params
std::vector< ParamRef > params
Definition
BmnParamLayout.h:67
NodeRef::level
Int_t level
Definition
BmnParamLayout.h:65
ParamRef
Definition
BmnParamLayout.h:44
ParamRef::full
Int_t full
Definition
BmnParamLayout.h:45
ParamRef::nodeName
const char * nodeName
Definition
BmnParamLayout.h:51
ParamRef::prm
Int_t prm
Definition
BmnParamLayout.h:49
ParamRef::prmName
const char * prmName
Definition
BmnParamLayout.h:52
ParamRef::leaf
Int_t leaf
Definition
BmnParamLayout.h:46
ParamRef::level
Int_t level
Definition
BmnParamLayout.h:50
ParamRef::comp
Int_t comp
Definition
BmnParamLayout.h:47
ParamRef::node
Int_t node
Definition
BmnParamLayout.h:48
align_new
src
BmnParamLayout.cxx
Generated on
for BmnRoot by
1.17.0