Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:47:37

0001 #include <iostream>
0002 #include <fstream>
0003 #include <vector>
0004 #include <iostream>
0005 #include <string>
0006 
0007 int main(){
0008 
0009   const int MAX_SIZE = 252288;
0010 
0011   int old_index;
0012   float old_xtalk_left, old_xtalk_right, old_int_left, old_int_right;
0013   std::vector<int> old_index_id;
0014   std::vector<float> old_Rxtalk;
0015   std::vector<float> old_Lxtalk;
0016   std::vector<float> old_Rint;
0017   std::vector<float> old_Lint;
0018   std::vector<float> diffXtalkR;
0019   std::vector<float> diffXtalkL;
0020   std::vector<float> diffIntR;
0021   std::vector<float> diffIntL;
0022   
0023   std::vector<float> myoldxtalkR;
0024   std::vector<float> myoldxtalkL;
0025   std::vector<float> myoldintR;
0026   std::vector<float> myoldintL;
0027 
0028   int new_index,extra1,extra2;
0029   float new_xtalk_left, new_xtalk_right, new_int_left, new_int_right;
0030   std::vector<int> new_index_id;
0031   std::vector<float> new_Rxtalk;
0032   std::vector<float> new_Lxtalk;
0033   std::vector<float> new_Rint;
0034   std::vector<float> new_Lint;
0035 
0036   int counter,counter1;
0037   int old_nrlines=0;
0038   int new_nrlines=0;
0039 
0040    std::ifstream olddata; 
0041   olddata.open("goodXtalk2008_09_02.dat",std::ios::in); 
0042   if(!olddata) {
0043     std::cerr <<"Error: goodXtalk2008_09_02.dat -> no such file!"<< std::endl;
0044     exit(1);
0045   }
0046 
0047   while (!olddata.eof() ) { 
0048     olddata >> old_index >> old_xtalk_left >> old_int_left >> old_xtalk_right >> old_int_right ;
0049     old_index_id.push_back(old_index);
0050     old_Rxtalk.push_back(old_xtalk_right);
0051     old_Rint.push_back(old_int_right); 
0052     old_Lxtalk.push_back(old_xtalk_left);  
0053     old_Lint.push_back(old_int_left);
0054   }
0055   olddata.close();
0056 
0057   std::ifstream newdata;
0058   std::ofstream myXtalkFile("diffXtalkOct_Aug3.dat",std::ios::out);
0059 
0060   newdata.open("goodXtalk2009_08_07_run109890.dat",std::ios::in); 
0061   if(!newdata) {
0062     std::cerr <<"Error:goodXtalk2009_08_07_run109890.dat  -> no such file!"<< std::endl;
0063     exit(1);
0064   }
0065 
0066   while (!newdata.eof() ) { 
0067     newdata >> new_index >> new_xtalk_left >> new_int_left >> new_xtalk_right >> new_int_right ;
0068     new_index_id.push_back(new_index);
0069     new_Rxtalk.push_back(new_xtalk_right);
0070     new_Rint.push_back(new_int_right); 
0071     new_Lxtalk.push_back(new_xtalk_left);
0072     new_Lint.push_back(new_int_left);
0073   }
0074   newdata.close();  
0075 
0076   diffXtalkR.resize(MAX_SIZE);
0077   diffXtalkL.resize(MAX_SIZE);
0078   diffIntR.resize(MAX_SIZE);
0079   diffIntL.resize(MAX_SIZE);
0080   myoldxtalkR.resize(MAX_SIZE);
0081   myoldxtalkL.resize(MAX_SIZE);
0082   myoldintR.resize(MAX_SIZE);
0083   myoldintR.resize(MAX_SIZE);
0084 
0085   for(int i=0; i<MAX_SIZE;++i){
0086     counter=old_index_id[i];  
0087     myoldxtalkR[i]=old_Rxtalk[i];
0088     myoldxtalkL[i]=old_Lxtalk[i];
0089     myoldintR[i]=old_Rint[i];
0090     myoldintR[i]=old_Lint[i];
0091 
0092     for (int k=0;k<new_index_id.size()-1;k++){
0093       counter1=new_index_id[k];
0094       if(counter == counter1){
0095     diffXtalkR[k]=old_Rxtalk[i] - new_Rxtalk[k];
0096     diffXtalkL[k]=old_Lxtalk[i] - new_Lxtalk[k];
0097     diffIntR[k]=old_Rint[i] - new_Rint[k];
0098     diffIntL[k]=old_Rint[i] - new_Rint[k];
0099 
0100     //  std::cout<<counter<<" "<<counter1<<"  "<<old_Rxtalk[i]<<" new_Rxtalk[k] "<<new_Rxtalk[k]<<std::endl;
0101     myXtalkFile<<counter<<"  "<<diffXtalkL[k]<<"  "<<diffIntL[k]<<"  "<<diffXtalkR[k]<<"  "<<diffIntR[k]<<"  "<<std::endl;  
0102       }
0103     }
0104   }
0105 }