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