36 |
// |
// |
37 |
#include <iostream> |
#include <iostream> |
38 |
#include <fstream> |
#include <fstream> |
39 |
|
#include <cstdlib> |
40 |
// |
// |
41 |
#include <TObject.h> |
#include <TObject.h> |
42 |
#include <TString.h> |
#include <TString.h> |
43 |
#include <TFile.h> |
#include <TFile.h> |
44 |
|
#include <TROOT.h> |
45 |
#include <TCanvas.h> |
#include <TCanvas.h> |
46 |
#include <TH1.h> |
#include <TH1.h> |
47 |
#include <TH1F.h> |
#include <TH1F.h> |
57 |
#include <physics/calorimeter/CalorimeterEvent.h> |
#include <physics/calorimeter/CalorimeterEvent.h> |
58 |
// |
// |
59 |
#include <FCaloQLOOKfun.h> |
#include <FCaloQLOOKfun.h> |
60 |
|
#include <sys/stat.h> |
61 |
|
#include <cstdlib> |
62 |
// |
// |
63 |
using namespace std; |
using namespace std; |
64 |
// |
// |
90 |
} else { |
} else { |
91 |
Int_t posiz2 = 0; |
Int_t posiz2 = 0; |
92 |
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
93 |
TString pdat(".dat"); |
TString pdat(".pam"); |
94 |
stringappend(file2,pdat); |
stringappend(file2,pdat); |
95 |
}; |
}; |
96 |
return file2; |
return file2; |
144 |
// |
// |
145 |
Float_t ctshitthr = 0.65; |
Float_t ctshitthr = 0.65; |
146 |
Float_t cbasethr = 0.95; |
Float_t cbasethr = 0.95; |
147 |
Float_t cdexythr = 0.995; |
// Float_t cdexythr = 0.995; |
148 |
|
Float_t cdexythr = 0.95; |
149 |
//Float_t cdexythr = 0.90; |
//Float_t cdexythr = 0.90; |
150 |
Float_t cdexycthr = 0.95; |
Float_t cdexycthr = 0.95; |
151 |
Float_t h1rth = 0.90; |
Float_t h1rth = 0.90; |
195 |
return; |
return; |
196 |
}; |
}; |
197 |
Int_t const size = nevents; |
Int_t const size = nevents; |
198 |
Double_t iev2[size+1]; |
// Double_t iev2[size+1]; |
199 |
Int_t ver[4][23], lver[4][23],shit[4][11], rshit[4][11], se,bl, pl, fulldiff[4],cshit, cpre[4],nullsh[4][11], lalarm[4]; |
//aumentata la lunghezza di ver, prima era 23 |
200 |
|
Int_t ver[4][24], lver[4][23],shit[4][11], rshit[4][11], se,bl, pl, fulldiff[4],cshit, cpre[4],nullsh[4][11], lalarm[4]; |
201 |
se = 0; |
se = 0; |
202 |
pl = 0; |
pl = 0; |
203 |
Float_t allbase = 0.; |
Float_t allbase = 0.; |
204 |
Int_t tshit, trshit, compdata,rawdata, errorfull, calevn1, calevn2, calevn3, calevn4, pshit[4][11]; |
Int_t tshit, trshit, compdata,rawdata, errorfull, calevn1, calevn2, calevn3, calevn4, pshit[4][11]; |
205 |
tshit = 0; |
tshit = 0; |
206 |
trshit = 0; |
trshit = 0; |
207 |
char *sezione; |
const char *sezione = ""; |
208 |
Bool_t check = false; |
Bool_t check = false; |
209 |
sezione = ""; |
// sezione = ""; |
210 |
stringstream errore; |
stringstream errore; |
211 |
errore.str(""); |
errore.str(""); |
212 |
// |
// |
299 |
maxevent = fromevent - 1; |
maxevent = fromevent - 1; |
300 |
}; |
}; |
301 |
}; |
}; |
302 |
|
//azzera i tipi di errore |
303 |
for (Int_t k = 0; k < 4; k++ ){ |
for (Int_t k = 0; k < 4; k++ ){ |
304 |
for (Int_t m = 0; m < 23 ; m++ ){ |
for (Int_t m = 0; m < 23 ; m++ ){ |
305 |
ver[k][m] = 0 ; |
ver[k][m] = 0 ; |
311 |
}; |
}; |
312 |
lalarm[k] = 0; |
lalarm[k] = 0; |
313 |
}; |
}; |
314 |
|
//il 23 lo azzero cosi per non modificare le altre variabili |
315 |
|
ver[k][23]=0; |
316 |
}; |
}; |
317 |
Int_t pdone, bdone; |
Int_t pdone, bdone; |
318 |
pdone = 0; |
pdone = 0; |
386 |
tshit = 0; |
tshit = 0; |
387 |
trshit = 0; |
trshit = 0; |
388 |
tr->GetEntry(i); |
tr->GetEntry(i); |
389 |
iev2[i] = ce->iev; |
|
390 |
|
// iev2[i] = ce->iev; |
391 |
// |
// |
392 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
393 |
headco = headc; |
headco = headc; |
394 |
headc = ph->GetCounter(); |
headc = ph->GetCounter(); |
395 |
obt = ph->GetOrbitalTime(); |
obt = ph->GetOrbitalTime(); |
396 |
|
|
397 |
if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])) ) calevn1++; |
if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])) ) calevn1++; |
398 |
if ( (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])) ) calevn2++; |
if ( (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])) ) calevn2++; |
399 |
if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])) ) calevn3++; |
if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])) ) calevn3++; |
450 |
sighandler(headc,obt,i,3,nevents,evdone); |
sighandler(headc,obt,i,3,nevents,evdone); |
451 |
printf(" jump in the counter calev is %i oldcalev was %i \n",calev3,oldcalev3); |
printf(" jump in the counter calev is %i oldcalev was %i \n",calev3,oldcalev3); |
452 |
}; |
}; |
453 |
} |
}; |
454 |
}; |
}; |
455 |
// jumpprintout: |
// jumpprintout: |
456 |
memcpy(shit, nullsh, sizeof(nullsh)); |
memcpy(shit, nullsh, sizeof(nullsh)); |
524 |
if ( obt > maxobt[se] ) maxobt[se] = obt; |
if ( obt > maxobt[se] ) maxobt[se] = obt; |
525 |
}; |
}; |
526 |
lver[se][2]++ ; |
lver[se][2]++ ; |
527 |
sighandler(headc,obt,i,se,nevents,evdone); |
if ( lver[se][2] == 1000 ){ |
528 |
printf(" latch up (data) in DSP mode alldexy %i planebases %i \n",alldexy,planebases); |
sighandler(headc,obt,i,se,nevents,evdone); |
529 |
|
printf(" latch up (data) in DSP mode alldexy %i planebases %i \n",alldexy,planebases); |
530 |
|
printf(" WARNING TOO MANY LATCHUP ERRORS ON DATA FOR THIS SECTION \n"); |
531 |
|
printf(" THEY WILL NOT BE DISPLAYED HERE ANYMORE FOR THIS FILE! \n"); |
532 |
|
}; |
533 |
|
if ( lver[se][2] < 1000 ){ |
534 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
535 |
|
printf(" latch up (data) in DSP mode alldexy %i planebases %i \n",alldexy,planebases); |
536 |
|
}; |
537 |
}; |
}; |
538 |
} |
} |
539 |
// |
// |
540 |
if ( !bdone ){ |
if ( !bdone ){ |
541 |
Baseline->Fill(ce->base[l][ii][bl]); |
Baseline->Fill(ce->base[l][ii][bl]); |
542 |
if ( ce->base[l][ii][bl] > 2000. && ce->base[l][ii][bl] < 4500. ){ |
if ( ce->base[l][ii][bl] > 2000. && ce->base[l][ii][bl] < 5500. ){ |
543 |
inbase++; |
inbase++; |
544 |
} else { |
} else { |
545 |
outbase++; |
outbase++; |
597 |
} else { |
} else { |
598 |
if ( !pdone ){ |
if ( !pdone ){ |
599 |
if ( ( alldexy2 > 3072000 || alldexy2 == 0) && ce->perror[se] == 0 ) { |
if ( ( alldexy2 > 3072000 || alldexy2 == 0) && ce->perror[se] == 0 ) { |
600 |
// if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) { |
// if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) |
601 |
pdone = 1; |
pdone = 1; |
602 |
pshit[se][pl]++ ; |
pshit[se][pl]++ ; |
603 |
if ( (ce->stwerr[se] & (1 << 4)) == 0 ){ |
if ( (ce->stwerr[se] & (1 << 4)) == 0 ){ |
607 |
if ( obt > maxobt[se] ) maxobt[se] = obt; |
if ( obt > maxobt[se] ) maxobt[se] = obt; |
608 |
}; |
}; |
609 |
lver[se][2]++ ; |
lver[se][2]++ ; |
610 |
sighandler(headc,obt,i,se,nevents,evdone); |
if ( lver[se][2] == 1000 ){ |
611 |
printf(" latch up (data) in RAW mode alldexy2 %i \n",alldexy2); |
sighandler(headc,obt,i,se,nevents,evdone); |
612 |
|
printf(" latch up (data) in RAW mode alldexy2 %i \n",alldexy2); |
613 |
|
printf(" WARNING TOO MANY LATCHUP ERRORS ON DATA FOR THIS SECTION \n"); |
614 |
|
printf(" THEY WILL NOT BE DISPLAYED HERE ANYMORE FOR THIS FILE! \n"); |
615 |
|
}; |
616 |
|
if ( lver[se][2] < 1000 ){ |
617 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
618 |
|
printf(" latch up (data) in RAW mode alldexy2 %i \n",alldexy2); |
619 |
|
}; |
620 |
}; |
}; |
621 |
}; |
}; |
622 |
if ( ce->dexy[l][ii][kk] > 0 && ce->dexy[l][ii][kk] < 32000 ) { |
if ( ce->dexy[l][ii][kk] > 0 && ce->dexy[l][ii][kk] < 32000 ) { |
637 |
for (Int_t k = 0; k < 4 ; k++ ){ |
for (Int_t k = 0; k < 4 ; k++ ){ |
638 |
isCOMP = false; |
isCOMP = false; |
639 |
isFULL = false; |
isFULL = false; |
640 |
cestw=0; |
cestw=0;// queste righe qui |
641 |
if ( ce->stwerr[k] ) cestw = ce->stwerr[k] & cmask ; |
if ( ce->stwerr[k] ) cestw = ce->stwerr[k] & cmask ;// |
642 |
if ( ce->stwerr[k] & (1 << 16) && !(cestw & (1 << 3)) ) isCOMP = true; |
if ( ce->stwerr[k] & (1 << 16) && !(cestw & (1 << 3)) ) isCOMP = true; |
643 |
if ( ce->stwerr[k] & (1 << 17) && !(cestw & (1 << 3)) ) isFULL = true; |
if ( ce->stwerr[k] & (1 << 17) && !(cestw & (1 << 3)) ) isFULL = true; |
644 |
// |
// |
664 |
if ( cestw & (1 << 3) ) ver[k][3]++ ; // raw mode |
if ( cestw & (1 << 3) ) ver[k][3]++ ; // raw mode |
665 |
if ( cestw & (1 << 4) ){ |
if ( cestw & (1 << 4) ){ |
666 |
ver[k][2]++ ; |
ver[k][2]++ ; |
667 |
sighandler(headc,obt,i,k,nevents,evdone); |
if ( ver[k][2] == 1000 ){ |
668 |
printf(" latch up alarm (st. word)\n"); |
sighandler(headc,obt,i,k,nevents,evdone); |
669 |
|
printf(" latch up alarm (st. word)\n"); |
670 |
|
printf(" WARNING TOO MANY LATCHUP ERRORS ON DATA FOR THIS SECTION \n"); |
671 |
|
printf(" THEY WILL NOT BE DISPLAYED HERE ANYMORE FOR THIS FILE! \n"); |
672 |
|
}; |
673 |
|
if ( ver[k][2] < 1000 ){ |
674 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
675 |
|
printf(" latch up alarm (st. word)\n"); |
676 |
|
}; |
677 |
lupstw[k]->Fill(obt); |
lupstw[k]->Fill(obt); |
678 |
if ( swfirstobt[k] ) swminobt[k] = obt; |
if ( swfirstobt[k] ) swminobt[k] = obt; |
679 |
if ( obt > swmaxobt[k] ) swmaxobt[k] = obt; |
if ( obt > swmaxobt[k] ) swmaxobt[k] = obt; |
688 |
sighandler(headc,obt,i,k,nevents,evdone); |
sighandler(headc,obt,i,k,nevents,evdone); |
689 |
printf(" DSP ack error \n"); |
printf(" DSP ack error \n"); |
690 |
}; |
}; |
691 |
}; |
};// controllo se ci sono errori crc se perr=0 ok! |
692 |
if ( ce->stwerr[k] == 0 && ce->perror[k] == 0 ) ver[k][8]++ ; |
if ( ce->stwerr[k] == 0 && ce->perror[k] == 0 ) ver[k][8]++ ; |
693 |
if ( ce->perror[k] != 0. ){ |
if ( ce->perror[k] != 0. ){ |
694 |
if (ce->perror[k] == 128){ |
if (ce->perror[k] == 128){ |
754 |
sighandler(headc,obt,i,k,nevents,evdone); |
sighandler(headc,obt,i,k,nevents,evdone); |
755 |
printf(" packet length is zero (YODA input error), skipped\n"); |
printf(" packet length is zero (YODA input error), skipped\n"); |
756 |
}; |
}; |
757 |
|
//aggiunto questo errore |
758 |
|
if (ce->perror[k] == 143){ |
759 |
|
ver[k][23]++ ; |
760 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
761 |
|
printf(" corrupted packet lenght \n"); |
762 |
|
}; |
763 |
}; |
}; |
764 |
for (Int_t kk = 0; kk < 11 ; kk++ ){ |
for (Int_t kk = 0; kk < 11 ; kk++ ){ |
765 |
tshit += shit[k][kk]; |
tshit += shit[k][kk]; |
769 |
if (isCOMP || isFULL){ |
if (isCOMP || isFULL){ |
770 |
Calstriphit->Fill(cshit); |
Calstriphit->Fill(cshit); |
771 |
// if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){ |
// if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){ |
772 |
if ( (cshit > 10 && cshit < 100) ){ |
// |
773 |
|
//cambiata la banda di soglia ora 5 prima era 10 |
774 |
|
// |
775 |
|
if ( (cshit > 5 && cshit < 100) ){ |
776 |
incshit++; |
incshit++; |
777 |
} else { |
} else { |
778 |
outcshit++; |
outcshit++; |
780 |
// |
// |
781 |
if ( tshit>0 ) h1->Fill(tshit); |
if ( tshit>0 ) h1->Fill(tshit); |
782 |
// if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){ |
// if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){ |
783 |
if ( (tshit > 10 && tshit < 100) ){ |
//cambiata la soglia ora 5 prima era 10 |
784 |
|
if ( (tshit > 5 && tshit < 100) ){ |
785 |
intshit++; |
intshit++; |
786 |
} else { |
} else { |
787 |
outtshit++; |
outtshit++; |
869 |
h1->Draw(); |
h1->Draw(); |
870 |
// |
// |
871 |
h1max = h1->GetMaximum()*1.05; |
h1max = h1->GetMaximum()*1.05; |
872 |
Double_t xc[4] = {10.,100.,100.,10.}; |
|
873 |
|
//cambiata banda prima era 10 ora 5 |
874 |
|
Double_t xc[4] = {5.,100.,100.,5.}; |
875 |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
876 |
banda1 = new TPolyLine(4,xc,yc); |
banda1 = new TPolyLine(4,xc,yc); |
877 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
921 |
h1->SetYTitle("Number of events"); |
h1->SetYTitle("Number of events"); |
922 |
h1->Draw(); |
h1->Draw(); |
923 |
h1max = h1->GetMaximum()*1.05; |
h1max = h1->GetMaximum()*1.05; |
924 |
Double_t xe[4] = {10.,100.,100.,10.}; |
//cambiato banda, prima era 10,ora 5 |
925 |
|
Double_t xe[4] = {5.,100.,100.,5.}; |
926 |
Double_t ye[4] = {0.,0.,h1max,h1max}; |
Double_t ye[4] = {0.,0.,h1max,h1max}; |
927 |
banda1 = new TPolyLine(4,xe,ye); |
banda1 = new TPolyLine(4,xe,ye); |
928 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
1108 |
Baseline->SetYTitle("Number of events"); |
Baseline->SetYTitle("Number of events"); |
1109 |
Baseline->Draw(); |
Baseline->Draw(); |
1110 |
h1max = Baseline->GetMaximum()*1.05; |
h1max = Baseline->GetMaximum()*1.05; |
1111 |
Double_t xc[4] = {2000.,4500.,4500.,2000.}; |
Double_t xc[4] = {2000.,5500.,5500.,2000.}; |
1112 |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
1113 |
banda1 = new TPolyLine(4,xc,yc); |
banda1 = new TPolyLine(4,xc,yc); |
1114 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
1145 |
Calstriphit->SetYTitle("Number of events"); |
Calstriphit->SetYTitle("Number of events"); |
1146 |
Calstriphit->Draw(); |
Calstriphit->Draw(); |
1147 |
h1max = Calstriphit->GetMaximum()*1.05; |
h1max = Calstriphit->GetMaximum()*1.05; |
1148 |
Double_t xg[4] = {10.,100.,100.,10.}; |
|
1149 |
|
//banda di sogla portata a 5, prima era a 10 |
1150 |
|
Double_t xg[4] = {5.,100.,100.,5.}; |
1151 |
Double_t yg[4] = {0.,0.,h1max,h1max}; |
Double_t yg[4] = {0.,0.,h1max,h1max}; |
1152 |
banda1 = new TPolyLine(4,xg,yg); |
banda1 = new TPolyLine(4,xg,yg); |
1153 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
1389 |
t->SetTextAlign(12); |
t->SetTextAlign(12); |
1390 |
t->DrawLatex(33.,97.,sezione); |
t->DrawLatex(33.,97.,sezione); |
1391 |
t->SetTextSize(0.05); |
t->SetTextSize(0.05); |
1392 |
for (Int_t j = 0; j < 23; j++){ |
//aggiunto un errore jmax=23 |
1393 |
|
for (Int_t j = 0; j < 24; j++){ |
1394 |
if ( ver[i][j] || lver[i][j] ) { |
if ( ver[i][j] || lver[i][j] ) { |
1395 |
t->SetTextColor(50); |
t->SetTextColor(50); |
1396 |
if (j == 0) { |
if (j == 0) { |
1578 |
t->DrawLatex(2.,3.,errore.str().c_str()); |
t->DrawLatex(2.,3.,errore.str().c_str()); |
1579 |
check = true; |
check = true; |
1580 |
}; |
}; |
1581 |
}; |
//aggiunto questo errore |
1582 |
}; |
if (j == 23) { |
1583 |
|
errore.str(""); |
1584 |
|
errore << "Corrupted packet lenght " << ver[i][j]; |
1585 |
|
errore << " time(s) "; |
1586 |
|
t->DrawLatex(2.,2.,errore.str().c_str()); |
1587 |
|
check = true; |
1588 |
|
}; |
1589 |
|
}; |
1590 |
|
}; |
1591 |
t->SetTextColor(50); |
t->SetTextColor(50); |
1592 |
if ( fulldiff[i] !=0 ) { |
if ( fulldiff[i] !=0 ) { |
1593 |
check = true; |
check = true; |
1614 |
if ( check ){ |
if ( check ){ |
1615 |
t->SetTextColor(50); |
t->SetTextColor(50); |
1616 |
t->DrawLatex(60.,95.," WARNING, CHECK! "); |
t->DrawLatex(60.,95.," WARNING, CHECK! "); |
|
printf("cdexyc %f cdexy %f ctshit %f cbase %f \n",cdexyc,cdexy,ctshit,cbase); |
|
1617 |
} else { |
} else { |
1618 |
t->SetTextColor(32); |
t->SetTextColor(32); |
1619 |
t->DrawLatex(60.,95.," OK! "); |
t->DrawLatex(60.,95.," OK! "); |
1620 |
}; |
}; |
1621 |
|
printf("cdexyc %f cdexy %f ctshit %f cbase %f \n",cdexyc,cdexy,ctshit,cbase); |
1622 |
// |
// |
1623 |
// const string fil = (const char*)filename; |
// const string fil = (const char*)filename; |
1624 |
// Int_t posiz = fil.find("dw_"); |
// Int_t posiz = fil.find("dw_"); |
1701 |
}; |
}; |
1702 |
}; |
}; |
1703 |
} |
} |
|
|
|