Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include <string>
0002 #include <iostream>
0003 #include <map>
0004 #include <vector>
0005 #include <fstream>
0006 #include <memory>
0007 
0008 int main()
0009 {
0010   //Gains variables
0011   int counter=0;
0012   int dbgains_nrlines=0;
0013   int fakegains_nrlines=0;
0014  
0015   int dbgains_index;
0016   float db_gainslope;
0017   std::vector<int> dbgains_index_id;
0018   std::vector<float> db_slope;
0019   int fakegains_index;
0020   float fake_gainslope;
0021   std::vector<int> fakegains_index_id;
0022   std::vector<float> fake_slope;
0023 
0024   //NoiseMatrix variables
0025   int dbmatrix_nrlines=0;
0026   int fakematrix_nrlines=0;
0027   int fakematrix_index;
0028   int dbmatrix_index;
0029   float db_elm33,db_elm34, db_elm44, db_elm35, db_elm45, db_elm55;
0030   float db_elm46, db_elm56, db_elm66, db_elm57, db_elm67, db_elm77;
0031   std::vector<int> dbmatrix_index_id;
0032   std::vector<float> db_elem33;
0033   std::vector<float> db_elem34;
0034   std::vector<float> db_elem44;
0035   std::vector<float> db_elem45;
0036   std::vector<float> db_elem35;
0037   std::vector<float> db_elem55;
0038   std::vector<float> db_elem46;
0039   std::vector<float> db_elem56;
0040   std::vector<float> db_elem66;
0041   std::vector<float> db_elem57;
0042   std::vector<float> db_elem67;
0043   std::vector<float> db_elem77;
0044   float fake_elm33,fake_elm34, fake_elm44, fake_elm35, fake_elm45, fake_elm55;
0045   float fake_elm46, fake_elm56, fake_elm66, fake_elm57, fake_elm67, fake_elm77;
0046   std::vector<int> fakematrix_index_id;
0047   std::vector<float> fake_elem33;
0048   std::vector<float> fake_elem34;
0049   std::vector<float> fake_elem44;
0050   std::vector<float> fake_elem45;
0051   std::vector<float> fake_elem35;
0052   std::vector<float> fake_elem55;
0053   std::vector<float> fake_elem46;
0054   std::vector<float> fake_elem56;
0055   std::vector<float> fake_elem66;
0056   std::vector<float> fake_elem57;
0057   std::vector<float> fake_elem67;
0058   std::vector<float> fake_elem77;
0059 
0060   //Pedestal variables
0061   int dbpeds_nrlines=0;
0062   int fakepeds_nrlines=0;
0063   int dbpeds_index,fakepeds_index;
0064   float fake_peds,fake_rms;
0065   std::vector<int> fakepeds_index_id;
0066   std::vector<float> fake_pedestal;
0067   std::vector<float> fake_pedrms;
0068   float db_peds,db_rms;
0069   std::vector<int> dbpeds_index_id;
0070   std::vector<float> db_pedestal;
0071   std::vector<float> db_pedrms;
0072 
0073   //Crosstalk variables
0074   int dbxtalk_nrlines=0;
0075   int fakextalk_nrlines=0;
0076   int dbxtalk_index,fakextalk_index;
0077   float dbxtalk_slope_right,dbxtalk_slope_left,dbxtalk_intercept_right;
0078   float dbxtalk_intercept_left; 
0079   float fakextalk_slope_right,fakextalk_slope_left,fakextalk_intercept_right;
0080   float fakextalk_intercept_left; 
0081   std::vector<int> fakextalk_index_id;
0082   std::vector<float> fakextalk_slope_r;
0083   std::vector<float> fakextalk_intercept_r;
0084   std::vector<float> fakextalk_slope_l;
0085   std::vector<float> fakextalk_intercept_l;
0086   std::vector<int> dbxtalk_index_id;
0087   std::vector<float> dbxtalk_slope_r;
0088   std::vector<float> dbxtalk_intercept_r;
0089   std::vector<float> dbxtalk_slope_l;
0090   std::vector<float> dbxtalk_intercept_l;
0091 
0092   /////////////////////////////////////////////////////////////////////////////////////////////
0093   //read fakes-on-the-fly for Gains
0094   std::ifstream fakegainsdata; 
0095   fakegainsdata.open("fakegains.dat",std::ios::in); 
0096   if(!fakegainsdata) {
0097     std::cerr <<"Error: fakegains.dat -> no such file!"<< std::endl;
0098     exit(1);
0099   }
0100   while (!fakegainsdata.eof() ) { 
0101     fakegainsdata >> fakegains_index >> fake_gainslope; 
0102     fakegains_index_id.push_back(fakegains_index);
0103     fake_slope.push_back(fake_gainslope);
0104     fakegains_nrlines++;
0105   }
0106   fakegainsdata.close();
0107 
0108   //read database values for Gains
0109   std::ifstream dbgainsdata; 
0110   dbgainsdata.open("dbgains.dat",std::ios::in); 
0111   if(!dbgainsdata) {
0112     std::cerr <<"Error: dbgains.dat -> no such file!"<< std::endl;
0113     exit(1);
0114   }
0115   while (!dbgainsdata.eof() ) { 
0116     dbgainsdata >> dbgains_index >> db_gainslope; 
0117     dbgains_index_id.push_back(dbgains_index);
0118     db_slope.push_back(db_gainslope);
0119     dbgains_nrlines++;
0120   }
0121   dbgainsdata.close();
0122 
0123  
0124   for(int i=0; i<217728; i++){
0125     if(fake_slope[i] != db_slope[i]){
0126       std::cout<<"ERROR::: CSC Gains object::: Values in DB incompatible with Fakes!"<<std::endl;    
0127     }
0128   }
0129 
0130   //////////////////////////////////////////////////////////////////////////////////////////
0131   //read fakes-on-the-fly for NoiseMatrix
0132   std::ifstream fakematrixdata; 
0133   fakematrixdata.open("fakematrix.dat",std::ios::in); 
0134   if(!fakematrixdata) {
0135     std::cerr <<"Error: fakematrix.dat -> no such file!"<< std::endl;
0136     exit(1);
0137   }
0138   
0139   while (!fakematrixdata.eof() ) { 
0140     fakematrixdata >> fakematrix_index >> fake_elm33 >> fake_elm34 >> fake_elm44 >> fake_elm35 >> fake_elm45 >> fake_elm55 >> fake_elm46 >> fake_elm56 >> fake_elm66 >> fake_elm57 >> fake_elm67 >> fake_elm77; 
0141     fakematrix_index_id.push_back(fakematrix_index);
0142     fake_elem33.push_back(fake_elm33);
0143     fake_elem34.push_back(fake_elm34);
0144     fake_elem44.push_back(fake_elm44);
0145     fake_elem35.push_back(fake_elm35);
0146     fake_elem45.push_back(fake_elm45);
0147     fake_elem55.push_back(fake_elm55);
0148     fake_elem46.push_back(fake_elm46);
0149     fake_elem56.push_back(fake_elm56);
0150     fake_elem66.push_back(fake_elm66);
0151     fake_elem57.push_back(fake_elm57);
0152     fake_elem67.push_back(fake_elm67);
0153     fake_elem77.push_back(fake_elm77);
0154 
0155     fakematrix_nrlines++;
0156   }
0157   fakematrixdata.close();
0158 
0159   //read database values for NoiseMatrix
0160   std::ifstream dbmatrixdata;
0161   dbmatrixdata.open("dbmatrix.dat",std::ios::in); 
0162   if(!dbmatrixdata) {
0163     std::cerr <<"Error: dbmatrix.txt -> no such file!"<< std::endl;
0164     exit(1);
0165   }
0166   
0167   while (!dbmatrixdata.eof() ) { 
0168     dbmatrixdata >> dbmatrix_index >> db_elm33 >> db_elm34 >> db_elm44 >> db_elm35 >> db_elm45 >> db_elm55 >> db_elm46 >> db_elm56 >> db_elm66 >> db_elm57 >> db_elm67 >> db_elm77 ; 
0169     dbmatrix_index_id.push_back(dbmatrix_index);
0170     db_elem33.push_back(db_elm33);
0171     db_elem34.push_back(db_elm34);
0172     db_elem44.push_back(db_elm44);
0173     db_elem35.push_back(db_elm35);
0174     db_elem45.push_back(db_elm45);
0175     db_elem55.push_back(db_elm55);
0176     db_elem46.push_back(db_elm46);
0177     db_elem56.push_back(db_elm56);
0178     db_elem66.push_back(db_elm66);
0179     db_elem57.push_back(db_elm57);
0180     db_elem67.push_back(db_elm67);
0181     db_elem77.push_back(db_elm77); 
0182     dbmatrix_nrlines++;
0183   }
0184   dbmatrixdata.close();
0185 
0186 
0187   for(int i=0; i<217728; i++){
0188     if(fake_elem33[i]  != db_elem33[i]){
0189       std::cout<<"ERROR::: CSC NoiseMatrix object:::elem33 Values in DB incompatible with Fakes!"<<std::endl;
0190     }
0191     if(fake_elem34[i]  != db_elem34[i]){
0192       std::cout<<"ERROR::: CSC NoiseMatrix object:::elem34 Values in DB incompatible with Fakes!"<<std::endl;
0193     }
0194     if(fake_elem44[i]  != db_elem44[i]){
0195       std::cout<<"ERROR::: CSC NoiseMatrix object:::elem44 Values in DB incompatible with Fakes!"<<std::endl;
0196     }
0197     if(fake_elem35[i]  != db_elem35[i]){
0198       std::cout<<"ERROR::: CSC NoiseMatrix object:::elem35 Values in DB incompatible with Fakes!"<<std::endl;
0199     }
0200     if(fake_elem45[i]  != db_elem45[i]){
0201       std::cout<<"ERROR::: CSC NoiseMatrix object:::elem45 Values in DB incompatible with Fakes!"<<std::endl;
0202     }
0203     if(fake_elem55[i]  != db_elem55[i]){
0204       std::cout<<"ERROR::: CSC NoiseMatrix object:::elem55 Values in DB incompatible with Fakes!"<<std::endl;
0205     }
0206     if(fake_elem46[i]  != db_elem46[i]){
0207       std::cout<<"ERROR::: CSC NoiseMatrix object:::elem46 Values in DB incompatible with Fakes!"<<std::endl;
0208     }
0209     if(fake_elem56[i]  != db_elem56[i]){
0210       std::cout<<"ERROR::: CSC NoiseMatrix object:::elem56 Values in DB incompatible with Fakes!"<<std::endl;
0211     }
0212     if(fake_elem66[i]  != db_elem66[i]){
0213       std::cout<<"ERROR::: CSC NoiseMatrix object:::elem66 Values in DB incompatible with Fakes!"<<std::endl;
0214     }
0215     if(fake_elem57[i]  != db_elem57[i]){
0216       std::cout<<"ERROR::: CSC NoiseMatrix object:::elem57 Values in DB incompatible with Fakes!"<<std::endl;
0217     }
0218     if(fake_elem67[i]  != db_elem67[i]){
0219       std::cout<<"ERROR::: CSC NoiseMatrix object:::elem67 Values in DB incompatible with Fakes!"<<std::endl;
0220     }
0221     if(fake_elem77[i]  != db_elem77[i]){
0222       std::cout<<"ERROR::: CSC NoiseMatrix object:::elem77 Values in DB incompatible with Fakes!"<<std::endl;
0223     }
0224   }
0225 
0226   ///////////////////////////////////////////////////////////////////////////////////////////
0227   //read fakes_on-the-fly for Pedestals
0228   std::ifstream fakepedsdata; 
0229   fakepedsdata.open("fakepeds.dat",std::ios::in); 
0230   if(!fakepedsdata) {
0231     std::cerr <<"Error: fakepeds.dat -> no such file!"<< std::endl;
0232     exit(1);
0233   }
0234   while (!fakepedsdata.eof() ) { 
0235     fakepedsdata >> fakepeds_index >> fake_peds >> fake_rms; 
0236     fakepeds_index_id.push_back(fakepeds_index);
0237     fake_pedestal.push_back(fake_peds);
0238     fake_pedrms.push_back(fake_rms);
0239     fakepeds_nrlines++;
0240   }
0241   fakepedsdata.close();
0242 
0243   //read database values for Pedestals
0244   std::ifstream dbpedsdata; 
0245   dbpedsdata.open("dbpeds.dat",std::ios::in); 
0246   if(!dbpedsdata) {
0247     std::cerr <<"Error: dbpeds.dat -> no such file!"<< std::endl;
0248     exit(1);
0249   }
0250   while (!dbpedsdata.eof() ) { 
0251     dbpedsdata >> dbpeds_index >> db_peds >> db_rms ; 
0252     dbpeds_index_id.push_back(dbpeds_index);
0253     db_pedestal.push_back(db_peds);
0254     db_pedrms.push_back(db_rms);
0255     dbpeds_nrlines++;
0256   }
0257   dbpedsdata.close();
0258 
0259  
0260   for(int i=0; i<217728; i++){
0261     if(fake_slope[i] != db_slope[i]){
0262       std::cout<<"ERROR::: CSC Pedestal object::: Values in DB incompatible with Fakes!"<<std::endl;    
0263     }
0264   }
0265 
0266   //////////////////////////////////////////////////////////////////////////////////////////////
0267   //read fakes-on-the-fly for Crosstalk
0268   std::ifstream fakextalkdata; 
0269   fakextalkdata.open("fakextalk.dat",std::ios::in); 
0270   if(!fakextalkdata) {
0271     std::cerr <<"Error: fakextalk.dat -> no such file!"<< std::endl;
0272     exit(1);
0273   }
0274   
0275   while (!fakextalkdata.eof() ) { 
0276     fakextalkdata >> fakextalk_index >> fakextalk_slope_right >> fakextalk_intercept_right >> fakextalk_slope_left >> fakextalk_intercept_left;
0277     fakextalk_index_id.push_back(fakextalk_index);
0278     fakextalk_slope_r.push_back(fakextalk_slope_right);
0279     fakextalk_slope_l.push_back(fakextalk_slope_left);
0280     fakextalk_intercept_r.push_back(fakextalk_intercept_right);
0281     fakextalk_intercept_l.push_back(fakextalk_intercept_left);
0282     fakextalk_nrlines++;
0283   }
0284   fakextalkdata.close();
0285 
0286   //read database values for Crosstalk
0287   std::ifstream dbxtalkdata;
0288   dbxtalkdata.open("dbxtalk.dat",std::ios::in); 
0289   if(!dbxtalkdata) {
0290     std::cerr <<"Error: dbxtalk.dat -> no such file!"<< std::endl;
0291     exit(1);
0292   }
0293   
0294   while (!dbxtalkdata.eof() ) { 
0295     dbxtalkdata >> dbxtalk_index >> dbxtalk_slope_right >> dbxtalk_intercept_right >> dbxtalk_slope_left >> dbxtalk_intercept_left ; 
0296     dbxtalk_index_id.push_back(dbxtalk_index);
0297     dbxtalk_slope_r.push_back(dbxtalk_slope_right);
0298     dbxtalk_slope_l.push_back(dbxtalk_slope_left);
0299     dbxtalk_intercept_r.push_back(dbxtalk_intercept_right);
0300     dbxtalk_intercept_l.push_back(dbxtalk_intercept_left);
0301     dbxtalk_nrlines++;
0302   }
0303   dbxtalkdata.close();
0304 
0305   for(int i=0; i<217728; i++){
0306     if(fakextalk_slope_r[i] != dbxtalk_slope_r[i]){
0307       //      std::cout<<fakextalk_slope_r[i]<<"  "<<dbxtalk_slope_r[i]<<std::endl;
0308       std::cout<<"ERROR::: CSC Crosstalk object:::Slope_right Values in DB incompatible with Fakes!"<<std::endl;    
0309     }
0310     if(fakextalk_slope_l[i] != dbxtalk_slope_l[i]){
0311       std::cout<<"ERROR::: CSC Crosstalk object:::Slope_left Values in DB incompatible with Fakes!"<<std::endl;    
0312     }
0313     if(fakextalk_intercept_r[i] != dbxtalk_intercept_r[i]){
0314       std::cout<<"ERROR::: CSC Crosstalk object:::Intercept_right Values in DB incompatible with Fakes!"<<std::endl;    
0315     }
0316     if(fakextalk_intercept_l[i] != dbxtalk_intercept_l[i]){
0317       std::cout<<"ERROR::: CSC Crosstalk object:::Intercept_left Values in DB incompatible with Fakes!"<<std::endl;    
0318     }
0319   }
0320 }