BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
getListofINL_from_Map.C
Go to the documentation of this file.
1#include <TString.h>
2#include <fstream>
3#include <iostream>
4
5void getListofINL_from_Map(const std::string& inputFilename, const std::string& outputFilename)
6{
7 std::ifstream inputFile(inputFilename);
8 std::ofstream outputFile(outputFilename);
9
10 if (!inputFile.is_open()) {
11 std::cerr << "Ошибка: не удалось открыть входной файл: " << inputFilename << std::endl;
12 return;
13 }
14
15 if (!outputFile.is_open()) {
16 std::cerr << "Ошибка: не удалось создать выходной файл: " << outputFilename << std::endl;
17 inputFile.close();
18 return;
19 }
20
21 TString TTVXSID;
22 TString Slot;
23 TString TDCID;
24 TString line;
25
26 while (inputFile >> TTVXSID >> Slot >> TDCID) {
27 line = TTVXSID + " " + Slot + " " + TDCID;
28 std::cout << "line = " << line << std::endl;
29
30 // Формируем итоговую строку в формате "TDC64VHLE-XXXX-XXXX.ini"
31 TString result = "TDC64VHLE-" + TDCID(0, 4) + "-" + // первые 4 символа
32 TDCID(4, 4) + ".ini"; // следующие 4 символа
33
34 std::cout << "result = " << result << std::endl;
35
36 // Записываем результат в выходной файл
37 outputFile << result.Data() << std::endl;
38 }
39
40 inputFile.close();
41 outputFile.close();
42}
void getListofINL_from_Map(const std::string &inputFilename, const std::string &outputFilename)