BmnRoot 26.10.0-210-gc52d34b0
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
BmnAlignConfig.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 BmnAlignConfig class declaration
10 JSON configuration and solution files of the alignment task
11*/
12
13#ifndef BMNALIGNCONFIG_H
14#define BMNALIGNCONFIG_H
15
16#include "BmnAlignDefines.h"
17#include "BmnAlignHierarchy.h"
18#include "BmnAlignPriors.h"
19#include "BmnAlignResult.h"
20
21#include <vector>
22
23/*
24 * The file format layer of the alignment: it turns the JSON config files into
25 * the data structures the rest of the code works with, and back.
26 *
27 * It knows about the parametrization (BmnAlignHierarchy) because that is what
28 * the files address, and about nothing else - no data, no solver, no iteration
29 * state. Everything here is static: there is nothing to hold between calls.
30 *
31 * Reading a solution deliberately stops at producing values. Applying them -
32 * adding a result, recomputing the local parameters - is the aligner's
33 * business, and a consumer that only needs the corrections (BmnAlignerApply)
34 * can read a file without dragging the solver in.
35 *
36 * The target in a solution file. BmnAligner::PrepareData may move the target
37 * of the detector model by s = BmnDetectorModel::TargetShift(), and the solver
38 * then measures the target dZ from the moved target. The measurement models
39 * read a hit at z as the line at z - dZ, so a target at true z_t has
40 * dZ = z_c - z_t, and moving the centre z_c by s adds s to it. A file always
41 * holds the dZ of the geometry file: WriteSolution subtracts s, ReadSolution
42 * adds it back. So a file means the same in every run, and BmnAlignerApply,
43 * whose model is never moved, reads it as it is.
44 */
45
47{
48 public:
49 BmnAlignConfig() = delete;
50
51 // one alignable object as a solution file states it
53 {
54 Int_t node{-1}; // index in BmnParamLayout::ByNode()
55 SVectGL values{}; // its six corrections
56 };
57 // what a solution file holds, in the order the file listed it
58 struct Solution
59 {
60 std::vector<NodeValues> leaves; // by detector element
61 std::vector<NodeValues> composites; // by composite node
62 // kTRUE if the hierarchy has composites, so that loading must zero the
63 // ones the file does not mention rather than leave them where they were
65 };
66
67 // constraints file -> priors.constraints, priors.inhomogeneous
68 static Bool_t LoadConstraints(const char* jsonPath, const BmnAlignHierarchy& hierarchy, BmnAlignPriors& priors);
69
70 // presigmas file -> priors.sigma, priors.ref, priors.presigmaCount
71 static Bool_t LoadPresigmas(const char* jsonPath, const BmnAlignHierarchy& hierarchy, BmnAlignPriors& priors);
72
73 // solution file -> plain values, see the note above
74 static Bool_t ReadSolution(const char* jsonPath, const BmnAlignHierarchy& hierarchy, Solution& solution);
75
76 // solution + optionally the track approximations -> solution file
77 static Bool_t WriteSolution(const char* jsonPath,
78 const BmnAlignHierarchy& hierarchy,
79 const BmnAlignResult& result,
80 Int_t totalTracks,
81 Bool_t withAlpha);
82};
83
84#endif // BMNALIGNCONFIG_H
RM::SVector< Double_t, BMN_GLOBAL_PARAMS_PD > SVectGL
bool Bool_t
int Int_t
constexpr Bool_t kFALSE
static Bool_t LoadConstraints(const char *jsonPath, const BmnAlignHierarchy &hierarchy, BmnAlignPriors &priors)
static Bool_t WriteSolution(const char *jsonPath, const BmnAlignHierarchy &hierarchy, const BmnAlignResult &result, Int_t totalTracks, Bool_t withAlpha)
static Bool_t LoadPresigmas(const char *jsonPath, const BmnAlignHierarchy &hierarchy, BmnAlignPriors &priors)
static Bool_t ReadSolution(const char *jsonPath, const BmnAlignHierarchy &hierarchy, Solution &solution)
BmnAlignConfig()=delete
std::vector< NodeValues > composites
std::vector< NodeValues > leaves