CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ROSDebugUtility.h
Go to the documentation of this file.
1 /*
2  * \file ROSDebugUtility.h
3  * File to generate the plots used in the debug of ROS parameters
4  * $Date: 2007/10/9
5  * \author Jorge Molina (CIEMAT)
6  */
7 
22 int cont=0,cont2=0,cont3=0,cont4=0,cont5=0,cont6=0;
23 int cont7=0,cont8=0,cont9=0,cont10=0,cont11=0,cont12=0,cycle = 1495;
27 long double first_evt=0;
28 long double first_evt2=0;
29 long double first_evt3=0;
30 long double first_evt4=0;
31 long double first_evt5=0;
32 long double first_evt6=0;
33 long double first_evt7=0;
34 long double first_evt8=0;
35 long double first_evt9=0;
36 long double first_evt10=0;
37 long double first_evt11=0;
38 long double first_evt12=0;
39 float peso=1;
40 
41 inline void ROSWords_t(double& ResetCount_unfolded,int ROS_number,int ROSDebug_BcntResCnt,int nevents)
42 {
43 
44 // synchronize with evt #
45 // if (neventsROS25 ==1) ResetCount_unfolded_comp.first=ROS_number;
46 
47 // Processing first ROS
48  if (ROS_number == 1){
49  double ResetCount = ROSDebug_BcntResCnt*0.0000891;
50 
51  if (ResetCount_unfolded_comp <= (ResetCount)) {
52  ResetCount_unfolded = ResetCount + cycle*cont;
53  }
54  else { cont = cont + 1;
55  ResetCount_unfolded = ResetCount + cycle*cont;
56  }
57  ResetCount_unfolded_comp = ResetCount;
58  }
59 
60 // second ROS
61  else if (ROS_number == 2){
62  double ResetCount2 = ROSDebug_BcntResCnt*0.0000891;
63  if (ResetCount_unfolded_comp2 <= (ResetCount2)) {
64  ResetCount_unfolded = ResetCount2 + cycle*cont2;
65  }
66  else { cont2 = cont2 + 1;
67  ResetCount_unfolded = ResetCount2 + cycle*cont2;
68  }
69  ResetCount_unfolded_comp2 = ResetCount2;
70  }
71 
72 // third ROS
73  else if (ROS_number == 3){
74  double ResetCount3 = ROSDebug_BcntResCnt*0.0000891;
75  if (ResetCount_unfolded_comp3 <= (ResetCount3)) {
76  ResetCount_unfolded = ResetCount3 + cycle*cont3;
77  }
78  else { cont3 = cont3 + 1;
79  ResetCount_unfolded = ResetCount3 + cycle*cont3;
80  }
81  ResetCount_unfolded_comp3 = ResetCount3;
82  }
83 
84 
85 // 4th ROS
86  else if (ROS_number == 4){
87  double ResetCount4 = ROSDebug_BcntResCnt*0.0000891;
88  if (ResetCount_unfolded_comp4 <= (ResetCount4)) {
89  ResetCount_unfolded = ResetCount4 + cycle*cont4;
90  }
91  else { cont4 = cont4 + 1;
92  ResetCount_unfolded = ResetCount4 + cycle*cont4;
93  }
94  ResetCount_unfolded_comp = ResetCount4;
95  }
96 
97 // 5th ROS
98  else if (ROS_number == 5){
99  double ResetCount5 = ROSDebug_BcntResCnt*0.0000891;
100  if (ResetCount_unfolded_comp5 <= (ResetCount5)) {
101  ResetCount_unfolded = ResetCount5 + cycle*cont5;
102  }
103  else { cont5 = cont5 + 1;
104  ResetCount_unfolded = ResetCount5 + cycle*cont5;
105  }
106  ResetCount_unfolded_comp5 = ResetCount5;
107  }
108 
109 // 6th ROS
110  else if (ROS_number == 6){
111  double ResetCount6 = ROSDebug_BcntResCnt*0.0000891;
112  if (ResetCount_unfolded_comp6 <= (ResetCount6)) {
113  ResetCount_unfolded = ResetCount6 + cycle*cont6;
114  }
115  else { cont6 = cont6 + 1;
116  ResetCount_unfolded = ResetCount6 + cycle*cont6;
117  }
118  ResetCount_unfolded_comp6 = ResetCount6;
119  }
120 
121 // 7th ROS
122  else if (ROS_number == 7){
123  double ResetCount7 = ROSDebug_BcntResCnt*0.0000891;
124  if (ResetCount_unfolded_comp7 <= (ResetCount7)) {
125  ResetCount_unfolded = ResetCount7 + cycle*cont7;
126  }
127  else { cont7 = cont7 + 1;
128  ResetCount_unfolded = ResetCount7 + cycle*cont7;
129  }
130  ResetCount_unfolded_comp7 = ResetCount7;
131  }
132 
133 // 8th ROS
134  else if (ROS_number == 8){
135  double ResetCount8 = ROSDebug_BcntResCnt*0.0000891;
136  if (ResetCount_unfolded_comp8 <= (ResetCount8)) {
137  ResetCount_unfolded = ResetCount8 + cycle*cont8;
138  }
139  else { cont8 = cont8 + 1;
140  ResetCount_unfolded = ResetCount8 + cycle*cont8;
141  }
142  ResetCount_unfolded_comp8 = ResetCount8;
143  }
144 
145 // 9th ROS
146  else if (ROS_number == 9){
147  double ResetCount9 = ROSDebug_BcntResCnt*0.0000891;
148  if (ResetCount_unfolded_comp9 <= (ResetCount9)) {
149  ResetCount_unfolded = ResetCount9 + cycle*cont9;
150  }
151  else { cont9 = cont9 + 1;
152  ResetCount_unfolded = ResetCount9 + cycle*cont9;
153  }
154  ResetCount_unfolded_comp9 = ResetCount9;
155  }
156 
157 // 10th ROS
158  else if (ROS_number == 10){
159  double ResetCount10 = ROSDebug_BcntResCnt*0.0000891;
160  if (ResetCount_unfolded_comp10 <= (ResetCount10)) {
161  ResetCount_unfolded = ResetCount10 + cycle*cont10;
162  }
163  else { cont10 = cont10 + 1;
164  ResetCount_unfolded = ResetCount10 + cycle*cont10;
165  }
166  ResetCount_unfolded_comp10 = ResetCount10;
167  }
168 
169 // 11th ROS
170  else if (ROS_number == 11){
171  double ResetCount11 = ROSDebug_BcntResCnt*0.0000891;
172  if (ResetCount_unfolded_comp11 <= (ResetCount11)) {
173  ResetCount_unfolded = ResetCount11 + cycle*cont11;
174  }
175  else { cont11 = cont11 + 1;
176  ResetCount_unfolded = ResetCount11 + cycle*cont11;
177  }
178  ResetCount_unfolded_comp11 = ResetCount11;
179  }
180 
181  // 12th ROS
182  else if (ROS_number == 12){
183  double ResetCount12 = ROSDebug_BcntResCnt*0.0000891;
184  if (ResetCount_unfolded_comp12 <= (ResetCount12)) {
185  ResetCount_unfolded = ResetCount12 + cycle*cont12;
186  }
187  else { cont12 = cont12 + 1;
188  ResetCount_unfolded = ResetCount12 + cycle*cont12;
189  }
190  ResetCount_unfolded_comp12 = ResetCount12;
191  }
192 }
193 
196 
197 
198 
199 void ROS_L1A_Frequency(int ROS_number,int ROSDebug_BcntResCnt,
200  int neventsROS25,double& frequency,float& trigger_counter)
201 {
202 
203  trigger_counter = 0.;
204 
205 // first ROS
206  if (ROS_number == 1)
207  {
208  long double second_evt = ROSDebug_BcntResCnt;
209  if (neventsROS25==1) first_evt = ROSDebug_BcntResCnt;
210 
211  if (ROSDebug_BcntResCnt<16777215) {
212 
213  if ((second_evt - first_evt)<(1/(0.0000891*peso))){
214  trigger_counter1 += 1;
215  trigger_counter = trigger_counter1;
216  }
217  else{ //window change
218  frequency = trigger_counter1;
219  first_evt = second_evt;
220  trigger_counter1 = 0;}
221  }
222  else{
223  long double second_evt_neg = second_evt + max_bx;
224 
225  if ((second_evt_neg - first_evt)<(1/(0.0000891*peso))){
226  trigger_counter1 +=1;
227  trigger_counter = trigger_counter1;
228  frequency = first_evt*0.0000891;
229  }
230  else {
231  first_evt = second_evt;
232  trigger_counter1 = 0;}
233  }
234  return;
235  }
236 
237 
238 
239 // second ROS
240  else if (ROS_number == 2){
241  long double second_evt2 = ROSDebug_BcntResCnt;
242 
243  if (neventsROS25==1) first_evt2 = ROSDebug_BcntResCnt;
244 
245  if (ROSDebug_BcntResCnt<16777215) {
246 
247  if ((second_evt2 - first_evt2)<(1/(0.0000891*peso))){
248  trigger_counter2 += 1;
249  trigger_counter = trigger_counter2;
250  }
251  else{ //window change
252  frequency = trigger_counter2;
253  first_evt2 = second_evt2;
254  trigger_counter2 = 0;}
255  }
256  else{
257  long double second_evt_neg2 = second_evt2 + max_bx;
258 
259  if ((second_evt_neg2 - first_evt2)<(1/(0.0000891*peso))){
260  trigger_counter2 +=1;
261  trigger_counter = trigger_counter2;
262  frequency = first_evt2*0.0000891;
263  }
264  else {
265  first_evt2 = second_evt2;
266  trigger_counter2 = 0;}
267  }
268  }
269 
270 // third ROS
271  else if (ROS_number == 3){
272 
273  long double second_evt3 = ROSDebug_BcntResCnt;
274  if (neventsROS25==1) first_evt3 = ROSDebug_BcntResCnt;
275 
276  if (ROSDebug_BcntResCnt<16777215) {
277 
278  if ((second_evt3 - first_evt3)<(1/(0.0000891*peso))){
279  trigger_counter3 += 1;
280  trigger_counter = trigger_counter3;
281  }
282  else{ //window change
283  frequency = trigger_counter3;
284  first_evt3 = second_evt3;
285  trigger_counter3 = 0;}
286  }
287  else{
288  long double second_evt_neg3 = second_evt3 + max_bx;
289 
290  if ((second_evt_neg3 - first_evt3)<(1/(0.0000891*peso))){
291  trigger_counter3 +=1;
292  trigger_counter = trigger_counter3;
293  frequency = first_evt3*0.0000891;
294  }
295  else {
296  first_evt3 = second_evt3;
297  trigger_counter3 = 0;}
298  }
299  }
300 
301 
302 // 4th ROS
303  else if (ROS_number == 4){
304 
305  long double second_evt4 = ROSDebug_BcntResCnt;
306  if (neventsROS25==1) first_evt4 = ROSDebug_BcntResCnt;
307 
308  if (ROSDebug_BcntResCnt<16777215) {
309 
310  if ((second_evt4 - first_evt4)<(1/(0.0000891*peso))){
311  trigger_counter4 += 1;
312  trigger_counter = trigger_counter4;
313  }
314  else{ //window change
315  frequency = trigger_counter4;
316  first_evt4 = second_evt4;
317  trigger_counter4 = 0;}
318  }
319  else{
320  long double second_evt_neg4 = second_evt4 + max_bx;
321 
322  if ((second_evt_neg4 - first_evt4)<(1/(0.0000891*peso))){
323  trigger_counter4 +=1;
324  trigger_counter = trigger_counter4;
325  frequency = first_evt4*0.0000891;
326  }
327  else {
328  first_evt4 = second_evt4;
329  trigger_counter4 = 0;}
330  }
331  }
332 
333 // 5th ROS
334  else if (ROS_number == 5){
335 
336  long double second_evt5 = ROSDebug_BcntResCnt;
337  if (neventsROS25==1) first_evt5 = ROSDebug_BcntResCnt;
338 
339  if (ROSDebug_BcntResCnt<16777215) {
340 
341  if ((second_evt5 - first_evt5)<(1/(0.0000891*peso))){
342  trigger_counter5 += 1;
343  trigger_counter = trigger_counter5;
344  }
345  else{ //window change
346  frequency = trigger_counter5;
347  first_evt5 = second_evt5;
348  trigger_counter5 = 0;}
349  }
350  else{
351  long double second_evt_neg5 = second_evt5 + max_bx;
352 
353  if ((second_evt_neg5 - first_evt5)<(1/(0.0000891*peso))){
354  trigger_counter5 +=1;
355  trigger_counter = trigger_counter5;
356  frequency = first_evt5*0.0000891;
357  }
358  else {
359  first_evt5 = second_evt5;
360  trigger_counter5 = 0;}
361  }
362  }
363 
364 // 6th ROS
365  else if (ROS_number == 6){
366 
367  long double second_evt6 = ROSDebug_BcntResCnt;
368  if (neventsROS25==1) first_evt6 = ROSDebug_BcntResCnt;
369 
370  if (ROSDebug_BcntResCnt<16777215) {
371 
372  if ((second_evt6 - first_evt6)<(1/(0.0000891*peso))){
373  trigger_counter6 += 1;
374  trigger_counter = trigger_counter6;
375  }
376  else{ //window change
377  frequency = trigger_counter6;
378  first_evt6 = second_evt6;
379  trigger_counter6 = 0;}
380  }
381  else{
382  long double second_evt_neg6 = second_evt6 + max_bx;
383 
384  if ((second_evt_neg6 - first_evt6)<(1/(0.0000891*peso))){
385  trigger_counter6 +=1;
386  trigger_counter = trigger_counter6;
387  frequency = first_evt6*0.0000891;
388  }
389  else {
390  first_evt6 = second_evt6;
391  trigger_counter6 = 0;}
392  }
393  }
394 
395 
396 // 7th ROS
397  else if (ROS_number == 7){
398 
399  long double second_evt7 = ROSDebug_BcntResCnt;
400  if (neventsROS25==1) first_evt7 = ROSDebug_BcntResCnt;
401 
402  if (ROSDebug_BcntResCnt<16777215) {
403 
404  if ((second_evt7 - first_evt7)<(1/(0.0000891*peso))){
405  trigger_counter7 += 1;
406  trigger_counter = trigger_counter7;
407  }
408  else{ //window change
409  frequency = trigger_counter7;
410  first_evt7 = second_evt7;
411  trigger_counter7 = 0;}
412  }
413  else{
414  long double second_evt_neg7 = second_evt7 + max_bx;
415 
416  if ((second_evt_neg7 - first_evt7)<(1/(0.0000891*peso))){
417  trigger_counter7 +=1;
418  trigger_counter = trigger_counter7;
419  frequency = first_evt7*0.0000891;
420  }
421  else {
422  first_evt7 = second_evt7;
423  trigger_counter7 = 0;}
424  }
425  }
426 
427 // 8th ROS
428  else if (ROS_number == 8){
429 
430  long double second_evt8 = ROSDebug_BcntResCnt;
431  if (neventsROS25==1) first_evt8 = ROSDebug_BcntResCnt;
432 
433  if (ROSDebug_BcntResCnt<16777215) {
434 
435  if ((second_evt8 - first_evt8)<(1/(0.0000891*peso))){
436  trigger_counter8 += 1;
437  trigger_counter = trigger_counter8;
438  }
439  else{ //window change
440  frequency = trigger_counter8;
441  first_evt8 = second_evt8;
442  trigger_counter8 = 0;}
443  }
444  else{
445  long double second_evt_neg8 = second_evt8 + max_bx;
446 
447  if ((second_evt_neg8 - first_evt8)<(1/(0.0000891*peso))){
448  trigger_counter8 +=1;
449  trigger_counter = trigger_counter8;
450  frequency = first_evt8*0.0000891;
451  }
452  else {
453  first_evt8 = second_evt8;
454  trigger_counter8 = 0;}
455  }
456  }
457 
458 // 9th ROS
459  else if (ROS_number == 9){
460 
461  long double second_evt9 = ROSDebug_BcntResCnt;
462  if (neventsROS25==1) first_evt9 = ROSDebug_BcntResCnt;
463 
464  if (ROSDebug_BcntResCnt<16777215) {
465 
466  if ((second_evt9 - first_evt9)<(1/(0.0000891*peso))){
467  trigger_counter9 += 1;
468  trigger_counter = trigger_counter9;
469  }
470  else{ //window change
471  frequency = trigger_counter9;
472  first_evt9 = second_evt9;
473  trigger_counter9 = 0;}
474  }
475  else{
476  long double second_evt_neg9 = second_evt9 + max_bx;
477 
478  if ((second_evt_neg9 - first_evt9)<(1/(0.0000891*peso))){
479  trigger_counter9 +=1;
480  trigger_counter = trigger_counter9;
481  frequency = first_evt9*0.0000891;
482  }
483  else {
484  first_evt9 = second_evt9;
485  trigger_counter9 = 0;}
486  }
487  }
488 
489 
490 // 10th ROS
491  else if (ROS_number == 10){
492 
493  long double second_evt10 = ROSDebug_BcntResCnt;
494  if (neventsROS25==1) first_evt10 = ROSDebug_BcntResCnt;
495 
496  if (ROSDebug_BcntResCnt<16777215) {
497 
498  if ((second_evt10 - first_evt10)<(1/(0.0000891*peso))){
499  trigger_counter10 += 1;
500  trigger_counter = trigger_counter10;
501  }
502  else{ //window change
503  frequency = trigger_counter10;
504  first_evt10 = second_evt10;
505  trigger_counter10 = 0;}
506  }
507  else{
508  long double second_evt_neg10 = second_evt10 + max_bx;
509 
510  if ((second_evt_neg10 - first_evt10)<(1/(0.0000891*peso))){
511  trigger_counter10 +=1;
512  trigger_counter = trigger_counter10;
513  frequency = first_evt10*0.0000891;
514  }
515  else {
516  first_evt10 = second_evt10;
517  trigger_counter10 = 0;}
518  }
519  }
520 
521 
522 // 11th ROS
523  else if (ROS_number == 11){
524 
525  long double second_evt11 = ROSDebug_BcntResCnt;
526  if (neventsROS25==1) first_evt11 = ROSDebug_BcntResCnt;
527 
528  if (ROSDebug_BcntResCnt<16777215) {
529 
530  if ((second_evt11 - first_evt11)<(1/(0.0000891*peso))){
531  trigger_counter11 += 1;
532  trigger_counter = trigger_counter11;
533  }
534  else{ //window change
535  frequency = trigger_counter11;
536  first_evt11 = second_evt11;
537  trigger_counter11 = 0;}
538  }
539  else{
540  long double second_evt_neg11 = second_evt11 + max_bx;
541 
542  if ((second_evt_neg11 - first_evt11)<(1/(0.0000891*peso))){
543  trigger_counter11 +=1;
544  trigger_counter = trigger_counter11;
545  frequency = first_evt11*0.0000891;
546  }
547  else {
548  first_evt11 = second_evt11;
549  trigger_counter11 = 0;}
550  }
551  }
552 
553 
554 // 12th ROS
555  else if (ROS_number == 12){
556 
557  long double second_evt12 = ROSDebug_BcntResCnt;
558  if (neventsROS25==1) first_evt12 = ROSDebug_BcntResCnt;
559 
560  if (ROSDebug_BcntResCnt<16777215) {
561 
562  if ((second_evt12 - first_evt12)<(1/(0.0000891*peso))){
563  trigger_counter12 += 1;
564  trigger_counter = trigger_counter12;
565  }
566  else{ //window change
567  frequency = trigger_counter12;
568  first_evt12 = second_evt12;
569  trigger_counter12 = 0;}
570  }
571  else{
572  long double second_evt_neg12 = second_evt12 + max_bx;
573 
574  if ((second_evt_neg12 - first_evt12)<(1/(0.0000891*peso))){
575  trigger_counter12 +=1;
576  trigger_counter = trigger_counter12;
577  frequency = first_evt12*0.0000891;
578  }
579  else {
580  first_evt12 = second_evt12;
581  trigger_counter12 = 0;}
582  }
583  }
584 }
585 
586 /* Local Variables: */
587 /* show-trailing-whitespace: t */
588 /* truncate-lines: t */
589 /* End: */
int freq3
double ResetCount_unfolded_comp7
float peso
int cont4
int freq8
int freq5
long double first_evt9
float trigger_counter1
int cont5
int freq1
int cont6
double ResetCount_unfolded_comp4
float trigger_counter3
void ROSWords_t(double &ResetCount_unfolded, int ROS_number, int ROSDebug_BcntResCnt, int nevents)
void ROS_L1A_Frequency(int ROS_number, int ROSDebug_BcntResCnt, int neventsROS25, double &frequency, float &trigger_counter)
float trigger_counter10
int cont12
std::string itoa(int current)
double ResetCount_unfolded
int cont10
long double first_evt7
long double first_evt6
double ResetCount_unfolded_comp5
long double first_evt12
double ResetCount_unfolded_comp9
float trigger_counter6
int cont9
int cont11
int cycle
long double first_evt
double ResetCount_unfolded_comp3
long double first_evt11
int freq2
int cont2
int nevents
float trigger_counter11
double ResetCount_unfolded_comp2
float trigger_counter4
long double first_evt3
long double first_evt8
float trigger_counter9
float trigger_counter7
const unsigned long long max_bx
int freq12
float trigger_counter5
double ResetCount_unfolded_comp
float trigger_counter2
int freq6
long double first_evt4
long double first_evt2
float trigger_counter12
long double first_evt10
int cont
int cont3
double ResetCount_unfolded_comp11
int freq4
double ResetCount_unfolded_comp12
int cont7
int cont8
int freq7
float trigger_counter8
int freq9
double ResetCount_unfolded_comp10
int freq11
long double first_evt5
int freq10
double ResetCount_unfolded_comp8
double ResetCount_unfolded_comp6