BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
read_Tof1_mapping.C
Go to the documentation of this file.
1/*
2 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
5 */
6
7/*
8 * File: read_Tof1_mapping.C
9 * Author: mikhailr
10 *
11 * Created on August 27, 2021, 11:51 AM
12 */
13
14#include <cstdlib>
15#include <vector>
16
17using namespace std;
18
19void read_Tof1_mapping(Int_t period = 7, Int_t run = 4700)
20{
21
22 bool return_error = false;
23
24 // get parameter of TDC's map
26 "TOF1", "TOF1_TdcMap", period, run); //(detector_name, parameter_name, period_number, run_number)
27 if (pDetectorParameter == nullptr) {
28 cout << "\nMacro finished with errors" << endl;
29 return;
30 }
31
32 // Print parameters
33 vector<UniValue*> pValues;
34 pDetectorParameter->GetValue(pValues);
35 MapIntValue* tempMap = new MapIntValue;
36 for (int i = 0; i < pValues.size(); i++) {
37 tempMap = (MapIntValue*)pValues.at(i);
38 cout << std::hex << tempMap->serial << std::dec << " : " << tempMap->channel << " -> " << std::hex
39 << tempMap->value << std::dec << endl;
40 }
41
42 // clean memory after work
43 for (int i = 0; i < pValues.size(); i++)
44 delete pValues[i];
45 if (pDetectorParameter)
46 delete pDetectorParameter;
47
48 //--------------------------------------------------------------------------
49 // get parameter of Strip's map
51 "TOF1", "TOF1_StripMap", period, run); //(detector_name, parameter_name, period_number, run_number)
52 if (pDetectorParameter2 == nullptr) {
53 cout << "\nMacro finished with errors" << endl;
54 return;
55 }
56
57 // Print parameters
58 vector<UniValue*> pValues2;
59 pDetectorParameter2->GetValue(pValues2);
60 MapDVectorValue* tempMap2 = new MapDVectorValue;
61 cout << pValues2.size() << " lines in the Strip map " << endl;
62 for (int i = 0; i < pValues2.size(); i++) {
63 tempMap2 = (MapDVectorValue*)pValues2.at(i);
64 cout << std::hex << tempMap2->serial << std::dec << " ch " << tempMap2->channel << " -> "
65 << tempMap2->value.at(0) << " " << tempMap2->value.at(1) << " " << tempMap2->value.at(2) << endl;
66 }
67
68 // clean memory after work
69 for (int i = 0; i < pValues2.size(); i++)
70 delete pValues2[i];
71 if (pDetectorParameter2)
72 delete pDetectorParameter2;
73
74 else
75 return_error = true;
76
77 if (return_error)
78 cout << "\nMacro finished with errors" << endl;
79 else
80 cout << "\nMacro finished successfully" << endl;
81}
int i
Definition P4_F32vec4.h:22
int Int_t
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
Definition json.hpp:4446
void read_Tof1_mapping(Int_t period=7, Int_t run=4700)
vector< double > value