Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:58:24

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_elem33, old_elem34,old_elem35,old_elem44,old_elem45,old_elem46,old_elem55,old_elem56;
0013   float old_elem57,old_elem66,old_elem67,old_elem77;
0014   std::vector<int> old_index_id;
0015   std::vector<float> old_el33;
0016   std::vector<float> old_el34;
0017   std::vector<float> old_el35;
0018   std::vector<float> old_el44;
0019   std::vector<float> old_el45;
0020   std::vector<float> old_el46;
0021   std::vector<float> old_el55;
0022   std::vector<float> old_el56;
0023   std::vector<float> old_el57;
0024   std::vector<float> old_el66;
0025   std::vector<float> old_el67;
0026   std::vector<float> old_el77;
0027 
0028   int new_index;
0029   float new_elem33,new_elem34,new_elem35,new_elem44,new_elem45,new_elem46,new_elem55,new_elem56;
0030   float new_elem57,new_elem66,new_elem67,new_elem77;
0031   std::vector<int> new_index_id;
0032   std::vector<float> new_el33;
0033   std::vector<float> new_el34;
0034   std::vector<float> new_el35;
0035   std::vector<float> new_el44;
0036   std::vector<float> new_el45;
0037   std::vector<float> new_el46;
0038   std::vector<float> new_el55;
0039   std::vector<float> new_el56;
0040   std::vector<float> new_el57;
0041   std::vector<float> new_el66;
0042   std::vector<float> new_el67;
0043   std::vector<float> new_el77;
0044 
0045   //differences
0046   std::vector<float> diff_el33;
0047   std::vector<float> diff_el34;
0048   std::vector<float> diff_el35;
0049   std::vector<float> diff_el44;
0050   std::vector<float> diff_el45;
0051   std::vector<float> diff_el46;
0052   std::vector<float> diff_el55;
0053   std::vector<float> diff_el56;
0054   std::vector<float> diff_el57;
0055   std::vector<float> diff_el66;
0056   std::vector<float> diff_el67;
0057   std::vector<float> diff_el77;
0058 
0059   //old vectors
0060   std::vector<float> myoldel33;
0061   std::vector<float> myoldel34;
0062   std::vector<float> myoldel35;
0063   std::vector<float> myoldel44;
0064   std::vector<float> myoldel45;
0065   std::vector<float> myoldel46;
0066   std::vector<float> myoldel55;
0067   std::vector<float> myoldel56;
0068   std::vector<float> myoldel57;
0069   std::vector<float> myoldel66;
0070   std::vector<float> myoldel67;
0071   std::vector<float> myoldel77;
0072 
0073   int counter,counter1;
0074   int old_nrlines=0;
0075   int new_nrlines=0;
0076 
0077   std::ifstream olddata; 
0078   olddata.open("goodMatrix2008_09_02.dat",std::ios::in); 
0079   if(!olddata) {
0080     std::cerr <<"Error: goodMatrix2008_09_02.dat -> no such file!"<< std::endl;
0081     exit(1);
0082   }
0083   
0084   while (!olddata.eof() ) { 
0085     olddata >> old_index >> old_elem33 >> old_elem34 >> old_elem44 >> old_elem35 >> old_elem45 >> old_elem55 >> old_elem46 >> old_elem56 >>old_elem66 >> old_elem57 >> old_elem67 >> old_elem77 ; 
0086     old_index_id.push_back(old_index);
0087     old_el33.push_back(old_elem33);
0088     old_el34.push_back(old_elem34);
0089     old_el35.push_back(old_elem35);
0090     old_el44.push_back(old_elem44);
0091     old_el45.push_back(old_elem45);
0092     old_el46.push_back(old_elem46);
0093     old_el55.push_back(old_elem55);
0094     old_el56.push_back(old_elem56);
0095     old_el57.push_back(old_elem57);
0096     old_el66.push_back(old_elem66);
0097     old_el67.push_back(old_elem67);
0098     old_el77.push_back(old_elem77);
0099     old_nrlines++;
0100   }
0101   olddata.close();
0102 
0103   std::ifstream newdata;
0104   std::ofstream myXtalkFile("diffMatrixOct_Aug109891.dat",std::ios::out);
0105   newdata.open("goodMatrix2009_08_07_run109891.dat",std::ios::in); 
0106   if(!newdata) {
0107     std::cerr <<"Error: goodMatrix2009_08_07_run109891.dat -> no such file!"<< std::endl;
0108     exit(1);
0109   }
0110   
0111   while (!newdata.eof() ) { 
0112     newdata >> new_index >> new_elem33 >> new_elem34 >> new_elem44 >> new_elem35 >> new_elem45 >> new_elem55 >> new_elem46 >> new_elem56 >>new_elem66 >> new_elem57 >> new_elem67 >> new_elem77; 
0113     new_index_id.push_back(new_index);
0114     new_el33.push_back(new_elem33);
0115     new_el34.push_back(new_elem34);
0116     new_el35.push_back(new_elem35);
0117     new_el44.push_back(new_elem44);
0118     new_el45.push_back(new_elem45);
0119     new_el46.push_back(new_elem46);
0120     new_el55.push_back(new_elem55);
0121     new_el56.push_back(new_elem56);
0122     new_el57.push_back(new_elem57);
0123     new_el66.push_back(new_elem66);
0124     new_el67.push_back(new_elem67);
0125     new_el77.push_back(new_elem77);
0126     new_nrlines++;
0127   }
0128   newdata.close();
0129 
0130   //resize
0131   diff_el33.resize(MAX_SIZE);
0132   diff_el34.resize(MAX_SIZE);
0133   diff_el35.resize(MAX_SIZE);
0134   diff_el44.resize(MAX_SIZE);
0135   diff_el45.resize(MAX_SIZE);
0136   diff_el46.resize(MAX_SIZE);
0137   diff_el55.resize(MAX_SIZE);
0138   diff_el56.resize(MAX_SIZE);
0139   diff_el57.resize(MAX_SIZE);
0140   diff_el66.resize(MAX_SIZE);
0141   diff_el67.resize(MAX_SIZE);
0142   diff_el77.resize(MAX_SIZE);
0143 
0144   myoldel33.resize(MAX_SIZE);
0145   myoldel34.resize(MAX_SIZE);
0146   myoldel35.resize(MAX_SIZE);
0147   myoldel44.resize(MAX_SIZE);
0148   myoldel45.resize(MAX_SIZE);
0149   myoldel46.resize(MAX_SIZE);
0150   myoldel55.resize(MAX_SIZE);
0151   myoldel56.resize(MAX_SIZE);
0152   myoldel57.resize(MAX_SIZE);
0153   myoldel66.resize(MAX_SIZE);
0154   myoldel67.resize(MAX_SIZE);
0155   myoldel77.resize(MAX_SIZE);
0156 
0157   for(int i=0; i<MAX_SIZE;++i){
0158     counter=old_index_id[i];  
0159     myoldel33[i]=old_el33[i];
0160     myoldel34[i]=old_el34[i];
0161     myoldel35[i]=old_el35[i];
0162     myoldel44[i]=old_el44[i];
0163     myoldel45[i]=old_el45[i];
0164     myoldel46[i]=old_el46[i];
0165     myoldel55[i]=old_el55[i];
0166     myoldel56[i]=old_el56[i];
0167     myoldel57[i]=old_el57[i];
0168     myoldel66[i]=old_el66[i];
0169     myoldel67[i]=old_el67[i];
0170     myoldel77[i]=old_el77[i];
0171     
0172     for (int k=0;k<new_index_id.size()-1;k++){
0173       counter1=new_index_id[k];
0174       if(counter == counter1){
0175     diff_el33[k]=old_el33[i] - new_el33[k];
0176     diff_el34[k]=old_el34[i] - new_el34[k];
0177     diff_el35[k]=old_el35[i] - new_el35[k];
0178     diff_el44[k]=old_el44[i] - new_el44[k];
0179     diff_el45[k]=old_el45[i] - new_el45[k];
0180     diff_el46[k]=old_el46[i] - new_el46[k];
0181     diff_el55[k]=old_el55[i] - new_el55[k];
0182     diff_el56[k]=old_el56[i] - new_el56[k];
0183     diff_el57[k]=old_el57[i] - new_el57[k];
0184     diff_el66[k]=old_el66[i] - new_el66[k];
0185     diff_el67[k]=old_el67[i] - new_el67[k];
0186     diff_el77[k]=old_el77[i] - new_el77[k];
0187     //std::cout<<old_el33[i]<<" new_el33[k]"<<new_el33[k]<<std::endl;
0188     myXtalkFile<<counter<<"  "<<diff_el33[k]<<"  "<< diff_el34[k]<<"  "<<diff_el35[k]<<"  "<<diff_el44[k]<<"  "<<diff_el45[k]<<"  "<<diff_el46[k]<<"  "<<diff_el55[k]<<"  "<<diff_el56[k]<<"  "<<diff_el57[k]<<"  "<<diff_el66[k]<<"  "<<diff_el67[k]<<"  "<<diff_el77[k]<<"  "<<std::endl; 
0189       }
0190     }
0191   }
0192 }