BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
tango_gem_hv.C
Go to the documentation of this file.
1// Macro for drawing the high voltage of the GEM detectors from the Tango database as line graphs or as a surface
2//
3// The GEM high voltage (monitored values) is stored in Tango separately for every channel of the CAEN modules:
4// gem/caen_240/mod_0/vmon_<N> and gem/caen_240/mod_2/vmon_<N>, N = 0, ..., 11
5//
6// Parameters:
7// period, start_run, end_run - period and run range (or start_date, end_date - time interval)
8// module - CAEN module ("mod_0" or "mod_2"), empty string - all the modules
9// draw_option - "lines" - line graphs, "lines3d" - line graphs in 3D view,
10// "SURF1" - surface, "LEGO2" - columns, "COLZ" - color map or another option of the 2D histogram
11//
12// Examples:
13// root -l 'tango_gem_hv.C(9, 9696, 9730)' - channels of mod_0 as line graphs
14// root -l 'tango_gem_hv.C(9, 9696, 9730, "", "SURF1")' - channels of all the modules as a surface
15// root -l 'tango_gem_hv.C("2026-03-01 10:00:00", "2026-03-01 16:00:00", "mod_2", "LEGO2")'
16
17// CAEN modules of the GEM high voltage stored in Tango
18vector<TString> gem_hv_modules = {"mod_0", "mod_2"};
19const int gem_hv_channel_count = 12;
20
21// read the high voltage of the selected GEM channels and draw them,
22// create_tango - function creating TangoData object for the given Tango attribute and member names
23void DrawGemHV(function<TangoData*(const char*, const char*)> create_tango, TString module, TString draw_option)
24{
25 vector<TString> modules;
26 if (module == "")
27 modules = gem_hv_modules;
28 else
29 modules.push_back(module);
30
31 // TangoData object for every channel, the channels without data are skipped
32 vector<TangoData*> vecTangoData;
33 cout << "Channel indices on the graph:" << endl;
34 for (const auto& m : modules) {
35 for (int ch = 0; ch < gem_hv_channel_count; ch++) {
36 TString attribute_name = TString::Format("vmon_%d", ch);
37 TangoData* tango_data = create_tango(attribute_name.Data(), m.Data());
38 if ((tango_data->GetTangoData() == nullptr) || (tango_data->GetTangoData()->IsEmpty())) {
39 cout << "WARNING: there are no Tango data for " << m << "/" << attribute_name
40 << ", the channel is skipped" << endl;
41 delete tango_data;
42 continue;
43 }
44 cout << " " << vecTangoData.size() << " - " << m << ", " << attribute_name << endl;
45 vecTangoData.push_back(tango_data);
46 }
47 }
48 if (vecTangoData.empty()) {
49 cout << "Macro finished with errors: there are no Tango data for the selected GEM channels" << endl;
50 return;
51 }
52
53 TString option(draw_option);
54 option.ToLower();
55 int result;
56 if ((option == "lines") || (option == "lines3d"))
57 result = TangoData::PrintTangoArrayMultiGraph(vecTangoData, "voltage", option == "lines3d");
58 else
59 result = TangoData::PrintTangoArraySurface(vecTangoData, "voltage", "channel index", draw_option);
60
61 for (auto tango_data : vecTangoData)
62 delete tango_data;
63
64 if (result < 0)
65 cout << "Macro finished with errors" << endl;
66 else
67 cout << "Macro finished successfully" << endl;
68}
69
70// for the run range of the period
71void tango_gem_hv(int period = 9,
72 int start_run = 9696,
73 int end_run = 9730,
74 TString module = "mod_0",
75 TString draw_option = "lines")
76{
78 [&](const char* attribute_name, const char* member_name) {
79 return new TangoData(period, start_run, end_run, "gem", attribute_name, member_name);
80 },
81 module, draw_option);
82}
83
84// for the time interval
85void tango_gem_hv(const char* start_date, const char* end_date, TString module = "mod_0", TString draw_option = "lines")
86{
88 [&](const char* attribute_name, const char* member_name) {
89 return new TangoData(start_date, end_date, "gem", attribute_name, member_name);
90 },
91 module, draw_option);
92}
__m128 m
Definition P4_F32vec4.h:27
Bool_t IsEmpty() const override
void ToLower()
const char * Data() const
static TString Format(const char *fmt,...)
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.
TObjArray * GetTangoData()
Definition TangoData.h:141
static int PrintTangoArrayMultiGraph(std::vector< TangoData * > vecTangoData, const char *y_axis="parameter", bool is3D=false)
const int gem_hv_channel_count
vector< TString > gem_hv_modules
void tango_gem_hv(int period=9, int start_run=9696, int end_run=9730, TString module="mod_0", TString draw_option="lines")
void DrawGemHV(function< TangoData *(const char *, const char *)> create_tango, TString module, TString draw_option)