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.09 (2006-05-29) |
// FCaloQLOOK.c version 1.13 (2006-09-28) |
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.12 - 1.13 (2006-09-28): Give wrong number of events in compress mode, fixed. |
11 |
|
// |
12 |
|
// 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. |
13 |
|
// |
14 |
|
// 1.09 - 1.11 (2006-07-17): Adapted to flight conditions. |
15 |
|
// |
16 |
// 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. |
17 |
// |
// |
18 |
// 1.06 - 1.07 (2006-05-23): Don't print warning in case of latchup not recognized from the status word, fixed. Added "expert" figures from 21 to 28 which appears only in the |
// 1.06 - 1.07 (2006-05-23): Don't print warning in case of latchup not recognized from the status word, fixed. Added "expert" figures from 21 to 28 which appears only in the |
47 |
#include <TPolyLine.h> |
#include <TPolyLine.h> |
48 |
#include <TStyle.h> |
#include <TStyle.h> |
49 |
#include <TSystem.h> |
#include <TSystem.h> |
50 |
|
#include <TApplication.h> |
51 |
// |
// |
52 |
#include <PamelaRun.h> |
#include <PamelaRun.h> |
53 |
#include <physics/calorimeter/CalorimeterEvent.h> |
#include <physics/calorimeter/CalorimeterEvent.h> |
90 |
return file2; |
return file2; |
91 |
} |
} |
92 |
|
|
93 |
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){ |
94 |
|
if ( !evdone ){ |
95 |
|
printf("\n\n=================================================\n"); |
96 |
|
printf("PSCU-Pkt N. %u - OBT %u ms\n",pkt_num,obt); |
97 |
|
printf("Total events %u\n",totev); |
98 |
|
printf("(ROOT-tree entry %u )\n",entry); |
99 |
|
printf("=================================================\n"); |
100 |
|
evdone = true; |
101 |
|
}; |
102 |
|
TString sec = "UNKNOWN"; |
103 |
|
if ( section == 0 ) sec = "XE"; |
104 |
|
if ( section == 1 ) sec = "XO"; |
105 |
|
if ( section == 2 ) sec = "YE"; |
106 |
|
if ( section == 3 ) sec = "YO"; |
107 |
|
printf(" Section %s (DSP n. %i) message: ",sec.Data(),section); |
108 |
|
}; |
109 |
|
|
110 |
|
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){ |
111 |
gStyle->SetPaperSize(19.,25.); |
gStyle->SetPaperSize(19.,25.); |
112 |
const char* startingdir = gSystem->WorkingDirectory(); |
const char* startingdir = gSystem->WorkingDirectory(); |
113 |
// printf(" basename is %s \n",gSystem->BaseName(filename.Data())); |
// printf(" basename is %s \n",gSystem->BaseName(filename.Data())); |
114 |
// printf(" getfilename is %s \n",getFilename(filename).Data()); |
// printf(" getfilename is %s \n",getFilename(filename).Data()); |
115 |
if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; |
if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; |
116 |
// |
// |
117 |
|
TApplication *app = 0; |
118 |
|
if ( iactive ) app = new TApplication("app",0,0); |
119 |
// |
// |
120 |
ifstream myfile; |
ifstream myfile; |
121 |
myfile.open(filename.Data()); |
myfile.open(filename.Data()); |
138 |
Float_t ctshitthr = 0.65; |
Float_t ctshitthr = 0.65; |
139 |
Float_t cbasethr = 0.95; |
Float_t cbasethr = 0.95; |
140 |
Float_t cdexythr = 0.995; |
Float_t cdexythr = 0.995; |
141 |
|
//Float_t cdexythr = 0.90; |
142 |
Float_t cdexycthr = 0.95; |
Float_t cdexycthr = 0.95; |
143 |
|
Float_t h1rth = 0.90; |
144 |
|
Int_t calevnth = 13; |
145 |
// |
// |
146 |
pamela::calorimeter::CalorimeterEvent *ce = 0; |
pamela::calorimeter::CalorimeterEvent *ce = 0; |
147 |
pamela::EventHeader *eh = 0; |
pamela::EventHeader *eh = 0; |
227 |
hdiff->SetBit(TH1F::kCanRebin); |
hdiff->SetBit(TH1F::kCanRebin); |
228 |
Baseline = new TH1F("C9","baselines",100,0,3); |
Baseline = new TH1F("C9","baselines",100,0,3); |
229 |
Baseline->SetBit(TH1F::kCanRebin); |
Baseline->SetBit(TH1F::kCanRebin); |
230 |
Dexy = new TH1F("C12","dexy",100,0.,37000.); |
Dexy = new TH1F("C12","dexy",100,0.,10000.); |
231 |
Dexyc = new TH1F("C10","dexyc",100,0,3); |
Dexy->SetBit(TH1F::kCanRebin); |
232 |
Dexyc->SetBit(TH1F::kCanRebin); |
Dexyc = new TH1F("C10","dexyc",100,-100.,37000.); |
233 |
|
// Dexyc->SetBit(TH1F::kCanRebin); |
234 |
Calstriphit = new TH1F("C11","calstriphit[1:4]",100,0.,200.); |
Calstriphit = new TH1F("C11","calstriphit[1:4]",100,0.,200.); |
235 |
|
|
236 |
calev01 = new TH1F("C3","|calevnum(1)-calevnum(2)|",100,0,1); |
calev01 = new TH1F("C3","|calevnum(1)-calevnum(2)|",100,0,1); |
306 |
Int_t pdone, bdone; |
Int_t pdone, bdone; |
307 |
pdone = 0; |
pdone = 0; |
308 |
bdone = 0; |
bdone = 0; |
309 |
bool isCOMP = 0; |
bool isCOMP = false; |
310 |
bool isFULL = 0; |
bool isFULL = false; |
311 |
bool isRAW = 0; |
bool isRAW = false; |
312 |
Int_t alldexy=0; |
Int_t alldexy=0; |
313 |
Int_t alldexy2=0; |
Int_t alldexy2=0; |
314 |
Int_t planebases=0; |
Int_t planebases=0; |
327 |
fulldiff[1] = 0; |
fulldiff[1] = 0; |
328 |
fulldiff[2] = 0; |
fulldiff[2] = 0; |
329 |
fulldiff[3] = 0; |
fulldiff[3] = 0; |
330 |
printf("\n Processed events: \n\n"); |
// printf("\n Processed events: \n\n"); |
331 |
|
printf("\n Start processing: \n\n"); |
332 |
unsigned short int calev0=0; |
unsigned short int calev0=0; |
333 |
unsigned short int oldcalev0; |
unsigned short int oldcalev0; |
334 |
unsigned short int calev1=0; |
unsigned short int calev1=0; |
338 |
unsigned short int calev3=0; |
unsigned short int calev3=0; |
339 |
unsigned short int oldcalev3; |
unsigned short int oldcalev3; |
340 |
Int_t i = minevent; |
Int_t i = minevent; |
341 |
Float_t headc = 0.; |
UInt_t headc = 0; |
342 |
Float_t headco = 0.; |
UInt_t headco = 0; |
343 |
Bool_t h1rcheck = false; |
Bool_t h1rcheck = false; |
344 |
|
Int_t h1rin = 0; |
345 |
|
Int_t h1rout = 0; |
346 |
Int_t intshit = 0; |
Int_t intshit = 0; |
347 |
Int_t outtshit = 0; |
Int_t outtshit = 0; |
348 |
Int_t incshit = 0; |
Int_t incshit = 0; |
353 |
Int_t outdexy = 0; |
Int_t outdexy = 0; |
354 |
Int_t indexyc = 0; |
Int_t indexyc = 0; |
355 |
Int_t outdexyc = 0; |
Int_t outdexyc = 0; |
356 |
Int_t obt = 0; |
UInt_t obt = 0; |
357 |
Int_t minobt[4]; |
UInt_t minobt[4]; |
358 |
Int_t maxobt[4]; |
UInt_t maxobt[4]; |
359 |
Int_t swminobt[4]; |
UInt_t swminobt[4]; |
360 |
Int_t swmaxobt[4]; |
UInt_t swmaxobt[4]; |
361 |
Bool_t firstobt[4]; |
Bool_t firstobt[4]; |
362 |
Bool_t swfirstobt[4]; |
Bool_t swfirstobt[4]; |
363 |
for ( Int_t i = 0; i<4; i++){ |
for ( Int_t i = 0; i<4; i++){ |
368 |
firstobt[i] = true; |
firstobt[i] = true; |
369 |
swfirstobt[i] = true; |
swfirstobt[i] = true; |
370 |
}; |
}; |
371 |
|
Bool_t evdone = false; |
372 |
|
// |
373 |
while ( i < maxevent+1){ |
while ( i < maxevent+1){ |
374 |
|
evdone = false; |
375 |
tshit = 0; |
tshit = 0; |
376 |
trshit = 0; |
trshit = 0; |
377 |
tr->GetEntry(i); |
tr->GetEntry(i); |
381 |
headco = headc; |
headco = headc; |
382 |
headc = ph->GetCounter(); |
headc = ph->GetCounter(); |
383 |
obt = ph->GetOrbitalTime(); |
obt = ph->GetOrbitalTime(); |
384 |
calevn1 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])); |
if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])) ) calevn1++; |
385 |
calevn2 += (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])); |
if ( (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])) ) calevn2++; |
386 |
calevn3 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])); |
if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])) ) calevn3++; |
387 |
calev01->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[1]))); |
calev01->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[1]))); |
388 |
calev23->Fill(abs((int)(ce->calevnum[2]-ce->calevnum[3]))); |
calev23->Fill(abs((int)(ce->calevnum[2]-ce->calevnum[3]))); |
389 |
calev03->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[3]))); |
calev03->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[3]))); |
398 |
calevv2 = (int)ce->calevnum[2]; |
calevv2 = (int)ce->calevnum[2]; |
399 |
oldcalev3 = calev3; |
oldcalev3 = calev3; |
400 |
calev3 = (int)ce->calevnum[3]; |
calev3 = (int)ce->calevnum[3]; |
401 |
goto jumpprintout; |
// goto jumpprintout; |
402 |
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) ){ |
403 |
if ( i != minevent ) { |
if ( i != minevent ) { |
404 |
printf(" %f 0 Event %i: %i\n",headco,i,oldcalev0); |
// printf(" %f 0 Event %i: %i\n",headco,i,oldcalev0); |
405 |
printf(" %f 0 Event %i: %i\n",headc,i+1,calev0); |
// printf(" %f 0 Event %i: %i\n",headc,i+1,calev0); |
406 |
printf(" %f 1 Event %i: %i\n",headco,i,oldcalev1); |
// printf(" %f 1 Event %i: %i\n",headco,i,oldcalev1); |
407 |
printf(" %f 1 Event %i: %i\n",headc,i+1,calev1); |
// printf(" %f 1 Event %i: %i\n",headc,i+1,calev1); |
408 |
printf(" %f 2 Event %i: %i\n",headco,i,oldcalev2); |
// printf(" %f 2 Event %i: %i\n",headco,i,oldcalev2); |
409 |
printf(" %f 2 Event %i: %i\n",headc,i+1,calevv2); |
// printf(" %f 2 Event %i: %i\n",headc,i+1,calevv2); |
410 |
printf(" %f 3 Event %i: %i\n",headco,i,oldcalev3); |
// printf(" %f 3 Event %i: %i\n",headco,i,oldcalev3); |
411 |
printf(" %f 3 Event %i: %i\n",headc,i+1,calev3); |
// printf(" %f 3 Event %i: %i\n",headc,i+1,calev3); |
412 |
isRAW = 0; |
isRAW = 0; |
413 |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
414 |
if ( (calev0 - oldcalev0 - 1) > 0 && !isRAW && ce->perror[0] != 129 && oldcalev0 != 0) { |
if ( (calev0 - oldcalev0 - 1) > 0 && !isRAW && ce->perror[0] != 129 && oldcalev0 != 0) { |
415 |
ver[0][10]++; |
ver[0][10]++; |
416 |
|
sighandler(headc,obt,i,0,nevents,evdone); |
417 |
|
printf(" jump in the counter calev is %i oldcalev was %i \n",calev0,oldcalev0); |
418 |
}; |
}; |
419 |
isRAW = 0; |
isRAW = 0; |
420 |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
421 |
if ( (calev1 - oldcalev1 - 1) > 0 && !isRAW && ce->perror[1] != 129 && oldcalev1 != 0 ){ |
if ( (calev1 - oldcalev1 - 1) > 0 && !isRAW && ce->perror[1] != 129 && oldcalev1 != 0 ){ |
422 |
ver[1][10]++; |
ver[1][10]++; |
423 |
|
sighandler(headc,obt,i,1,nevents,evdone); |
424 |
|
printf(" jump in the counter calev is %i oldcalev was %i \n",calev1,oldcalev1); |
425 |
}; |
}; |
426 |
isRAW = 0; |
isRAW = 0; |
427 |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
428 |
if ( (calevv2 - oldcalev2 - 1) > 0 && !isRAW && ce->perror[2] != 129 && oldcalev2 != 0 ){ |
if ( (calevv2 - oldcalev2 - 1) > 0 && !isRAW && ce->perror[2] != 129 && oldcalev2 != 0 ){ |
429 |
ver[2][10]++; |
ver[2][10]++; |
430 |
|
sighandler(headc,obt,i,2,nevents,evdone); |
431 |
|
printf(" jump in the counter calev is %i oldcalev was %i \n",calevv2,oldcalev2); |
432 |
}; |
}; |
433 |
isRAW = 0; |
isRAW = 0; |
434 |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
435 |
if ( (calev3 - oldcalev3 - 1) > 0 && !isRAW && ce->perror[3] != 129 && oldcalev3 != 0 ){ |
if ( (calev3 - oldcalev3 - 1) > 0 && !isRAW && ce->perror[3] != 129 && oldcalev3 != 0 ){ |
436 |
ver[3][10]++; |
ver[3][10]++; |
437 |
|
sighandler(headc,obt,i,3,nevents,evdone); |
438 |
|
printf(" jump in the counter calev is %i oldcalev was %i \n",calev3,oldcalev3); |
439 |
}; |
}; |
440 |
} |
} |
441 |
}; |
}; |
442 |
jumpprintout: |
// jumpprintout: |
443 |
memcpy(shit, nullsh, sizeof(nullsh)); |
memcpy(shit, nullsh, sizeof(nullsh)); |
444 |
memcpy(rshit, nullsh, sizeof(nullsh)); |
memcpy(rshit, nullsh, sizeof(nullsh)); |
445 |
for (Int_t l = 0; l < 2; l++ ){ |
for (Int_t l = 0; l < 2; l++ ){ |
463 |
se = 1; |
se = 1; |
464 |
pl = (ii-1)/2; |
pl = (ii-1)/2; |
465 |
pdone = 0; |
pdone = 0; |
466 |
}; |
}; |
467 |
|
isCOMP = false; |
468 |
isCOMP = 0; |
isFULL = false; |
469 |
isFULL = 0; |
isRAW = false; |
470 |
isRAW = 0; |
if ( ce->stwerr[se] & (1 << 16) ) isCOMP = true; |
471 |
if ( ce->stwerr[se] & (1 << 16) ) isCOMP = 1; |
if ( ce->stwerr[se] & (1 << 17) ) isFULL = true; |
472 |
if ( ce->stwerr[se] & (1 << 17) ) isFULL = 1; |
if ( ce->stwerr[se] & (1 << 3) ) isRAW = true; |
|
if ( ce->stwerr[se] & (1 << 3) ) isRAW = 1; |
|
473 |
bl = -1; |
bl = -1; |
474 |
for (Int_t kk = 0; kk < 96 ; kk++ ){ |
for (Int_t kk = 0; kk < 96 ; kk++ ){ |
475 |
if ( kk%16 == 0 ){ |
if ( kk%16 == 0 ){ |
511 |
if ( obt > maxobt[se] ) maxobt[se] = obt; |
if ( obt > maxobt[se] ) maxobt[se] = obt; |
512 |
}; |
}; |
513 |
lver[se][2]++ ; |
lver[se][2]++ ; |
514 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
515 |
|
printf(" latch up (data) in DSP mode alldexy %i planebases %i \n",alldexy,planebases); |
516 |
}; |
}; |
517 |
} |
} |
518 |
// |
// |
556 |
indexyc++; |
indexyc++; |
557 |
}; |
}; |
558 |
// |
// |
559 |
if (ce->dexyc[l][ii][kk] < 0 ) ver[se][21]++ ; |
if (ce->dexyc[l][ii][kk] < 0 ){ |
560 |
|
ver[se][21]++ ; |
561 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
562 |
|
printf(" negative ADC values!! ce->dexyc[%i][%i][%i] = %f \n",l,ii,kk,ce->dexyc[l][ii][kk]); |
563 |
|
}; |
564 |
// |
// |
565 |
if ( allbase == 0. || allbase > 32000.) { |
if ( allbase == 0. || allbase > 32000.) { |
566 |
fcheck = 0; |
fcheck = 0; |
586 |
if ( obt > maxobt[se] ) maxobt[se] = obt; |
if ( obt > maxobt[se] ) maxobt[se] = obt; |
587 |
}; |
}; |
588 |
lver[se][2]++ ; |
lver[se][2]++ ; |
589 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
590 |
|
printf(" latch up (data) in RAW mode alldexy2 %i \n",alldexy2); |
591 |
}; |
}; |
592 |
}; |
}; |
593 |
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 ) { |
606 |
}; |
}; |
607 |
cshit = 0; |
cshit = 0; |
608 |
for (Int_t k = 0; k < 4 ; k++ ){ |
for (Int_t k = 0; k < 4 ; k++ ){ |
609 |
isCOMP = 0; |
isCOMP = false; |
610 |
isFULL = 0; |
isFULL = false; |
611 |
if ( ce->stwerr[se] & (1 << 16) ) isCOMP = 1; |
cestw=0; |
612 |
if ( ce->stwerr[se] & (1 << 17) ) isFULL = 1; |
if ( ce->stwerr[k] ) cestw = ce->stwerr[k] & cmask ; |
613 |
|
if ( ce->stwerr[k] & (1 << 16) && !(cestw & (1 << 3)) ) isCOMP = true; |
614 |
|
if ( ce->stwerr[k] & (1 << 17) && !(cestw & (1 << 3)) ) isFULL = true; |
615 |
|
// |
616 |
if ( isCOMP ) ver[k][16]++; |
if ( isCOMP ) ver[k][16]++; |
617 |
if ( isFULL ) ver[k][17]++; |
if ( isFULL ) ver[k][17]++; |
618 |
cshit += (int)ce->calstriphit[k]; |
cshit += (int)ce->calstriphit[k]; |
|
cestw=0; |
|
|
if ( ce->stwerr[k] ) cestw = ce->stwerr[k] & cmask ; |
|
619 |
if ( cestw ){ |
if ( cestw ){ |
620 |
if ( cestw & (1 << 0) ) ver[k][6]++ ; |
if ( cestw & (1 << 0) ){ |
621 |
if ( cestw & (1 << 1) ) ver[k][5]++ ; |
ver[k][6]++ ; |
622 |
if ( cestw & (1 << 2) ) ver[k][4]++ ; |
sighandler(headc,obt,i,k,nevents,evdone); |
623 |
if ( cestw & (1 << 3) ) ver[k][3]++ ; |
printf(" CRC error (st. word) \n"); |
624 |
|
}; |
625 |
|
if ( cestw & (1 << 1) ){ |
626 |
|
ver[k][5]++ ; |
627 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
628 |
|
printf(" execution error \n"); |
629 |
|
}; |
630 |
|
if ( cestw & (1 << 2) ){ |
631 |
|
ver[k][4]++ ; |
632 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
633 |
|
printf(" CMD length error \n"); |
634 |
|
}; |
635 |
|
if ( cestw & (1 << 3) ) ver[k][3]++ ; // raw mode |
636 |
if ( cestw & (1 << 4) ){ |
if ( cestw & (1 << 4) ){ |
637 |
ver[k][2]++ ; |
ver[k][2]++ ; |
638 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
639 |
|
printf(" latch up alarm (st. word)\n"); |
640 |
lupstw[k]->Fill(obt); |
lupstw[k]->Fill(obt); |
641 |
if ( swfirstobt[k] ) swminobt[k] = obt; |
if ( swfirstobt[k] ) swminobt[k] = obt; |
642 |
if ( obt > swmaxobt[k] ) swmaxobt[k] = obt; |
if ( obt > swmaxobt[k] ) swmaxobt[k] = obt; |
643 |
}; |
}; |
644 |
if ( cestw & (1 << 5) ) ver[k][1]++ ; |
if ( cestw & (1 << 5) ){ |
645 |
if ( cestw & (1 << 6) ) ver[k][0]++ ; |
ver[k][1]++ ; |
646 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
647 |
|
printf(" temperature alarm \n"); |
648 |
|
}; |
649 |
|
if ( cestw & (1 << 6) ){ |
650 |
|
ver[k][0]++ ; |
651 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
652 |
|
printf(" DSP ack error \n"); |
653 |
|
}; |
654 |
}; |
}; |
655 |
|
if ( ce->stwerr[k] == 0 && ce->perror[k] == 0 ) ver[k][8]++ ; |
656 |
if ( ce->perror[k] != 0. ){ |
if ( ce->perror[k] != 0. ){ |
657 |
if (ce->perror[k] == 128) ver[k][7]++ ; |
if (ce->perror[k] == 128){ |
658 |
if (ce->perror[k] == 129) ver[k][8]++ ; |
ver[k][7]++ ; |
659 |
if (ce->perror[k] == 132) ver[k][11]++ ; |
sighandler(headc,obt,i,k,nevents,evdone); |
660 |
if (ce->perror[k] == 133) ver[k][12]++ ; |
printf(" view or command not recognized \n"); |
661 |
if (ce->perror[k] == 134) ver[k][13]++ ; |
}; |
662 |
if (ce->perror[k] == 135) ver[k][14]++ ; |
if (ce->perror[k] == 129){ |
663 |
if (ce->perror[k] == 136) ver[k][15]++ ; |
ver[k][8]++ ; |
664 |
if (ce->perror[k] == 139) ver[k][18]++ ; |
sighandler(headc,obt,i,k,nevents,evdone); |
665 |
if (ce->perror[k] == 140) ver[k][19]++ ; |
printf(" missing section \n"); |
666 |
if (ce->perror[k] == 141) ver[k][20]++ ; |
}; |
667 |
if (ce->perror[k] == 142) ver[k][22]++ ; |
if (ce->perror[k] == 132){ |
668 |
|
ver[k][11]++ ; |
669 |
|
if ( ver[k][11] < 30 ){ |
670 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
671 |
|
printf(" CRC error (data) \n"); |
672 |
|
}; |
673 |
|
if ( ver[k][11] == 30 ){ |
674 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
675 |
|
printf(" CRC error (data) \n"); |
676 |
|
printf(" WARNING TOO MANY CRC ERRORS ON DATA FOR THIS SECTION \n"); |
677 |
|
printf(" THEY WILL NOT BE DISPLAYED HERE ANYMORE FOR THIS FILE! \n"); |
678 |
|
}; |
679 |
|
}; |
680 |
|
if (ce->perror[k] == 133){ |
681 |
|
ver[k][12]++ ; |
682 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
683 |
|
printf(" length problems in RAW mode \n"); |
684 |
|
}; |
685 |
|
if (ce->perror[k] == 134){ |
686 |
|
ver[k][13]++ ; |
687 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
688 |
|
printf(" length problems in COMPRESS mode \n"); |
689 |
|
}; |
690 |
|
if (ce->perror[k] == 135){ |
691 |
|
ver[k][14]++ ; |
692 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
693 |
|
printf(" length problems in FULL mode \n"); |
694 |
|
}; |
695 |
|
if (ce->perror[k] == 136){ |
696 |
|
ver[k][15]++ ; |
697 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
698 |
|
printf(" acquisition mode problems \n"); |
699 |
|
}; |
700 |
|
if (ce->perror[k] == 139){ |
701 |
|
ver[k][18]++ ; |
702 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
703 |
|
printf(" problems with coding\n"); |
704 |
|
}; |
705 |
|
if (ce->perror[k] == 140){ |
706 |
|
ver[k][19]++ ; |
707 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
708 |
|
printf(" pedestal checksum wrong\n"); |
709 |
|
}; |
710 |
|
if (ce->perror[k] == 141){ |
711 |
|
ver[k][20]++ ; |
712 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
713 |
|
printf(" thresholds checksum wrong\n"); |
714 |
|
}; |
715 |
|
if (ce->perror[k] == 142){ |
716 |
|
ver[k][22]++ ; |
717 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
718 |
|
printf(" packet length is zero (YODA input error), skipped\n"); |
719 |
|
}; |
720 |
}; |
}; |
721 |
for (Int_t kk = 0; kk < 11 ; kk++ ){ |
for (Int_t kk = 0; kk < 11 ; kk++ ){ |
722 |
tshit += shit[k][kk]; |
tshit += shit[k][kk]; |
723 |
trshit += rshit[k][kk]; |
trshit += rshit[k][kk]; |
724 |
}; |
}; |
725 |
}; |
}; |
726 |
Calstriphit->Fill(cshit); |
if (isCOMP || isFULL){ |
727 |
if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){ |
Calstriphit->Fill(cshit); |
728 |
incshit++; |
// if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){ |
729 |
} else { |
if ( (cshit > 10 && cshit < 100) ){ |
730 |
outcshit++; |
incshit++; |
731 |
}; |
} else { |
732 |
if ( tshit>0 ) h1->Fill(tshit); |
outcshit++; |
733 |
if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){ |
}; |
734 |
intshit++; |
// |
735 |
} else { |
if ( tshit>0 ) h1->Fill(tshit); |
736 |
outtshit++; |
// if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){ |
737 |
|
if ( (tshit > 10 && tshit < 100) ){ |
738 |
|
intshit++; |
739 |
|
} else { |
740 |
|
outtshit++; |
741 |
|
}; |
742 |
}; |
}; |
743 |
if ( trshit>0 ) { |
if ( trshit>0 ) { |
744 |
h1r->Fill(trshit); |
h1r->Fill(trshit); |
745 |
if ( trshit < 4210 ){ |
if ( trshit < 4210 ){ |
746 |
h1rcheck = true; |
h1rout++; |
747 |
// printf("ma come... trshit %i \n",trshit); |
// printf("ma come... trshit %i \n",trshit); |
748 |
|
} else { |
749 |
|
h1rin++; |
750 |
}; |
}; |
751 |
}; |
}; |
752 |
if ( i%1000 == 0 && i > 0 ) printf("%iK\n",i/1000); |
// if ( i%1000 == 0 && i > 0 ) printf("%iK\n",i/1000); |
753 |
i++; |
i++; |
754 |
}; |
}; |
755 |
printf("\n"); |
printf("\n"); |
756 |
|
printf("\n end processing. \n\n"); |
757 |
|
if ( (float)h1rout/((float)h1rin+(float)h1rout) > h1rth ){ |
758 |
|
h1rcheck = true; |
759 |
|
}; |
760 |
// |
// |
761 |
// output figures, first sheet: |
// output figures, first sheet: |
762 |
// |
// |
822 |
h1->Draw(); |
h1->Draw(); |
823 |
// |
// |
824 |
h1max = h1->GetMaximum()*1.05; |
h1max = h1->GetMaximum()*1.05; |
825 |
Double_t xc[4] = {0.,25.,25.,0.}; |
Double_t xc[4] = {10.,100.,100.,10.}; |
826 |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
827 |
banda1 = new TPolyLine(4,xc,yc); |
banda1 = new TPolyLine(4,xc,yc); |
828 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
829 |
banda1->SetFillColor(5); |
banda1->SetFillColor(5); |
830 |
banda1->SetLineWidth(1); |
banda1->SetLineWidth(1); |
831 |
banda1->Draw("fSAME"); |
banda1->Draw("fSAME"); |
832 |
Double_t xd[4] = {40.,80.,80.,40.}; |
// Double_t xd[4] = {40.,80.,80.,40.}; |
833 |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
// Double_t yd[4] = {0.,0.,h1max,h1max}; |
834 |
banda2 = new TPolyLine(4,xd,yd); |
// banda2 = new TPolyLine(4,xd,yd); |
835 |
banda2->SetLineColor(5); |
// banda2->SetLineColor(5); |
836 |
banda2->SetFillColor(5); |
// banda2->SetFillColor(5); |
837 |
banda2->SetLineWidth(1); |
// banda2->SetLineWidth(1); |
838 |
banda2->Draw("fSAME"); |
//banda2->Draw("fSAME"); |
839 |
h1->Draw("SAME"); |
h1->Draw("SAME"); |
840 |
// |
// |
841 |
figura->cd(); |
figura->cd(); |
872 |
h1->SetYTitle("Number of events"); |
h1->SetYTitle("Number of events"); |
873 |
h1->Draw(); |
h1->Draw(); |
874 |
h1max = h1->GetMaximum()*1.05; |
h1max = h1->GetMaximum()*1.05; |
875 |
Double_t xe[4] = {0.,25.,25.,0.}; |
Double_t xe[4] = {10.,100.,100.,10.}; |
876 |
Double_t ye[4] = {0.,0.,h1max,h1max}; |
Double_t ye[4] = {0.,0.,h1max,h1max}; |
877 |
banda1 = new TPolyLine(4,xe,ye); |
banda1 = new TPolyLine(4,xe,ye); |
878 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
879 |
banda1->SetFillColor(5); |
banda1->SetFillColor(5); |
880 |
banda1->SetLineWidth(1); |
banda1->SetLineWidth(1); |
881 |
banda1->Draw("fSAME"); |
banda1->Draw("fSAME"); |
882 |
Double_t xf[4] = {40.,80.,80.,40.}; |
// Double_t xf[4] = {40.,80.,80.,40.}; |
883 |
Double_t yf[4] = {0.,0.,h1max,h1max}; |
// Double_t yf[4] = {0.,0.,h1max,h1max}; |
884 |
banda2 = new TPolyLine(4,xf,yf); |
// banda2 = new TPolyLine(4,xf,yf); |
885 |
banda2->SetLineColor(5); |
// banda2->SetLineColor(5); |
886 |
banda2->SetFillColor(5); |
// banda2->SetFillColor(5); |
887 |
banda2->SetLineWidth(1); |
// banda2->SetLineWidth(1); |
888 |
banda2->Draw("fSAME"); |
// banda2->Draw("fSAME"); |
889 |
h1->Draw("SAME"); |
h1->Draw("SAME"); |
890 |
}; |
}; |
891 |
if ( trshit !=0 ) { |
if ( trshit !=0 ) { |
915 |
}; |
}; |
916 |
}; |
}; |
917 |
if ( !errorfull ) { |
if ( !errorfull ) { |
918 |
if ( calevn1 || calevn2 || calevn3 ) { |
if ( calevn1 > calevnth || calevn2 > calevnth || calevn3 > calevnth ) { |
919 |
pd1 = new TPad("pd1","This is pad1",0.02,0.51,0.24,0.98,45); |
pd1 = new TPad("pd1","This is pad1",0.02,0.51,0.24,0.98,45); |
920 |
pd2 = new TPad("pd2","This is pad2",0.26,0.51,0.49,0.98,45); |
pd2 = new TPad("pd2","This is pad2",0.26,0.51,0.49,0.98,45); |
921 |
pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.24,0.49,45); |
pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.24,0.49,45); |
1090 |
Dexyc->Draw("SAME"); |
Dexyc->Draw("SAME"); |
1091 |
// |
// |
1092 |
pd3->cd(); |
pd3->cd(); |
1093 |
|
// gPad->SetLogy(); |
1094 |
Calstriphit->SetXTitle("Number of hit"); |
Calstriphit->SetXTitle("Number of hit"); |
1095 |
Calstriphit->SetYTitle("Number of events"); |
Calstriphit->SetYTitle("Number of events"); |
1096 |
Calstriphit->Draw(); |
Calstriphit->Draw(); |
1097 |
h1max = Calstriphit->GetMaximum()*1.05; |
h1max = Calstriphit->GetMaximum()*1.05; |
1098 |
Double_t xg[4] = {0.,25.,25.,0.}; |
Double_t xg[4] = {10.,100.,100.,10.}; |
1099 |
Double_t yg[4] = {0.,0.,h1max,h1max}; |
Double_t yg[4] = {0.,0.,h1max,h1max}; |
1100 |
banda1 = new TPolyLine(4,xg,yg); |
banda1 = new TPolyLine(4,xg,yg); |
1101 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
1102 |
banda1->SetFillColor(5); |
banda1->SetFillColor(5); |
1103 |
banda1->SetLineWidth(1); |
banda1->SetLineWidth(1); |
1104 |
banda1->Draw("fSAME"); |
banda1->Draw("fSAME"); |
1105 |
Double_t xh[4] = {40.,80.,80.,40.}; |
// Double_t xh[4] = {40.,80.,80.,40.}; |
1106 |
Double_t yh[4] = {0.,0.,h1max,h1max}; |
// Double_t yh[4] = {0.,0.,h1max,h1max}; |
1107 |
banda2 = new TPolyLine(4,xh,yh); |
// banda2 = new TPolyLine(4,xh,yh); |
1108 |
banda2->SetLineColor(5); |
// banda2->SetLineColor(5); |
1109 |
banda2->SetFillColor(5); |
// banda2->SetFillColor(5); |
1110 |
banda2->SetLineWidth(1); |
// banda2->SetLineWidth(1); |
1111 |
banda2->Draw("fSAME"); |
// banda2->Draw("fSAME"); |
1112 |
Calstriphit->Draw("SAME"); |
Calstriphit->Draw("SAME"); |
1113 |
// |
// |
1114 |
pd4->cd(); |
pd4->cd(); |
1115 |
|
gPad->SetLogy(); |
1116 |
Dexy->SetXTitle("ADC channels"); |
Dexy->SetXTitle("ADC channels"); |
1117 |
Dexy->SetYTitle("Number of events"); |
Dexy->SetYTitle("Number of events"); |
1118 |
Dexy->Draw(); |
Dexy->Draw(); |
1119 |
h1max = Dexy->GetMaximum()*1.05; |
// h1max = Dexy->GetMaximum()*1.05; |
1120 |
|
h1max = Dexy->GetMaximum()*2.05; |
1121 |
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
1122 |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
1123 |
banda1 = new TPolyLine(4,xd,yd); |
banda1 = new TPolyLine(4,xd,yd); |
1153 |
pd4->Draw(); |
pd4->Draw(); |
1154 |
// |
// |
1155 |
pd4->cd(); |
pd4->cd(); |
1156 |
|
gPad->SetLogy(); |
1157 |
Dexy->SetXTitle("ADC channels"); |
Dexy->SetXTitle("ADC channels"); |
1158 |
Dexy->SetYTitle("Number of events"); |
Dexy->SetYTitle("Number of events"); |
1159 |
Dexy->Draw(); |
Dexy->Draw(); |
1160 |
h1max = Dexy->GetMaximum()*1.05; |
// h1max = Dexy->GetMaximum()*1.05; |
1161 |
|
h1max = Dexy->GetMaximum()*2.05; |
1162 |
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
1163 |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
1164 |
banda1 = new TPolyLine(4,xd,yd); |
banda1 = new TPolyLine(4,xd,yd); |
1302 |
pad2->Draw(); |
pad2->Draw(); |
1303 |
pad3->Draw(); |
pad3->Draw(); |
1304 |
pad4->Draw(); |
pad4->Draw(); |
1305 |
|
// |
1306 |
|
Bool_t redevent = true; |
1307 |
|
// |
1308 |
|
if ( ver[0][3]+ver[0][16]+ver[0][17] == ver[1][3]+ver[1][16]+ver[1][17] && ver[1][3]+ver[1][16]+ver[1][17] == ver[2][3]+ver[2][16]+ver[2][17] && ver[2][3]+ver[2][16]+ver[2][17] == ver[3][3]+ver[3][16]+ver[3][17] ){ |
1309 |
|
redevent = false; |
1310 |
|
}; |
1311 |
|
if ( redevent ) check = true; |
1312 |
|
// |
1313 |
for (Int_t i = 0; i < 4; i++){ |
for (Int_t i = 0; i < 4; i++){ |
1314 |
if (i == 2) |
if (i == 2) |
1315 |
{ |
{ |
1396 |
errore.str(""); |
errore.str(""); |
1397 |
errore << "RAW mode: " << ver[i][j]; |
errore << "RAW mode: " << ver[i][j]; |
1398 |
errore << " time(s)"; |
errore << " time(s)"; |
1399 |
t->SetTextColor(32); |
if ( !redevent ) t->SetTextColor(32); |
1400 |
t->DrawLatex(2.,90.,errore.str().c_str()); |
t->DrawLatex(2.,90.,errore.str().c_str()); |
1401 |
} |
} |
1402 |
if (j == 4) { |
if (j == 4) { |
1432 |
errore << "Missing section: " << ver[i][j]; |
errore << "Missing section: " << ver[i][j]; |
1433 |
errore << " time(s)"; |
errore << " time(s)"; |
1434 |
t->DrawLatex(2.,50.,errore.str().c_str()); |
t->DrawLatex(2.,50.,errore.str().c_str()); |
1435 |
check = true; |
if ( ver[i][j] > 3 ) check = true; |
1436 |
} |
} |
1437 |
if (j == 10) { |
if (j == 10) { |
1438 |
errore.str(""); |
errore.str(""); |
1439 |
errore << "Calevnum jump: " << ver[i][j]; |
errore << "Calevnum jump: " << ver[i][j]; |
1440 |
errore << " time(s)"; |
errore << " time(s)"; |
1441 |
t->DrawLatex(2.,42.,errore.str().c_str()); |
t->DrawLatex(2.,42.,errore.str().c_str()); |
1442 |
check = true; |
if ( ver[i][j] > 3 ) check = true; |
1443 |
} |
} |
1444 |
if (j == 11) { |
if (j == 11) { |
1445 |
errore.str(""); |
errore.str(""); |
1446 |
errore << "CRC error (data): " << ver[i][j]; |
errore << "CRC error (data): " << ver[i][j]; |
1447 |
errore << " time(s)"; |
errore << " time(s)"; |
1448 |
t->DrawLatex(2.,38.,errore.str().c_str()); |
t->DrawLatex(2.,38.,errore.str().c_str()); |
1449 |
check = true; |
if ( ver[i][j] > 10 ) check = true; |
1450 |
} |
} |
1451 |
if (j == 12) { |
if (j == 12) { |
1452 |
errore.str(""); |
errore.str(""); |
1480 |
errore.str(""); |
errore.str(""); |
1481 |
errore << "COMPRESS mode: " << ver[i][j]; |
errore << "COMPRESS mode: " << ver[i][j]; |
1482 |
errore << " time(s)"; |
errore << " time(s)"; |
1483 |
t->SetTextColor(32); |
if ( !redevent ) t->SetTextColor(32); |
1484 |
t->DrawLatex(2.,86.,errore.str().c_str()); |
t->DrawLatex(2.,86.,errore.str().c_str()); |
1485 |
} |
} |
1486 |
if (j == 17) { |
if (j == 17) { |
1487 |
errore.str(""); |
errore.str(""); |
1488 |
errore << "FULL mode: " << ver[i][j]; |
errore << "FULL mode: " << ver[i][j]; |
1489 |
errore << " time(s)"; |
errore << " time(s)"; |
1490 |
t->SetTextColor(32); |
if ( !redevent ) t->SetTextColor(32); |
1491 |
t->DrawLatex(2.,82.,errore.str().c_str()); |
t->DrawLatex(2.,82.,errore.str().c_str()); |
1492 |
} |
} |
1493 |
if (j == 18) { |
if (j == 18) { |
1633 |
figsave << format; |
figsave << format; |
1634 |
rapporto->SaveAs(figsave.str().c_str()); |
rapporto->SaveAs(figsave.str().c_str()); |
1635 |
}; |
}; |
1636 |
|
if ( iactive && w4i ){ |
1637 |
|
while ( gROOT->GetListOfCanvases()->FindObject(rapporto) || gROOT->GetListOfCanvases()->FindObject(figura3) || gROOT->GetListOfCanvases()->FindObject(figura2) || gROOT->GetListOfCanvases()->FindObject(figura) ){ |
1638 |
|
gSystem->ProcessEvents(); |
1639 |
|
gSystem->Sleep(10); |
1640 |
|
}; |
1641 |
|
}; |
1642 |
} |
} |
1643 |
|
|