CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DQM/DTMonitorModule/src/ROSDebugUtility.h

Go to the documentation of this file.
00001 /*
00002  * \file ROSDebugUtility.h
00003  * File to generate the plots used in the debug of ROS parameters
00004  * $Date: 2007/10/9 
00005  * \author Jorge Molina (CIEMAT)
00006  */
00007 
00008 std::string itoa(int current);
00009 double ResetCount_unfolded_comp =0;
00010 double ResetCount_unfolded_comp2 =0;
00011 double ResetCount_unfolded_comp3 =0;
00012 double ResetCount_unfolded_comp4 =0;
00013 double ResetCount_unfolded_comp5 =0;
00014 double ResetCount_unfolded_comp6 =0;
00015 double ResetCount_unfolded_comp7 =0;
00016 double ResetCount_unfolded_comp8 =0;
00017 double ResetCount_unfolded_comp9 =0;
00018 double ResetCount_unfolded_comp10 =0;
00019 double ResetCount_unfolded_comp11 =0;
00020 double ResetCount_unfolded_comp12 =0;
00021 double ResetCount_unfolded=0;
00022 int cont=0,cont2=0,cont3=0,cont4=0,cont5=0,cont6=0;
00023 int cont7=0,cont8=0,cont9=0,cont10=0,cont11=0,cont12=0,cycle = 1495;
00024 float trigger_counter1=0,trigger_counter2=0,trigger_counter3=0,trigger_counter4=0,trigger_counter5=0,trigger_counter6=0;
00025 float trigger_counter7=0,trigger_counter8=0,trigger_counter9=0,trigger_counter10=0,trigger_counter11=0,trigger_counter12=0;
00026 int freq1,freq2,freq3,freq4,freq5,freq6,freq7,freq8,freq9,freq10,freq11,freq12;
00027 long double first_evt=0;
00028 long double first_evt2=0;
00029 long double first_evt3=0;
00030 long double first_evt4=0;
00031 long double first_evt5=0;
00032 long double first_evt6=0;
00033 long double first_evt7=0;
00034 long double first_evt8=0;
00035 long double first_evt9=0;
00036 long double first_evt10=0;
00037 long double first_evt11=0;
00038 long double first_evt12=0;
00039 float peso=1;
00040 
00041 inline void ROSWords_t(double& ResetCount_unfolded,int ROS_number,int ROSDebug_BcntResCnt,int nevents)
00042 {
00043 
00044 // synchronize with evt #
00045 // if (neventsROS25 ==1) ResetCount_unfolded_comp.first=ROS_number;
00046 
00047 // Processing first ROS
00048  if (ROS_number == 1){
00049   double ResetCount = ROSDebug_BcntResCnt*0.0000891;
00050  
00051   if (ResetCount_unfolded_comp <= (ResetCount)) {
00052   cont = cont;  
00053    ResetCount_unfolded = ResetCount + cycle*cont;
00054    }
00055   else { cont = cont + 1;
00056    ResetCount_unfolded = ResetCount + cycle*cont;
00057    }  
00058   ResetCount_unfolded_comp = ResetCount; 
00059    }
00060     
00061 // second ROS  
00062  else if (ROS_number == 2){
00063   double ResetCount2 = ROSDebug_BcntResCnt*0.0000891;
00064   if (ResetCount_unfolded_comp2 <= (ResetCount2)) {
00065   cont2 = cont2;  
00066    ResetCount_unfolded = ResetCount2 + cycle*cont2;
00067    }
00068   else { cont2 = cont2 + 1;
00069    ResetCount_unfolded = ResetCount2 + cycle*cont2;
00070     }
00071   ResetCount_unfolded_comp2 = ResetCount2;    
00072    }
00073 
00074 // third ROS  
00075  else if (ROS_number == 3){
00076   double ResetCount3 = ROSDebug_BcntResCnt*0.0000891;
00077   if (ResetCount_unfolded_comp3 <= (ResetCount3)) {
00078   cont3 = cont3;  
00079    ResetCount_unfolded = ResetCount3 + cycle*cont3;
00080    }
00081   else { cont3 = cont3 + 1;
00082    ResetCount_unfolded = ResetCount3 + cycle*cont3;
00083     }
00084   ResetCount_unfolded_comp3 = ResetCount3;  
00085    }
00086   
00087 
00088 // 4th ROS  
00089  else if (ROS_number == 4){
00090   double ResetCount4 = ROSDebug_BcntResCnt*0.0000891;
00091   if (ResetCount_unfolded_comp4 <= (ResetCount4)) {
00092   cont4 = cont4;  
00093    ResetCount_unfolded = ResetCount4 + cycle*cont4;
00094    }
00095   else { cont4 = cont4 + 1;
00096    ResetCount_unfolded = ResetCount4 + cycle*cont4;
00097     }
00098   ResetCount_unfolded_comp = ResetCount4;  
00099     }
00100 
00101 // 5th ROS  
00102  else if (ROS_number == 5){
00103   double ResetCount5 = ROSDebug_BcntResCnt*0.0000891;
00104   if (ResetCount_unfolded_comp5 <= (ResetCount5)) {
00105   cont5 = cont5;  
00106    ResetCount_unfolded = ResetCount5 + cycle*cont5;
00107    }
00108   else { cont5 = cont5 + 1;
00109    ResetCount_unfolded = ResetCount5 + cycle*cont5;
00110     }
00111   ResetCount_unfolded_comp5 = ResetCount5;  
00112    }
00113 
00114 // 6th ROS  
00115  else if (ROS_number == 6){
00116   double ResetCount6 = ROSDebug_BcntResCnt*0.0000891;
00117   if (ResetCount_unfolded_comp6 <= (ResetCount6)) {
00118   cont6 = cont6;  
00119    ResetCount_unfolded = ResetCount6 + cycle*cont6;
00120    }
00121   else { cont6 = cont6 + 1;
00122    ResetCount_unfolded = ResetCount6 + cycle*cont6;
00123     }
00124   ResetCount_unfolded_comp6 = ResetCount6;  
00125    }
00126        
00127 // 7th ROS  
00128  else if (ROS_number == 7){
00129   double ResetCount7 = ROSDebug_BcntResCnt*0.0000891;
00130   if (ResetCount_unfolded_comp7 <= (ResetCount7)) {
00131   cont7 = cont7;  
00132    ResetCount_unfolded = ResetCount7 + cycle*cont7;
00133    }
00134   else { cont7 = cont7 + 1;
00135    ResetCount_unfolded = ResetCount7 + cycle*cont7;
00136     }
00137    ResetCount_unfolded_comp7 = ResetCount7;
00138    }
00139 
00140 // 8th ROS  
00141  else if (ROS_number == 8){
00142   double ResetCount8 = ROSDebug_BcntResCnt*0.0000891;
00143   if (ResetCount_unfolded_comp8 <= (ResetCount8)) {
00144   cont8 = cont8;  
00145    ResetCount_unfolded = ResetCount8 + cycle*cont8;
00146    }
00147   else { cont8 = cont8 + 1;
00148    ResetCount_unfolded = ResetCount8 + cycle*cont8;
00149     }
00150   ResetCount_unfolded_comp8 = ResetCount8;
00151    }
00152 
00153 // 9th ROS  
00154  else if (ROS_number == 9){
00155   double ResetCount9 = ROSDebug_BcntResCnt*0.0000891;
00156   if (ResetCount_unfolded_comp9 <= (ResetCount9)) {
00157   cont9 = cont9;  
00158    ResetCount_unfolded = ResetCount9 + cycle*cont9;
00159    }
00160   else { cont9 = cont9 + 1;
00161    ResetCount_unfolded = ResetCount9 + cycle*cont9;
00162     }
00163   ResetCount_unfolded_comp9 = ResetCount9;  
00164    }
00165 
00166 // 10th ROS  
00167  else if (ROS_number == 10){
00168   double ResetCount10 = ROSDebug_BcntResCnt*0.0000891;
00169   if (ResetCount_unfolded_comp10 <= (ResetCount10)) {
00170   cont10 = cont10;  
00171    ResetCount_unfolded = ResetCount10 + cycle*cont10;
00172    }
00173   else { cont10 = cont10 + 1;
00174    ResetCount_unfolded = ResetCount10 + cycle*cont10;
00175     }
00176   ResetCount_unfolded_comp10 = ResetCount10;  
00177    }
00178 
00179 // 11th ROS  
00180  else if (ROS_number == 11){
00181   double ResetCount11 = ROSDebug_BcntResCnt*0.0000891;
00182   if (ResetCount_unfolded_comp11 <= (ResetCount11)) {
00183   cont11 = cont11;  
00184    ResetCount_unfolded = ResetCount11 + cycle*cont11;
00185    }
00186   else { cont11 = cont11 + 1;
00187    ResetCount_unfolded = ResetCount11 + cycle*cont11;
00188     }
00189   ResetCount_unfolded_comp11 = ResetCount11;  
00190    }
00191   
00192   // 12th ROS  
00193  else if (ROS_number == 12){
00194   double ResetCount12 = ROSDebug_BcntResCnt*0.0000891;
00195   if (ResetCount_unfolded_comp12 <= (ResetCount12)) {
00196   cont12 = cont12;  
00197    ResetCount_unfolded = ResetCount12 + cycle*cont12;
00198    }
00199   else { cont12 = cont12 + 1;
00200    ResetCount_unfolded = ResetCount12 + cycle*cont12;
00201     }
00202   ResetCount_unfolded_comp12 = ResetCount12;  
00203    }  
00204 }
00205 
00208 
00209 
00210 
00211 void ROS_L1A_Frequency(int ROS_number,int ROSDebug_BcntResCnt,
00212                         int neventsROS25,double& frequency,float& trigger_counter)
00213 {
00214 
00215  trigger_counter = 0.;
00216  
00217 // first ROS
00218  if (ROS_number == 1)
00219  {  
00220   long double second_evt = ROSDebug_BcntResCnt;
00221    if (neventsROS25==1) first_evt = ROSDebug_BcntResCnt;
00222                    
00223   if (ROSDebug_BcntResCnt<16777215) {
00224 
00225     if ((second_evt - first_evt)<(1/(0.0000891*peso))){        
00226      trigger_counter1 += 1;
00227      trigger_counter = trigger_counter1;
00228      }
00229      else{ //window change
00230      frequency = trigger_counter1;
00231      first_evt = second_evt;
00232      trigger_counter1 = 0;} 
00233    }
00234   else{
00235     long double second_evt_neg = second_evt + max_bx;      
00236 
00237     if ((second_evt_neg - first_evt)<(1/(0.0000891*peso))){
00238      trigger_counter1 +=1;
00239      trigger_counter = trigger_counter1;
00240      frequency = first_evt*0.0000891;
00241      }
00242      else {
00243      first_evt = second_evt;
00244      trigger_counter1 = 0;}
00245   }
00246   return;
00247  }
00248 
00249 
00250 
00251 // second ROS
00252  else if (ROS_number == 2){ 
00253   long double second_evt2 = ROSDebug_BcntResCnt;
00254                    
00255    if (neventsROS25==1) first_evt2 = ROSDebug_BcntResCnt;
00256                    
00257   if (ROSDebug_BcntResCnt<16777215) {
00258 
00259     if ((second_evt2 - first_evt2)<(1/(0.0000891*peso))){        
00260      trigger_counter2 += 1;
00261      trigger_counter = trigger_counter2;
00262      }
00263      else{ //window change
00264      frequency = trigger_counter2;
00265      first_evt2 = second_evt2;
00266      trigger_counter2 = 0;} 
00267    }
00268   else{
00269     long double second_evt_neg2 = second_evt2 + max_bx;   
00270 
00271     if ((second_evt_neg2 - first_evt2)<(1/(0.0000891*peso))){
00272      trigger_counter2 +=1;
00273      trigger_counter = trigger_counter2;
00274      frequency = first_evt2*0.0000891;
00275      }
00276      else {
00277      first_evt2 = second_evt2;
00278      trigger_counter2 = 0;}
00279   }
00280  }     
00281  
00282 // third ROS
00283  else if (ROS_number == 3){
00284   
00285   long double second_evt3 = ROSDebug_BcntResCnt;
00286    if (neventsROS25==1) first_evt3 = ROSDebug_BcntResCnt;
00287                    
00288   if (ROSDebug_BcntResCnt<16777215) {
00289 
00290     if ((second_evt3 - first_evt3)<(1/(0.0000891*peso))){        
00291      trigger_counter3 += 1;
00292      trigger_counter = trigger_counter3;
00293      }
00294      else{ //window change
00295      frequency = trigger_counter3;
00296      first_evt3 = second_evt3;
00297      trigger_counter3 = 0;} 
00298    }
00299   else{
00300     long double second_evt_neg3 = second_evt3 + max_bx; 
00301 
00302     if ((second_evt_neg3 - first_evt3)<(1/(0.0000891*peso))){
00303      trigger_counter3 +=1;
00304      trigger_counter = trigger_counter3;
00305      frequency = first_evt3*0.0000891;
00306      }
00307      else {
00308      first_evt3 = second_evt3;
00309      trigger_counter3 = 0;}
00310   }
00311  }
00312 
00313  
00314 // 4th ROS
00315  else if (ROS_number == 4){
00316   
00317   long double second_evt4 = ROSDebug_BcntResCnt;
00318    if (neventsROS25==1) first_evt4 = ROSDebug_BcntResCnt;
00319                    
00320   if (ROSDebug_BcntResCnt<16777215) {
00321 
00322     if ((second_evt4 - first_evt4)<(1/(0.0000891*peso))){        
00323      trigger_counter4 += 1;
00324      trigger_counter = trigger_counter4;
00325      }
00326      else{ //window change
00327      frequency = trigger_counter4;
00328      first_evt4 = second_evt4;
00329      trigger_counter4 = 0;} 
00330    }
00331   else{
00332     long double second_evt_neg4 = second_evt4 + max_bx;      
00333 
00334     if ((second_evt_neg4 - first_evt4)<(1/(0.0000891*peso))){
00335      trigger_counter4 +=1;
00336      trigger_counter = trigger_counter4;
00337      frequency = first_evt4*0.0000891;
00338      }
00339      else {
00340      first_evt4 = second_evt4;
00341      trigger_counter4 = 0;}
00342   }
00343  }
00344                    
00345 // 5th ROS
00346  else if (ROS_number == 5){
00347   
00348   long double second_evt5 = ROSDebug_BcntResCnt;
00349    if (neventsROS25==1) first_evt5 = ROSDebug_BcntResCnt;
00350                    
00351   if (ROSDebug_BcntResCnt<16777215) {
00352 
00353     if ((second_evt5 - first_evt5)<(1/(0.0000891*peso))){        
00354      trigger_counter5 += 1;
00355      trigger_counter = trigger_counter5;
00356      }
00357      else{ //window change
00358      frequency = trigger_counter5;
00359      first_evt5 = second_evt5;
00360      trigger_counter5 = 0;} 
00361    }
00362   else{
00363     long double second_evt_neg5 = second_evt5 + max_bx;      
00364 
00365     if ((second_evt_neg5 - first_evt5)<(1/(0.0000891*peso))){
00366      trigger_counter5 +=1;
00367      trigger_counter = trigger_counter5;
00368      frequency = first_evt5*0.0000891;
00369      }
00370      else {
00371      first_evt5 = second_evt5;
00372      trigger_counter5 = 0;}
00373   }
00374  }
00375                    
00376 // 6th ROS
00377  else if (ROS_number == 6){
00378   
00379   long double second_evt6 = ROSDebug_BcntResCnt;
00380    if (neventsROS25==1) first_evt6 = ROSDebug_BcntResCnt;
00381                    
00382   if (ROSDebug_BcntResCnt<16777215) {
00383 
00384     if ((second_evt6 - first_evt6)<(1/(0.0000891*peso))){        
00385      trigger_counter6 += 1;
00386      trigger_counter = trigger_counter6;
00387      }
00388      else{ //window change
00389      frequency = trigger_counter6;
00390      first_evt6 = second_evt6;
00391      trigger_counter6 = 0;} 
00392    }
00393   else{
00394     long double second_evt_neg6 = second_evt6 + max_bx;      
00395 
00396     if ((second_evt_neg6 - first_evt6)<(1/(0.0000891*peso))){
00397      trigger_counter6 +=1;
00398      trigger_counter = trigger_counter6;
00399      frequency = first_evt6*0.0000891;
00400      }
00401      else {
00402      first_evt6 = second_evt6;
00403      trigger_counter6 = 0;}
00404   }
00405  }
00406                    
00407 
00408 // 7th ROS
00409  else if (ROS_number == 7){
00410   
00411   long double second_evt7 = ROSDebug_BcntResCnt;
00412    if (neventsROS25==1) first_evt7 = ROSDebug_BcntResCnt;
00413                    
00414   if (ROSDebug_BcntResCnt<16777215) {
00415 
00416     if ((second_evt7 - first_evt7)<(1/(0.0000891*peso))){        
00417      trigger_counter7 += 1;
00418      trigger_counter = trigger_counter7;
00419      }
00420      else{ //window change
00421      frequency = trigger_counter7;
00422      first_evt7 = second_evt7;
00423      trigger_counter7 = 0;} 
00424    }
00425   else{
00426     long double second_evt_neg7 = second_evt7 + max_bx;      
00427 
00428     if ((second_evt_neg7 - first_evt7)<(1/(0.0000891*peso))){
00429      trigger_counter7 +=1;
00430      trigger_counter = trigger_counter7;
00431      frequency = first_evt7*0.0000891;
00432      }
00433      else {
00434      first_evt7 = second_evt7;
00435      trigger_counter7 = 0;}
00436   }
00437  }
00438 
00439 // 8th ROS
00440  else if (ROS_number == 8){
00441   
00442   long double second_evt8 = ROSDebug_BcntResCnt;
00443    if (neventsROS25==1) first_evt8 = ROSDebug_BcntResCnt;
00444                    
00445   if (ROSDebug_BcntResCnt<16777215) {
00446 
00447     if ((second_evt8 - first_evt8)<(1/(0.0000891*peso))){        
00448      trigger_counter8 += 1;
00449      trigger_counter = trigger_counter8;
00450      }
00451      else{ //window change
00452      frequency = trigger_counter8;
00453      first_evt8 = second_evt8;
00454      trigger_counter8 = 0;} 
00455    }
00456   else{
00457     long double second_evt_neg8 = second_evt8 + max_bx;      
00458 
00459     if ((second_evt_neg8 - first_evt8)<(1/(0.0000891*peso))){
00460      trigger_counter8 +=1;
00461      trigger_counter = trigger_counter8;
00462      frequency = first_evt8*0.0000891;
00463      }
00464      else {
00465      first_evt8 = second_evt8;
00466      trigger_counter8 = 0;}
00467   }
00468  }
00469 
00470 // 9th ROS
00471  else if (ROS_number == 9){
00472   
00473   long double second_evt9 = ROSDebug_BcntResCnt;
00474    if (neventsROS25==1) first_evt9 = ROSDebug_BcntResCnt;
00475                    
00476   if (ROSDebug_BcntResCnt<16777215) {
00477 
00478     if ((second_evt9 - first_evt9)<(1/(0.0000891*peso))){        
00479      trigger_counter9 += 1;
00480      trigger_counter = trigger_counter9;
00481      }
00482      else{ //window change
00483      frequency = trigger_counter9;
00484      first_evt9 = second_evt9;
00485      trigger_counter9 = 0;} 
00486    }
00487   else{
00488     long double second_evt_neg9 = second_evt9 + max_bx;      
00489 
00490     if ((second_evt_neg9 - first_evt9)<(1/(0.0000891*peso))){
00491      trigger_counter9 +=1;
00492      trigger_counter = trigger_counter9;
00493      frequency = first_evt9*0.0000891;
00494      }
00495      else {
00496      first_evt9 = second_evt9;
00497      trigger_counter9 = 0;}
00498   }
00499  }
00500 
00501 
00502 // 10th ROS
00503  else if (ROS_number == 10){
00504   
00505   long double second_evt10 = ROSDebug_BcntResCnt;
00506    if (neventsROS25==1) first_evt10 = ROSDebug_BcntResCnt;
00507                    
00508   if (ROSDebug_BcntResCnt<16777215) {
00509 
00510     if ((second_evt10 - first_evt10)<(1/(0.0000891*peso))){        
00511      trigger_counter10 += 1;
00512      trigger_counter = trigger_counter10;
00513      }
00514      else{ //window change
00515      frequency = trigger_counter10;
00516      first_evt10 = second_evt10;
00517      trigger_counter10 = 0;} 
00518    }
00519   else{
00520     long double second_evt_neg10 = second_evt10 + max_bx;      
00521 
00522     if ((second_evt_neg10 - first_evt10)<(1/(0.0000891*peso))){
00523      trigger_counter10 +=1;
00524      trigger_counter = trigger_counter10;
00525      frequency = first_evt10*0.0000891;
00526      }
00527      else {
00528      first_evt10 = second_evt10;
00529      trigger_counter10 = 0;}
00530   }
00531  }
00532 
00533  
00534 // 11th ROS
00535  else if (ROS_number == 11){
00536   
00537   long double second_evt11 = ROSDebug_BcntResCnt;
00538    if (neventsROS25==1) first_evt11 = ROSDebug_BcntResCnt;
00539                    
00540   if (ROSDebug_BcntResCnt<16777215) {
00541 
00542     if ((second_evt11 - first_evt11)<(1/(0.0000891*peso))){        
00543      trigger_counter11 += 1;
00544      trigger_counter = trigger_counter11;
00545      }
00546      else{ //window change
00547      frequency = trigger_counter11;
00548      first_evt11 = second_evt11;
00549      trigger_counter11 = 0;} 
00550    }
00551   else{
00552     long double second_evt_neg11 = second_evt11 + max_bx;      
00553 
00554     if ((second_evt_neg11 - first_evt11)<(1/(0.0000891*peso))){
00555      trigger_counter11 +=1;
00556      trigger_counter = trigger_counter11;
00557      frequency = first_evt11*0.0000891;
00558      }
00559      else {
00560      first_evt11 = second_evt11;
00561      trigger_counter11 = 0;}
00562   }
00563  }
00564 
00565  
00566 // 12th ROS
00567  else if (ROS_number == 12){
00568   
00569   long double second_evt12 = ROSDebug_BcntResCnt;
00570    if (neventsROS25==1) first_evt12 = ROSDebug_BcntResCnt;
00571                    
00572   if (ROSDebug_BcntResCnt<16777215) {
00573 
00574     if ((second_evt12 - first_evt12)<(1/(0.0000891*peso))){        
00575      trigger_counter12 += 1;
00576      trigger_counter = trigger_counter12;
00577      }
00578      else{ //window change
00579      frequency = trigger_counter12;
00580      first_evt12 = second_evt12;
00581      trigger_counter12 = 0;} 
00582    }
00583   else{
00584     long double second_evt_neg12 = second_evt12 + max_bx;      
00585 
00586     if ((second_evt_neg12 - first_evt12)<(1/(0.0000891*peso))){
00587      trigger_counter12 +=1;
00588      trigger_counter = trigger_counter12;
00589      frequency = first_evt12*0.0000891;
00590      }
00591      else {
00592      first_evt12 = second_evt12;
00593      trigger_counter12 = 0;}
00594   }
00595  }
00596 }