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