2 |
* FTrkCalibQLookExpert.cxx |
* FTrkCalibQLookExpert.cxx |
3 |
* |
* |
4 |
* autor: D.Fedele |
* autor: D.Fedele |
5 |
* version v1r14 |
* version v1r28 |
6 |
* Parameters: |
* Parameters: |
7 |
* file - the data file to analyze |
* file - the data file to analyze |
8 |
* step - select =1 in order to analyze one event at time |
* step - select =1 in order to analyze one event at time |
23 |
#include <TGraph.h> |
#include <TGraph.h> |
24 |
#include <TStyle.h> |
#include <TStyle.h> |
25 |
#include <TString.h> |
#include <TString.h> |
26 |
|
#include <TAxis.h> |
27 |
|
#include <TH1F.h> |
28 |
|
#include <TROOT.h> |
29 |
|
#include <cstdlib> |
30 |
// |
// |
31 |
#include <PscuHeader.h> |
#include <PscuHeader.h> |
32 |
#include <EventHeader.h> |
#include <EventHeader.h> |
34 |
#include <CalibTrk2Event.h> |
#include <CalibTrk2Event.h> |
35 |
// |
// |
36 |
|
|
37 |
typedef struct caltrk_def{ |
struct caltrk_def{ |
38 |
Int_t good0[2]; |
Int_t good0[2]; |
39 |
Int_t daqmode[12]; |
Int_t daqmode[12]; |
40 |
Int_t dspnum[12]; |
Int_t dspnum[12]; |
81 |
Int_t nevents=0; |
Int_t nevents=0; |
82 |
Int_t minevent = 0; |
Int_t minevent = 0; |
83 |
Int_t maxevent = 0; |
Int_t maxevent = 0; |
84 |
ULong64_t FOBT[2]; |
ULong_t FOBT[2]; |
85 |
|
|
86 |
FOBT[0]=0; |
FOBT[0]=0; |
87 |
FOBT[1]=0; |
FOBT[1]=0; |
91 |
ctrk.good0[1]=0; |
ctrk.good0[1]=0; |
92 |
for(Int_t i=0;i<12;i++){ |
for(Int_t i=0;i<12;i++){ |
93 |
ctrk.daqmode[i]=0; |
ctrk.daqmode[i]=0; |
94 |
ctrk.dspnum[i]=100; |
ctrk.dspnum[i]=0; |
95 |
ctrk.calibnum[i]=0; |
ctrk.calibnum[i]=0; |
96 |
ctrk.ncalev[i]=0; |
ctrk.ncalev[i]=0; |
97 |
ctrk.calfl[i]=0; |
ctrk.calfl[i]=0; |
192 |
|
|
193 |
Int_t hcevent=hotr->GetEntries(); |
Int_t hcevent=hotr->GetEntries(); |
194 |
Int_t tcevent=totr->GetEntries(); |
Int_t tcevent=totr->GetEntries(); |
195 |
ULong64_t HOBT[hcevent], TOBT[tcevent]; |
ULong_t HOBT[hcevent], TOBT[tcevent]; |
196 |
for (Int_t i = 0; i < hcevent; i++){ |
for (Int_t i = 0; i < hcevent; i++){ |
197 |
hotr->GetEntry(i); |
hotr->GetEntry(i); |
198 |
ph = eh4->GetPscuHeader(); |
ph = eh4->GetPscuHeader(); |
277 |
|
|
278 |
// |
// |
279 |
// other variables definitions |
// other variables definitions |
280 |
|
|
281 |
Int_t risposta=0; |
Int_t risposta=0; |
282 |
stringstream fromfile; |
stringstream fromfile,isfile; |
283 |
|
|
284 |
fromfile<<"FTrkCalibQLook_EXPERT File: "<<ffile<<" -- CalibHeader OBT= "<<HOBT[(cod->Get(pctp->CalibHeader))-1]<<" -- Calib pkt OBT= "<<FOBT[0]<<" -- CalibTrailer OBT= "<<TOBT[(cod->Get(pctp->CalibTrailer))]<<" --"; |
fromfile<<"FTrkCalibQLook_EXPERT File: "<<ffile<<" -- CalibHeader OBT= "<<HOBT[(cod->Get(pctp->CalibHeader))-1]<<" -- Calib pkt OBT= "<<FOBT[0]<<" -- CalibTrailer OBT= "<<TOBT[(cod->Get(pctp->CalibTrailer))]<<" --"; |
285 |
|
|
309 |
Int_t canvasy=900; |
Int_t canvasy=900; |
310 |
TCanvas *c1 = new TCanvas("c1","FTrkCalibQLook_EXPERT_ped",canvasx,canvasy); |
TCanvas *c1 = new TCanvas("c1","FTrkCalibQLook_EXPERT_ped",canvasx,canvasy); |
311 |
c1->SetFillColor(10); |
c1->SetFillColor(10); |
312 |
tzz->DrawLatex(.01,0.98,fromfile.str().c_str()); |
tzz->DrawLatex(.01,.98,fromfile.str().c_str()); |
313 |
tzz->DrawLatex(.90,0.98,"PEDESTAL"); |
tzz->DrawLatex(.90,.98,"PEDESTAL"); |
314 |
|
|
315 |
|
isfile<<"Chips with white line at least once showed anomalous behaviour"; |
316 |
|
tzz->SetTextColor(17); |
317 |
|
tzz->SetTextSize(0.018); |
318 |
|
tzz->DrawLatex(.01,.96,isfile.str().c_str()); |
319 |
|
isfile.str(""); |
320 |
|
|
321 |
|
isfile<<"Boxes so colored point out anomalous chips (not necessarily broken)"; |
322 |
|
tzz->SetTextColor(107); |
323 |
|
// tzz->DrawLatex(.05,.96,isfile.str().c_str()); |
324 |
|
isfile.str(""); |
325 |
|
|
326 |
TCanvas *c2 = new TCanvas("c2","FTrkCalibQLook_EXPERT_sig",canvasx,canvasy); |
TCanvas *c2 = new TCanvas("c2","FTrkCalibQLook_EXPERT_sig",canvasx,canvasy); |
327 |
c2->SetFillColor(10); |
c2->SetFillColor(10); |
328 |
tzz->DrawLatex(.01,0.98,fromfile.str().c_str()); |
tzz->SetTextColor(1); |
329 |
tzz->DrawLatex(.90,0.98,"SIGMA"); |
tzz->DrawLatex(.01,.98,fromfile.str().c_str()); |
330 |
|
tzz->DrawLatex(.90,.98,"SIGMA"); |
331 |
|
|
332 |
|
isfile<<"Chips with white line at least once showed anomalous behaviour"; |
333 |
|
tzz->SetTextColor(17); |
334 |
|
tzz->SetTextSize(0.018); |
335 |
|
tzz->DrawLatex(.01,.96,isfile.str().c_str()); |
336 |
|
isfile.str(""); |
337 |
|
|
338 |
|
isfile<<"Boxes so colored point out anomalous chips (not necessarily broken)"; |
339 |
|
tzz->SetTextColor(107); |
340 |
|
// tzz->DrawLatex(.05,.96,isfile.str().c_str()); |
341 |
|
isfile.str(""); |
342 |
|
|
343 |
|
|
344 |
TCanvas *sig=new TCanvas("sig","FTrkCalibQLook_EXPERT_histosig",canvasx,canvasy); |
TCanvas *sig=new TCanvas("sig","FTrkCalibQLook_EXPERT_histosig",canvasx,canvasy); |
345 |
sig->SetFillColor(10); |
sig->SetFillColor(10); |
346 |
tzz->DrawLatex(.01,0.98,fromfile.str().c_str()); |
tzz->SetTextColor(1); |
347 |
tzz->DrawLatex(.85,0.97,"Histograms of the sigmas"); |
tzz->DrawLatex(.01,.98,fromfile.str().c_str()); |
348 |
|
tzz->DrawLatex(.85,.97,"Histograms of the sigmas"); |
349 |
|
|
350 |
|
|
351 |
|
|
448 |
for(Int_t n = 0; n<12; n++){ |
for(Int_t n = 0; n<12; n++){ |
449 |
if(ctrk.ncalev[n]==0 && ctrk.calfl[n]==0)calok = 1;//GOOD |
if(ctrk.ncalev[n]==0 && ctrk.calfl[n]==0)calok = 1;//GOOD |
450 |
|
|
451 |
if(ctrk.dspnum[n]>13) |
if(ctrk.dspnum[n]==0) |
452 |
continue; |
continue; |
453 |
|
|
454 |
nn=ctrk.dspnum[n]-1; |
nn=ctrk.dspnum[n]-1; |
536 |
histoaped[nn]->Fill(1025,ctrk.ped2[n]); |
histoaped[nn]->Fill(1025,ctrk.ped2[n]); |
537 |
histoaped[nn]->Fill(2049,ctrk.ped3[n]); |
histoaped[nn]->Fill(2049,ctrk.ped3[n]); |
538 |
/******************************************************/ |
/******************************************************/ |
539 |
|
|
540 |
TLine li; |
TLine li,liva1; |
541 |
li.SetLineColor(38); |
li.SetLineColor(38); |
542 |
li.SetLineStyle(3); |
li.SetLineStyle(4); |
543 |
li.SetLineWidth(2); |
li.SetLineWidth(2); |
544 |
|
liva1.SetLineColor(42); |
545 |
Float_t maxhist=0; |
liva1.SetLineStyle(3); |
546 |
|
liva1.SetLineWidth(1); |
547 |
|
|
548 |
|
Float_t maxhist=0,va1x=0,minhist=0.; |
549 |
TBox b; |
TBox b; |
550 |
/* plot PEDESTAL */ |
/* plot PEDESTAL */ |
551 |
c1->cd(); |
c1->cd(); |
564 |
if((nn+1)%2==0) histoped[nn]->GetYaxis()->SetRangeUser(700,1700); |
if((nn+1)%2==0) histoped[nn]->GetYaxis()->SetRangeUser(700,1700); |
565 |
histoaped[nn]->SetLineColor(5); |
histoaped[nn]->SetLineColor(5); |
566 |
histoaped[nn]->SetLineWidth(1); |
histoaped[nn]->SetLineWidth(1); |
567 |
// if(ctrk.good0[0]==1 && ctrk.good0[1]==1){ |
// if(ctrk.good0[0]==1 && ctrk.good0[1]==1){ |
568 |
histoped[nn]->Draw("b"); |
histoped[nn]->Draw("b"); |
569 |
if(nn==1){ |
maxhist=histoped[nn]->GetMaximum(); |
570 |
maxhist=histoped[nn]->GetMaximum(); |
if(nn%2==0) minhist=2200; |
571 |
b.SetFillColor(6); |
else minhist=700; |
572 |
b.SetFillStyle(3945); |
b.SetFillColor(19); |
573 |
b.DrawBox(2944.,700.,3060.,maxhist); |
b.SetFillStyle(3954); |
574 |
|
if(nn==0){ |
575 |
b.SetFillColor(107); |
b.DrawBox(0.,minhist,2047.,maxhist); |
576 |
b.SetFillStyle(3954); |
} |
577 |
b.DrawBox(2816.,700.,2944.,maxhist); |
else if(nn==1){ |
578 |
b.DrawBox(2048.,700.,2176.,maxhist); |
b.DrawBox(128.,minhist,256.,maxhist); |
579 |
} |
b.DrawBox(384.,minhist,512.,maxhist); |
580 |
else if(nn==4){ |
b.DrawBox(896.,minhist,1024.,maxhist); |
581 |
maxhist=histoped[nn]->GetMaximum(); |
b.DrawBox(2048.,minhist,2432.,maxhist); |
582 |
b.SetFillColor(107); |
b.DrawBox(2816.,minhist,2944.,maxhist); |
583 |
b.SetFillStyle(3954); |
b.DrawBox(2944.,minhist,3070.,maxhist); |
584 |
b.DrawBox(384.,2200.,512.,maxhist); |
} |
585 |
} |
else if(nn==3){ |
586 |
else if(nn==6){ |
b.DrawBox(0.,minhist,256.,maxhist); |
587 |
maxhist=histoped[nn]->GetMaximum(); |
b.DrawBox(2816.,minhist,3070.,maxhist); |
588 |
b.SetFillColor(6); |
} |
589 |
b.SetFillStyle(3945); |
else if(nn==4){ |
590 |
b.DrawBox(2560.,2200.,2816.,maxhist); |
b.DrawBox(256.,minhist,512.,maxhist); |
591 |
b.DrawBox(1024.,2200.,1535.,maxhist); |
b.DrawBox(1792.,minhist,1920.,maxhist); |
592 |
|
b.DrawBox(2816.,minhist,3070.,maxhist); |
593 |
b.SetFillColor(107); |
} |
594 |
b.SetFillStyle(3954); |
else if(nn==5){ |
595 |
b.DrawBox(512.,2200.,768.,maxhist); |
b.DrawBox(0.,minhist,256.,maxhist); |
596 |
b.DrawBox(1536.,2200.,1792.,maxhist); |
b.DrawBox(896.,minhist,1024.,maxhist); |
597 |
} |
b.DrawBox(1664.,minhist,1792.,maxhist); |
598 |
else if(nn==7){ |
} |
599 |
maxhist=histoped[nn]->GetMaximum(); |
else if(nn==6){ |
600 |
b.SetFillColor(107); |
b.DrawBox(512.,minhist,768.,maxhist); |
601 |
b.SetFillStyle(3954); |
b.DrawBox(1024.,minhist,1280.,maxhist); |
602 |
b.DrawBox(512.,700.,768.,maxhist); |
b.DrawBox(1280.,minhist,1792.,maxhist); |
603 |
} |
b.DrawBox(2560.,minhist,2816.,maxhist); |
604 |
else if(nn==9){ |
} |
605 |
maxhist=histoped[nn]->GetMaximum(); |
else if(nn==7){ |
606 |
b.SetFillColor(107); |
b.DrawBox(0.,minhist,1535.,maxhist); |
607 |
b.SetFillStyle(3954); |
b.DrawBox(2024.,minhist,2280.,maxhist); |
608 |
b.DrawBox(256.,700.,384.,maxhist); |
} |
609 |
} |
else if(nn==8){ |
610 |
else if(nn==11){ |
b.DrawBox(512.,minhist,768.,maxhist); |
611 |
maxhist=histoped[nn]->GetMaximum(); |
} |
612 |
b.SetFillColor(6); |
else if(nn==9){ |
613 |
b.SetFillStyle(3945); |
b.DrawBox(0.,minhist,128.,maxhist); |
614 |
b.DrawBox(768.,700.,1024.,maxhist); |
b.DrawBox(256.,minhist,384.,maxhist); |
615 |
|
b.DrawBox(512.,minhist,640.,maxhist); |
616 |
b.SetFillColor(107); |
b.DrawBox(896.,minhist,1152.,maxhist); |
617 |
b.SetFillStyle(3954); |
b.DrawBox(1280.,minhist,1535.,maxhist); |
618 |
b.DrawBox(0.,700.,512.,maxhist); |
b.DrawBox(1664.,minhist,1920.,maxhist); |
619 |
b.DrawBox(1920.,700.,2560.,maxhist); |
b.DrawBox(2048.,minhist,2304.,maxhist); |
620 |
} |
} |
621 |
// } |
else if(nn==10){ |
622 |
// else histoped[nn]->Draw("axis"); |
b.DrawBox(0.,minhist,512.,maxhist); |
623 |
|
b.DrawBox(1024.,minhist,3070.,maxhist); |
624 |
|
} |
625 |
|
else if(nn==11){ |
626 |
|
b.DrawBox(0.,minhist,512.,maxhist); |
627 |
|
b.DrawBox(768.,minhist,1024.,maxhist); |
628 |
|
b.DrawBox(1536.,minhist,1664.,maxhist); |
629 |
|
b.DrawBox(1920.,minhist,2560.,maxhist); |
630 |
|
b.DrawBox(2816.,minhist,3070.,maxhist); |
631 |
|
} |
632 |
|
// } |
633 |
|
// else histoped[nn]->Draw("axis"); |
634 |
histoaped[nn]->Draw("same"); |
histoaped[nn]->Draw("same"); |
635 |
if((nn+1)%2==1) { |
if((nn+1)%2==1) { |
636 |
li.DrawLine(1024.5,2200,1024.5,3200); |
for(int va=1; va<24; va++){ |
637 |
li.DrawLine(2048.5,2200,2048.5,3200); |
va1x=128*va; |
638 |
|
liva1.DrawLine(va1x,2200.,va1x,3200.); |
639 |
|
} |
640 |
|
li.DrawLine(1024.5,2200.,1024.5,3200.); |
641 |
|
li.DrawLine(2048.5,2200.,2048.5,3200.); |
642 |
} |
} |
643 |
if((nn+1)%2==0) { |
if((nn+1)%2==0) { |
644 |
|
for(int va=1; va<24; va++){ |
645 |
|
va1x=128*va; |
646 |
|
liva1.DrawLine(va1x,700.,va1x,1700.); |
647 |
|
} |
648 |
li.DrawLine(1024.5,700,1024.5,1700); |
li.DrawLine(1024.5,700,1024.5,1700); |
649 |
li.DrawLine(2048.5,700,2048.5,1700); |
li.DrawLine(2048.5,700,2048.5,1700); |
650 |
} |
} |
671 |
histosig[nn]->GetYaxis()->CenterTitle(); |
histosig[nn]->GetYaxis()->CenterTitle(); |
672 |
histoasig[nn]->SetLineColor(5); |
histoasig[nn]->SetLineColor(5); |
673 |
histoasig[nn]->SetLineWidth(1); |
histoasig[nn]->SetLineWidth(1); |
674 |
// if(ctrk.good0[0]==1 && ctrk.good0[1]==1){ |
// if(ctrk.good0[0]==1 && ctrk.good0[1]==1){ |
675 |
histosig[nn]->Draw("b"); |
histosig[nn]->Draw("b"); |
676 |
if(nn==1){ |
maxhist=histosig[nn]->GetMaximum(); |
677 |
maxhist=histosig[nn]->GetMaximum(); |
minhist=0.; |
678 |
b.SetFillColor(6); |
b.SetFillColor(19); |
679 |
b.SetFillStyle(3945); |
b.SetFillStyle(3945); |
680 |
b.DrawBox(2944.,0.,3060.,maxhist); |
if(nn==0){ |
681 |
|
b.DrawBox(0.,minhist,2047.,maxhist); |
682 |
b.SetFillColor(107); |
} |
683 |
b.SetFillStyle(3954); |
else if(nn==1){ |
684 |
b.DrawBox(2816.,0.,2944.,maxhist); |
b.DrawBox(128.,minhist,256.,maxhist); |
685 |
b.DrawBox(2048.,0.,2176.,maxhist); |
b.DrawBox(384.,minhist,512.,maxhist); |
686 |
} |
b.DrawBox(896.,minhist,1024.,maxhist); |
687 |
else if(nn==4){ |
b.DrawBox(2048.,minhist,2432.,maxhist); |
688 |
maxhist=histosig[nn]->GetMaximum(); |
b.DrawBox(2816.,minhist,2944.,maxhist); |
689 |
b.SetFillColor(107); |
b.DrawBox(2944.,minhist,3070.,maxhist); |
690 |
b.SetFillStyle(3954); |
} |
691 |
b.DrawBox(384.,0.,512.,maxhist); |
else if(nn==3){ |
692 |
} |
b.DrawBox(0.,minhist,256.,maxhist); |
693 |
else if(nn==6){ |
b.DrawBox(2816.,minhist,3070.,maxhist); |
694 |
maxhist=histosig[nn]->GetMaximum(); |
} |
695 |
b.SetFillColor(6); |
else if(nn==4){ |
696 |
b.SetFillStyle(3945); |
b.DrawBox(256.,minhist,512.,maxhist); |
697 |
b.DrawBox(2560.,0.,2816.,maxhist); |
b.DrawBox(1792.,minhist,1920.,maxhist); |
698 |
b.DrawBox(1024.,0.,1535.,maxhist); |
b.DrawBox(2816.,minhist,3070.,maxhist); |
699 |
|
} |
700 |
b.SetFillColor(107); |
else if(nn==5){ |
701 |
b.SetFillStyle(3954); |
b.DrawBox(0.,minhist,256.,maxhist); |
702 |
b.DrawBox(512.,0.,768.,maxhist); |
b.DrawBox(896.,minhist,1024.,maxhist); |
703 |
b.DrawBox(1536.,0.,1792.,maxhist); |
b.DrawBox(1664.,minhist,1792.,maxhist); |
704 |
} |
} |
705 |
else if(nn==7){ |
else if(nn==6){ |
706 |
maxhist=histosig[nn]->GetMaximum(); |
b.DrawBox(512.,minhist,768.,maxhist); |
707 |
b.SetFillColor(107); |
b.DrawBox(1024.,minhist,1280.,maxhist); |
708 |
b.SetFillStyle(3954); |
b.DrawBox(1280.,minhist,1792.,maxhist); |
709 |
b.DrawBox(512.,0.,768.,maxhist); |
b.DrawBox(2560.,minhist,2816.,maxhist); |
710 |
} |
} |
711 |
else if(nn==9){ |
else if(nn==7){ |
712 |
maxhist=histosig[nn]->GetMaximum(); |
b.DrawBox(0.,minhist,1535.,maxhist); |
713 |
b.SetFillColor(107); |
b.DrawBox(2024.,minhist,2280.,maxhist); |
714 |
b.SetFillStyle(3954); |
} |
715 |
b.DrawBox(256.,0.,384.,maxhist); |
else if(nn==8){ |
716 |
} |
b.DrawBox(512.,minhist,768.,maxhist); |
717 |
else if(nn==11){ |
} |
718 |
maxhist=histosig[nn]->GetMaximum(); |
else if(nn==9){ |
719 |
b.SetFillColor(6); |
b.DrawBox(0.,minhist,128.,maxhist); |
720 |
b.SetFillStyle(3945); |
b.DrawBox(256.,minhist,384.,maxhist); |
721 |
b.DrawBox(768.,0.,1024.,maxhist); |
b.DrawBox(512.,minhist,640.,maxhist); |
722 |
|
b.DrawBox(896.,minhist,1152.,maxhist); |
723 |
b.SetFillColor(107); |
b.DrawBox(1280.,minhist,1535.,maxhist); |
724 |
b.SetFillStyle(3954); |
b.DrawBox(1664.,minhist,1920.,maxhist); |
725 |
b.DrawBox(0.,0.,512.,maxhist); |
b.DrawBox(2048.,minhist,2304.,maxhist); |
726 |
b.DrawBox(1920.,0.,2560.,maxhist); |
} |
727 |
} |
else if(nn==10){ |
728 |
// } |
b.DrawBox(0.,minhist,512.,maxhist); |
729 |
// else histosig[nn]->Draw("axis"); |
b.DrawBox(1024.,minhist,3070.,maxhist); |
730 |
|
} |
731 |
|
else if(nn==11){ |
732 |
|
b.DrawBox(0.,minhist,512.,maxhist); |
733 |
|
b.DrawBox(768.,minhist,1024.,maxhist); |
734 |
|
b.DrawBox(1536.,minhist,1664.,maxhist); |
735 |
|
b.DrawBox(1920.,minhist,2560.,maxhist); |
736 |
|
b.DrawBox(2816.,minhist,3070.,maxhist); |
737 |
|
} |
738 |
|
// } |
739 |
|
// else histosig[nn]->Draw("axis"); |
740 |
histoasig[nn]->Draw("same"); |
histoasig[nn]->Draw("same"); |
741 |
|
for(int va=1; va<24; va++){ |
742 |
|
va1x=128*va; |
743 |
|
liva1.DrawLine(va1x,0.,va1x,max); |
744 |
|
} |
745 |
li.DrawLine(1024.5,0,1024.5,max); |
li.DrawLine(1024.5,0,1024.5,max); |
746 |
li.DrawLine(2048.5,0,2048.5,max); |
li.DrawLine(2048.5,0,2048.5,max); |
747 |
|
c2->Update();//draw pads in canvas |
748 |
|
|
749 |
for(int ii=0;ii<3;ii++){ |
for(int ii=0;ii<3;ii++){ |
750 |
sig->cd(); |
sig->cd(); |