BmnRoot 26.10.0-210-gc52d34b0
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
BmnAlignReport.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: Igor Polev, polev@jinr.int
7
8 BmnAlignReport class declaration
9 Textual analysis of alignment results
10*/
11
12#ifndef BMNALIGNREPORT_H
13#define BMNALIGNREPORT_H
14
15#include "BmnAligner.h"
16
17#include <TPad.h>
18
19class TH1; // only pointers and references to it are named below
20
21/*
22 * Reads what an alignment run produced and logs it: the summary of a finished
23 * run, the weak modes of the solved system, and the parameter correlations.
24 *
25 * A consumer of BmnAligner, not a part of it - everything here is read-only
26 * over the aligner's public interface, so there is no state to hold and the
27 * methods are static. Weak mode analysis may write a constraints snippet file,
28 * and Draw() creates a canvas; those are the only side effects.
29 */
30
32{
33 public:
34 BmnAlignReport() = delete;
35
36 // summary of a finished run: MSE and residual changes, constraint
37 // satisfaction, composite corrections, timings
38 static void Results(const BmnAligner& aligner);
39
40 // eigenvectors of the solved system below an eigenvalue threshold, with
41 // their overlap against the constraints already in force. With dumpNew the
42 // unconstrained ones are written out as a ready-to-paste constraints file.
43 static void ModesBelow(const BmnAligner& aligner, Double_t absThreshold, Bool_t dumpNew = kTRUE);
44
45 // parameter pairs whose correlation exceeds a threshold, plus the
46 // per-parameter global correlation
47 static void Correlations(const BmnAligner& aligner,
48 Double_t absThreshold = 0.9,
49 Int_t topK = 20,
50 Bool_t skipIntraDet = kFALSE);
51
52 // Canvas view of a result: residuals before and after, the SVD spectrum
53 // tail, and a sample of tracks in 3D. Everything drawn is copied, so the
54 // canvas keeps working after the aligner it was built from is gone.
55 // number is the ordered number of the result starting from 1, negative
56 // values mean counting from the end.
57 static void Draw(const BmnAligner& aligner, Int_t number = -1);
58
59 protected:
60 // relative change of a value, as a percentage or in orders of magnitude
61 static char* Change(Double_t before, Double_t after);
62
63 // the eight pads Draw() lays out, passed between its helpers instead of
64 // being held as state - there is nothing to remember between calls
65 struct Pads
66 {
67 TPad *resSXbefore{nullptr}, // synthetic X residuals before alignment
68 *resSXafter{nullptr}, // synthetic X residuals after alignment
69 *resSYbefore{nullptr}, // synthetic Y residuals before alignment
70 *resSYafter{nullptr}, // synthetic Y residuals after alignment
71 *resX{nullptr}, // 1D total residuals by X
72 *resY{nullptr}, // 1D total residuals by Y
73 *svd{nullptr}, // SVD singular values
74 *tracks{nullptr}; // 3D tracks visualization
75 };
76 static Pads PrepareCanvas();
77 static void DrawResiduals(const BmnAligner& aligner, const Pads& pads, std::size_t idx);
78
79 private:
80 // A pad must not point into the aligner's own histograms: the canvas
81 // outlives the run in macro mode, and redrawing a deleted histogram would
82 // crash. Every plot is therefore drawn from a detached copy.
83 static TH1* ClonePlot(const TH1& source);
84};
85
86#endif // BMNALIGNREPORT_H
bool Bool_t
int Int_t
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
static Pads PrepareCanvas()
BmnAlignReport()=delete
static void DrawResiduals(const BmnAligner &aligner, const Pads &pads, std::size_t idx)
static void Correlations(const BmnAligner &aligner, Double_t absThreshold=0.9, Int_t topK=20, Bool_t skipIntraDet=kFALSE)
static void ModesBelow(const BmnAligner &aligner, Double_t absThreshold, Bool_t dumpNew=kTRUE)
static TH1 * ClonePlot(const TH1 &source)
static char * Change(Double_t before, Double_t after)
static void Draw(const BmnAligner &aligner, Int_t number=-1)
static void Results(const BmnAligner &aligner)