BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
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
17
using namespace
std
;
18
19
void
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
25
UniDetectorParameter
* pDetectorParameter =
UniDetectorParameter::GetDetectorParameter
(
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
50
UniDetectorParameter
* pDetectorParameter2 =
UniDetectorParameter::GetDetectorParameter
(
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
}
i
int i
Definition
P4_F32vec4.h:22
Int_t
int Int_t
UniDetectorParameter
Definition
UniDetectorParameter.h:23
UniDetectorParameter::GetValue
int GetValue(vector< UniValue * > ¶meter_value)
get value of detector parameter presented by an array
Definition
UniDetectorParameter.cxx:1109
UniDetectorParameter::GetDetectorParameter
static UniDetectorParameter * GetDetectorParameter(int value_id)
get detector parameter from the database
Definition
UniDetectorParameter.cxx:165
std
Definition
json.hpp:4446
read_Tof1_mapping
void read_Tof1_mapping(Int_t period=7, Int_t run=4700)
Definition
read_Tof1_mapping.C:19
MapDVectorValue
Definition
uni_db_structures.h:293
MapDVectorValue::channel
int32_t channel
Definition
uni_db_structures.h:295
MapDVectorValue::serial
uint32_t serial
Definition
uni_db_structures.h:294
MapDVectorValue::value
vector< double > value
Definition
uni_db_structures.h:296
MapIntValue
Definition
uni_db_structures.h:271
MapIntValue::value
int32_t value
Definition
uni_db_structures.h:274
MapIntValue::serial
uint32_t serial
Definition
uni_db_structures.h:272
MapIntValue::channel
int32_t channel
Definition
uni_db_structures.h:273
database
examples
uni_db
TOF1
read_Tof1_mapping.C
Generated on
for BmnRoot by
1.17.0