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. |
36 |
// |
// |
37 |
#include <iostream> |
#include <iostream> |
38 |
#include <fstream> |
#include <fstream> |
39 |
|
#include <cstdlib> |
40 |
// |
// |
41 |
#include <TObject.h> |
#include <TObject.h> |
42 |
#include <TString.h> |
#include <TString.h> |
43 |
#include <TFile.h> |
#include <TFile.h> |
44 |
|
#include <TROOT.h> |
45 |
#include <TCanvas.h> |
#include <TCanvas.h> |
46 |
#include <TH1.h> |
#include <TH1.h> |
47 |
#include <TH1F.h> |
#include <TH1F.h> |
57 |
#include <physics/calorimeter/CalorimeterEvent.h> |
#include <physics/calorimeter/CalorimeterEvent.h> |
58 |
// |
// |
59 |
#include <FCaloQLOOKfun.h> |
#include <FCaloQLOOKfun.h> |
60 |
|
#include <sys/stat.h> |
61 |
|
#include <cstdlib> |
62 |
// |
// |
63 |
using namespace std; |
using namespace std; |
64 |
// |
// |
90 |
} else { |
} else { |
91 |
Int_t posiz2 = 0; |
Int_t posiz2 = 0; |
92 |
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
93 |
TString pdat(".dat"); |
TString pdat(".pam"); |
94 |
stringappend(file2,pdat); |
stringappend(file2,pdat); |
95 |
}; |
}; |
96 |
return file2; |
return file2; |
97 |
} |
} |
98 |
|
|
99 |
|
void sighandler(UInt_t pkt_num, UInt_t obt, UInt_t entry, UInt_t section, UInt_t totev, Bool_t &evdone){ |
100 |
|
if ( !evdone ){ |
101 |
|
printf("\n\n=================================================\n"); |
102 |
|
printf("PSCU-Pkt N. %u - OBT %u ms\n",pkt_num,obt); |
103 |
|
printf("Total events %u\n",totev); |
104 |
|
printf("(ROOT-tree entry %u )\n",entry); |
105 |
|
if ( (totev-1) == entry ) printf("NOTICE: this is last entry! \n"); |
106 |
|
printf("=================================================\n"); |
107 |
|
evdone = true; |
108 |
|
}; |
109 |
|
TString sec = "UNKNOWN"; |
110 |
|
if ( section == 0 ) sec = "XE"; |
111 |
|
if ( section == 1 ) sec = "XO"; |
112 |
|
if ( section == 2 ) sec = "YE"; |
113 |
|
if ( section == 3 ) sec = "YO"; |
114 |
|
printf(" Section %s (DSP n. %i) message: ",sec.Data(),section); |
115 |
|
}; |
116 |
|
|
117 |
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){ |
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){ |
118 |
gStyle->SetPaperSize(19.,25.); |
gStyle->SetPaperSize(19.,25.); |
119 |
const char* startingdir = gSystem->WorkingDirectory(); |
const char* startingdir = gSystem->WorkingDirectory(); |
144 |
// |
// |
145 |
Float_t ctshitthr = 0.65; |
Float_t ctshitthr = 0.65; |
146 |
Float_t cbasethr = 0.95; |
Float_t cbasethr = 0.95; |
147 |
Float_t cdexythr = 0.995; |
// Float_t cdexythr = 0.995; |
148 |
|
Float_t cdexythr = 0.95; |
149 |
//Float_t cdexythr = 0.90; |
//Float_t cdexythr = 0.90; |
150 |
Float_t cdexycthr = 0.95; |
Float_t cdexycthr = 0.95; |
151 |
Float_t h1rth = 0.90; |
Float_t h1rth = 0.90; |
195 |
return; |
return; |
196 |
}; |
}; |
197 |
Int_t const size = nevents; |
Int_t const size = nevents; |
198 |
Double_t iev2[size+1]; |
// Double_t iev2[size+1]; |
199 |
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 |
200 |
|
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]; |
201 |
se = 0; |
se = 0; |
202 |
pl = 0; |
pl = 0; |
203 |
Float_t allbase = 0.; |
Float_t allbase = 0.; |
204 |
Int_t tshit, trshit, compdata,rawdata, errorfull, calevn1, calevn2, calevn3, calevn4, pshit[4][11]; |
Int_t tshit, trshit, compdata,rawdata, errorfull, calevn1, calevn2, calevn3, calevn4, pshit[4][11]; |
205 |
tshit = 0; |
tshit = 0; |
206 |
trshit = 0; |
trshit = 0; |
207 |
char *sezione; |
const char *sezione = ""; |
208 |
Bool_t check = false; |
Bool_t check = false; |
209 |
sezione = ""; |
// sezione = ""; |
210 |
stringstream errore; |
stringstream errore; |
211 |
errore.str(""); |
errore.str(""); |
212 |
// |
// |
299 |
maxevent = fromevent - 1; |
maxevent = fromevent - 1; |
300 |
}; |
}; |
301 |
}; |
}; |
302 |
|
//azzera i tipi di errore |
303 |
for (Int_t k = 0; k < 4; k++ ){ |
for (Int_t k = 0; k < 4; k++ ){ |
304 |
for (Int_t m = 0; m < 23 ; m++ ){ |
for (Int_t m = 0; m < 23 ; m++ ){ |
305 |
ver[k][m] = 0 ; |
ver[k][m] = 0 ; |
311 |
}; |
}; |
312 |
lalarm[k] = 0; |
lalarm[k] = 0; |
313 |
}; |
}; |
314 |
|
//il 23 lo azzero cosi per non modificare le altre variabili |
315 |
|
ver[k][23]=0; |
316 |
}; |
}; |
317 |
Int_t pdone, bdone; |
Int_t pdone, bdone; |
318 |
pdone = 0; |
pdone = 0; |
319 |
bdone = 0; |
bdone = 0; |
320 |
bool isCOMP = 0; |
bool isCOMP = false; |
321 |
bool isFULL = 0; |
bool isFULL = false; |
322 |
bool isRAW = 0; |
bool isRAW = false; |
323 |
Int_t alldexy=0; |
Int_t alldexy=0; |
324 |
Int_t alldexy2=0; |
Int_t alldexy2=0; |
325 |
Int_t planebases=0; |
Int_t planebases=0; |
338 |
fulldiff[1] = 0; |
fulldiff[1] = 0; |
339 |
fulldiff[2] = 0; |
fulldiff[2] = 0; |
340 |
fulldiff[3] = 0; |
fulldiff[3] = 0; |
341 |
printf("\n Processed events: \n\n"); |
// printf("\n Processed events: \n\n"); |
342 |
|
printf("\n Start processing: \n\n"); |
343 |
unsigned short int calev0=0; |
unsigned short int calev0=0; |
344 |
unsigned short int oldcalev0; |
unsigned short int oldcalev0; |
345 |
unsigned short int calev1=0; |
unsigned short int calev1=0; |
349 |
unsigned short int calev3=0; |
unsigned short int calev3=0; |
350 |
unsigned short int oldcalev3; |
unsigned short int oldcalev3; |
351 |
Int_t i = minevent; |
Int_t i = minevent; |
352 |
Float_t headc = 0.; |
UInt_t headc = 0; |
353 |
Float_t headco = 0.; |
UInt_t headco = 0; |
354 |
Bool_t h1rcheck = false; |
Bool_t h1rcheck = false; |
355 |
Int_t h1rin = 0; |
Int_t h1rin = 0; |
356 |
Int_t h1rout = 0; |
Int_t h1rout = 0; |
364 |
Int_t outdexy = 0; |
Int_t outdexy = 0; |
365 |
Int_t indexyc = 0; |
Int_t indexyc = 0; |
366 |
Int_t outdexyc = 0; |
Int_t outdexyc = 0; |
367 |
Int_t obt = 0; |
UInt_t obt = 0; |
368 |
Int_t minobt[4]; |
UInt_t minobt[4]; |
369 |
Int_t maxobt[4]; |
UInt_t maxobt[4]; |
370 |
Int_t swminobt[4]; |
UInt_t swminobt[4]; |
371 |
Int_t swmaxobt[4]; |
UInt_t swmaxobt[4]; |
372 |
Bool_t firstobt[4]; |
Bool_t firstobt[4]; |
373 |
Bool_t swfirstobt[4]; |
Bool_t swfirstobt[4]; |
374 |
for ( Int_t i = 0; i<4; i++){ |
for ( Int_t i = 0; i<4; i++){ |
379 |
firstobt[i] = true; |
firstobt[i] = true; |
380 |
swfirstobt[i] = true; |
swfirstobt[i] = true; |
381 |
}; |
}; |
382 |
|
Bool_t evdone = false; |
383 |
|
// |
384 |
while ( i < maxevent+1){ |
while ( i < maxevent+1){ |
385 |
|
evdone = false; |
386 |
tshit = 0; |
tshit = 0; |
387 |
trshit = 0; |
trshit = 0; |
388 |
tr->GetEntry(i); |
tr->GetEntry(i); |
389 |
iev2[i] = ce->iev; |
|
390 |
|
// iev2[i] = ce->iev; |
391 |
// |
// |
392 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
393 |
headco = headc; |
headco = headc; |
394 |
headc = ph->GetCounter(); |
headc = ph->GetCounter(); |
395 |
obt = ph->GetOrbitalTime(); |
obt = ph->GetOrbitalTime(); |
396 |
|
|
397 |
if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])) ) calevn1++; |
if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])) ) calevn1++; |
398 |
if ( (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])) ) calevn2++; |
if ( (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])) ) calevn2++; |
399 |
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])); |
|
400 |
calev01->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[1]))); |
calev01->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[1]))); |
401 |
calev23->Fill(abs((int)(ce->calevnum[2]-ce->calevnum[3]))); |
calev23->Fill(abs((int)(ce->calevnum[2]-ce->calevnum[3]))); |
402 |
calev03->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[3]))); |
calev03->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[3]))); |
411 |
calevv2 = (int)ce->calevnum[2]; |
calevv2 = (int)ce->calevnum[2]; |
412 |
oldcalev3 = calev3; |
oldcalev3 = calev3; |
413 |
calev3 = (int)ce->calevnum[3]; |
calev3 = (int)ce->calevnum[3]; |
414 |
goto jumpprintout; |
// goto jumpprintout; |
415 |
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) ){ |
416 |
if ( i != minevent ) { |
if ( i != minevent ) { |
417 |
printf(" %f 0 Event %i: %i\n",headco,i,oldcalev0); |
// printf(" %f 0 Event %i: %i\n",headco,i,oldcalev0); |
418 |
printf(" %f 0 Event %i: %i\n",headc,i+1,calev0); |
// printf(" %f 0 Event %i: %i\n",headc,i+1,calev0); |
419 |
printf(" %f 1 Event %i: %i\n",headco,i,oldcalev1); |
// printf(" %f 1 Event %i: %i\n",headco,i,oldcalev1); |
420 |
printf(" %f 1 Event %i: %i\n",headc,i+1,calev1); |
// printf(" %f 1 Event %i: %i\n",headc,i+1,calev1); |
421 |
printf(" %f 2 Event %i: %i\n",headco,i,oldcalev2); |
// printf(" %f 2 Event %i: %i\n",headco,i,oldcalev2); |
422 |
printf(" %f 2 Event %i: %i\n",headc,i+1,calevv2); |
// printf(" %f 2 Event %i: %i\n",headc,i+1,calevv2); |
423 |
printf(" %f 3 Event %i: %i\n",headco,i,oldcalev3); |
// printf(" %f 3 Event %i: %i\n",headco,i,oldcalev3); |
424 |
printf(" %f 3 Event %i: %i\n",headc,i+1,calev3); |
// printf(" %f 3 Event %i: %i\n",headc,i+1,calev3); |
425 |
isRAW = 0; |
isRAW = 0; |
426 |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
427 |
if ( (calev0 - oldcalev0 - 1) > 0 && !isRAW && ce->perror[0] != 129 && oldcalev0 != 0) { |
if ( (calev0 - oldcalev0 - 1) > 0 && !isRAW && ce->perror[0] != 129 && oldcalev0 != 0) { |
428 |
ver[0][10]++; |
ver[0][10]++; |
429 |
|
sighandler(headc,obt,i,0,nevents,evdone); |
430 |
|
printf(" jump in the counter calev is %i oldcalev was %i \n",calev0,oldcalev0); |
431 |
}; |
}; |
432 |
isRAW = 0; |
isRAW = 0; |
433 |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
434 |
if ( (calev1 - oldcalev1 - 1) > 0 && !isRAW && ce->perror[1] != 129 && oldcalev1 != 0 ){ |
if ( (calev1 - oldcalev1 - 1) > 0 && !isRAW && ce->perror[1] != 129 && oldcalev1 != 0 ){ |
435 |
ver[1][10]++; |
ver[1][10]++; |
436 |
|
sighandler(headc,obt,i,1,nevents,evdone); |
437 |
|
printf(" jump in the counter calev is %i oldcalev was %i \n",calev1,oldcalev1); |
438 |
}; |
}; |
439 |
isRAW = 0; |
isRAW = 0; |
440 |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
441 |
if ( (calevv2 - oldcalev2 - 1) > 0 && !isRAW && ce->perror[2] != 129 && oldcalev2 != 0 ){ |
if ( (calevv2 - oldcalev2 - 1) > 0 && !isRAW && ce->perror[2] != 129 && oldcalev2 != 0 ){ |
442 |
ver[2][10]++; |
ver[2][10]++; |
443 |
|
sighandler(headc,obt,i,2,nevents,evdone); |
444 |
|
printf(" jump in the counter calev is %i oldcalev was %i \n",calevv2,oldcalev2); |
445 |
}; |
}; |
446 |
isRAW = 0; |
isRAW = 0; |
447 |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
448 |
if ( (calev3 - oldcalev3 - 1) > 0 && !isRAW && ce->perror[3] != 129 && oldcalev3 != 0 ){ |
if ( (calev3 - oldcalev3 - 1) > 0 && !isRAW && ce->perror[3] != 129 && oldcalev3 != 0 ){ |
449 |
ver[3][10]++; |
ver[3][10]++; |
450 |
|
sighandler(headc,obt,i,3,nevents,evdone); |
451 |
|
printf(" jump in the counter calev is %i oldcalev was %i \n",calev3,oldcalev3); |
452 |
}; |
}; |
453 |
} |
}; |
454 |
}; |
}; |
455 |
jumpprintout: |
// jumpprintout: |
456 |
memcpy(shit, nullsh, sizeof(nullsh)); |
memcpy(shit, nullsh, sizeof(nullsh)); |
457 |
memcpy(rshit, nullsh, sizeof(nullsh)); |
memcpy(rshit, nullsh, sizeof(nullsh)); |
458 |
for (Int_t l = 0; l < 2; l++ ){ |
for (Int_t l = 0; l < 2; l++ ){ |
476 |
se = 1; |
se = 1; |
477 |
pl = (ii-1)/2; |
pl = (ii-1)/2; |
478 |
pdone = 0; |
pdone = 0; |
479 |
}; |
}; |
480 |
|
isCOMP = false; |
481 |
isCOMP = 0; |
isFULL = false; |
482 |
isFULL = 0; |
isRAW = false; |
483 |
isRAW = 0; |
if ( ce->stwerr[se] & (1 << 16) ) isCOMP = true; |
484 |
if ( ce->stwerr[se] & (1 << 16) ) isCOMP = 1; |
if ( ce->stwerr[se] & (1 << 17) ) isFULL = true; |
485 |
if ( ce->stwerr[se] & (1 << 17) ) isFULL = 1; |
if ( ce->stwerr[se] & (1 << 3) ) isRAW = true; |
|
if ( ce->stwerr[se] & (1 << 3) ) isRAW = 1; |
|
486 |
bl = -1; |
bl = -1; |
487 |
for (Int_t kk = 0; kk < 96 ; kk++ ){ |
for (Int_t kk = 0; kk < 96 ; kk++ ){ |
488 |
if ( kk%16 == 0 ){ |
if ( kk%16 == 0 ){ |
524 |
if ( obt > maxobt[se] ) maxobt[se] = obt; |
if ( obt > maxobt[se] ) maxobt[se] = obt; |
525 |
}; |
}; |
526 |
lver[se][2]++ ; |
lver[se][2]++ ; |
527 |
|
if ( lver[se][2] == 1000 ){ |
528 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
529 |
|
printf(" latch up (data) in DSP mode alldexy %i planebases %i \n",alldexy,planebases); |
530 |
|
printf(" WARNING TOO MANY LATCHUP ERRORS ON DATA FOR THIS SECTION \n"); |
531 |
|
printf(" THEY WILL NOT BE DISPLAYED HERE ANYMORE FOR THIS FILE! \n"); |
532 |
|
}; |
533 |
|
if ( lver[se][2] < 1000 ){ |
534 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
535 |
|
printf(" latch up (data) in DSP mode alldexy %i planebases %i \n",alldexy,planebases); |
536 |
|
}; |
537 |
}; |
}; |
538 |
} |
} |
539 |
// |
// |
540 |
if ( !bdone ){ |
if ( !bdone ){ |
541 |
Baseline->Fill(ce->base[l][ii][bl]); |
Baseline->Fill(ce->base[l][ii][bl]); |
542 |
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. ){ |
543 |
inbase++; |
inbase++; |
544 |
} else { |
} else { |
545 |
outbase++; |
outbase++; |
577 |
indexyc++; |
indexyc++; |
578 |
}; |
}; |
579 |
// |
// |
580 |
if (ce->dexyc[l][ii][kk] < 0 ) ver[se][21]++ ; |
if (ce->dexyc[l][ii][kk] < 0 ){ |
581 |
|
ver[se][21]++ ; |
582 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
583 |
|
printf(" negative ADC values!! ce->dexyc[%i][%i][%i] = %f \n",l,ii,kk,ce->dexyc[l][ii][kk]); |
584 |
|
}; |
585 |
// |
// |
586 |
if ( allbase == 0. || allbase > 32000.) { |
if ( allbase == 0. || allbase > 32000.) { |
587 |
fcheck = 0; |
fcheck = 0; |
597 |
} else { |
} else { |
598 |
if ( !pdone ){ |
if ( !pdone ){ |
599 |
if ( ( alldexy2 > 3072000 || alldexy2 == 0) && ce->perror[se] == 0 ) { |
if ( ( alldexy2 > 3072000 || alldexy2 == 0) && ce->perror[se] == 0 ) { |
600 |
// if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) { |
// if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) |
601 |
pdone = 1; |
pdone = 1; |
602 |
pshit[se][pl]++ ; |
pshit[se][pl]++ ; |
603 |
if ( (ce->stwerr[se] & (1 << 4)) == 0 ){ |
if ( (ce->stwerr[se] & (1 << 4)) == 0 ){ |
607 |
if ( obt > maxobt[se] ) maxobt[se] = obt; |
if ( obt > maxobt[se] ) maxobt[se] = obt; |
608 |
}; |
}; |
609 |
lver[se][2]++ ; |
lver[se][2]++ ; |
610 |
|
if ( lver[se][2] == 1000 ){ |
611 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
612 |
|
printf(" latch up (data) in RAW mode alldexy2 %i \n",alldexy2); |
613 |
|
printf(" WARNING TOO MANY LATCHUP ERRORS ON DATA FOR THIS SECTION \n"); |
614 |
|
printf(" THEY WILL NOT BE DISPLAYED HERE ANYMORE FOR THIS FILE! \n"); |
615 |
|
}; |
616 |
|
if ( lver[se][2] < 1000 ){ |
617 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
618 |
|
printf(" latch up (data) in RAW mode alldexy2 %i \n",alldexy2); |
619 |
|
}; |
620 |
}; |
}; |
621 |
}; |
}; |
622 |
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 ) { |
635 |
}; |
}; |
636 |
cshit = 0; |
cshit = 0; |
637 |
for (Int_t k = 0; k < 4 ; k++ ){ |
for (Int_t k = 0; k < 4 ; k++ ){ |
638 |
isCOMP = 0; |
isCOMP = false; |
639 |
isFULL = 0; |
isFULL = false; |
640 |
if ( ce->stwerr[se] & (1 << 16) ) isCOMP = 1; |
cestw=0;// queste righe qui |
641 |
if ( ce->stwerr[se] & (1 << 17) ) isFULL = 1; |
if ( ce->stwerr[k] ) cestw = ce->stwerr[k] & cmask ;// |
642 |
|
if ( ce->stwerr[k] & (1 << 16) && !(cestw & (1 << 3)) ) isCOMP = true; |
643 |
|
if ( ce->stwerr[k] & (1 << 17) && !(cestw & (1 << 3)) ) isFULL = true; |
644 |
|
// |
645 |
if ( isCOMP ) ver[k][16]++; |
if ( isCOMP ) ver[k][16]++; |
646 |
if ( isFULL ) ver[k][17]++; |
if ( isFULL ) ver[k][17]++; |
647 |
cshit += (int)ce->calstriphit[k]; |
cshit += (int)ce->calstriphit[k]; |
|
cestw=0; |
|
|
if ( ce->stwerr[k] ) cestw = ce->stwerr[k] & cmask ; |
|
648 |
if ( cestw ){ |
if ( cestw ){ |
649 |
if ( cestw & (1 << 0) ) ver[k][6]++ ; |
if ( cestw & (1 << 0) ){ |
650 |
if ( cestw & (1 << 1) ) ver[k][5]++ ; |
ver[k][6]++ ; |
651 |
if ( cestw & (1 << 2) ) ver[k][4]++ ; |
sighandler(headc,obt,i,k,nevents,evdone); |
652 |
if ( cestw & (1 << 3) ) ver[k][3]++ ; |
printf(" CRC error (st. word) \n"); |
653 |
|
}; |
654 |
|
if ( cestw & (1 << 1) ){ |
655 |
|
ver[k][5]++ ; |
656 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
657 |
|
printf(" execution error \n"); |
658 |
|
}; |
659 |
|
if ( cestw & (1 << 2) ){ |
660 |
|
ver[k][4]++ ; |
661 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
662 |
|
printf(" CMD length error \n"); |
663 |
|
}; |
664 |
|
if ( cestw & (1 << 3) ) ver[k][3]++ ; // raw mode |
665 |
if ( cestw & (1 << 4) ){ |
if ( cestw & (1 << 4) ){ |
666 |
ver[k][2]++ ; |
ver[k][2]++ ; |
667 |
|
if ( ver[k][2] == 1000 ){ |
668 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
669 |
|
printf(" latch up alarm (st. word)\n"); |
670 |
|
printf(" WARNING TOO MANY LATCHUP ERRORS ON DATA FOR THIS SECTION \n"); |
671 |
|
printf(" THEY WILL NOT BE DISPLAYED HERE ANYMORE FOR THIS FILE! \n"); |
672 |
|
}; |
673 |
|
if ( ver[k][2] < 1000 ){ |
674 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
675 |
|
printf(" latch up alarm (st. word)\n"); |
676 |
|
}; |
677 |
lupstw[k]->Fill(obt); |
lupstw[k]->Fill(obt); |
678 |
if ( swfirstobt[k] ) swminobt[k] = obt; |
if ( swfirstobt[k] ) swminobt[k] = obt; |
679 |
if ( obt > swmaxobt[k] ) swmaxobt[k] = obt; |
if ( obt > swmaxobt[k] ) swmaxobt[k] = obt; |
680 |
}; |
}; |
681 |
if ( cestw & (1 << 5) ) ver[k][1]++ ; |
if ( cestw & (1 << 5) ){ |
682 |
if ( cestw & (1 << 6) ) ver[k][0]++ ; |
ver[k][1]++ ; |
683 |
}; |
sighandler(headc,obt,i,k,nevents,evdone); |
684 |
|
printf(" temperature alarm \n"); |
685 |
|
}; |
686 |
|
if ( cestw & (1 << 6) ){ |
687 |
|
ver[k][0]++ ; |
688 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
689 |
|
printf(" DSP ack error \n"); |
690 |
|
}; |
691 |
|
};// controllo se ci sono errori crc se perr=0 ok! |
692 |
|
if ( ce->stwerr[k] == 0 && ce->perror[k] == 0 ) ver[k][8]++ ; |
693 |
if ( ce->perror[k] != 0. ){ |
if ( ce->perror[k] != 0. ){ |
694 |
if (ce->perror[k] == 128) ver[k][7]++ ; |
if (ce->perror[k] == 128){ |
695 |
if (ce->perror[k] == 129) ver[k][8]++ ; |
ver[k][7]++ ; |
696 |
if (ce->perror[k] == 132) ver[k][11]++ ; |
sighandler(headc,obt,i,k,nevents,evdone); |
697 |
if (ce->perror[k] == 133) ver[k][12]++ ; |
printf(" view or command not recognized \n"); |
698 |
if (ce->perror[k] == 134) ver[k][13]++ ; |
}; |
699 |
if (ce->perror[k] == 135) ver[k][14]++ ; |
if (ce->perror[k] == 129){ |
700 |
if (ce->perror[k] == 136) ver[k][15]++ ; |
ver[k][8]++ ; |
701 |
if (ce->perror[k] == 139) ver[k][18]++ ; |
sighandler(headc,obt,i,k,nevents,evdone); |
702 |
if (ce->perror[k] == 140) ver[k][19]++ ; |
printf(" missing section \n"); |
703 |
if (ce->perror[k] == 141) ver[k][20]++ ; |
}; |
704 |
if (ce->perror[k] == 142) ver[k][22]++ ; |
if (ce->perror[k] == 132){ |
705 |
|
ver[k][11]++ ; |
706 |
|
if ( ver[k][11] < 30 ){ |
707 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
708 |
|
printf(" CRC error (data) \n"); |
709 |
|
}; |
710 |
|
if ( ver[k][11] == 30 ){ |
711 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
712 |
|
printf(" CRC error (data) \n"); |
713 |
|
printf(" WARNING TOO MANY CRC ERRORS ON DATA FOR THIS SECTION \n"); |
714 |
|
printf(" THEY WILL NOT BE DISPLAYED HERE ANYMORE FOR THIS FILE! \n"); |
715 |
|
}; |
716 |
|
}; |
717 |
|
if (ce->perror[k] == 133){ |
718 |
|
ver[k][12]++ ; |
719 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
720 |
|
printf(" length problems in RAW mode \n"); |
721 |
|
}; |
722 |
|
if (ce->perror[k] == 134){ |
723 |
|
ver[k][13]++ ; |
724 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
725 |
|
printf(" length problems in COMPRESS mode \n"); |
726 |
|
}; |
727 |
|
if (ce->perror[k] == 135){ |
728 |
|
ver[k][14]++ ; |
729 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
730 |
|
printf(" length problems in FULL mode \n"); |
731 |
|
}; |
732 |
|
if (ce->perror[k] == 136){ |
733 |
|
ver[k][15]++ ; |
734 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
735 |
|
printf(" acquisition mode problems \n"); |
736 |
|
}; |
737 |
|
if (ce->perror[k] == 139){ |
738 |
|
ver[k][18]++ ; |
739 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
740 |
|
printf(" problems with coding\n"); |
741 |
|
}; |
742 |
|
if (ce->perror[k] == 140){ |
743 |
|
ver[k][19]++ ; |
744 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
745 |
|
printf(" pedestal checksum wrong\n"); |
746 |
|
}; |
747 |
|
if (ce->perror[k] == 141){ |
748 |
|
ver[k][20]++ ; |
749 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
750 |
|
printf(" thresholds checksum wrong\n"); |
751 |
|
}; |
752 |
|
if (ce->perror[k] == 142){ |
753 |
|
ver[k][22]++ ; |
754 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
755 |
|
printf(" packet length is zero (YODA input error), skipped\n"); |
756 |
|
}; |
757 |
|
//aggiunto questo errore |
758 |
|
if (ce->perror[k] == 143){ |
759 |
|
ver[k][23]++ ; |
760 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
761 |
|
printf(" corrupted packet lenght \n"); |
762 |
|
}; |
763 |
}; |
}; |
764 |
for (Int_t kk = 0; kk < 11 ; kk++ ){ |
for (Int_t kk = 0; kk < 11 ; kk++ ){ |
765 |
tshit += shit[k][kk]; |
tshit += shit[k][kk]; |
769 |
if (isCOMP || isFULL){ |
if (isCOMP || isFULL){ |
770 |
Calstriphit->Fill(cshit); |
Calstriphit->Fill(cshit); |
771 |
// if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){ |
// if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){ |
772 |
if ( (cshit > 10 && cshit < 100) ){ |
// |
773 |
|
//cambiata la banda di soglia ora 5 prima era 10 |
774 |
|
// |
775 |
|
if ( (cshit > 5 && cshit < 100) ){ |
776 |
incshit++; |
incshit++; |
777 |
} else { |
} else { |
778 |
outcshit++; |
outcshit++; |
780 |
// |
// |
781 |
if ( tshit>0 ) h1->Fill(tshit); |
if ( tshit>0 ) h1->Fill(tshit); |
782 |
// if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){ |
// if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){ |
783 |
if ( (tshit > 10 && tshit < 100) ){ |
//cambiata la soglia ora 5 prima era 10 |
784 |
|
if ( (tshit > 5 && tshit < 100) ){ |
785 |
intshit++; |
intshit++; |
786 |
} else { |
} else { |
787 |
outtshit++; |
outtshit++; |
796 |
h1rin++; |
h1rin++; |
797 |
}; |
}; |
798 |
}; |
}; |
799 |
if ( i%1000 == 0 && i > 0 ) printf("%iK\n",i/1000); |
// if ( i%1000 == 0 && i > 0 ) printf("%iK\n",i/1000); |
800 |
i++; |
i++; |
801 |
}; |
}; |
802 |
printf("\n"); |
printf("\n"); |
803 |
|
printf("\n end processing. \n\n"); |
804 |
if ( (float)h1rout/((float)h1rin+(float)h1rout) > h1rth ){ |
if ( (float)h1rout/((float)h1rin+(float)h1rout) > h1rth ){ |
805 |
h1rcheck = true; |
h1rcheck = true; |
806 |
}; |
}; |
869 |
h1->Draw(); |
h1->Draw(); |
870 |
// |
// |
871 |
h1max = h1->GetMaximum()*1.05; |
h1max = h1->GetMaximum()*1.05; |
872 |
Double_t xc[4] = {10.,100.,100.,10.}; |
|
873 |
|
//cambiata banda prima era 10 ora 5 |
874 |
|
Double_t xc[4] = {5.,100.,100.,5.}; |
875 |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
876 |
banda1 = new TPolyLine(4,xc,yc); |
banda1 = new TPolyLine(4,xc,yc); |
877 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
921 |
h1->SetYTitle("Number of events"); |
h1->SetYTitle("Number of events"); |
922 |
h1->Draw(); |
h1->Draw(); |
923 |
h1max = h1->GetMaximum()*1.05; |
h1max = h1->GetMaximum()*1.05; |
924 |
Double_t xe[4] = {10.,100.,100.,10.}; |
//cambiato banda, prima era 10,ora 5 |
925 |
|
Double_t xe[4] = {5.,100.,100.,5.}; |
926 |
Double_t ye[4] = {0.,0.,h1max,h1max}; |
Double_t ye[4] = {0.,0.,h1max,h1max}; |
927 |
banda1 = new TPolyLine(4,xe,ye); |
banda1 = new TPolyLine(4,xe,ye); |
928 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
1108 |
Baseline->SetYTitle("Number of events"); |
Baseline->SetYTitle("Number of events"); |
1109 |
Baseline->Draw(); |
Baseline->Draw(); |
1110 |
h1max = Baseline->GetMaximum()*1.05; |
h1max = Baseline->GetMaximum()*1.05; |
1111 |
Double_t xc[4] = {2000.,4500.,4500.,2000.}; |
Double_t xc[4] = {2000.,5500.,5500.,2000.}; |
1112 |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
1113 |
banda1 = new TPolyLine(4,xc,yc); |
banda1 = new TPolyLine(4,xc,yc); |
1114 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
1145 |
Calstriphit->SetYTitle("Number of events"); |
Calstriphit->SetYTitle("Number of events"); |
1146 |
Calstriphit->Draw(); |
Calstriphit->Draw(); |
1147 |
h1max = Calstriphit->GetMaximum()*1.05; |
h1max = Calstriphit->GetMaximum()*1.05; |
1148 |
Double_t xg[4] = {10.,100.,100.,10.}; |
|
1149 |
|
//banda di sogla portata a 5, prima era a 10 |
1150 |
|
Double_t xg[4] = {5.,100.,100.,5.}; |
1151 |
Double_t yg[4] = {0.,0.,h1max,h1max}; |
Double_t yg[4] = {0.,0.,h1max,h1max}; |
1152 |
banda1 = new TPolyLine(4,xg,yg); |
banda1 = new TPolyLine(4,xg,yg); |
1153 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
1354 |
pad2->Draw(); |
pad2->Draw(); |
1355 |
pad3->Draw(); |
pad3->Draw(); |
1356 |
pad4->Draw(); |
pad4->Draw(); |
1357 |
|
// |
1358 |
|
Bool_t redevent = true; |
1359 |
|
// |
1360 |
|
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] ){ |
1361 |
|
redevent = false; |
1362 |
|
}; |
1363 |
|
if ( redevent ) check = true; |
1364 |
|
// |
1365 |
for (Int_t i = 0; i < 4; i++){ |
for (Int_t i = 0; i < 4; i++){ |
1366 |
if (i == 2) |
if (i == 2) |
1367 |
{ |
{ |
1389 |
t->SetTextAlign(12); |
t->SetTextAlign(12); |
1390 |
t->DrawLatex(33.,97.,sezione); |
t->DrawLatex(33.,97.,sezione); |
1391 |
t->SetTextSize(0.05); |
t->SetTextSize(0.05); |
1392 |
for (Int_t j = 0; j < 23; j++){ |
//aggiunto un errore jmax=23 |
1393 |
|
for (Int_t j = 0; j < 24; j++){ |
1394 |
if ( ver[i][j] || lver[i][j] ) { |
if ( ver[i][j] || lver[i][j] ) { |
1395 |
t->SetTextColor(50); |
t->SetTextColor(50); |
1396 |
if (j == 0) { |
if (j == 0) { |
1449 |
errore.str(""); |
errore.str(""); |
1450 |
errore << "RAW mode: " << ver[i][j]; |
errore << "RAW mode: " << ver[i][j]; |
1451 |
errore << " time(s)"; |
errore << " time(s)"; |
1452 |
t->SetTextColor(32); |
if ( !redevent ) t->SetTextColor(32); |
1453 |
t->DrawLatex(2.,90.,errore.str().c_str()); |
t->DrawLatex(2.,90.,errore.str().c_str()); |
1454 |
} |
} |
1455 |
if (j == 4) { |
if (j == 4) { |
1492 |
errore << "Calevnum jump: " << ver[i][j]; |
errore << "Calevnum jump: " << ver[i][j]; |
1493 |
errore << " time(s)"; |
errore << " time(s)"; |
1494 |
t->DrawLatex(2.,42.,errore.str().c_str()); |
t->DrawLatex(2.,42.,errore.str().c_str()); |
1495 |
check = true; |
if ( ver[i][j] > 3 ) check = true; |
1496 |
} |
} |
1497 |
if (j == 11) { |
if (j == 11) { |
1498 |
errore.str(""); |
errore.str(""); |
1533 |
errore.str(""); |
errore.str(""); |
1534 |
errore << "COMPRESS mode: " << ver[i][j]; |
errore << "COMPRESS mode: " << ver[i][j]; |
1535 |
errore << " time(s)"; |
errore << " time(s)"; |
1536 |
t->SetTextColor(32); |
if ( !redevent ) t->SetTextColor(32); |
1537 |
t->DrawLatex(2.,86.,errore.str().c_str()); |
t->DrawLatex(2.,86.,errore.str().c_str()); |
1538 |
} |
} |
1539 |
if (j == 17) { |
if (j == 17) { |
1540 |
errore.str(""); |
errore.str(""); |
1541 |
errore << "FULL mode: " << ver[i][j]; |
errore << "FULL mode: " << ver[i][j]; |
1542 |
errore << " time(s)"; |
errore << " time(s)"; |
1543 |
t->SetTextColor(32); |
if ( !redevent ) t->SetTextColor(32); |
1544 |
t->DrawLatex(2.,82.,errore.str().c_str()); |
t->DrawLatex(2.,82.,errore.str().c_str()); |
1545 |
} |
} |
1546 |
if (j == 18) { |
if (j == 18) { |
1578 |
t->DrawLatex(2.,3.,errore.str().c_str()); |
t->DrawLatex(2.,3.,errore.str().c_str()); |
1579 |
check = true; |
check = true; |
1580 |
}; |
}; |
1581 |
}; |
//aggiunto questo errore |
1582 |
}; |
if (j == 23) { |
1583 |
|
errore.str(""); |
1584 |
|
errore << "Corrupted packet lenght " << ver[i][j]; |
1585 |
|
errore << " time(s) "; |
1586 |
|
t->DrawLatex(2.,2.,errore.str().c_str()); |
1587 |
|
check = true; |
1588 |
|
}; |
1589 |
|
}; |
1590 |
|
}; |
1591 |
t->SetTextColor(50); |
t->SetTextColor(50); |
1592 |
if ( fulldiff[i] !=0 ) { |
if ( fulldiff[i] !=0 ) { |
1593 |
check = true; |
check = true; |
1614 |
if ( check ){ |
if ( check ){ |
1615 |
t->SetTextColor(50); |
t->SetTextColor(50); |
1616 |
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); |
|
1617 |
} else { |
} else { |
1618 |
t->SetTextColor(32); |
t->SetTextColor(32); |
1619 |
t->DrawLatex(60.,95.," OK! "); |
t->DrawLatex(60.,95.," OK! "); |
1620 |
}; |
}; |
1621 |
|
printf("cdexyc %f cdexy %f ctshit %f cbase %f \n",cdexyc,cdexy,ctshit,cbase); |
1622 |
// |
// |
1623 |
// const string fil = (const char*)filename; |
// const string fil = (const char*)filename; |
1624 |
// Int_t posiz = fil.find("dw_"); |
// Int_t posiz = fil.find("dw_"); |
1701 |
}; |
}; |
1702 |
}; |
}; |
1703 |
} |
} |
|
|
|