BmnRoot
26.10.0-210-gc52d34b0
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
geometry.C
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
Detector geometry check macro: prints the sensitive rectangle of every
10
alignable element, so that the numbers can be compared with the detector
11
XML configurations by eye
12
*/
13
14
// headers below are for IDE syntax to work and they will be
15
// turned off during execution in ROOT macro mode
16
#ifndef __CLING__
17
#include "
BmnAlignModels.h
"
// IWYU pragma: keep
18
19
#include <iomanip>
20
#include <iostream>
21
#endif
22
23
#include "fairlogger/Logger.h"
24
25
/**
26
* @brief Print the geometry a detector model has read from the configurations.
27
*
28
* @return 0 on success, -1 if the model has no geometry or it looks wrong
29
*/
30
int
geometry
()
31
{
32
fair::Logger::SetConsoleColor(
true
);
33
fair::Logger::SetConsoleSeverity(
"info"
);
34
35
BmnRun9DM
detectorModel;
36
if
(!detectorModel.
Init
(
"/home/igor/bmnroot/geometry/target_CsI.geo"
))
37
return
-1;
38
39
const
auto
& target{detectorModel.
Target
()};
40
std::cout << std::fixed << std::setprecision(3) <<
"target: z from "
<< target.zStart <<
" to "
<< target.zEnd
41
<<
" cm, thickness "
<< target.zEnd - target.zStart <<
" cm\n"
;
42
43
const
auto
& planes{detectorModel.
Geometry
()};
44
if
(planes.size() !=
size_t
(detectorModel.
Alignables
())) {
45
std::cout <<
"geometry: "
<< planes.size() <<
" rectangle(s) for "
<< detectorModel.
Alignables
()
46
<<
" element(s)\n"
;
47
return
-1;
48
}
49
50
std::cout << std::fixed << std::setprecision(3)
51
<<
" idx id element xMin xMax yMin yMax z\n"
;
52
for
(
size_t
idx = 0; idx < planes.size(); idx++) {
53
const
int
ID{detectorModel.
EncodedID
(idx)};
54
const
auto
& p{planes[idx]};
55
std::cout << std::setw(5) << idx << std::setw(11) << ID <<
" "
<< detectorModel.
DecodeID
(ID) << std::setw(12)
56
<< p.xMin << std::setw(10) << p.xMax << std::setw(10) << p.yMin << std::setw(10) << p.yMax
57
<< std::setw(10) << p.z <<
'\n'
;
58
}
59
return
0;
60
}
BmnAlignModels.h
geometry
int geometry()
Print the geometry a detector model has read from the configurations.
Definition
geometry.C:30
BmnDetectorModel::Target
const Layer & Target() const
Definition
BmnDetectorModel.h:105
BmnDetectorModel::Geometry
const std::vector< Plane > & Geometry() const
Definition
BmnDetectorModel.h:104
BmnDetectorModel::EncodedID
Int_t EncodedID(Int_t idx) const
Definition
BmnDetectorModel.h:96
BmnDetectorModel::Init
Bool_t Init(const char *targetGeoFile=nullptr)
Definition
BmnDetectorModel.h:120
BmnRun9DM
Definition
BmnRun9DM.h:53
BmnRun9DM::DecodeID
virtual std::string DecodeID(Int_t id) const override
Definition
BmnRun9DM.h:203
BmnRun9DM::Alignables
virtual Int_t Alignables() const noexcept override
Definition
BmnRun9DM.h:170
align_new
macro
geometry.C
Generated on
for BmnRoot by
1.17.0