11 cout <<
"Reading file: " << file_name << endl;
12 Int_t idxStart = file_name.Index(
"file_") + 5;
13 Int_t idxEnd = file_name.Index(
"_CW.");
14 TString shift = file_name(idxStart, idxEnd - idxStart);
15 TString fileIdx = shift(0, shift.Index(
"_"));
16 Int_t yShift = (doShift) ? TString(shift(shift.Index(
"_") + 1, shift.Length() - shift.Index(
"_") - 1)).Atoi() : 0;
17 cout <<
"File index: " << fileIdx <<
" Y shift = " << yShift << endl;
18 ifstream in_file(file_name);
19 if (!in_file.is_open())
20 throw runtime_error(
"Unable to read file " + file_name);
22 size_t line_number = 0;
23 vector<BmnFieldPoint> field_points;
24 while (getline(in_file, line)) {
25 istringstream stream(line);
27 if (line_number == 0) {
32 Double_t x = 0, y = 0, z = 0;
34 Double_t bx = 0, by = 0, bz = 0;
35 stream >> enc_pos >> x >> y >> z >> mon >> bx >> by >> bz;
36 field_points.push_back(
BmnFieldPoint(x, y + yShift, z, bx, by, bz));
39 cout << field_points.size() <<
" points are read" << endl;
44 cout <<
"Reading file: " << file_name << endl;
45 Int_t idxStart = file_name.Index(
"file_") + 5;
46 Int_t idxEnd = file_name.Index(
"_CW.");
47 TString shift = file_name(idxStart, idxEnd - idxStart);
48 TString fileIdx = shift(0, shift.Index(
"_"));
49 Int_t yShift = (doShift) ? TString(shift(shift.Index(
"_") + 1, shift.Length() - shift.Index(
"_") - 1)).Atoi() : 0;
50 cout <<
"File index: " << fileIdx <<
" Y shift = " << yShift << endl;
51 ifstream in_file(file_name);
52 if (!in_file.is_open())
53 throw runtime_error(
"Unable to read file " + file_name);
55 size_t line_number = 0;
57 while (getline(in_file, line)) {
58 istringstream stream(line);
60 if (line_number == 0) {
65 Double_t x = 0, y = 0, z = 0;
67 Double_t bx = 0, by = 0, bz = 0;
68 stream >> enc_pos >> x >> y >> z >> mon >> bx >> by >> bz;
69 if (Int_t(y + yShift) == 3075) cout << Int_t(x) <<
" " << Int_t(y + yShift) << endl;
70 field_points.insert(pair<pair<Int_t, Int_t>,
BmnFieldPoint>(pair<Int_t, Int_t>(Int_t(x), Int_t(y + yShift)),
BmnFieldPoint(x, y + yShift, z, bx, by, bz)));
73 cout << field_points.size() << endl;
74 cout << field_points.size() <<
" points are read" << endl;