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