/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Mdc/MdcAlignAlg/MdcAlignAlg-00-01-04/share/distAlign/src/MdcAlignPar.cpp

Go to the documentation of this file.
00001 #include "include/MdcAlignPar.h"
00002 
00003 #include <iostream>
00004 #include <fstream>
00005 #include <string>
00006 #include <cstring>
00007 #include <iomanip>
00008 
00009 using namespace std;
00010 
00011 MdcAlignPar::MdcAlignPar(){
00012      for(int iEP=0; iEP<NEP; iEP++){
00013           m_delDx[iEP] = 0.0;
00014           m_delDy[iEP] = 0.0;
00015           m_delDz[iEP] = 0.0;
00016           m_delRx[iEP] = 0.0;
00017           m_delRy[iEP] = 0.0;
00018           m_delRz[iEP] = 0.0;
00019      }
00020 }
00021 
00022 MdcAlignPar::~MdcAlignPar(){
00023 }
00024 void MdcAlignPar::initAlignPar(){
00025      for(int iEP=0; iEP<NEP; iEP++){
00026           m_dx[iEP] = 0.0;
00027           m_dy[iEP] = 0.0;
00028           m_dz[iEP] = 0.0;
00029           m_rx[iEP] = 0.0;
00030           m_ry[iEP] = 0.0;
00031           m_rz[iEP] = 0.0;
00032 
00033           m_errDx[iEP] = 0.0;
00034           m_errDy[iEP] = 0.0;
00035           m_errDz[iEP] = 0.0;
00036           m_errRx[iEP] = 0.0;
00037           m_errRy[iEP] = 0.0;
00038           m_errRz[iEP] = 0.0;
00039      }
00040 }
00041 
00042 bool MdcAlignPar::rdAlignPar(std::string alignFile){
00043      ifstream fpar(alignFile.c_str());
00044      cout << "open file" << endl;
00045      if( ! fpar.is_open() ){
00046           cout << "ERROR: can not open alignment file " << alignFile.c_str() << endl;
00047           return false;
00048      }
00049 
00050      int i;
00051      string strtmp;
00052      for(i=0; i<7; i++) fpar >> strtmp;
00053      for(int iEP=0; iEP<NEP; iEP++){
00054           fpar >> strtmp >> m_dx[iEP] >> m_dy[iEP] >> m_dz[iEP]
00055                >> m_rx[iEP] >> m_ry[iEP] >> m_rz[iEP];
00056      }
00057      fpar.close();
00058      return true;
00059 }
00060 
00061 void MdcAlignPar::wrtAlignPar(){
00062      int i;
00063      int iEnd;
00064      string str[] = {"Inner_east", "Step0_east", "Step1_east",
00065                      "Step2_east", "Step3_east", "Step4_east",
00066                      "Step5_east", "Outer_east", "Inner_west",
00067                      "Step0_west", "Step1_west", "Step2_west",
00068                      "Step3_west", "Step4_west", "Step5_west",
00069                      "Outer_west"};
00070 
00071      string name[] = {"Elements", "DeltaX(mm)", "DeltaY(mm)",
00072                       "DeltaZ(mm)", "RX(rad)", "RY(rad)", "RZ(rad)"};
00073 
00074      ofstream fout("alignPar_new.txt");
00075      fout << setw(14) << name[0];
00076      for(i=1; i<7; i++) fout << setw(13) << name[i];
00077      fout << endl;
00078      for (iEnd=0; iEnd<NEP; iEnd++){
00079           fout << setw(14) << str[iEnd]
00080                << setw(13) << m_dx[iEnd] + m_delDx[iEnd]
00081                << setw(13) << m_dy[iEnd] + m_delDy[iEnd]
00082                << setw(13) << m_dz[iEnd] + m_delDz[iEnd]
00083                << setw(13) << m_rx[iEnd] + m_delRx[iEnd]
00084                << setw(13) << m_ry[iEnd] + m_delRy[iEnd]
00085                << setw(13) << m_rz[iEnd] + m_delRz[iEnd] << endl;
00086           if(7 == iEnd) fout << endl;
00087      }
00088      fout.close();
00089 
00090      ofstream fdel("delAlign_new.txt");
00091      fdel << setw(14) << name[0];
00092      for(i=1; i<7; i++) fdel << setw(13) << name[i];
00093      fdel << endl;
00094      for (iEnd=0; iEnd<NEP; iEnd++){
00095           fdel << setw(14) << str[iEnd] << setw(13) << m_delDx[iEnd]
00096                << setw(13) << m_delDy[iEnd] << setw(13) << m_delDz[iEnd]
00097                << setw(13) << m_delRx[iEnd] << setw(13) << m_delRy[iEnd]
00098                << setw(13) << m_delRz[iEnd] << endl;
00099           if(7 == iEnd) fdel << endl;
00100      }
00101 
00102      fdel << endl << "Fit error:" << endl;
00103      for (iEnd=0; iEnd<NEP; iEnd++){
00104           fdel << setw(14) << str[iEnd] << setw(13) << m_errDx[iEnd]
00105                << setw(13) << m_errDy[iEnd] << setw(13) << m_errDz[iEnd]
00106                << setw(13) << m_errRx[iEnd] << setw(13) << m_errRy[iEnd]
00107                << setw(13) << m_errRz[iEnd] << endl;
00108           if(7 == iEnd) fdel << endl;
00109      }
00110      fdel.close();
00111 }

Generated on Tue Nov 29 23:12:48 2016 for BOSS_7.0.2 by  doxygen 1.4.7