22void add_Tof1_mapping(
string placement_map_filename =
"/home/mikhailr/bmnroot/input/TOF400_PlaceMap_Period5_v3.txt",
23 string main_map_filename =
"/home/mikhailr/bmnroot/input/TOF400_StripMap_Period5_v3.txt",
29 gROOT->LoadMacro(
"$VMCWORKDIR/gconfig/basiclibs.C");
50 unsigned int map1[100];
54 ff.open(placement_map_filename.c_str(), std::fstream::in);
56 cout <<
"Failed to open " << placement_map_filename << endl;
60 ff >> std::hex >> fcrate >> std::dec >> fslot >> std::hex >> fserial;
61 if (ff.eof() || fcrate == 0)
64 cout << std::hex << fcrate <<
" : " << std::dec << fslot << std::hex <<
" -> " << fserial << std::dec << endl;
65 map1[nLines * 3 + 0] = fcrate;
66 map1[nLines * 3 + 1] = fslot;
67 map1[nLines * 3 + 2] = fserial;
74 cout << nTDC <<
" TDCs in the mapping " << endl;
79 ff.open(main_map_filename.c_str(), std::fstream::in);
81 cout <<
"Failed to open " << main_map_filename << endl;
85 ff >> std::hex >> fserial >> std::dec >> fchan >> fplane >> fstrip >> side_c;
86 if (ff.eof() || fserial == 0)
89 if (side_c !=
'L' && side_c !=
'R')
90 cout <<
"Wrong mapping file: Side is not L or R." << endl;
100 cout << nLines <<
" lines in the main mapping file" << endl;
101 cout << (double(nLines) / 72.0) <<
" TDCs in the main mapping file" << endl;
108 cout <<
"Resulting array of unsigned int: " << endl;
109 for (
int i = 0;
i < map1Size;
i++) {
110 cout << map1[
i] <<
" (" << std::hex << map1[
i] << std::dec << endl;
114 cout <<
"\nOkay to upload it? (y/N)" << endl;
116 if (anwser ==
'y' || anwser ==
'Y') {
117 unsigned char* pt =
reinterpret_cast<unsigned char*
>(map1);
119 "TOF1",
"placementmap", sP, sR, eP, eR, pt, map1Size *
sizeof(
unsigned int), UIntArrayType);
121 cout <<
"Cannot upload the placement map" << endl;
129 cout <<
"Okay to upload the main map? (y/N)" << endl;
131 if (anwser ==
'y' || anwser ==
'Y') {
132 ff.open(main_map_filename.c_str(), std::fstream::in);
134 cout <<
"Uploading line " << nLines << endl;
135 ff >> std::hex >> fserial >> std::dec >> fchan >> fplane >> fstrip >> side_c;
138 }
else if (side_c ==
'R') {
141 cout <<
"Error: side is not L or R" << endl;
144 cout << std::hex << fserial <<
" " << std::dec << fchan <<
" " << fplane <<
" " << fstrip <<
" " << side_c;
146 if (ff.eof() || fserial == 0) {
153 cout <<
"Cannot upload the placement map" << endl;
160 cout <<
"Cannot upload the placement map" << endl;
167 cout <<
"Cannot upload the placement map" << endl;
static UniDetectorParameter * CreateDetectorParameter(TString detector_name, int parameter_id, int start_period, int start_run, int end_period, int end_run, int value_key, unsigned char *parameter_value, Long_t size_parameter_value, TDatime *expiry_date)
add new detector parameter to the database
void add_Tof1_mapping(string placement_map_filename="/home/mikhailr/bmnroot/input/TOF400_PlaceMap_Period5_v3.txt", string main_map_filename="/home/mikhailr/bmnroot/input/TOF400_StripMap_Period5_v3.txt", int sP=5, int sR=419, int eP=5, int eR=10000)