CMS 3D CMS Logo

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