BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
get_parameter_value_inl.C
Go to the documentation of this file.
1// function: convert integer (hexadecimal value) to string with hexadecimal presentation without "0x"
2string int_to_hex_string(int int_number)
3{
4 stringstream stream;
5 stream << std::hex << int_number;
6 return stream.str();
7}
8
9// macro for getting parameter value (if parameter exist - you could check existing parameters by
10// 'UniParameter::PrintAll()' function)
12{
13 // get 'INL' parameter value (int array) for 72 channels
14 bool is_error = false;
15 int TDC_SERIAL = (int)0x06e9da91; //(int)0x0168fdca;
16
17 int channel_count = UniDetectorParameter::GetChannelCount("TOF1", "inl", 5, 419, TDC_SERIAL);
18 if (channel_count == 0)
19 cout << "The detector parameter wasn't found" << endl;
20 else
21 cout << "Channel number is equal " << channel_count << endl;
22
23 for (int i = 0; i < channel_count; i++) {
25 "TOF1", "inl", 5, 419, TDC_SERIAL,
26 i); //(detector_name, parameter_name, period_number, run_number, dc_serial, channel)
27 if (pDetectorParameter == nullptr) {
28 is_error = true;
29 continue;
30 }
31
32 int inl_size = -1;
33 double* inl_for_channel = nullptr;
34 int res_code = pDetectorParameter->GetDoubleArray(inl_for_channel, inl_size);
35 if (res_code != 0) {
36 is_error = true;
37 continue;
38 }
39
40 cout << "TDC: " << int_to_hex_string(TDC_SERIAL) << ". Channel: " << i << endl << "INL:";
41 for (int j = 0; j < inl_size; j++)
42 cout << " " << inl_for_channel[j];
43 cout << endl << endl;
44
45 // clean memory after work
46 delete pDetectorParameter;
47 delete[] inl_for_channel;
48 }
49
50 if (is_error)
51 cout << "\nMacro finished with errors" << endl;
52 else
53 cout << "\nMacro finished successfully" << endl;
54}
int i
Definition P4_F32vec4.h:22
static UniDetectorParameter * GetDetectorParameter(int value_id)
get detector parameter from the database
void get_parameter_value_inl()
string int_to_hex_string(int int_number)