BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
tango_gem_u.C
Go to the documentation of this file.
1
// Macro for printing TANGO data for GEM high voltage
2
3
// mod_2 top GEMs: vmon_1 - М6, vmon_2 - М10, vmon_3 - М7, vmon_4 - М9, vmon_5 - М5, vmon_6 - М8, vmon_7 - М11 (vmon_8 -
4
// small GEM) mod_0 bottom GEMs: vmon_1 - М16, vmon_2 - М15, vmon_3 - М14, vmon_4 - М12, vmon_5 - М18, vmon_6 - М13,
5
// vmon_7 - М17
6
vector<pair<const char*, const char*>>
map_channel_run8
= {
7
{
"mod_2"
,
"vmon_1"
}, {
"mod_2"
,
"vmon_2"
}, {
"mod_2"
,
"vmon_3"
}, {
"mod_2"
,
"vmon_4"
}, {
"mod_2"
,
"vmon_5"
},
8
{
"mod_2"
,
"vmon_6"
}, {
"mod_2"
,
"vmon_7"
}, {
"mod_0"
,
"vmon_1"
}, {
"mod_0"
,
"vmon_2"
}, {
"mod_0"
,
"vmon_3"
},
9
{
"mod_0"
,
"vmon_4"
}, {
"mod_0"
,
"vmon_5"
}, {
"mod_0"
,
"vmon_6"
}, {
"mod_0"
,
"vmon_7"
}};
10
11
// for datetime range
12
void
tango_gem_u
(
const
char
* start_date =
"2016-12-21 12:20:00"
,
const
char
* end_date =
"2016-12-21 12:40:00"
)
13
{
14
int
start_period =
UniRunPeriod::GetPeriodNumber
(start_date);
15
if
(start_period < 1) {
16
cout <<
"ERROR: start date is not in any run period of the experiment"
<< endl;
17
exit(-1);
18
}
19
int
end_period =
UniRunPeriod::GetPeriodNumber
(end_date);
20
if
(end_period < 1) {
21
cout <<
"ERROR: end date is not in any run period of the experiment"
<< endl;
22
exit(-2);
23
}
24
if
(start_period != end_period) {
25
cout <<
"ERROR: the time interval must be in one run period of the experiment"
<< endl;
26
exit(-3);
27
}
28
29
if
(start_period >= 8) {
30
switch
(start_period) {
31
case
8: {
32
const
char
* detector_name =
"gem"
;
33
vector<TangoData*> vecTangoData;
34
for
(
const
auto
& current_channel :
map_channel_run8
) {
35
// cout<<"detector_name = "<<detector_name<<", parameter name = "<<current_channel.second<<", member
36
// name = "<<current_channel.first<<endl;
37
// TangoData stores array of TangoTimeParameter* (parameter's values) for all time points
38
TangoData
* db_tango =
new
TangoData
(start_date, end_date, detector_name, current_channel.second,
39
current_channel.first);
40
vecTangoData.push_back(db_tango);
41
if
(db_tango->
GetTangoData
() ==
nullptr
) {
42
cout <<
"Macro finished with errors"
<< endl;
43
exit(-4);
44
}
45
}
46
47
// console output
48
TangoData::PrintTangoArrayConsole
(vecTangoData);
49
// graph output
50
TangoData::PrintTangoArrayMultiGraph
(vecTangoData);
51
52
for
(
const
auto
& tango_data : vecTangoData)
53
delete
tango_data;
54
vecTangoData.clear();
55
56
break
;
57
}
58
default
: {
59
cout <<
"Period "
<< start_period <<
" is not supported"
<< endl;
60
exit(-5);
61
}
62
}
63
}
else
{
64
const
char
* detector_name =
"gem"
;
65
const
char
* parameter_name =
"u"
;
66
67
// TangoData stores array of TangoTimeParameter* (parameter's values) for all time points
68
TangoData
db_tango(start_date, end_date, detector_name, parameter_name);
69
if
(db_tango.
GetTangoData
() ==
nullptr
) {
70
cout <<
"Macro finished with errors"
<< endl;
71
exit(-6);
72
}
73
74
// console output
75
db_tango.
PrintTangoDataConsole
();
76
77
// graph output
78
// db_tango.PrintTangoDataSurface(tango_data);
79
db_tango.
PrintTangoDataMultiGraph
();
//, "U", true);
80
}
81
82
cout <<
"Macro finished successfully"
<< endl;
83
}
84
85
// for a given run
86
void
tango_gem_u
(
int
period,
int
run)
87
{
88
// get run time
89
UniRun
* pRun =
UniRun::GetRun
(period, run);
90
if
(pRun ==
nullptr
) {
91
cout <<
"Macro finished with errors: no experimental run was found for period = "
<< period <<
", run = "
<< run
92
<< endl;
93
exit(-1);
94
}
95
96
TString
strStartDate = pRun->
GetStartDatetime
().
AsSQLString
();
97
TDatime
* endDate = pRun->
GetEndDatetime
();
98
if
(endDate ==
nullptr
) {
99
cout <<
"Macro finished with errors: no end datetime in the database for period = "
<< period
100
<<
", run = "
<< run << endl;
101
delete
pRun;
102
exit(-2);
103
}
104
TString
strEndDate = endDate->
AsSQLString
();
105
delete
pRun;
106
107
if
(period >= 8) {
108
switch
(period) {
109
case
8: {
110
const
char
* detector_name =
"gem"
;
111
vector<TangoData*> vecTangoData;
112
for
(
const
auto
& current_channel :
map_channel_run8
) {
113
// cout<<"detector_name = "<<detector_name<<", parameter name = "<<current_channel.second<<", member
114
// name = "<<current_channel.first<<endl;
115
// TangoData stores array of TangoTimeParameter* (parameter's values) for all time points
116
TangoData
* db_tango =
new
TangoData
(strStartDate.
Data
(), strEndDate.
Data
(), detector_name,
117
current_channel.second, current_channel.first);
118
vecTangoData.push_back(db_tango);
119
if
(db_tango->
GetTangoData
() ==
nullptr
) {
120
cout <<
"Macro finished with errors"
<< endl;
121
exit(-3);
122
}
123
}
124
125
// console output
126
TangoData::PrintTangoArrayConsole
(vecTangoData);
127
// graph output
128
TangoData::PrintTangoArrayMultiGraph
(vecTangoData);
129
130
for
(
const
auto
& tango_data : vecTangoData)
131
delete
tango_data;
132
vecTangoData.clear();
133
134
break
;
135
}
136
default
: {
137
cout <<
"Period "
<< period <<
" is not supported"
<< endl;
138
exit(-4);
139
}
140
}
141
}
else
{
142
const
char
* detector_name =
"gem"
;
143
const
char
* parameter_name =
"u"
;
144
145
// TangoData stores array of TangoTimeParameter* (parameter's values) for all time points
146
TangoData
db_tango(strStartDate.
Data
(), strEndDate.
Data
(), detector_name, parameter_name);
147
if
(db_tango.
GetTangoData
() ==
nullptr
) {
148
cout <<
"Macro finished with errors"
<< endl;
149
exit(-5);
150
}
151
152
// console output
153
db_tango.
PrintTangoDataConsole
();
154
155
// graph output
156
// db_tango.PrintTangoDataSurface();
157
db_tango.
PrintTangoDataMultiGraph
();
158
}
159
160
cout <<
"Macro finished successfully"
<< endl;
161
}
TDatime
TDatime::AsSQLString
const char * AsSQLString() const
TString
TString::Data
const char * Data() const
TangoData
Definition
TangoData.h:83
TangoData::PrintTangoArrayConsole
static void PrintTangoArrayConsole(std::vector< TangoData * > vecTangoData)
TangoData::PrintTangoDataConsole
void PrintTangoDataConsole()
Definition
TangoData.cxx:503
TangoData::GetTangoData
TObjArray * GetTangoData()
Definition
TangoData.h:141
TangoData::PrintTangoDataMultiGraph
int PrintTangoDataMultiGraph(const char *y_axis="parameter", bool is3D=false)
Definition
TangoData.cxx:698
TangoData::PrintTangoArrayMultiGraph
static int PrintTangoArrayMultiGraph(std::vector< TangoData * > vecTangoData, const char *y_axis="parameter", bool is3D=false)
UniRunPeriod::GetPeriodNumber
int GetPeriodNumber()
get period number of the current run period
Definition
UniRunPeriod.h:54
UniRun
UniRun.h Class for the table: run_.
Definition
UniRun.h:21
UniRun::GetRun
static UniRun * GetRun(int period_number, int run_number)
get run from the database
Definition
UniRun.cxx:161
UniRun::GetEndDatetime
TDatime * GetEndDatetime()
get end datetime of the current run
Definition
UniRun.h:101
UniRun::GetStartDatetime
TDatime GetStartDatetime()
get start datetime of the current run
Definition
UniRun.h:99
map_channel_run8
vector< pair< const char *, const char * > > map_channel_run8
Definition
tango_gem_u.C:6
tango_gem_u
void tango_gem_u(const char *start_date="2016-12-21 12:20:00", const char *end_date="2016-12-21 12:40:00")
Definition
tango_gem_u.C:12
database
tango
examples
tango_gem_u.C
Generated on
for BmnRoot by
1.17.0