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> |
88 |
} else { |
} else { |
89 |
Int_t posiz2 = 0; |
Int_t posiz2 = 0; |
90 |
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
91 |
TString pdat(".dat"); |
TString pdat(".pam"); |
92 |
stringappend(file2,pdat); |
stringappend(file2,pdat); |
93 |
}; |
}; |
94 |
return file2; |
return file2; |
142 |
// |
// |
143 |
Float_t ctshitthr = 0.65; |
Float_t ctshitthr = 0.65; |
144 |
Float_t cbasethr = 0.95; |
Float_t cbasethr = 0.95; |
145 |
Float_t cdexythr = 0.995; |
// Float_t cdexythr = 0.995; |
146 |
|
Float_t cdexythr = 0.95; |
147 |
//Float_t cdexythr = 0.90; |
//Float_t cdexythr = 0.90; |
148 |
Float_t cdexycthr = 0.95; |
Float_t cdexycthr = 0.95; |
149 |
Float_t h1rth = 0.90; |
Float_t h1rth = 0.90; |
194 |
}; |
}; |
195 |
Int_t const size = nevents; |
Int_t const size = nevents; |
196 |
Double_t iev2[size+1]; |
Double_t iev2[size+1]; |
197 |
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 |
198 |
|
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]; |
199 |
se = 0; |
se = 0; |
200 |
pl = 0; |
pl = 0; |
201 |
Float_t allbase = 0.; |
Float_t allbase = 0.; |
202 |
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]; |
203 |
tshit = 0; |
tshit = 0; |
204 |
trshit = 0; |
trshit = 0; |
205 |
char *sezione; |
const char *sezione = ""; |
206 |
Bool_t check = false; |
Bool_t check = false; |
207 |
sezione = ""; |
// sezione = ""; |
208 |
stringstream errore; |
stringstream errore; |
209 |
errore.str(""); |
errore.str(""); |
210 |
// |
// |
297 |
maxevent = fromevent - 1; |
maxevent = fromevent - 1; |
298 |
}; |
}; |
299 |
}; |
}; |
300 |
|
//azzera i tipi di errore |
301 |
for (Int_t k = 0; k < 4; k++ ){ |
for (Int_t k = 0; k < 4; k++ ){ |
302 |
for (Int_t m = 0; m < 23 ; m++ ){ |
for (Int_t m = 0; m < 23 ; m++ ){ |
303 |
ver[k][m] = 0 ; |
ver[k][m] = 0 ; |
309 |
}; |
}; |
310 |
lalarm[k] = 0; |
lalarm[k] = 0; |
311 |
}; |
}; |
312 |
|
//il 23 lo azzero cosi per non modificare le altre variabili |
313 |
|
ver[k][23]=0; |
314 |
}; |
}; |
315 |
Int_t pdone, bdone; |
Int_t pdone, bdone; |
316 |
pdone = 0; |
pdone = 0; |
384 |
tshit = 0; |
tshit = 0; |
385 |
trshit = 0; |
trshit = 0; |
386 |
tr->GetEntry(i); |
tr->GetEntry(i); |
387 |
|
|
388 |
iev2[i] = ce->iev; |
iev2[i] = ce->iev; |
389 |
// |
// |
390 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
391 |
headco = headc; |
headco = headc; |
392 |
headc = ph->GetCounter(); |
headc = ph->GetCounter(); |
393 |
obt = ph->GetOrbitalTime(); |
obt = ph->GetOrbitalTime(); |
394 |
|
|
395 |
if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])) ) calevn1++; |
if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])) ) calevn1++; |
396 |
if ( (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])) ) calevn2++; |
if ( (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])) ) calevn2++; |
397 |
if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])) ) calevn3++; |
if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])) ) calevn3++; |
448 |
sighandler(headc,obt,i,3,nevents,evdone); |
sighandler(headc,obt,i,3,nevents,evdone); |
449 |
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); |
450 |
}; |
}; |
451 |
} |
}; |
452 |
}; |
}; |
453 |
// jumpprintout: |
// jumpprintout: |
454 |
memcpy(shit, nullsh, sizeof(nullsh)); |
memcpy(shit, nullsh, sizeof(nullsh)); |
522 |
if ( obt > maxobt[se] ) maxobt[se] = obt; |
if ( obt > maxobt[se] ) maxobt[se] = obt; |
523 |
}; |
}; |
524 |
lver[se][2]++ ; |
lver[se][2]++ ; |
525 |
sighandler(headc,obt,i,se,nevents,evdone); |
if ( lver[se][2] == 1000 ){ |
526 |
printf(" latch up (data) in DSP mode alldexy %i planebases %i \n",alldexy,planebases); |
sighandler(headc,obt,i,se,nevents,evdone); |
527 |
|
printf(" latch up (data) in DSP mode alldexy %i planebases %i \n",alldexy,planebases); |
528 |
|
printf(" WARNING TOO MANY LATCHUP ERRORS ON DATA FOR THIS SECTION \n"); |
529 |
|
printf(" THEY WILL NOT BE DISPLAYED HERE ANYMORE FOR THIS FILE! \n"); |
530 |
|
}; |
531 |
|
if ( lver[se][2] < 1000 ){ |
532 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
533 |
|
printf(" latch up (data) in DSP mode alldexy %i planebases %i \n",alldexy,planebases); |
534 |
|
}; |
535 |
}; |
}; |
536 |
} |
} |
537 |
// |
// |
538 |
if ( !bdone ){ |
if ( !bdone ){ |
539 |
Baseline->Fill(ce->base[l][ii][bl]); |
Baseline->Fill(ce->base[l][ii][bl]); |
540 |
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. ){ |
541 |
inbase++; |
inbase++; |
542 |
} else { |
} else { |
543 |
outbase++; |
outbase++; |
595 |
} else { |
} else { |
596 |
if ( !pdone ){ |
if ( !pdone ){ |
597 |
if ( ( alldexy2 > 3072000 || alldexy2 == 0) && ce->perror[se] == 0 ) { |
if ( ( alldexy2 > 3072000 || alldexy2 == 0) && ce->perror[se] == 0 ) { |
598 |
// if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) { |
// if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) |
599 |
pdone = 1; |
pdone = 1; |
600 |
pshit[se][pl]++ ; |
pshit[se][pl]++ ; |
601 |
if ( (ce->stwerr[se] & (1 << 4)) == 0 ){ |
if ( (ce->stwerr[se] & (1 << 4)) == 0 ){ |
605 |
if ( obt > maxobt[se] ) maxobt[se] = obt; |
if ( obt > maxobt[se] ) maxobt[se] = obt; |
606 |
}; |
}; |
607 |
lver[se][2]++ ; |
lver[se][2]++ ; |
608 |
sighandler(headc,obt,i,se,nevents,evdone); |
if ( lver[se][2] == 1000 ){ |
609 |
printf(" latch up (data) in RAW mode alldexy2 %i \n",alldexy2); |
sighandler(headc,obt,i,se,nevents,evdone); |
610 |
|
printf(" latch up (data) in RAW mode alldexy2 %i \n",alldexy2); |
611 |
|
printf(" WARNING TOO MANY LATCHUP ERRORS ON DATA FOR THIS SECTION \n"); |
612 |
|
printf(" THEY WILL NOT BE DISPLAYED HERE ANYMORE FOR THIS FILE! \n"); |
613 |
|
}; |
614 |
|
if ( lver[se][2] < 1000 ){ |
615 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
616 |
|
printf(" latch up (data) in RAW mode alldexy2 %i \n",alldexy2); |
617 |
|
}; |
618 |
}; |
}; |
619 |
}; |
}; |
620 |
if ( ce->dexy[l][ii][kk] > 0 && ce->dexy[l][ii][kk] < 32000 ) { |
if ( ce->dexy[l][ii][kk] > 0 && ce->dexy[l][ii][kk] < 32000 ) { |
635 |
for (Int_t k = 0; k < 4 ; k++ ){ |
for (Int_t k = 0; k < 4 ; k++ ){ |
636 |
isCOMP = false; |
isCOMP = false; |
637 |
isFULL = false; |
isFULL = false; |
638 |
cestw=0; |
cestw=0;// queste righe qui |
639 |
if ( ce->stwerr[k] ) cestw = ce->stwerr[k] & cmask ; |
if ( ce->stwerr[k] ) cestw = ce->stwerr[k] & cmask ;// |
640 |
if ( ce->stwerr[k] & (1 << 16) && !(cestw & (1 << 3)) ) isCOMP = true; |
if ( ce->stwerr[k] & (1 << 16) && !(cestw & (1 << 3)) ) isCOMP = true; |
641 |
if ( ce->stwerr[k] & (1 << 17) && !(cestw & (1 << 3)) ) isFULL = true; |
if ( ce->stwerr[k] & (1 << 17) && !(cestw & (1 << 3)) ) isFULL = true; |
642 |
// |
// |
662 |
if ( cestw & (1 << 3) ) ver[k][3]++ ; // raw mode |
if ( cestw & (1 << 3) ) ver[k][3]++ ; // raw mode |
663 |
if ( cestw & (1 << 4) ){ |
if ( cestw & (1 << 4) ){ |
664 |
ver[k][2]++ ; |
ver[k][2]++ ; |
665 |
sighandler(headc,obt,i,k,nevents,evdone); |
if ( ver[k][2] == 1000 ){ |
666 |
printf(" latch up alarm (st. word)\n"); |
sighandler(headc,obt,i,k,nevents,evdone); |
667 |
|
printf(" latch up alarm (st. word)\n"); |
668 |
|
printf(" WARNING TOO MANY LATCHUP ERRORS ON DATA FOR THIS SECTION \n"); |
669 |
|
printf(" THEY WILL NOT BE DISPLAYED HERE ANYMORE FOR THIS FILE! \n"); |
670 |
|
}; |
671 |
|
if ( ver[k][2] < 1000 ){ |
672 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
673 |
|
printf(" latch up alarm (st. word)\n"); |
674 |
|
}; |
675 |
lupstw[k]->Fill(obt); |
lupstw[k]->Fill(obt); |
676 |
if ( swfirstobt[k] ) swminobt[k] = obt; |
if ( swfirstobt[k] ) swminobt[k] = obt; |
677 |
if ( obt > swmaxobt[k] ) swmaxobt[k] = obt; |
if ( obt > swmaxobt[k] ) swmaxobt[k] = obt; |
686 |
sighandler(headc,obt,i,k,nevents,evdone); |
sighandler(headc,obt,i,k,nevents,evdone); |
687 |
printf(" DSP ack error \n"); |
printf(" DSP ack error \n"); |
688 |
}; |
}; |
689 |
}; |
};// controllo se ci sono errori crc se perr=0 ok! |
690 |
if ( ce->stwerr[k] == 0 && ce->perror[k] == 0 ) ver[k][8]++ ; |
if ( ce->stwerr[k] == 0 && ce->perror[k] == 0 ) ver[k][8]++ ; |
691 |
if ( ce->perror[k] != 0. ){ |
if ( ce->perror[k] != 0. ){ |
692 |
if (ce->perror[k] == 128){ |
if (ce->perror[k] == 128){ |
752 |
sighandler(headc,obt,i,k,nevents,evdone); |
sighandler(headc,obt,i,k,nevents,evdone); |
753 |
printf(" packet length is zero (YODA input error), skipped\n"); |
printf(" packet length is zero (YODA input error), skipped\n"); |
754 |
}; |
}; |
755 |
|
//aggiunto questo errore |
756 |
|
if (ce->perror[k] == 143){ |
757 |
|
ver[k][23]++ ; |
758 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
759 |
|
printf(" corrupted packet lenght \n"); |
760 |
|
}; |
761 |
}; |
}; |
762 |
for (Int_t kk = 0; kk < 11 ; kk++ ){ |
for (Int_t kk = 0; kk < 11 ; kk++ ){ |
763 |
tshit += shit[k][kk]; |
tshit += shit[k][kk]; |
767 |
if (isCOMP || isFULL){ |
if (isCOMP || isFULL){ |
768 |
Calstriphit->Fill(cshit); |
Calstriphit->Fill(cshit); |
769 |
// if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){ |
// if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){ |
770 |
if ( (cshit > 10 && cshit < 100) ){ |
// |
771 |
|
//cambiata la banda di soglia ora 5 prima era 10 |
772 |
|
// |
773 |
|
if ( (cshit > 5 && cshit < 100) ){ |
774 |
incshit++; |
incshit++; |
775 |
} else { |
} else { |
776 |
outcshit++; |
outcshit++; |
778 |
// |
// |
779 |
if ( tshit>0 ) h1->Fill(tshit); |
if ( tshit>0 ) h1->Fill(tshit); |
780 |
// if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){ |
// if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){ |
781 |
if ( (tshit > 10 && tshit < 100) ){ |
//cambiata la soglia ora 5 prima era 10 |
782 |
|
if ( (tshit > 5 && tshit < 100) ){ |
783 |
intshit++; |
intshit++; |
784 |
} else { |
} else { |
785 |
outtshit++; |
outtshit++; |
867 |
h1->Draw(); |
h1->Draw(); |
868 |
// |
// |
869 |
h1max = h1->GetMaximum()*1.05; |
h1max = h1->GetMaximum()*1.05; |
870 |
Double_t xc[4] = {10.,100.,100.,10.}; |
|
871 |
|
//cambiata banda prima era 10 ora 5 |
872 |
|
Double_t xc[4] = {5.,100.,100.,5.}; |
873 |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
874 |
banda1 = new TPolyLine(4,xc,yc); |
banda1 = new TPolyLine(4,xc,yc); |
875 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
919 |
h1->SetYTitle("Number of events"); |
h1->SetYTitle("Number of events"); |
920 |
h1->Draw(); |
h1->Draw(); |
921 |
h1max = h1->GetMaximum()*1.05; |
h1max = h1->GetMaximum()*1.05; |
922 |
Double_t xe[4] = {10.,100.,100.,10.}; |
//cambiato banda, prima era 10,ora 5 |
923 |
|
Double_t xe[4] = {5.,100.,100.,5.}; |
924 |
Double_t ye[4] = {0.,0.,h1max,h1max}; |
Double_t ye[4] = {0.,0.,h1max,h1max}; |
925 |
banda1 = new TPolyLine(4,xe,ye); |
banda1 = new TPolyLine(4,xe,ye); |
926 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
1106 |
Baseline->SetYTitle("Number of events"); |
Baseline->SetYTitle("Number of events"); |
1107 |
Baseline->Draw(); |
Baseline->Draw(); |
1108 |
h1max = Baseline->GetMaximum()*1.05; |
h1max = Baseline->GetMaximum()*1.05; |
1109 |
Double_t xc[4] = {2000.,4500.,4500.,2000.}; |
Double_t xc[4] = {2000.,5500.,5500.,2000.}; |
1110 |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
1111 |
banda1 = new TPolyLine(4,xc,yc); |
banda1 = new TPolyLine(4,xc,yc); |
1112 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
1143 |
Calstriphit->SetYTitle("Number of events"); |
Calstriphit->SetYTitle("Number of events"); |
1144 |
Calstriphit->Draw(); |
Calstriphit->Draw(); |
1145 |
h1max = Calstriphit->GetMaximum()*1.05; |
h1max = Calstriphit->GetMaximum()*1.05; |
1146 |
Double_t xg[4] = {10.,100.,100.,10.}; |
|
1147 |
|
//banda di sogla portata a 5, prima era a 10 |
1148 |
|
Double_t xg[4] = {5.,100.,100.,5.}; |
1149 |
Double_t yg[4] = {0.,0.,h1max,h1max}; |
Double_t yg[4] = {0.,0.,h1max,h1max}; |
1150 |
banda1 = new TPolyLine(4,xg,yg); |
banda1 = new TPolyLine(4,xg,yg); |
1151 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
1387 |
t->SetTextAlign(12); |
t->SetTextAlign(12); |
1388 |
t->DrawLatex(33.,97.,sezione); |
t->DrawLatex(33.,97.,sezione); |
1389 |
t->SetTextSize(0.05); |
t->SetTextSize(0.05); |
1390 |
for (Int_t j = 0; j < 23; j++){ |
//aggiunto un errore jmax=23 |
1391 |
|
for (Int_t j = 0; j < 24; j++){ |
1392 |
if ( ver[i][j] || lver[i][j] ) { |
if ( ver[i][j] || lver[i][j] ) { |
1393 |
t->SetTextColor(50); |
t->SetTextColor(50); |
1394 |
if (j == 0) { |
if (j == 0) { |
1576 |
t->DrawLatex(2.,3.,errore.str().c_str()); |
t->DrawLatex(2.,3.,errore.str().c_str()); |
1577 |
check = true; |
check = true; |
1578 |
}; |
}; |
1579 |
}; |
//aggiunto questo errore |
1580 |
}; |
if (j == 23) { |
1581 |
|
errore.str(""); |
1582 |
|
errore << "Corrupted packet lenght " << ver[i][j]; |
1583 |
|
errore << " time(s) "; |
1584 |
|
t->DrawLatex(2.,2.,errore.str().c_str()); |
1585 |
|
check = true; |
1586 |
|
}; |
1587 |
|
}; |
1588 |
|
}; |
1589 |
t->SetTextColor(50); |
t->SetTextColor(50); |
1590 |
if ( fulldiff[i] !=0 ) { |
if ( fulldiff[i] !=0 ) { |
1591 |
check = true; |
check = true; |
1612 |
if ( check ){ |
if ( check ){ |
1613 |
t->SetTextColor(50); |
t->SetTextColor(50); |
1614 |
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); |
|
1615 |
} else { |
} else { |
1616 |
t->SetTextColor(32); |
t->SetTextColor(32); |
1617 |
t->DrawLatex(60.,95.," OK! "); |
t->DrawLatex(60.,95.," OK! "); |
1618 |
}; |
}; |
1619 |
|
printf("cdexyc %f cdexy %f ctshit %f cbase %f \n",cdexyc,cdexy,ctshit,cbase); |
1620 |
// |
// |
1621 |
// const string fil = (const char*)filename; |
// const string fil = (const char*)filename; |
1622 |
// Int_t posiz = fil.find("dw_"); |
// Int_t posiz = fil.find("dw_"); |
1699 |
}; |
}; |
1700 |
}; |
}; |
1701 |
} |
} |
|
|
|