BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
tango_fhcal_hv.C
Go to the documentation of this file.
1
// Macro for drawing the high voltage of the FHCal from the Tango database as line graphs or as a surface
2
//
3
// The FHCal high voltage is stored in Tango separately for every section of every module:
4
// fhcal/hv/hv_1/vch_<module>_<section>, module = 2, 4, ..., 116 (except 64, 78, 92, 114), section = 1, ..., 10
5
//
6
// Parameters:
7
// period, start_run, end_run - period and run range (or start_date, end_date - time interval)
8
// module - FHCal module number to show all its sections, 0 - show the given section of all the modules
9
// section - section number to show for all the modules (used only if module = 0)
10
// draw_option - "lines" - line graphs, "lines3d" - line graphs in 3D view,
11
// "SURF1" - surface, "LEGO2" - columns, "COLZ" - color map or another option of the 2D histogram
12
//
13
// Examples:
14
// root -l 'tango_fhcal_hv.C(9, 9696, 9730)' - all sections of module 2 as line graphs
15
// root -l 'tango_fhcal_hv.C(9, 9696, 9730, 0, 1, "SURF1")' - section 1 of all the modules as a surface
16
// root -l 'tango_fhcal_hv.C("2026-03-01 10:00:00", "2026-03-01 16:00:00", 2, 1, "LEGO2")'
17
18
// FHCal modules whose high voltage is stored in Tango
19
vector<int>
GetFHCalModules
()
20
{
21
vector<int> modules;
22
for
(
int
module = 2;
module
<= 116;
module
+= 2)
23
if ((module != 64) && (module != 78) && (module != 92) && (module != 114))
24
modules.push_back(module);
25
return
modules;
26
}
27
28
// read the high voltage of the selected FHCal channels and draw them,
29
// create_tango - function creating TangoData object for the given Tango attribute name
30
void
DrawFHCalHV
(function<
TangoData
*(
const
char
*)> create_tango,
int
module,
int
section,
TString
draw_option)
31
{
32
vector<int> modules, sections;
33
if
(module > 0) {
34
modules.push_back(module);
35
for
(
int
s = 1; s <= 10; s++)
36
sections.push_back(s);
37
}
else
{
38
if
((section < 1) || (section > 10)) {
39
cout <<
"ERROR: section number should be from 1 to 10"
<< endl;
40
return
;
41
}
42
modules =
GetFHCalModules
();
43
sections.push_back(section);
44
}
45
46
// TangoData object for every channel, the channels without data are skipped
47
vector<TangoData*> vecTangoData;
48
cout <<
"Channel indices on the graph:"
<< endl;
49
for
(
int
m
: modules) {
50
for
(
int
s : sections) {
51
TString
attribute_name =
TString::Format
(
"vch_%d_%d"
,
m
, s);
52
TangoData
* tango_data = create_tango(attribute_name.
Data
());
53
if
((tango_data->
GetTangoData
() ==
nullptr
) || (tango_data->
GetTangoData
()->
IsEmpty
())) {
54
cout <<
"WARNING: there are no Tango data for "
<< attribute_name <<
", the channel is skipped"
<< endl;
55
delete
tango_data;
56
continue
;
57
}
58
cout <<
" "
<< vecTangoData.size() <<
" - module "
<<
m
<<
", section "
<< s << endl;
59
vecTangoData.push_back(tango_data);
60
}
61
}
62
if
(vecTangoData.empty()) {
63
cout <<
"Macro finished with errors: there are no Tango data for the selected FHCal channels"
<< endl;
64
return
;
65
}
66
67
TString
option(draw_option);
68
option.
ToLower
();
69
int
result;
70
if
((option ==
"lines"
) || (option ==
"lines3d"
))
71
result =
TangoData::PrintTangoArrayMultiGraph
(vecTangoData,
"voltage"
, option ==
"lines3d"
);
72
else
73
result =
TangoData::PrintTangoArraySurface
(vecTangoData,
"voltage"
,
74
module > 0 ?
"section index"
:
"module index"
, draw_option);
75
76
for
(
auto
tango_data : vecTangoData)
77
delete
tango_data;
78
79
if
(result < 0)
80
cout <<
"Macro finished with errors"
<< endl;
81
else
82
cout <<
"Macro finished successfully"
<< endl;
83
}
84
85
// for the run range of the period
86
void
tango_fhcal_hv
(
int
period = 9,
87
int
start_run = 9696,
88
int
end_run = 9730,
89
int
module = 2,
90
int
section = 1,
91
TString
draw_option =
"lines"
)
92
{
93
DrawFHCalHV
(
94
[&](
const
char
* attribute_name) {
95
return
new
TangoData
(period, start_run, end_run,
"fhcal"
, attribute_name,
"hv_1"
);
96
},
97
module, section, draw_option);
98
}
99
100
// for the time interval
101
void
tango_fhcal_hv
(
const
char
* start_date,
102
const
char
* end_date,
103
int
module = 2,
104
int
section = 1,
105
TString
draw_option =
"lines"
)
106
{
107
DrawFHCalHV
(
108
[&](
const
char
* attribute_name) {
109
return
new
TangoData
(start_date, end_date,
"fhcal"
, attribute_name,
"hv_1"
);
110
},
111
module, section, draw_option);
112
}
m
__m128 m
Definition
P4_F32vec4.h:27
TObjArray::IsEmpty
Bool_t IsEmpty() const override
TString
TString::ToLower
void ToLower()
TString::Data
const char * Data() const
TString::Format
static TString Format(const char *fmt,...)
TangoData
Definition
TangoData.h:83
TangoData::PrintTangoArraySurface
static int PrintTangoArraySurface(std::vector< TangoData * > vecTangoData, const char *z_axis="parameter", const char *y_axis="channel", const char *draw_option="SURF1", int time_bins=100)
Function displays a set of "simple" parameters obtained from Tango, e.g.
TangoData::GetTangoData
TObjArray * GetTangoData()
Definition
TangoData.h:141
TangoData::PrintTangoArrayMultiGraph
static int PrintTangoArrayMultiGraph(std::vector< TangoData * > vecTangoData, const char *y_axis="parameter", bool is3D=false)
DrawFHCalHV
void DrawFHCalHV(function< TangoData *(const char *)> create_tango, int module, int section, TString draw_option)
Definition
tango_fhcal_hv.C:30
GetFHCalModules
vector< int > GetFHCalModules()
Definition
tango_fhcal_hv.C:19
tango_fhcal_hv
void tango_fhcal_hv(int period=9, int start_run=9696, int end_run=9730, int module=2, int section=1, TString draw_option="lines")
Definition
tango_fhcal_hv.C:86
install
database
tango
examples
tango_fhcal_hv.C
Generated on
for BmnRoot by
1.17.0