BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
get_parameter_value_complex.C
Go to the documentation of this file.
1// macro for getting parameter value (if parameter exist - you could check existing parameters by
2// 'UniParameter::PrintAll()' function)
4{
5 bool return_error = false;
6
7 // get noise parameter values presented by IIStructure: Int+Int (slot:channel)
8 UniDetectorParameter* pDetectorParameter = UniDetectorParameter::GetDetectorParameter("DCH1", "noise", 1, 133);
9 if (pDetectorParameter != nullptr) {
10 vector<UniValue*> pValues;
11 pDetectorParameter->GetValue(pValues);
12
13 // YOUR CODE (e.g print values)
14 for (int i = 0; i < pValues.size(); i++)
15 cout << "Slot:Channel " << ((IIValue*)pValues[i])->value1 << ":" << ((IIValue*)pValues[i])->value2 << endl;
16
17 // clean memory after work
18 for (int i = 0; i < pValues.size(); i++)
19 delete pValues[i];
20 if (pDetectorParameter)
21 delete pDetectorParameter;
22 } else
23 return_error = true;
24
25 if (return_error)
26 cout << "\nMacro finished with errors" << endl;
27 else
28 cout << "\nMacro finished successfully" << endl;
29}
30
31// macro for getting alignment value for the given period and run number
32void get_parameter_alignment(int period_number = 7, int run_number = 4668)
33{
34 bool return_error = false;
35
36 // get noise parameter values presented by IIStructure: Int+Int (slot:channel)
37 UniDetectorParameter* pDetectorParameter =
38 UniDetectorParameter::GetDetectorParameter("gem", "alignment_shift", period_number, run_number);
39 if (pDetectorParameter != nullptr) {
40 vector<UniValue*> pValues;
41 pDetectorParameter->GetValue(pValues);
42
43 for (int i = 0; i < pValues.size(); i++) {
44 AlignmentValue* pValue = (AlignmentValue*)pValues[i];
45 cout << "Station:Module = " << (unsigned)pValue->station << ":" << (unsigned)pValue->module << endl;
46 cout << "shiftX = " << pValue->value[0] << ", shiftY = " << pValue->value[1]
47 << ", shiftZ = " << pValue->value[2] << endl
48 << endl;
49 }
50
51 // clean memory after work
52 for (int i = 0; i < pValues.size(); i++)
53 delete pValues[i];
54 if (pDetectorParameter)
55 delete pDetectorParameter;
56 } else
57 return_error = true;
58
59 if (return_error)
60 cout << "Macro finished with errors" << endl;
61 else
62 cout << "Macro finished successfully" << endl;
63}
int i
Definition P4_F32vec4.h:22
int GetValue(vector< UniValue * > &parameter_value)
get value of detector parameter presented by an array
static UniDetectorParameter * GetDetectorParameter(int value_id)
get detector parameter from the database
void get_parameter_alignment(int period_number=7, int run_number=4668)
void get_parameter_value_complex()