BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcAlignPar.cpp
Go to the documentation of this file.
2
3#include <iostream>
4#include <fstream>
5#include <string>
6#include <cstring>
7#include <iomanip>
8
9using namespace std;
10
12 for(int iEP=0; iEP<NEP; iEP++){
13 m_delDx[iEP] = 0.0;
14 m_delDy[iEP] = 0.0;
15 m_delDz[iEP] = 0.0;
16 m_delRx[iEP] = 0.0;
17 m_delRy[iEP] = 0.0;
18 m_delRz[iEP] = 0.0;
19 }
20}
21
23}
25 for(int iEP=0; iEP<NEP; iEP++){
26 m_dx[iEP] = 0.0;
27 m_dy[iEP] = 0.0;
28 m_dz[iEP] = 0.0;
29 m_rx[iEP] = 0.0;
30 m_ry[iEP] = 0.0;
31 m_rz[iEP] = 0.0;
32
33 m_errDx[iEP] = 0.0;
34 m_errDy[iEP] = 0.0;
35 m_errDz[iEP] = 0.0;
36 m_errRx[iEP] = 0.0;
37 m_errRy[iEP] = 0.0;
38 m_errRz[iEP] = 0.0;
39 }
40}
41
42bool MdcAlignPar::rdAlignPar(std::string alignFile){
43 ifstream fpar(alignFile.c_str());
44 cout << "open file" << endl;
45 if( ! fpar.is_open() ){
46 cout << "ERROR: can not open alignment file " << alignFile.c_str() << endl;
47 return false;
48 }
49
50 int i;
51 string strtmp;
52 for(i=0; i<7; i++) fpar >> strtmp;
53 for(int iEP=0; iEP<NEP; iEP++){
54 fpar >> strtmp >> m_dx[iEP] >> m_dy[iEP] >> m_dz[iEP]
55 >> m_rx[iEP] >> m_ry[iEP] >> m_rz[iEP];
56 }
57 fpar.close();
58 return true;
59}
60
62 int i;
63 int iEnd;
64 string str[] = {"Inner_east", "Step0_east", "Step1_east",
65 "Step2_east", "Step3_east", "Step4_east",
66 "Step5_east", "Outer_east", "Inner_west",
67 "Step0_west", "Step1_west", "Step2_west",
68 "Step3_west", "Step4_west", "Step5_west",
69 "Outer_west"};
70
71 string name[] = {"Elements", "DeltaX(mm)", "DeltaY(mm)",
72 "DeltaZ(mm)", "RX(rad)", "RY(rad)", "RZ(rad)"};
73
74 ofstream fout("alignPar_new.txt");
75 fout << setw(14) << name[0];
76 for(i=1; i<7; i++) fout << setw(13) << name[i];
77 fout << endl;
78 for (iEnd=0; iEnd<NEP; iEnd++){
79 fout << setw(14) << str[iEnd]
80 << setw(13) << m_dx[iEnd] + m_delDx[iEnd]
81 << setw(13) << m_dy[iEnd] + m_delDy[iEnd]
82 << setw(13) << m_dz[iEnd] + m_delDz[iEnd]
83 << setw(13) << m_rx[iEnd] + m_delRx[iEnd]
84 << setw(13) << m_ry[iEnd] + m_delRy[iEnd]
85 << setw(13) << m_rz[iEnd] + m_delRz[iEnd] << endl;
86 if(7 == iEnd) fout << endl;
87 }
88 fout.close();
89
90 ofstream fdel("delAlign_new.txt");
91 fdel << setw(14) << name[0];
92 for(i=1; i<7; i++) fdel << setw(13) << name[i];
93 fdel << endl;
94 for (iEnd=0; iEnd<NEP; iEnd++){
95 fdel << setw(14) << str[iEnd] << setw(13) << m_delDx[iEnd]
96 << setw(13) << m_delDy[iEnd] << setw(13) << m_delDz[iEnd]
97 << setw(13) << m_delRx[iEnd] << setw(13) << m_delRy[iEnd]
98 << setw(13) << m_delRz[iEnd] << endl;
99 if(7 == iEnd) fdel << endl;
100 }
101
102 fdel << endl << "Fit error:" << endl;
103 for (iEnd=0; iEnd<NEP; iEnd++){
104 fdel << setw(14) << str[iEnd] << setw(13) << m_errDx[iEnd]
105 << setw(13) << m_errDy[iEnd] << setw(13) << m_errDz[iEnd]
106 << setw(13) << m_errRx[iEnd] << setw(13) << m_errRy[iEnd]
107 << setw(13) << m_errRz[iEnd] << endl;
108 if(7 == iEnd) fdel << endl;
109 }
110 fdel.close();
111}
void initAlignPar()
Definition: MdcAlignPar.cpp:24
void wrtAlignPar()
Definition: MdcAlignPar.cpp:61
bool rdAlignPar(std::string alignFile)
Definition: MdcAlignPar.cpp:42