1 |
// |
// |
2 |
// Check for possible errors and shows raw distribution of variables coming from the DSP (no calibrations needed) - Emiliano Mocchiutti |
// Check for possible errors and shows raw distribution of variables coming from the DSP (no calibrations needed) - Emiliano Mocchiutti |
3 |
// |
// |
4 |
// FCaloQLOOK.c version 1.11 (2006-07-17) |
// FCaloQLOOK.c version 1.14 (2006-09-29) |
5 |
// |
// |
6 |
// The only input needed is the path to the directory created by YODA for the data file you want to analyze. |
// The only input needed is the path to the directory created by YODA for the data file you want to analyze. |
7 |
// |
// |
8 |
// Changelog: |
// Changelog: |
9 |
// |
// |
10 |
|
// 1.13 - 1.14 (2006-09-29): Flag the last entry in the txt file, count missing section when checking for DSP entries correspondence. |
11 |
|
// |
12 |
|
// 1.12 - 1.13 (2006-09-28): Give wrong number of events in compress mode, fixed. |
13 |
|
// |
14 |
|
// 1.11 - 1.12 (2006-09-22): Check for different number of events, put output in a file and write down errors for each event. Fixed jumpev bug. |
15 |
|
// |
16 |
// 1.09 - 1.11 (2006-07-17): Adapted to flight conditions. |
// 1.09 - 1.11 (2006-07-17): Adapted to flight conditions. |
17 |
// |
// |
18 |
// 1.07 - 1.09 (2006-05-29): Fixed bug in output filename when input is not in the form DW_YYMMDD_NNN. Bug in latchup alarm not coming from the status word, fixed. |
// 1.07 - 1.09 (2006-05-29): Fixed bug in output filename when input is not in the form DW_YYMMDD_NNN. Bug in latchup alarm not coming from the status word, fixed. |
49 |
#include <TPolyLine.h> |
#include <TPolyLine.h> |
50 |
#include <TStyle.h> |
#include <TStyle.h> |
51 |
#include <TSystem.h> |
#include <TSystem.h> |
52 |
|
#include <TApplication.h> |
53 |
// |
// |
54 |
#include <PamelaRun.h> |
#include <PamelaRun.h> |
55 |
#include <physics/calorimeter/CalorimeterEvent.h> |
#include <physics/calorimeter/CalorimeterEvent.h> |
86 |
} else { |
} else { |
87 |
Int_t posiz2 = 0; |
Int_t posiz2 = 0; |
88 |
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
89 |
TString pdat(".dat"); |
TString pdat(".pam"); |
90 |
stringappend(file2,pdat); |
stringappend(file2,pdat); |
91 |
}; |
}; |
92 |
return file2; |
return file2; |
93 |
} |
} |
94 |
|
|
95 |
void FCaloQLOOK(TString filename, Int_t fromevent=0, Int_t toevent=0, TString outDir="", TString saveas = "ps"){ |
void sighandler(UInt_t pkt_num, UInt_t obt, UInt_t entry, UInt_t section, UInt_t totev, Bool_t &evdone){ |
96 |
|
if ( !evdone ){ |
97 |
|
printf("\n\n=================================================\n"); |
98 |
|
printf("PSCU-Pkt N. %u - OBT %u ms\n",pkt_num,obt); |
99 |
|
printf("Total events %u\n",totev); |
100 |
|
printf("(ROOT-tree entry %u )\n",entry); |
101 |
|
if ( (totev-1) == entry ) printf("NOTICE: this is last entry! \n"); |
102 |
|
printf("=================================================\n"); |
103 |
|
evdone = true; |
104 |
|
}; |
105 |
|
TString sec = "UNKNOWN"; |
106 |
|
if ( section == 0 ) sec = "XE"; |
107 |
|
if ( section == 1 ) sec = "XO"; |
108 |
|
if ( section == 2 ) sec = "YE"; |
109 |
|
if ( section == 3 ) sec = "YO"; |
110 |
|
printf(" Section %s (DSP n. %i) message: ",sec.Data(),section); |
111 |
|
}; |
112 |
|
|
113 |
|
void FCaloQLOOK(TString filename, Int_t fromevent=0, Int_t toevent=0, TString outDir="", TString saveas = "png", Bool_t iactive =false, Bool_t w4i=false){ |
114 |
gStyle->SetPaperSize(19.,25.); |
gStyle->SetPaperSize(19.,25.); |
115 |
const char* startingdir = gSystem->WorkingDirectory(); |
const char* startingdir = gSystem->WorkingDirectory(); |
116 |
// printf(" basename is %s \n",gSystem->BaseName(filename.Data())); |
// printf(" basename is %s \n",gSystem->BaseName(filename.Data())); |
117 |
// printf(" getfilename is %s \n",getFilename(filename).Data()); |
// printf(" getfilename is %s \n",getFilename(filename).Data()); |
118 |
if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; |
if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; |
119 |
// |
// |
120 |
|
TApplication *app = 0; |
121 |
|
if ( iactive ) app = new TApplication("app",0,0); |
122 |
// |
// |
123 |
ifstream myfile; |
ifstream myfile; |
124 |
myfile.open(filename.Data()); |
myfile.open(filename.Data()); |
140 |
// |
// |
141 |
Float_t ctshitthr = 0.65; |
Float_t ctshitthr = 0.65; |
142 |
Float_t cbasethr = 0.95; |
Float_t cbasethr = 0.95; |
143 |
Float_t cdexythr = 0.995; |
// Float_t cdexythr = 0.995; |
144 |
|
Float_t cdexythr = 0.95; |
145 |
//Float_t cdexythr = 0.90; |
//Float_t cdexythr = 0.90; |
146 |
Float_t cdexycthr = 0.95; |
Float_t cdexycthr = 0.95; |
147 |
Float_t h1rth = 0.90; |
Float_t h1rth = 0.90; |
192 |
}; |
}; |
193 |
Int_t const size = nevents; |
Int_t const size = nevents; |
194 |
Double_t iev2[size+1]; |
Double_t iev2[size+1]; |
195 |
Int_t ver[4][23], lver[4][23],shit[4][11], rshit[4][11], se,bl, pl, fulldiff[4],cshit, cpre[4],nullsh[4][11], lalarm[4]; |
//aumentata la lunghezza di ver, prima era 23 |
196 |
|
Int_t ver[4][24], lver[4][23],shit[4][11], rshit[4][11], se,bl, pl, fulldiff[4],cshit, cpre[4],nullsh[4][11], lalarm[4]; |
197 |
se = 0; |
se = 0; |
198 |
pl = 0; |
pl = 0; |
199 |
Float_t allbase = 0.; |
Float_t allbase = 0.; |
295 |
maxevent = fromevent - 1; |
maxevent = fromevent - 1; |
296 |
}; |
}; |
297 |
}; |
}; |
298 |
|
//azzera i tipi di errore |
299 |
for (Int_t k = 0; k < 4; k++ ){ |
for (Int_t k = 0; k < 4; k++ ){ |
300 |
for (Int_t m = 0; m < 23 ; m++ ){ |
for (Int_t m = 0; m < 23 ; m++ ){ |
301 |
ver[k][m] = 0 ; |
ver[k][m] = 0 ; |
307 |
}; |
}; |
308 |
lalarm[k] = 0; |
lalarm[k] = 0; |
309 |
}; |
}; |
310 |
|
//il 23 lo azzero cosi per non modificare le altre variabili |
311 |
|
ver[k][23]=0; |
312 |
}; |
}; |
313 |
Int_t pdone, bdone; |
Int_t pdone, bdone; |
314 |
pdone = 0; |
pdone = 0; |
315 |
bdone = 0; |
bdone = 0; |
316 |
bool isCOMP = 0; |
bool isCOMP = false; |
317 |
bool isFULL = 0; |
bool isFULL = false; |
318 |
bool isRAW = 0; |
bool isRAW = false; |
319 |
Int_t alldexy=0; |
Int_t alldexy=0; |
320 |
Int_t alldexy2=0; |
Int_t alldexy2=0; |
321 |
Int_t planebases=0; |
Int_t planebases=0; |
334 |
fulldiff[1] = 0; |
fulldiff[1] = 0; |
335 |
fulldiff[2] = 0; |
fulldiff[2] = 0; |
336 |
fulldiff[3] = 0; |
fulldiff[3] = 0; |
337 |
printf("\n Processed events: \n\n"); |
// printf("\n Processed events: \n\n"); |
338 |
|
printf("\n Start processing: \n\n"); |
339 |
unsigned short int calev0=0; |
unsigned short int calev0=0; |
340 |
unsigned short int oldcalev0; |
unsigned short int oldcalev0; |
341 |
unsigned short int calev1=0; |
unsigned short int calev1=0; |
345 |
unsigned short int calev3=0; |
unsigned short int calev3=0; |
346 |
unsigned short int oldcalev3; |
unsigned short int oldcalev3; |
347 |
Int_t i = minevent; |
Int_t i = minevent; |
348 |
Float_t headc = 0.; |
UInt_t headc = 0; |
349 |
Float_t headco = 0.; |
UInt_t headco = 0; |
350 |
Bool_t h1rcheck = false; |
Bool_t h1rcheck = false; |
351 |
Int_t h1rin = 0; |
Int_t h1rin = 0; |
352 |
Int_t h1rout = 0; |
Int_t h1rout = 0; |
360 |
Int_t outdexy = 0; |
Int_t outdexy = 0; |
361 |
Int_t indexyc = 0; |
Int_t indexyc = 0; |
362 |
Int_t outdexyc = 0; |
Int_t outdexyc = 0; |
363 |
Int_t obt = 0; |
UInt_t obt = 0; |
364 |
Int_t minobt[4]; |
UInt_t minobt[4]; |
365 |
Int_t maxobt[4]; |
UInt_t maxobt[4]; |
366 |
Int_t swminobt[4]; |
UInt_t swminobt[4]; |
367 |
Int_t swmaxobt[4]; |
UInt_t swmaxobt[4]; |
368 |
Bool_t firstobt[4]; |
Bool_t firstobt[4]; |
369 |
Bool_t swfirstobt[4]; |
Bool_t swfirstobt[4]; |
370 |
for ( Int_t i = 0; i<4; i++){ |
for ( Int_t i = 0; i<4; i++){ |
375 |
firstobt[i] = true; |
firstobt[i] = true; |
376 |
swfirstobt[i] = true; |
swfirstobt[i] = true; |
377 |
}; |
}; |
378 |
|
Bool_t evdone = false; |
379 |
|
// |
380 |
while ( i < maxevent+1){ |
while ( i < maxevent+1){ |
381 |
|
evdone = false; |
382 |
tshit = 0; |
tshit = 0; |
383 |
trshit = 0; |
trshit = 0; |
384 |
tr->GetEntry(i); |
tr->GetEntry(i); |
385 |
|
|
386 |
iev2[i] = ce->iev; |
iev2[i] = ce->iev; |
387 |
// |
// |
388 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
389 |
headco = headc; |
headco = headc; |
390 |
headc = ph->GetCounter(); |
headc = ph->GetCounter(); |
391 |
obt = ph->GetOrbitalTime(); |
obt = ph->GetOrbitalTime(); |
392 |
|
|
393 |
if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])) ) calevn1++; |
if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])) ) calevn1++; |
394 |
if ( (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])) ) calevn2++; |
if ( (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])) ) calevn2++; |
395 |
if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])) ) calevn3++; |
if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])) ) calevn3++; |
|
// calevn1 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])); |
|
|
// calevn2 += (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])); |
|
|
// calevn3 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])); |
|
396 |
calev01->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[1]))); |
calev01->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[1]))); |
397 |
calev23->Fill(abs((int)(ce->calevnum[2]-ce->calevnum[3]))); |
calev23->Fill(abs((int)(ce->calevnum[2]-ce->calevnum[3]))); |
398 |
calev03->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[3]))); |
calev03->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[3]))); |
407 |
calevv2 = (int)ce->calevnum[2]; |
calevv2 = (int)ce->calevnum[2]; |
408 |
oldcalev3 = calev3; |
oldcalev3 = calev3; |
409 |
calev3 = (int)ce->calevnum[3]; |
calev3 = (int)ce->calevnum[3]; |
410 |
goto jumpprintout; |
// goto jumpprintout; |
411 |
if ( (headc - headco -1.) == 0. && ((calev0 - oldcalev0 - 1) > 0 || (calev1 - oldcalev1 - 1) > 0 || (calevv2 - oldcalev2 - 1) > 0 || (calev3 - oldcalev3 - 1) > 0) ){ |
if ( (headc - headco -1) == 0. && ((calev0 - oldcalev0 - 1) > 0 || (calev1 - oldcalev1 - 1) > 0 || (calevv2 - oldcalev2 - 1) > 0 || (calev3 - oldcalev3 - 1) > 0) ){ |
412 |
if ( i != minevent ) { |
if ( i != minevent ) { |
413 |
printf(" %f 0 Event %i: %i\n",headco,i,oldcalev0); |
// printf(" %f 0 Event %i: %i\n",headco,i,oldcalev0); |
414 |
printf(" %f 0 Event %i: %i\n",headc,i+1,calev0); |
// printf(" %f 0 Event %i: %i\n",headc,i+1,calev0); |
415 |
printf(" %f 1 Event %i: %i\n",headco,i,oldcalev1); |
// printf(" %f 1 Event %i: %i\n",headco,i,oldcalev1); |
416 |
printf(" %f 1 Event %i: %i\n",headc,i+1,calev1); |
// printf(" %f 1 Event %i: %i\n",headc,i+1,calev1); |
417 |
printf(" %f 2 Event %i: %i\n",headco,i,oldcalev2); |
// printf(" %f 2 Event %i: %i\n",headco,i,oldcalev2); |
418 |
printf(" %f 2 Event %i: %i\n",headc,i+1,calevv2); |
// printf(" %f 2 Event %i: %i\n",headc,i+1,calevv2); |
419 |
printf(" %f 3 Event %i: %i\n",headco,i,oldcalev3); |
// printf(" %f 3 Event %i: %i\n",headco,i,oldcalev3); |
420 |
printf(" %f 3 Event %i: %i\n",headc,i+1,calev3); |
// printf(" %f 3 Event %i: %i\n",headc,i+1,calev3); |
421 |
isRAW = 0; |
isRAW = 0; |
422 |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
423 |
if ( (calev0 - oldcalev0 - 1) > 0 && !isRAW && ce->perror[0] != 129 && oldcalev0 != 0) { |
if ( (calev0 - oldcalev0 - 1) > 0 && !isRAW && ce->perror[0] != 129 && oldcalev0 != 0) { |
424 |
ver[0][10]++; |
ver[0][10]++; |
425 |
|
sighandler(headc,obt,i,0,nevents,evdone); |
426 |
|
printf(" jump in the counter calev is %i oldcalev was %i \n",calev0,oldcalev0); |
427 |
}; |
}; |
428 |
isRAW = 0; |
isRAW = 0; |
429 |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
430 |
if ( (calev1 - oldcalev1 - 1) > 0 && !isRAW && ce->perror[1] != 129 && oldcalev1 != 0 ){ |
if ( (calev1 - oldcalev1 - 1) > 0 && !isRAW && ce->perror[1] != 129 && oldcalev1 != 0 ){ |
431 |
ver[1][10]++; |
ver[1][10]++; |
432 |
|
sighandler(headc,obt,i,1,nevents,evdone); |
433 |
|
printf(" jump in the counter calev is %i oldcalev was %i \n",calev1,oldcalev1); |
434 |
}; |
}; |
435 |
isRAW = 0; |
isRAW = 0; |
436 |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
437 |
if ( (calevv2 - oldcalev2 - 1) > 0 && !isRAW && ce->perror[2] != 129 && oldcalev2 != 0 ){ |
if ( (calevv2 - oldcalev2 - 1) > 0 && !isRAW && ce->perror[2] != 129 && oldcalev2 != 0 ){ |
438 |
ver[2][10]++; |
ver[2][10]++; |
439 |
|
sighandler(headc,obt,i,2,nevents,evdone); |
440 |
|
printf(" jump in the counter calev is %i oldcalev was %i \n",calevv2,oldcalev2); |
441 |
}; |
}; |
442 |
isRAW = 0; |
isRAW = 0; |
443 |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
444 |
if ( (calev3 - oldcalev3 - 1) > 0 && !isRAW && ce->perror[3] != 129 && oldcalev3 != 0 ){ |
if ( (calev3 - oldcalev3 - 1) > 0 && !isRAW && ce->perror[3] != 129 && oldcalev3 != 0 ){ |
445 |
ver[3][10]++; |
ver[3][10]++; |
446 |
|
sighandler(headc,obt,i,3,nevents,evdone); |
447 |
|
printf(" jump in the counter calev is %i oldcalev was %i \n",calev3,oldcalev3); |
448 |
}; |
}; |
449 |
} |
}; |
450 |
}; |
}; |
451 |
jumpprintout: |
// jumpprintout: |
452 |
memcpy(shit, nullsh, sizeof(nullsh)); |
memcpy(shit, nullsh, sizeof(nullsh)); |
453 |
memcpy(rshit, nullsh, sizeof(nullsh)); |
memcpy(rshit, nullsh, sizeof(nullsh)); |
454 |
for (Int_t l = 0; l < 2; l++ ){ |
for (Int_t l = 0; l < 2; l++ ){ |
472 |
se = 1; |
se = 1; |
473 |
pl = (ii-1)/2; |
pl = (ii-1)/2; |
474 |
pdone = 0; |
pdone = 0; |
475 |
}; |
}; |
476 |
|
isCOMP = false; |
477 |
isCOMP = 0; |
isFULL = false; |
478 |
isFULL = 0; |
isRAW = false; |
479 |
isRAW = 0; |
if ( ce->stwerr[se] & (1 << 16) ) isCOMP = true; |
480 |
if ( ce->stwerr[se] & (1 << 16) ) isCOMP = 1; |
if ( ce->stwerr[se] & (1 << 17) ) isFULL = true; |
481 |
if ( ce->stwerr[se] & (1 << 17) ) isFULL = 1; |
if ( ce->stwerr[se] & (1 << 3) ) isRAW = true; |
|
if ( ce->stwerr[se] & (1 << 3) ) isRAW = 1; |
|
482 |
bl = -1; |
bl = -1; |
483 |
for (Int_t kk = 0; kk < 96 ; kk++ ){ |
for (Int_t kk = 0; kk < 96 ; kk++ ){ |
484 |
if ( kk%16 == 0 ){ |
if ( kk%16 == 0 ){ |
520 |
if ( obt > maxobt[se] ) maxobt[se] = obt; |
if ( obt > maxobt[se] ) maxobt[se] = obt; |
521 |
}; |
}; |
522 |
lver[se][2]++ ; |
lver[se][2]++ ; |
523 |
|
if ( lver[se][2] == 1000 ){ |
524 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
525 |
|
printf(" latch up (data) in DSP mode alldexy %i planebases %i \n",alldexy,planebases); |
526 |
|
printf(" WARNING TOO MANY LATCHUP ERRORS ON DATA FOR THIS SECTION \n"); |
527 |
|
printf(" THEY WILL NOT BE DISPLAYED HERE ANYMORE FOR THIS FILE! \n"); |
528 |
|
}; |
529 |
|
if ( lver[se][2] < 1000 ){ |
530 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
531 |
|
printf(" latch up (data) in DSP mode alldexy %i planebases %i \n",alldexy,planebases); |
532 |
|
}; |
533 |
}; |
}; |
534 |
} |
} |
535 |
// |
// |
536 |
if ( !bdone ){ |
if ( !bdone ){ |
537 |
Baseline->Fill(ce->base[l][ii][bl]); |
Baseline->Fill(ce->base[l][ii][bl]); |
538 |
if ( ce->base[l][ii][bl] > 2000. && ce->base[l][ii][bl] < 4500. ){ |
if ( ce->base[l][ii][bl] > 2000. && ce->base[l][ii][bl] < 5500. ){ |
539 |
inbase++; |
inbase++; |
540 |
} else { |
} else { |
541 |
outbase++; |
outbase++; |
573 |
indexyc++; |
indexyc++; |
574 |
}; |
}; |
575 |
// |
// |
576 |
if (ce->dexyc[l][ii][kk] < 0 ) ver[se][21]++ ; |
if (ce->dexyc[l][ii][kk] < 0 ){ |
577 |
|
ver[se][21]++ ; |
578 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
579 |
|
printf(" negative ADC values!! ce->dexyc[%i][%i][%i] = %f \n",l,ii,kk,ce->dexyc[l][ii][kk]); |
580 |
|
}; |
581 |
// |
// |
582 |
if ( allbase == 0. || allbase > 32000.) { |
if ( allbase == 0. || allbase > 32000.) { |
583 |
fcheck = 0; |
fcheck = 0; |
593 |
} else { |
} else { |
594 |
if ( !pdone ){ |
if ( !pdone ){ |
595 |
if ( ( alldexy2 > 3072000 || alldexy2 == 0) && ce->perror[se] == 0 ) { |
if ( ( alldexy2 > 3072000 || alldexy2 == 0) && ce->perror[se] == 0 ) { |
596 |
// if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) { |
// if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) |
597 |
pdone = 1; |
pdone = 1; |
598 |
pshit[se][pl]++ ; |
pshit[se][pl]++ ; |
599 |
if ( (ce->stwerr[se] & (1 << 4)) == 0 ){ |
if ( (ce->stwerr[se] & (1 << 4)) == 0 ){ |
603 |
if ( obt > maxobt[se] ) maxobt[se] = obt; |
if ( obt > maxobt[se] ) maxobt[se] = obt; |
604 |
}; |
}; |
605 |
lver[se][2]++ ; |
lver[se][2]++ ; |
606 |
|
if ( lver[se][2] == 1000 ){ |
607 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
608 |
|
printf(" latch up (data) in RAW mode alldexy2 %i \n",alldexy2); |
609 |
|
printf(" WARNING TOO MANY LATCHUP ERRORS ON DATA FOR THIS SECTION \n"); |
610 |
|
printf(" THEY WILL NOT BE DISPLAYED HERE ANYMORE FOR THIS FILE! \n"); |
611 |
|
}; |
612 |
|
if ( lver[se][2] < 1000 ){ |
613 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
614 |
|
printf(" latch up (data) in RAW mode alldexy2 %i \n",alldexy2); |
615 |
|
}; |
616 |
}; |
}; |
617 |
}; |
}; |
618 |
if ( ce->dexy[l][ii][kk] > 0 && ce->dexy[l][ii][kk] < 32000 ) { |
if ( ce->dexy[l][ii][kk] > 0 && ce->dexy[l][ii][kk] < 32000 ) { |
631 |
}; |
}; |
632 |
cshit = 0; |
cshit = 0; |
633 |
for (Int_t k = 0; k < 4 ; k++ ){ |
for (Int_t k = 0; k < 4 ; k++ ){ |
634 |
isCOMP = 0; |
isCOMP = false; |
635 |
isFULL = 0; |
isFULL = false; |
636 |
if ( ce->stwerr[se] & (1 << 16) ) isCOMP = 1; |
cestw=0;// queste righe qui |
637 |
if ( ce->stwerr[se] & (1 << 17) ) isFULL = 1; |
if ( ce->stwerr[k] ) cestw = ce->stwerr[k] & cmask ;// |
638 |
|
if ( ce->stwerr[k] & (1 << 16) && !(cestw & (1 << 3)) ) isCOMP = true; |
639 |
|
if ( ce->stwerr[k] & (1 << 17) && !(cestw & (1 << 3)) ) isFULL = true; |
640 |
|
// |
641 |
if ( isCOMP ) ver[k][16]++; |
if ( isCOMP ) ver[k][16]++; |
642 |
if ( isFULL ) ver[k][17]++; |
if ( isFULL ) ver[k][17]++; |
643 |
cshit += (int)ce->calstriphit[k]; |
cshit += (int)ce->calstriphit[k]; |
|
cestw=0; |
|
|
if ( ce->stwerr[k] ) cestw = ce->stwerr[k] & cmask ; |
|
644 |
if ( cestw ){ |
if ( cestw ){ |
645 |
if ( cestw & (1 << 0) ) ver[k][6]++ ; |
if ( cestw & (1 << 0) ){ |
646 |
if ( cestw & (1 << 1) ) ver[k][5]++ ; |
ver[k][6]++ ; |
647 |
if ( cestw & (1 << 2) ) ver[k][4]++ ; |
sighandler(headc,obt,i,k,nevents,evdone); |
648 |
if ( cestw & (1 << 3) ) ver[k][3]++ ; |
printf(" CRC error (st. word) \n"); |
649 |
|
}; |
650 |
|
if ( cestw & (1 << 1) ){ |
651 |
|
ver[k][5]++ ; |
652 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
653 |
|
printf(" execution error \n"); |
654 |
|
}; |
655 |
|
if ( cestw & (1 << 2) ){ |
656 |
|
ver[k][4]++ ; |
657 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
658 |
|
printf(" CMD length error \n"); |
659 |
|
}; |
660 |
|
if ( cestw & (1 << 3) ) ver[k][3]++ ; // raw mode |
661 |
if ( cestw & (1 << 4) ){ |
if ( cestw & (1 << 4) ){ |
662 |
ver[k][2]++ ; |
ver[k][2]++ ; |
663 |
|
if ( ver[k][2] == 1000 ){ |
664 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
665 |
|
printf(" latch up alarm (st. word)\n"); |
666 |
|
printf(" WARNING TOO MANY LATCHUP ERRORS ON DATA FOR THIS SECTION \n"); |
667 |
|
printf(" THEY WILL NOT BE DISPLAYED HERE ANYMORE FOR THIS FILE! \n"); |
668 |
|
}; |
669 |
|
if ( ver[k][2] < 1000 ){ |
670 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
671 |
|
printf(" latch up alarm (st. word)\n"); |
672 |
|
}; |
673 |
lupstw[k]->Fill(obt); |
lupstw[k]->Fill(obt); |
674 |
if ( swfirstobt[k] ) swminobt[k] = obt; |
if ( swfirstobt[k] ) swminobt[k] = obt; |
675 |
if ( obt > swmaxobt[k] ) swmaxobt[k] = obt; |
if ( obt > swmaxobt[k] ) swmaxobt[k] = obt; |
676 |
}; |
}; |
677 |
if ( cestw & (1 << 5) ) ver[k][1]++ ; |
if ( cestw & (1 << 5) ){ |
678 |
if ( cestw & (1 << 6) ) ver[k][0]++ ; |
ver[k][1]++ ; |
679 |
}; |
sighandler(headc,obt,i,k,nevents,evdone); |
680 |
|
printf(" temperature alarm \n"); |
681 |
|
}; |
682 |
|
if ( cestw & (1 << 6) ){ |
683 |
|
ver[k][0]++ ; |
684 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
685 |
|
printf(" DSP ack error \n"); |
686 |
|
}; |
687 |
|
};// controllo se ci sono errori crc se perr=0 ok! |
688 |
|
if ( ce->stwerr[k] == 0 && ce->perror[k] == 0 ) ver[k][8]++ ; |
689 |
if ( ce->perror[k] != 0. ){ |
if ( ce->perror[k] != 0. ){ |
690 |
if (ce->perror[k] == 128) ver[k][7]++ ; |
if (ce->perror[k] == 128){ |
691 |
if (ce->perror[k] == 129) ver[k][8]++ ; |
ver[k][7]++ ; |
692 |
if (ce->perror[k] == 132) ver[k][11]++ ; |
sighandler(headc,obt,i,k,nevents,evdone); |
693 |
if (ce->perror[k] == 133) ver[k][12]++ ; |
printf(" view or command not recognized \n"); |
694 |
if (ce->perror[k] == 134) ver[k][13]++ ; |
}; |
695 |
if (ce->perror[k] == 135) ver[k][14]++ ; |
if (ce->perror[k] == 129){ |
696 |
if (ce->perror[k] == 136) ver[k][15]++ ; |
ver[k][8]++ ; |
697 |
if (ce->perror[k] == 139) ver[k][18]++ ; |
sighandler(headc,obt,i,k,nevents,evdone); |
698 |
if (ce->perror[k] == 140) ver[k][19]++ ; |
printf(" missing section \n"); |
699 |
if (ce->perror[k] == 141) ver[k][20]++ ; |
}; |
700 |
if (ce->perror[k] == 142) ver[k][22]++ ; |
if (ce->perror[k] == 132){ |
701 |
|
ver[k][11]++ ; |
702 |
|
if ( ver[k][11] < 30 ){ |
703 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
704 |
|
printf(" CRC error (data) \n"); |
705 |
|
}; |
706 |
|
if ( ver[k][11] == 30 ){ |
707 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
708 |
|
printf(" CRC error (data) \n"); |
709 |
|
printf(" WARNING TOO MANY CRC ERRORS ON DATA FOR THIS SECTION \n"); |
710 |
|
printf(" THEY WILL NOT BE DISPLAYED HERE ANYMORE FOR THIS FILE! \n"); |
711 |
|
}; |
712 |
|
}; |
713 |
|
if (ce->perror[k] == 133){ |
714 |
|
ver[k][12]++ ; |
715 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
716 |
|
printf(" length problems in RAW mode \n"); |
717 |
|
}; |
718 |
|
if (ce->perror[k] == 134){ |
719 |
|
ver[k][13]++ ; |
720 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
721 |
|
printf(" length problems in COMPRESS mode \n"); |
722 |
|
}; |
723 |
|
if (ce->perror[k] == 135){ |
724 |
|
ver[k][14]++ ; |
725 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
726 |
|
printf(" length problems in FULL mode \n"); |
727 |
|
}; |
728 |
|
if (ce->perror[k] == 136){ |
729 |
|
ver[k][15]++ ; |
730 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
731 |
|
printf(" acquisition mode problems \n"); |
732 |
|
}; |
733 |
|
if (ce->perror[k] == 139){ |
734 |
|
ver[k][18]++ ; |
735 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
736 |
|
printf(" problems with coding\n"); |
737 |
|
}; |
738 |
|
if (ce->perror[k] == 140){ |
739 |
|
ver[k][19]++ ; |
740 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
741 |
|
printf(" pedestal checksum wrong\n"); |
742 |
|
}; |
743 |
|
if (ce->perror[k] == 141){ |
744 |
|
ver[k][20]++ ; |
745 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
746 |
|
printf(" thresholds checksum wrong\n"); |
747 |
|
}; |
748 |
|
if (ce->perror[k] == 142){ |
749 |
|
ver[k][22]++ ; |
750 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
751 |
|
printf(" packet length is zero (YODA input error), skipped\n"); |
752 |
|
}; |
753 |
|
//aggiunto questo errore |
754 |
|
if (ce->perror[k] == 143){ |
755 |
|
ver[k][23]++ ; |
756 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
757 |
|
printf(" corrupted packet lenght \n"); |
758 |
|
}; |
759 |
}; |
}; |
760 |
for (Int_t kk = 0; kk < 11 ; kk++ ){ |
for (Int_t kk = 0; kk < 11 ; kk++ ){ |
761 |
tshit += shit[k][kk]; |
tshit += shit[k][kk]; |
765 |
if (isCOMP || isFULL){ |
if (isCOMP || isFULL){ |
766 |
Calstriphit->Fill(cshit); |
Calstriphit->Fill(cshit); |
767 |
// if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){ |
// if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){ |
768 |
if ( (cshit > 10 && cshit < 100) ){ |
// |
769 |
|
//cambiata la banda di soglia ora 5 prima era 10 |
770 |
|
// |
771 |
|
if ( (cshit > 5 && cshit < 100) ){ |
772 |
incshit++; |
incshit++; |
773 |
} else { |
} else { |
774 |
outcshit++; |
outcshit++; |
776 |
// |
// |
777 |
if ( tshit>0 ) h1->Fill(tshit); |
if ( tshit>0 ) h1->Fill(tshit); |
778 |
// if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){ |
// if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){ |
779 |
if ( (tshit > 10 && tshit < 100) ){ |
//cambiata la soglia ora 5 prima era 10 |
780 |
|
if ( (tshit > 5 && tshit < 100) ){ |
781 |
intshit++; |
intshit++; |
782 |
} else { |
} else { |
783 |
outtshit++; |
outtshit++; |
792 |
h1rin++; |
h1rin++; |
793 |
}; |
}; |
794 |
}; |
}; |
795 |
if ( i%1000 == 0 && i > 0 ) printf("%iK\n",i/1000); |
// if ( i%1000 == 0 && i > 0 ) printf("%iK\n",i/1000); |
796 |
i++; |
i++; |
797 |
}; |
}; |
798 |
printf("\n"); |
printf("\n"); |
799 |
|
printf("\n end processing. \n\n"); |
800 |
if ( (float)h1rout/((float)h1rin+(float)h1rout) > h1rth ){ |
if ( (float)h1rout/((float)h1rin+(float)h1rout) > h1rth ){ |
801 |
h1rcheck = true; |
h1rcheck = true; |
802 |
}; |
}; |
865 |
h1->Draw(); |
h1->Draw(); |
866 |
// |
// |
867 |
h1max = h1->GetMaximum()*1.05; |
h1max = h1->GetMaximum()*1.05; |
868 |
Double_t xc[4] = {10.,100.,100.,10.}; |
|
869 |
|
//cambiata banda prima era 10 ora 5 |
870 |
|
Double_t xc[4] = {5.,100.,100.,5.}; |
871 |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
872 |
banda1 = new TPolyLine(4,xc,yc); |
banda1 = new TPolyLine(4,xc,yc); |
873 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
917 |
h1->SetYTitle("Number of events"); |
h1->SetYTitle("Number of events"); |
918 |
h1->Draw(); |
h1->Draw(); |
919 |
h1max = h1->GetMaximum()*1.05; |
h1max = h1->GetMaximum()*1.05; |
920 |
Double_t xe[4] = {10.,100.,100.,10.}; |
//cambiato banda, prima era 10,ora 5 |
921 |
|
Double_t xe[4] = {5.,100.,100.,5.}; |
922 |
Double_t ye[4] = {0.,0.,h1max,h1max}; |
Double_t ye[4] = {0.,0.,h1max,h1max}; |
923 |
banda1 = new TPolyLine(4,xe,ye); |
banda1 = new TPolyLine(4,xe,ye); |
924 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
1104 |
Baseline->SetYTitle("Number of events"); |
Baseline->SetYTitle("Number of events"); |
1105 |
Baseline->Draw(); |
Baseline->Draw(); |
1106 |
h1max = Baseline->GetMaximum()*1.05; |
h1max = Baseline->GetMaximum()*1.05; |
1107 |
Double_t xc[4] = {2000.,4500.,4500.,2000.}; |
Double_t xc[4] = {2000.,5500.,5500.,2000.}; |
1108 |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
1109 |
banda1 = new TPolyLine(4,xc,yc); |
banda1 = new TPolyLine(4,xc,yc); |
1110 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
1141 |
Calstriphit->SetYTitle("Number of events"); |
Calstriphit->SetYTitle("Number of events"); |
1142 |
Calstriphit->Draw(); |
Calstriphit->Draw(); |
1143 |
h1max = Calstriphit->GetMaximum()*1.05; |
h1max = Calstriphit->GetMaximum()*1.05; |
1144 |
Double_t xg[4] = {10.,100.,100.,10.}; |
|
1145 |
|
//banda di sogla portata a 5, prima era a 10 |
1146 |
|
Double_t xg[4] = {5.,100.,100.,5.}; |
1147 |
Double_t yg[4] = {0.,0.,h1max,h1max}; |
Double_t yg[4] = {0.,0.,h1max,h1max}; |
1148 |
banda1 = new TPolyLine(4,xg,yg); |
banda1 = new TPolyLine(4,xg,yg); |
1149 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
1160 |
Calstriphit->Draw("SAME"); |
Calstriphit->Draw("SAME"); |
1161 |
// |
// |
1162 |
pd4->cd(); |
pd4->cd(); |
1163 |
|
gPad->SetLogy(); |
1164 |
Dexy->SetXTitle("ADC channels"); |
Dexy->SetXTitle("ADC channels"); |
1165 |
Dexy->SetYTitle("Number of events"); |
Dexy->SetYTitle("Number of events"); |
1166 |
Dexy->Draw(); |
Dexy->Draw(); |
1167 |
h1max = Dexy->GetMaximum()*1.05; |
// h1max = Dexy->GetMaximum()*1.05; |
1168 |
|
h1max = Dexy->GetMaximum()*2.05; |
1169 |
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
1170 |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
1171 |
banda1 = new TPolyLine(4,xd,yd); |
banda1 = new TPolyLine(4,xd,yd); |
1201 |
pd4->Draw(); |
pd4->Draw(); |
1202 |
// |
// |
1203 |
pd4->cd(); |
pd4->cd(); |
1204 |
|
gPad->SetLogy(); |
1205 |
Dexy->SetXTitle("ADC channels"); |
Dexy->SetXTitle("ADC channels"); |
1206 |
Dexy->SetYTitle("Number of events"); |
Dexy->SetYTitle("Number of events"); |
1207 |
Dexy->Draw(); |
Dexy->Draw(); |
1208 |
h1max = Dexy->GetMaximum()*1.05; |
// h1max = Dexy->GetMaximum()*1.05; |
1209 |
|
h1max = Dexy->GetMaximum()*2.05; |
1210 |
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
1211 |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
1212 |
banda1 = new TPolyLine(4,xd,yd); |
banda1 = new TPolyLine(4,xd,yd); |
1350 |
pad2->Draw(); |
pad2->Draw(); |
1351 |
pad3->Draw(); |
pad3->Draw(); |
1352 |
pad4->Draw(); |
pad4->Draw(); |
1353 |
|
// |
1354 |
|
Bool_t redevent = true; |
1355 |
|
// |
1356 |
|
if ( ver[0][3]+ver[0][16]+ver[0][17]+ver[0][8] == ver[1][3]+ver[1][16]+ver[1][17]+ver[1][8] && ver[1][3]+ver[1][16]+ver[1][17]+ver[1][8] == ver[2][3]+ver[2][16]+ver[2][17]+ver[2][8] && ver[2][3]+ver[2][16]+ver[2][17]+ver[2][8] == ver[3][3]+ver[3][16]+ver[3][17]+ver[3][8] ){ |
1357 |
|
redevent = false; |
1358 |
|
}; |
1359 |
|
if ( redevent ) check = true; |
1360 |
|
// |
1361 |
for (Int_t i = 0; i < 4; i++){ |
for (Int_t i = 0; i < 4; i++){ |
1362 |
if (i == 2) |
if (i == 2) |
1363 |
{ |
{ |
1385 |
t->SetTextAlign(12); |
t->SetTextAlign(12); |
1386 |
t->DrawLatex(33.,97.,sezione); |
t->DrawLatex(33.,97.,sezione); |
1387 |
t->SetTextSize(0.05); |
t->SetTextSize(0.05); |
1388 |
for (Int_t j = 0; j < 23; j++){ |
//aggiunto un errore jmax=23 |
1389 |
|
for (Int_t j = 0; j < 24; j++){ |
1390 |
if ( ver[i][j] || lver[i][j] ) { |
if ( ver[i][j] || lver[i][j] ) { |
1391 |
t->SetTextColor(50); |
t->SetTextColor(50); |
1392 |
if (j == 0) { |
if (j == 0) { |
1445 |
errore.str(""); |
errore.str(""); |
1446 |
errore << "RAW mode: " << ver[i][j]; |
errore << "RAW mode: " << ver[i][j]; |
1447 |
errore << " time(s)"; |
errore << " time(s)"; |
1448 |
t->SetTextColor(32); |
if ( !redevent ) t->SetTextColor(32); |
1449 |
t->DrawLatex(2.,90.,errore.str().c_str()); |
t->DrawLatex(2.,90.,errore.str().c_str()); |
1450 |
} |
} |
1451 |
if (j == 4) { |
if (j == 4) { |
1488 |
errore << "Calevnum jump: " << ver[i][j]; |
errore << "Calevnum jump: " << ver[i][j]; |
1489 |
errore << " time(s)"; |
errore << " time(s)"; |
1490 |
t->DrawLatex(2.,42.,errore.str().c_str()); |
t->DrawLatex(2.,42.,errore.str().c_str()); |
1491 |
check = true; |
if ( ver[i][j] > 3 ) check = true; |
1492 |
} |
} |
1493 |
if (j == 11) { |
if (j == 11) { |
1494 |
errore.str(""); |
errore.str(""); |
1529 |
errore.str(""); |
errore.str(""); |
1530 |
errore << "COMPRESS mode: " << ver[i][j]; |
errore << "COMPRESS mode: " << ver[i][j]; |
1531 |
errore << " time(s)"; |
errore << " time(s)"; |
1532 |
t->SetTextColor(32); |
if ( !redevent ) t->SetTextColor(32); |
1533 |
t->DrawLatex(2.,86.,errore.str().c_str()); |
t->DrawLatex(2.,86.,errore.str().c_str()); |
1534 |
} |
} |
1535 |
if (j == 17) { |
if (j == 17) { |
1536 |
errore.str(""); |
errore.str(""); |
1537 |
errore << "FULL mode: " << ver[i][j]; |
errore << "FULL mode: " << ver[i][j]; |
1538 |
errore << " time(s)"; |
errore << " time(s)"; |
1539 |
t->SetTextColor(32); |
if ( !redevent ) t->SetTextColor(32); |
1540 |
t->DrawLatex(2.,82.,errore.str().c_str()); |
t->DrawLatex(2.,82.,errore.str().c_str()); |
1541 |
} |
} |
1542 |
if (j == 18) { |
if (j == 18) { |
1574 |
t->DrawLatex(2.,3.,errore.str().c_str()); |
t->DrawLatex(2.,3.,errore.str().c_str()); |
1575 |
check = true; |
check = true; |
1576 |
}; |
}; |
1577 |
}; |
//aggiunto questo errore |
1578 |
}; |
if (j == 23) { |
1579 |
|
errore.str(""); |
1580 |
|
errore << "Corrupted packet lenght " << ver[i][j]; |
1581 |
|
errore << " time(s) "; |
1582 |
|
t->DrawLatex(2.,2.,errore.str().c_str()); |
1583 |
|
check = true; |
1584 |
|
}; |
1585 |
|
}; |
1586 |
|
}; |
1587 |
t->SetTextColor(50); |
t->SetTextColor(50); |
1588 |
if ( fulldiff[i] !=0 ) { |
if ( fulldiff[i] !=0 ) { |
1589 |
check = true; |
check = true; |
1610 |
if ( check ){ |
if ( check ){ |
1611 |
t->SetTextColor(50); |
t->SetTextColor(50); |
1612 |
t->DrawLatex(60.,95.," WARNING, CHECK! "); |
t->DrawLatex(60.,95.," WARNING, CHECK! "); |
|
printf("cdexyc %f cdexy %f ctshit %f cbase %f \n",cdexyc,cdexy,ctshit,cbase); |
|
1613 |
} else { |
} else { |
1614 |
t->SetTextColor(32); |
t->SetTextColor(32); |
1615 |
t->DrawLatex(60.,95.," OK! "); |
t->DrawLatex(60.,95.," OK! "); |
1616 |
}; |
}; |
1617 |
|
printf("cdexyc %f cdexy %f ctshit %f cbase %f \n",cdexyc,cdexy,ctshit,cbase); |
1618 |
// |
// |
1619 |
// const string fil = (const char*)filename; |
// const string fil = (const char*)filename; |
1620 |
// Int_t posiz = fil.find("dw_"); |
// Int_t posiz = fil.find("dw_"); |
1690 |
figsave << format; |
figsave << format; |
1691 |
rapporto->SaveAs(figsave.str().c_str()); |
rapporto->SaveAs(figsave.str().c_str()); |
1692 |
}; |
}; |
1693 |
|
if ( iactive && w4i ){ |
1694 |
|
while ( gROOT->GetListOfCanvases()->FindObject(rapporto) || gROOT->GetListOfCanvases()->FindObject(figura3) || gROOT->GetListOfCanvases()->FindObject(figura2) || gROOT->GetListOfCanvases()->FindObject(figura) ){ |
1695 |
|
gSystem->ProcessEvents(); |
1696 |
|
gSystem->Sleep(10); |
1697 |
|
}; |
1698 |
|
}; |
1699 |
} |
} |
|
|
|