2 |
* FTrkScanQlook_EXPERT.cxx |
* FTrkScanQlook_EXPERT.cxx |
3 |
* |
* |
4 |
* autor: D.Fedele |
* autor: D.Fedele |
5 |
* version v2r02 |
* version v2r08 |
6 |
* Parameters: |
* Parameters: |
7 |
* file - the path to the root file to analyze |
* file - the path to the root file to analyze |
8 |
* outdir - total path of output file |
* outdir - total path of output file |
16 |
#include <iostream> |
#include <iostream> |
17 |
#include <sstream> |
#include <sstream> |
18 |
#include <fstream> |
#include <fstream> |
19 |
|
#include <TAxis.h> |
20 |
|
#include <TH1F.h> |
21 |
|
#include <TROOT.h> |
22 |
|
#include <cstdlib> |
23 |
// |
// |
24 |
#include <TPaveText.h> |
#include <TPaveText.h> |
25 |
#include <TLatex.h> |
#include <TLatex.h> |
40 |
|
|
41 |
using namespace std; |
using namespace std; |
42 |
|
|
43 |
typedef struct trkword{ |
struct trkword{ |
44 |
int type; |
int type; |
45 |
int decode; |
int decode; |
46 |
}; |
}; |
206 |
printf(" Number of Header Entries: %d\n",neventH); |
printf(" Number of Header Entries: %d\n",neventH); |
207 |
printf(" Number of Calibration: %d\n",cevents); |
printf(" Number of Calibration: %d\n",cevents); |
208 |
|
|
209 |
Long64_t obt=0,hobt[neventH]; |
ULong_t obt=0,hobt[neventH]; |
210 |
Int_t eve,cin=0,cins=0,br=0; |
Int_t eve,cin=0,cins=0,br=0,olrun[neventH]; |
211 |
TString cal=""; |
TString cal=""; |
212 |
|
|
213 |
eve=3; |
eve=3; |
215 |
otr->GetEntry(i); |
otr->GetEntry(i); |
216 |
pH = eH->GetPscuHeader(); |
pH = eH->GetPscuHeader(); |
217 |
hobt[i]= pH->GetOrbitalTime(); |
hobt[i]= pH->GetOrbitalTime(); |
218 |
|
olrun[i]=reh->TRK_CALIB_USED; |
219 |
if(reh->TRK_CALIB_USED!=104 && br==0){ |
if(reh->TRK_CALIB_USED!=104 && br==0){ |
220 |
obt = pH->GetOrbitalTime(); |
obt = pH->GetOrbitalTime(); |
221 |
cal="Event with online calibration"; |
cal="Event with online calibration"; |
247 |
|
|
248 |
TPad *trkpad[12]; //pad for histos |
TPad *trkpad[12]; //pad for histos |
249 |
|
|
250 |
stringstream fromfile,title,hid,message; |
stringstream fromfile,isfile,title,hid,message; |
251 |
TString figsa="",figsav="",figsava=""; |
TString figsa="",figsav="",figsava=""; |
252 |
Int_t canvasx=1200; |
Int_t canvasx=1200; |
253 |
Int_t canvasy=900; |
Int_t canvasy=900; |
273 |
for(Int_t i=0;i<nevents;i++){ |
for(Int_t i=0;i<nevents;i++){ |
274 |
tr->GetEntry(i); |
tr->GetEntry(i); |
275 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
|
if(reh->TRK_CALIB_USED==104) continue; |
|
276 |
cod = eh->GetCounter(); |
cod = eh->GetCounter(); |
277 |
|
if(olrun[cod->Get(pctp->RunHeader)-1]==104) continue; |
278 |
if(value%10!=0){ |
if(value%10!=0){ |
279 |
if(i==0) cin=cod->Get(pctp->CalibTrk1)+((value%10)-1); |
if(i==0) cin=cod->Get(pctp->CalibTrk1)+((value%10)-1); |
280 |
if(cod->Get(pctp->CalibTrk1)==cin+1){ |
if(cod->Get(pctp->CalibTrk1)==cin+1){ |
288 |
eve=i+3; |
eve=i+3; |
289 |
cin=100; |
cin=100; |
290 |
} |
} |
291 |
else if(event>=0 && ph->GetOrbitalTime()>obt && obt>0){ |
else if(event>=0 && (ULong_t)ph->GetOrbitalTime()>obt && obt>0){ |
292 |
eve=i+3; |
eve=i+3; |
293 |
obt=-1; |
obt=0; |
294 |
} |
} |
295 |
} |
} |
296 |
if(i==0) cins=cod->Get(pctp->CalibTrk1); |
if(i==0) cins=cod->Get(pctp->CalibTrk1); |
297 |
if(cod->Get(pctp->CalibTrk1)==cins+1){ |
if(cod->Get(pctp->CalibTrk1)>cins){ |
298 |
psum=1; |
psum=1; |
299 |
cins=cod->Get(pctp->CalibTrk1); |
cins=cod->Get(pctp->CalibTrk1); |
300 |
} |
} |
345 |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
346 |
Int_t ndsp=0; |
Int_t ndsp=0; |
347 |
|
|
348 |
Int_t whistomax[3072]; |
// Int_t whistomax[3072]; |
349 |
Int_t whisto[3072]; |
Int_t whisto[3072]; |
350 |
Int_t whistocomp[3072]; |
// Int_t whistocomp[3072]; |
351 |
Int_t whistofull[3072]; |
Int_t whistofull[3072]; |
352 |
|
|
353 |
// // transmitted words |
// // transmitted words |
354 |
Int_t word = 0; |
Int_t word = 0; |
355 |
Int_t iword = 0; |
Int_t iword = 0; |
356 |
Int_t ii=0,ifull[12],icomp[12],imax[12],nn=0; |
// Int_t ii=0,ifull[12],icomp[12],imax[12],nn=0; |
357 |
|
Int_t ii=0,nn=0; |
358 |
trkword thisword; |
trkword thisword; |
359 |
|
|
360 |
Int_t address,ladder; |
Int_t address,ladder; |
363 |
for(Int_t n = 0; n<12; n++){ |
for(Int_t n = 0; n<12; n++){ |
364 |
ndsp = trk->DSPnumber[n]; |
ndsp = trk->DSPnumber[n]; |
365 |
nn = ndsp-1; |
nn = ndsp-1; |
366 |
ifull[nn]=0; |
// ifull[nn]=0; |
367 |
icomp[nn]=0; |
// icomp[nn]=0; |
368 |
imax[nn]=0; |
// imax[nn]=0; |
369 |
|
|
370 |
for(Int_t vi = 0; vi< 3072; vi++){ |
for(Int_t vi = 0; vi< 3072; vi++){ |
371 |
whistomax[vi] = -200; |
// whistomax[vi] = -200; |
372 |
whistocomp[vi] = -200; |
// whistocomp[vi] = -200; |
373 |
whistofull[vi] = -200; |
whistofull[vi] = -200; |
374 |
whisto[vi] = -200; |
whisto[vi] = -200; |
375 |
} |
} |
402 |
// end of compressed data - FILL HISTO |
// end of compressed data - FILL HISTO |
403 |
//cout << ">>> COMPRESSED data" << "\n"; |
//cout << ">>> COMPRESSED data" << "\n"; |
404 |
for(ii = 0; ii < 3072; ii++){ |
for(ii = 0; ii < 3072; ii++){ |
405 |
whistocomp[ii]=whisto[ii]; |
// whistocomp[ii]=whisto[ii]; |
406 |
whisto[ii] = -200; |
whisto[ii] = -200; |
407 |
} |
} |
408 |
address = 0; |
address = 0; |
446 |
if(psum==totsum+1){ |
if(psum==totsum+1){ |
447 |
if(value%10==0 && value>0) values << (short int)(-cins) << endl << endl; |
if(value%10==0 && value>0) values << (short int)(-cins) << endl << endl; |
448 |
psum=0; |
psum=0; |
449 |
for(Int_t vi = 0; vi < 12; vi++){ |
for(Int_t vi = 0; vi < 12; vi++){ |
450 |
TLine li,liva1; |
if(p[vi]>0){ |
451 |
li.SetLineColor(38); |
|
452 |
li.SetLineStyle(4); |
TLine li,liva1; |
453 |
li.SetLineWidth(2); |
li.SetLineColor(38); |
454 |
liva1.SetLineColor(42); |
li.SetLineStyle(4); |
455 |
liva1.SetLineStyle(3); |
li.SetLineWidth(2); |
456 |
liva1.SetLineWidth(1); |
liva1.SetLineColor(42); |
457 |
|
liva1.SetLineStyle(3); |
458 |
|
liva1.SetLineWidth(1); |
459 |
|
|
460 |
Float_t va1x=0; |
Float_t va1x=0; |
461 |
csum[cins-1]->cd(); |
csum[cins-1]->cd(); |
462 |
trkpad[vi]->Draw(); |
trkpad[vi]->Draw(); |
463 |
trkpad[vi]->cd(); |
trkpad[vi]->cd(); |
464 |
trkpad[vi]->SetFillColor(10); |
trkpad[vi]->SetFillColor(10); |
465 |
|
|
466 |
stringstream tit,hid; |
stringstream tit,hid; |
467 |
tit.str(""); |
tit.str(""); |
468 |
hid.str(""); |
hid.str(""); |
469 |
tit<<"DSP "<<vi+1; |
tit<<"DSP "<<vi+1; |
470 |
sum[vi][cins-1][0]->SetTitle(tit.str().c_str()); |
sum[vi][cins-1][0]->SetTitle(tit.str().c_str()); |
471 |
sum[vi][cins-1][0]->GetXaxis()->SetTitle("channel id"); |
sum[vi][cins-1][0]->GetXaxis()->SetTitle("channel id"); |
472 |
sum[vi][cins-1][0]->GetXaxis()->CenterTitle(); |
sum[vi][cins-1][0]->GetXaxis()->CenterTitle(); |
473 |
sum[vi][cins-1][0]->GetXaxis()->SetRangeUser(0,3073); |
sum[vi][cins-1][0]->GetXaxis()->SetRangeUser(0,3073); |
474 |
sum[vi][cins-1][0]->GetXaxis()->SetTitleSize(0.06); |
sum[vi][cins-1][0]->GetXaxis()->SetTitleSize(0.06); |
475 |
sum[vi][cins-1][0]->GetXaxis()->SetTitleOffset(0.8); |
sum[vi][cins-1][0]->GetXaxis()->SetTitleOffset(0.8); |
476 |
sum[vi][cins-1][0]->GetYaxis()->SetTitle("ADC value"); |
sum[vi][cins-1][0]->GetYaxis()->SetTitle("ADC value"); |
477 |
sum[vi][cins-1][0]->GetYaxis()->SetTitleSize(0.09); |
sum[vi][cins-1][0]->GetYaxis()->SetTitleSize(0.09); |
478 |
sum[vi][cins-1][0]->GetYaxis()->SetTitleOffset(0.4); |
sum[vi][cins-1][0]->GetYaxis()->SetTitleOffset(0.4); |
479 |
sum[vi][cins-1][0]->GetYaxis()->CenterTitle(); |
sum[vi][cins-1][0]->GetYaxis()->CenterTitle(); |
480 |
sum[vi][cins-1][0]->GetYaxis()->SetRangeUser(0,4500); |
sum[vi][cins-1][0]->GetYaxis()->SetRangeUser(0,4500); |
481 |
sum[vi][cins-1][0]->SetMarkerStyle(20); |
sum[vi][cins-1][0]->SetMarkerStyle(20); |
482 |
sum[vi][cins-1][0]->SetMarkerSize(0.1); |
sum[vi][cins-1][0]->SetMarkerSize(0.1); |
483 |
sum[vi][cins-1][0]->SetMarkerColor(4); |
sum[vi][cins-1][0]->SetMarkerColor(4); |
484 |
sum[vi][cins-1][0]->Draw("ap"); |
sum[vi][cins-1][0]->Draw("ap"); |
485 |
hid<<p[vi]<<" events"; |
hid<<p[vi]<<" events"; |
486 |
t->SetTextSize(0.11); |
t->SetTextSize(0.11); |
487 |
t->DrawLatex(2400,4250,hid.str().c_str()); |
t->DrawLatex(2400,4250,hid.str().c_str()); |
488 |
for(int pi=1; pi<p[vi];pi++){ |
for(int pi=1; pi<p[vi];pi++){ |
489 |
sum[vi][cins-1][pi]->SetMarkerStyle(21); |
sum[vi][cins-1][pi]->SetMarkerStyle(21); |
490 |
sum[vi][cins-1][pi]->SetMarkerSize(0.1); |
sum[vi][cins-1][pi]->SetMarkerSize(0.1); |
491 |
sum[vi][cins-1][pi]->SetMarkerColor(4); |
sum[vi][cins-1][pi]->SetMarkerColor(4); |
492 |
sum[vi][cins-1][pi]->Draw("p"); |
sum[vi][cins-1][pi]->Draw("p"); |
493 |
} |
} |
494 |
for(int va=1; va<24; va++){ |
for(int va=1; va<24; va++){ |
495 |
va1x=128*va; |
va1x=128*va; |
496 |
liva1.DrawLine(va1x,0.,va1x,4500.); |
liva1.DrawLine(va1x,0.,va1x,4500.); |
497 |
|
} |
498 |
|
li.DrawLine(1024.5,0.,1024.5,4500.); |
499 |
|
li.DrawLine(2048.5,0.,2048.5,4500.); |
500 |
|
csum[cins-1]->Update(); |
501 |
|
hid.str(""); |
502 |
} |
} |
|
li.DrawLine(1024.5,0.,1024.5,4500.); |
|
|
li.DrawLine(2048.5,0.,2048.5,4500.); |
|
|
csum[cins-1]->Update(); |
|
|
hid.str(""); |
|
503 |
} |
} |
504 |
if(strcmp(outfile.Data(),"ps") && strcmp(outfile.Data(),"pdf")){ |
if(strcmp(outfile.Data(),"ps") && strcmp(outfile.Data(),"pdf")){ |
505 |
figsa+="."+outfile; |
figsa+="."+outfile; |
506 |
csum[cins-1]->Print(figsa.Data()); |
csum[cins-1]->Print(figsa.Data()); |
507 |
} |
} |
508 |
} |
if(cod->Get(pctp->CalibTrk1)==cevents) break; |
509 |
|
} |
510 |
} |
} |
511 |
} |
} |
512 |
|
|
573 |
t->SetTextSize(0.02); |
t->SetTextSize(0.02); |
574 |
t->DrawLatex(0.02,0.98,fromfile.str().c_str()); |
t->DrawLatex(0.02,0.98,fromfile.str().c_str()); |
575 |
t->DrawLatex(0.60,0.98,cal.Data()); |
t->DrawLatex(0.60,0.98,cal.Data()); |
576 |
|
|
577 |
|
isfile<<"Chips with white line at least once showed anomalous behaviour"; |
578 |
|
t->SetTextColor(17); |
579 |
|
t->SetTextSize(0.018); |
580 |
|
t->DrawLatex(.01,.96,isfile.str().c_str()); |
581 |
|
isfile.str(""); |
582 |
|
|
583 |
|
isfile<<"Boxes so colored point out anomalous chips (not necessarily broken)"; |
584 |
|
t->SetTextColor(107); |
585 |
|
// t->DrawLatex(.5,.96,isfile.str().c_str()); |
586 |
|
isfile.str(""); |
587 |
|
t->SetTextColor(1); |
588 |
|
|
589 |
if(va1!=0){ |
if(va1!=0){ |
590 |
figsava=out+ffile+"_FTrkScanQLook_EXPERT_ev"; |
figsava=out+ffile+"_FTrkScanQLook_EXPERT_ev"; |
853 |
liva1.SetLineStyle(3); |
liva1.SetLineStyle(3); |
854 |
liva1.SetLineWidth(1); |
liva1.SetLineWidth(1); |
855 |
|
|
856 |
Float_t va1x=0; |
Float_t va1x=0,maxhist=4500.,minhist=-500.; |
857 |
|
|
858 |
if(va1!=0){ |
if(va1!=0){ |
859 |
cva[e]->cd(); |
cva[e]->cd(); |
898 |
if(icomp[nn]==1) histocomp[nn][e]->Draw("9bsame]["); |
if(icomp[nn]==1) histocomp[nn][e]->Draw("9bsame]["); |
899 |
if(imax[nn]==1) histomax[nn][e]->Draw("same]["); |
if(imax[nn]==1) histomax[nn][e]->Draw("same]["); |
900 |
histocomp[nn][e]->Draw("axis same"); |
histocomp[nn][e]->Draw("axis same"); |
901 |
|
|
902 |
|
b.SetFillColor(19); |
903 |
|
b.SetFillStyle(3945); |
904 |
if(nn==0){ |
if(nn==0){ |
905 |
b.SetFillColor(107); |
b.DrawBox(0.,minhist,2047.,maxhist); |
|
b.SetFillStyle(3945); |
|
|
b.DrawBox(768.,-500.,2047.,4500.); |
|
906 |
} |
} |
907 |
else if(nn==1){ |
else if(nn==1){ |
908 |
b.SetFillColor(6); |
b.DrawBox(128.,minhist,256.,maxhist); |
909 |
b.SetFillStyle(3945); |
b.DrawBox(384.,minhist,512.,maxhist); |
910 |
b.DrawBox(2944.,-500.,3060.,4500.); |
b.DrawBox(896.,minhist,1024.,maxhist); |
911 |
|
b.DrawBox(2048.,minhist,2432.,maxhist); |
912 |
b.SetFillColor(107); |
b.DrawBox(2816.,minhist,2944.,maxhist); |
913 |
b.SetFillStyle(3954); |
b.DrawBox(2944.,minhist,3070.,maxhist); |
914 |
b.DrawBox(384.,-500.,512.,4500.); |
} |
915 |
b.DrawBox(2048.,-500.,2432.,4500.); |
else if(nn==3){ |
916 |
b.DrawBox(2816.,-500.,2944.,4500.); |
b.DrawBox(0.,minhist,256.,maxhist); |
917 |
|
b.DrawBox(2816.,minhist,3070.,maxhist); |
918 |
} |
} |
919 |
else if(nn==4){ |
else if(nn==4){ |
920 |
b.SetFillColor(107); |
b.DrawBox(256.,minhist,512.,maxhist); |
921 |
b.SetFillStyle(3954); |
b.DrawBox(1792.,minhist,1920.,maxhist); |
922 |
b.DrawBox(384.,-500.,512.,4500.); |
b.DrawBox(2816.,minhist,3070.,maxhist); |
923 |
b.DrawBox(2816.,-500.,2944.,4500); |
} |
924 |
|
else if(nn==5){ |
925 |
|
b.DrawBox(0.,minhist,256.,maxhist); |
926 |
|
b.DrawBox(896.,minhist,1024.,maxhist); |
927 |
|
b.DrawBox(1664.,minhist,1792.,maxhist); |
928 |
} |
} |
929 |
else if(nn==6){ |
else if(nn==6){ |
930 |
b.SetFillColor(6); |
b.DrawBox(512.,minhist,768.,maxhist); |
931 |
b.SetFillStyle(3945); |
b.DrawBox(1024.,minhist,1280.,maxhist); |
932 |
b.DrawBox(1024.,-500.,1280.,4500.); |
b.DrawBox(1280.,minhist,1792.,maxhist); |
933 |
|
b.DrawBox(2560.,minhist,2816.,maxhist); |
|
b.SetFillColor(107); |
|
|
b.SetFillStyle(3954); |
|
|
b.DrawBox(512.,-500.,768.,4500.); |
|
|
b.DrawBox(1280.,-500.,1792.,4500.); |
|
|
b.DrawBox(2560.,-500.,2816.,4500.); |
|
934 |
} |
} |
935 |
else if(nn==7){ |
else if(nn==7){ |
936 |
b.SetFillColor(107); |
b.DrawBox(0.,minhist,1535.,maxhist); |
937 |
b.SetFillStyle(3954); |
b.DrawBox(2024.,minhist,2280.,maxhist); |
|
b.DrawBox(512.,-500.,768.,4500.); |
|
938 |
} |
} |
939 |
else if(nn==8){ |
else if(nn==8){ |
940 |
b.SetFillColor(107); |
b.DrawBox(512.,minhist,768.,maxhist); |
|
b.SetFillStyle(3954); |
|
|
b.DrawBox(512.,-500.,768.,4500.); |
|
941 |
} |
} |
942 |
else if(nn==9){ |
else if(nn==9){ |
943 |
b.SetFillColor(107); |
b.DrawBox(0.,minhist,128.,maxhist); |
944 |
b.SetFillStyle(3954); |
b.DrawBox(256.,minhist,384.,maxhist); |
945 |
b.DrawBox(256.,-500.,384.,4500.); |
b.DrawBox(512.,minhist,640.,maxhist); |
946 |
b.DrawBox(1280.,-500.,1535.,4500.); |
b.DrawBox(896.,minhist,1152.,maxhist); |
947 |
b.DrawBox(1792.,-500.,1920.,4500.); |
b.DrawBox(1280.,minhist,1535.,maxhist); |
948 |
|
b.DrawBox(1664.,minhist,1920.,maxhist); |
949 |
|
b.DrawBox(2048.,minhist,2304.,maxhist); |
950 |
} |
} |
951 |
else if(nn==10){ |
else if(nn==10){ |
952 |
b.SetFillColor(107); |
b.DrawBox(0.,minhist,512.,maxhist); |
953 |
b.SetFillStyle(3954); |
b.DrawBox(1024.,minhist,3070.,maxhist); |
|
b.DrawBox(1024.,-500.,1152.,4500); |
|
|
b.DrawBox(2048.,-500.,3070.,4500.); |
|
954 |
} |
} |
955 |
else if(nn==11){ |
else if(nn==11){ |
956 |
b.SetFillColor(6); |
b.DrawBox(0.,minhist,512.,maxhist); |
957 |
b.SetFillStyle(3945); |
b.DrawBox(768.,minhist,1024.,maxhist); |
958 |
b.DrawBox(768.,-500.,1024.,4500.); |
b.DrawBox(1536.,minhist,1664.,maxhist); |
959 |
|
b.DrawBox(1920.,minhist,2560.,maxhist); |
960 |
b.SetFillColor(107); |
b.DrawBox(2816.,minhist,3070.,maxhist); |
961 |
b.SetFillStyle(3954); |
} |
|
b.DrawBox(0.,-500.,512.,4500.); |
|
|
b.DrawBox(1920.,-500.,2560.,4500.); |
|
|
} |
|
962 |
for(int va=1; va<24; va++){ |
for(int va=1; va<24; va++){ |
963 |
va1x=128*va; |
va1x=128*va; |
964 |
liva1.DrawLine(va1x,-500.,va1x,4500.); |
liva1.DrawLine(va1x,minhist,va1x,maxhist); |
965 |
} |
} |
966 |
li.DrawLine(1024.5,-500.,1024.5,4500.); |
li.DrawLine(1024.5,minhist,1024.5,maxhist); |
967 |
li.DrawLine(2048.5,-500.,2048.5,4500.); |
li.DrawLine(2048.5,minhist,2048.5,maxhist); |
968 |
c1[e]->Update(); |
c1[e]->Update(); |
969 |
} |
} |
970 |
|
|