BmnRoot
26.10.0-210-gc52d34b0
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
BmnAlignPriors.h
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
BmnAlignPriors class declaration
10
Prior knowledge about the alignment: constraints and presigmas
11
*/
12
13
#ifndef BMNALIGNPRIORS_H
14
#define BMNALIGNPRIORS_H
15
16
#include "
BmnAlignHierarchy.h
"
17
18
#include <
TMatrixD.h
>
19
#include <
TVectorD.h
>
20
21
/*
22
* Everything the fit is told before it sees a single hit, in the form the
23
* solver consumes it:
24
*
25
* - constraints : exact linear relations the solution must satisfy, entering
26
* the system as Lagrange multiplier rows.
27
* - presigmas : per-parameter prior uncertainties, entering as
28
* pseudo-measurements "parameter == reference +/- sigma" (see Apply).
29
*
30
* Both are addressed in the full layout of BmnAlignHierarchy. BmnAlignConfig
31
* fills this from JSON; BmnAligner and BmnAlignReport only read it.
32
*
33
* They are also the way to hold an element in place. A constraint on a leaf
34
* pins its effective correction, so the element does not move at all. A
35
* tight presigma pins its own share only, so it still moves with its
36
* ancestors.
37
*
38
* Data is public on purpose: this is the parsed content of two config files,
39
* and the loaders write it field by field. The two members below carry the
40
* behaviour that belongs with the data rather than with either consumer.
41
*/
42
43
class
BmnAlignPriors
44
{
45
public
:
46
// --- constraints -----------------------------------------------------
47
// constraints * A = rhs, one row per constraint, columns in the full layout
48
TMatrixD
constraints
;
49
TVectorD
rhs
;
50
Bool_t
inhomogeneous
{
kFALSE
};
// any non-zero right-hand side
51
52
// --- presigmas -------------------------------------------------------
53
VecDouble_t
sigma
;
// prior sigma per full-layout parameter; <= 0 means "no prior"
54
VecDouble_t
ref
;
// value the prior pulls towards
55
Int_t
presigmaCount
{0};
// parameters that actually carry one
56
57
// sizes the presigma arrays and records the layout the addressing is in.
58
// Call once the hierarchy is built and before either loader runs.
59
void
Init
(
const
BmnAlignHierarchy
& hierarchy)
60
{
61
fAllParams
= hierarchy.
AllParams
();
62
sigma
.assign(
fAllParams
, 0.0);
63
ref
.assign(
fAllParams
, 0.0);
64
presigmaCount
= 0;
65
constraints
.ResizeTo(0,
fAllParams
);
66
rhs
.ResizeTo(0);
67
inhomogeneous
=
kFALSE
;
68
fKept
.clear();
69
fKeptRows
.ResizeTo(0, 0);
70
}
71
72
Int_t
ConstCount
() const noexcept {
return
constraints
.GetNrows(); }
73
Bool_t
UsePresigmas
() const noexcept {
return
presigmaCount
> 0; }
74
// the independent constraints, found by Check(): their indices into
75
// constraints / rhs, and their rows promoted to the solved basis
76
const
VecInt_t
&
Kept
() const noexcept {
return
fKept
; }
77
const
TMatrixD
&
KeptRows
() const noexcept {
return
fKeptRows
; }
78
Int_t
KeptCount
() const noexcept {
return
static_cast<
Int_t
>
(
fKept
.size()); }
79
// presigmas are absent altogether when no file was given, hence the guard
80
Double_t
SigmaAt
(
Int_t
full)
const
noexcept
{
return
full < static_cast<Int_t>(
sigma
.size()) ?
sigma
[full] : 0.0; }
81
82
// Folds the presigmas into an already reduced system, as pseudo-measurements
83
// of the parameters they refer to. accA is the accumulated solution in the
84
// full layout (effective leaf corrections), null on the first iteration;
85
// leaf priors are measured against its own-share part.
86
void
Apply
(
TVectorD
& vB,
TMatrixD
& mC,
const
BmnAlignHierarchy
& hierarchy,
const
TVectorD
* accA)
const
;
87
88
// Finds the independent constraints (see Kept()). kFALSE if the constraints
89
// contradict each other, or if the composite parameters of the hierarchy are
90
// not all determined by what is configured here, i.e. if the fit would be
91
// singular along some direction of the level split. Logs the reason.
92
Bool_t
Check
(
const
BmnAlignHierarchy
& hierarchy);
93
94
protected
:
95
Int_t
fAllParams
{0};
// the layout everything above is addressed in
96
VecInt_t
fKept
;
// see Kept()
97
TMatrixD
fKeptRows
;
// see KeptRows()
98
};
99
100
#endif
// BMNALIGNPRIORS_H
VecDouble_t
std::vector< Double_t > VecDouble_t
Definition
BmnAlignDefines.h:50
VecInt_t
std::vector< Int_t > VecInt_t
Definition
BmnAlignDefines.h:51
BmnAlignHierarchy.h
Bool_t
bool Bool_t
Int_t
int Int_t
kFALSE
constexpr Bool_t kFALSE
Double_t
double Double_t
TMatrixD.h
TMatrixD
TMatrixT< Double_t > TMatrixD
TVectorD.h
TVectorD
TVectorT< Double_t > TVectorD
BmnAlignHierarchy
Definition
BmnAlignHierarchy.h:89
BmnAlignHierarchy::AllParams
Int_t AllParams() const noexcept
Definition
BmnAlignHierarchy.h:129
BmnAlignPriors
Definition
BmnAlignPriors.h:44
BmnAlignPriors::inhomogeneous
Bool_t inhomogeneous
Definition
BmnAlignPriors.h:50
BmnAlignPriors::SigmaAt
Double_t SigmaAt(Int_t full) const noexcept
Definition
BmnAlignPriors.h:80
BmnAlignPriors::ref
VecDouble_t ref
Definition
BmnAlignPriors.h:54
BmnAlignPriors::sigma
VecDouble_t sigma
Definition
BmnAlignPriors.h:53
BmnAlignPriors::fKeptRows
TMatrixD fKeptRows
Definition
BmnAlignPriors.h:97
BmnAlignPriors::fAllParams
Int_t fAllParams
Definition
BmnAlignPriors.h:95
BmnAlignPriors::presigmaCount
Int_t presigmaCount
Definition
BmnAlignPriors.h:55
BmnAlignPriors::Apply
void Apply(TVectorD &vB, TMatrixD &mC, const BmnAlignHierarchy &hierarchy, const TVectorD *accA) const
Definition
BmnAlignPriors.cxx:68
BmnAlignPriors::Init
void Init(const BmnAlignHierarchy &hierarchy)
Definition
BmnAlignPriors.h:59
BmnAlignPriors::constraints
TMatrixD constraints
Definition
BmnAlignPriors.h:48
BmnAlignPriors::fKept
VecInt_t fKept
Definition
BmnAlignPriors.h:96
BmnAlignPriors::Check
Bool_t Check(const BmnAlignHierarchy &hierarchy)
Definition
BmnAlignPriors.cxx:91
BmnAlignPriors::Kept
const VecInt_t & Kept() const noexcept
Definition
BmnAlignPriors.h:76
BmnAlignPriors::rhs
TVectorD rhs
Definition
BmnAlignPriors.h:49
BmnAlignPriors::UsePresigmas
Bool_t UsePresigmas() const noexcept
Definition
BmnAlignPriors.h:73
BmnAlignPriors::KeptRows
const TMatrixD & KeptRows() const noexcept
Definition
BmnAlignPriors.h:77
BmnAlignPriors::KeptCount
Int_t KeptCount() const noexcept
Definition
BmnAlignPriors.h:78
BmnAlignPriors::ConstCount
Int_t ConstCount() const noexcept
Definition
BmnAlignPriors.h:72
align_new
src
BmnAlignPriors.h
Generated on
for BmnRoot by
1.17.0