Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include <iostream>
0002 #include <fstream>
0003 #include <vector>
0004 #include <iostream>
0005 #include <string>
0006 
0007 using namespace std;
0008 
0009 int main(){
0010   float peds,chi2;
0011   int index,flag,flag1;
0012   int nrlines=0;
0013 
0014   std::vector<int>   index_id;
0015   std::vector<float> Ped;
0016   std::vector<float> pedChi2;
0017   
0018   std::ifstream dbdata; 
0019   dbdata.open("FileName",std::ios::in); 
0020   if(!dbdata) {
0021     std::cerr <<"Error: FileName -> no such file!"<< std::endl;
0022     exit(1);
0023   }
0024 
0025   while (!dbdata.eof() ) { 
0026     dbdata >> index >> peds >>chi2 >>flag >>flag1; 
0027     index_id.push_back(index);
0028     Ped.push_back(peds);
0029     pedChi2.push_back(chi2);
0030     nrlines++;
0031   }
0032   dbdata.close();
0033   std::ofstream myPedsFile("GoodVals_FileName",std::ios::out);
0034  
0035   for(int i=0; i<nrlines-1;++i){
0036     if (Ped[i]>400.0 && Ped[i]<1000.0){
0037       myPedsFile<<index_id[i]<<"  "<<Ped[i]<<"  "<<pedChi2[i]<<std::endl;
0038       if (flag==1 || flag1==1){
0039   std::cout<<"Flag not 0: "<<index_id[i]<<" " <<flag<<"  "<<flag1<<std::endl;
0040       }
0041     }
0042   }
0043 }