3 |
#include <EventHeader.h> |
#include <EventHeader.h> |
4 |
|
|
5 |
#include <fstream> |
#include <fstream> |
6 |
|
#include <vector> |
7 |
|
|
8 |
#include <TCanvas.h> |
#include <TCanvas.h> |
9 |
#include <TLatex.h> |
#include <TLatex.h> |
433 |
ACheader[0]=0xAC11; |
ACheader[0]=0xAC11; |
434 |
ACheader[1]=0xAC22; |
ACheader[1]=0xAC22; |
435 |
|
|
436 |
|
vector<int> Err_type(0); |
437 |
|
vector<float> Err_obt(0); |
438 |
|
vector<int> Err_evt(0); |
439 |
|
|
440 |
|
|
441 |
Int_t *det_map = new Int_t[12]; |
Int_t *det_map = new Int_t[12]; |
442 |
det_map[0]=2; |
det_map[0]=2; |
443 |
det_map[1]=14; |
det_map[1]=14; |
546 |
} |
} |
547 |
|
|
548 |
TH1D *status_h = new TH1D("Status","Status",12,0.,12.); |
TH1D *status_h = new TH1D("Status","Status",12,0.,12.); |
549 |
status_h->GetXaxis()->SetBinLabel(1,"CRC event M"); |
status_h->GetXaxis()->SetBinLabel(1,"Headers M"); |
550 |
status_h->GetXaxis()->SetBinLabel(2,"Headers M"); |
status_h->GetXaxis()->SetBinLabel(2,"CRC M"); |
551 |
status_h->GetXaxis()->SetBinLabel(3,"CRC M"); |
status_h->GetXaxis()->SetBinLabel(3,"Dsp M"); |
552 |
status_h->GetXaxis()->SetBinLabel(4,"Dsp M"); |
status_h->GetXaxis()->SetBinLabel(4,"Temp M"); |
553 |
status_h->GetXaxis()->SetBinLabel(5,"Temp M"); |
status_h->GetXaxis()->SetBinLabel(5,"Reg M"); |
554 |
status_h->GetXaxis()->SetBinLabel(6,"Reg M"); |
status_h->GetXaxis()->SetBinLabel(6,"CRC Event M"); |
555 |
status_h->GetXaxis()->SetBinLabel(7,"CRC event E"); |
status_h->GetXaxis()->SetBinLabel(7,"Headers E"); |
556 |
status_h->GetXaxis()->SetBinLabel(8,"Headers E"); |
status_h->GetXaxis()->SetBinLabel(8,"CRC E"); |
557 |
status_h->GetXaxis()->SetBinLabel(9,"CRC E"); |
status_h->GetXaxis()->SetBinLabel(9,"Dsp E"); |
558 |
status_h->GetXaxis()->SetBinLabel(10,"Dsp E"); |
status_h->GetXaxis()->SetBinLabel(10,"Temp E"); |
559 |
status_h->GetXaxis()->SetBinLabel(11,"Temp E"); |
status_h->GetXaxis()->SetBinLabel(11,"Reg E"); |
560 |
status_h->GetXaxis()->SetBinLabel(12,"Reg E"); |
status_h->GetXaxis()->SetBinLabel(12,"CRC Event E"); |
561 |
status_h->GetYaxis()->SetTitle("# of Errors"); |
status_h->GetYaxis()->SetTitle("# of Errors"); |
562 |
status_h->SetMinimum(0); |
status_h->SetMinimum(0); |
563 |
|
|
661 |
} |
} |
662 |
|
|
663 |
//Status |
//Status |
664 |
if((ace->header[card][0] != 0xACAC) || (ace->header[card][1] != ACheader[card])) |
if((ace->header[card][0] != 0xACAC) || (ace->header[card][1] != ACheader[card])){ |
665 |
|
status_h->Fill(6.*card,1.); |
666 |
|
Err_type.push_back(6*card); |
667 |
|
Err_obt.push_back(ph->GetOrbitalTime()); |
668 |
|
Err_evt.push_back(i); |
669 |
|
} |
670 |
|
if((ace->status[card] & 0x8000) < 0x8000){ //crc |
671 |
status_h->Fill(1.+6.*card,1.); |
status_h->Fill(1.+6.*card,1.); |
672 |
if((ace->status[card] & 0x8000) < 0x8000) //crc |
Err_type.push_back(1+6*card); |
673 |
|
Err_obt.push_back(ph->GetOrbitalTime()); |
674 |
|
Err_evt.push_back(i); |
675 |
|
} |
676 |
|
if((ace->status[card] & 0x6000) < 0x6000){ //dsp |
677 |
status_h->Fill(2.+6.*card,1.); |
status_h->Fill(2.+6.*card,1.); |
678 |
if((ace->status[card] & 0x6000) < 0x6000) //dsp |
Err_type.push_back(2+6*card); |
679 |
|
Err_obt.push_back(ph->GetOrbitalTime()); |
680 |
|
Err_evt.push_back(i); |
681 |
|
} |
682 |
|
if((ace->status[card] & 0x0E00) < 0x0E00){ //temp |
683 |
status_h->Fill(3.+6.*card,1.); |
status_h->Fill(3.+6.*card,1.); |
684 |
if((ace->status[card] & 0x0E00) < 0x0E00) //temp |
Err_type.push_back(3+6*card); |
685 |
|
Err_obt.push_back(ph->GetOrbitalTime()); |
686 |
|
Err_evt.push_back(i); |
687 |
|
} |
688 |
|
if((ace->status[card] & 0x01FF) < 0x01FF){ //reg |
689 |
status_h->Fill(4.+6.*card,1.); |
status_h->Fill(4.+6.*card,1.); |
690 |
if((ace->status[card] & 0x01FF) < 0x01FF) //reg |
Err_type.push_back(4+6*card); |
691 |
status_h->Fill(4.+6*card,1.); |
Err_obt.push_back(ph->GetOrbitalTime()); |
692 |
|
Err_evt.push_back(i); |
693 |
|
} |
694 |
|
|
695 |
//temperature (left on cards) |
//temperature (left on cards) |
696 |
temp_gr[card][0][paramEvent] += ( ((ace->temp[card][0] & 0x00FF))*2.8 - 273. )/(Float_t)INTERVAL; |
temp_gr[card][0][paramEvent] += ( ((ace->temp[card][0] & 0x00FF))*2.8 - 273. )/(Float_t)INTERVAL; |
699 |
temp_gr[card][3][paramEvent] += ( ((ace->temp[card][1] & 0xFF00)/256)*2.8 - 273. )/(Float_t)INTERVAL; |
temp_gr[card][3][paramEvent] += ( ((ace->temp[card][1] & 0xFF00)/256)*2.8 - 273. )/(Float_t)INTERVAL; |
700 |
|
|
701 |
}//if(crc check) |
}//if(crc check) |
702 |
else |
else{ |
703 |
status_h->Fill(6.*card,1.); //event crc |
status_h->Fill(5.+6.*card,1.); //event crc |
704 |
|
Err_type.push_back(5+6*card); |
705 |
|
Err_obt.push_back(ph->GetOrbitalTime()); |
706 |
|
Err_evt.push_back(i); |
707 |
|
} |
708 |
}//for(card) |
}//for(card) |
709 |
|
|
710 |
nmbhitpmtCARD_h->Fill(hitsCARD); |
nmbhitpmtCARD_h->Fill(hitsCARD); |
737 |
|
|
738 |
} //for(events) |
} //for(events) |
739 |
|
|
740 |
//time2 = clock(); |
//for(Int_t i=0;i<Err_type.size();i++) |
741 |
|
//printf("%d\t%f\t%d\n\n",Err_type.at(i),Err_obt.at(i),Err_evt.at(i)); |
742 |
|
|
743 |
|
//Time2 = clock(); |
744 |
//printf("Loop time: %f\n",(Double_t) (time2 - time1) / (Double_t) CLOCKS_PER_SEC); |
//printf("Loop time: %f\n",(Double_t) (time2 - time1) / (Double_t) CLOCKS_PER_SEC); |
745 |
|
|
746 |
/****************************** PLOTTING ***************************/ |
/****************************** PLOTTING ***************************/ |
772 |
pd4->cd(); |
pd4->cd(); |
773 |
char namn3[30]; |
char namn3[30]; |
774 |
char namn4[40]; |
char namn4[40]; |
775 |
|
char namn5[30]; |
776 |
sprintf(namn3,"Anticounter Quicklook v%.1f",VERSION); |
sprintf(namn3,"Anticounter Quicklook v%.1f",VERSION); |
777 |
sprintf(namn4,"File: %s",fileName.Data()); |
sprintf(namn4,"File: %s",fileName.Data()); |
778 |
|
sprintf(namn5,"Events: %d",nevents); |
779 |
t->SetTextSize(0.1); |
t->SetTextSize(0.1); |
780 |
t->DrawLatex(5,90,namn3); |
t->DrawLatex(5,90,namn3); |
781 |
t->SetTextSize(0.1); |
t->SetTextSize(0.1); |
782 |
t->DrawLatex(20,50,namn4); |
t->DrawLatex(20,50,namn4); |
783 |
|
t->DrawLatex(20,40,namn5); |
784 |
|
|
785 |
t->SetTextSize(0.02); |
t->SetTextSize(0.02); |
786 |
|
|
803 |
temperatureACTEL_M_g->SetMarkerColor(2); |
temperatureACTEL_M_g->SetMarkerColor(2); |
804 |
temperatureLEFT_M_g->SetMarkerColor(3); |
temperatureLEFT_M_g->SetMarkerColor(3); |
805 |
temperatureDSP_M_g->SetMarkerColor(4); |
temperatureDSP_M_g->SetMarkerColor(4); |
806 |
temperatureRIGHT_M_g->Draw("AP"); |
temperatureRIGHT_M_g->SetLineColor(1); |
807 |
temperatureACTEL_M_g->Draw("PSAME"); |
temperatureACTEL_M_g->SetLineColor(2); |
808 |
temperatureLEFT_M_g->Draw("PSAME"); |
temperatureLEFT_M_g->SetLineColor(3); |
809 |
temperatureDSP_M_g->Draw("PSAME"); |
temperatureDSP_M_g->SetLineColor(4); |
810 |
|
temperatureRIGHT_M_g->Draw("AL"); |
811 |
|
temperatureACTEL_M_g->Draw("LSAME"); |
812 |
|
temperatureLEFT_M_g->Draw("LSAME"); |
813 |
|
temperatureDSP_M_g->Draw("LSAME"); |
814 |
|
|
815 |
TLegend *legTempM = new TLegend(0.72,0.63,0.85,0.8); |
TLegend *legTempM = new TLegend(0.72,0.63,0.85,0.8); |
816 |
legTempM->AddEntry(temperatureRIGHT_M_g,"Right","P"); |
legTempM->AddEntry(temperatureRIGHT_M_g,"Right","P"); |
1024 |
singles_Pads[k]->cd(); |
singles_Pads[k]->cd(); |
1025 |
singles_gr[card][det_map[k]][0]=0.0; |
singles_gr[card][det_map[k]][0]=0.0; |
1026 |
singlesrate_g[card][k] = new TGraph(paramEvents,event_obt,singles_gr[card][det_map[k]]); |
singlesrate_g[card][k] = new TGraph(paramEvents,event_obt,singles_gr[card][det_map[k]]); |
1027 |
singlesrate_g[card][k]->SetMarkerColor(card+1); |
singlesrate_g[card][k]->SetLineColor(card+1); |
1028 |
singlesrate_g[card][k]->GetXaxis()->SetTitle("Obt [ms]"); |
singlesrate_g[card][k]->GetXaxis()->SetTitle("Obt [ms]"); |
1029 |
singlesrate_g[card][k]->GetYaxis()->SetTitle("f [Hz]"); |
singlesrate_g[card][k]->GetYaxis()->SetTitle("f [Hz]"); |
1030 |
singlesrate_g[card][k]->SetTitle(detector[det_map[k]].Data()); |
singlesrate_g[card][k]->SetTitle(detector[det_map[k]].Data()); |
1031 |
if(card==0) |
if(card==0) |
1032 |
singlesrate_g[card][k]->Draw("AP"); |
singlesrate_g[card][k]->Draw("AL"); |
1033 |
else |
else |
1034 |
singlesrate_g[card][k]->Draw("PSAME"); |
singlesrate_g[card][k]->Draw("LSAME"); |
1035 |
k++; |
k++; |
1036 |
} |
} |
1037 |
} |
} |
1095 |
} |
} |
1096 |
} |
} |
1097 |
} |
} |
1098 |
|
|
1099 |
|
// Plot error report if any error occurs |
1100 |
|
|
1101 |
|
//char *namn6 = "KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK"; |
1102 |
|
int mposition = 80; |
1103 |
|
int eposition = 80; |
1104 |
|
char *mystring = "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"; |
1105 |
|
TString *merr; |
1106 |
|
TBox *b1,*b2; |
1107 |
|
|
1108 |
|
TCanvas *sheetError; |
1109 |
|
|
1110 |
figsave = Form("%s/%s_AcQLOOK1.%s",outDir.Data(),fileName.Data(),format.Data()); |
if(Err_type.size() > 0) |
1111 |
|
{ |
1112 |
|
merr = new TString[12]; |
1113 |
|
merr[0]="Header"; |
1114 |
|
merr[1]="CRC"; |
1115 |
|
merr[2]="Dsp"; |
1116 |
|
merr[3]="Temp"; |
1117 |
|
merr[4]="Reg"; |
1118 |
|
merr[5]="Event CRC"; |
1119 |
|
merr[6]="Header"; |
1120 |
|
merr[7]="CRC"; |
1121 |
|
merr[8]="Dsp"; |
1122 |
|
merr[9]="Temp"; |
1123 |
|
merr[10]="Reg"; |
1124 |
|
merr[11]="Event CRC"; |
1125 |
|
|
1126 |
|
sheetError = new TCanvas("Sheet Error","Sheet Error"); //base |
1127 |
|
sheetError->Range(0,0,100,100); |
1128 |
|
sheetError->Draw(); |
1129 |
|
b1 = new TBox(10,83.5,90,84.5); |
1130 |
|
b2 = new TBox(49.5,90,50.5,5); |
1131 |
|
b1->SetFillColor(1); |
1132 |
|
b2->SetFillColor(1); |
1133 |
|
b1->Draw(); |
1134 |
|
b2->Draw(); |
1135 |
|
|
1136 |
|
t->SetTextFont(40); |
1137 |
|
t->SetTextColor(1); |
1138 |
|
t->SetTextAlign(12); |
1139 |
|
t->SetTextSize(0.04); |
1140 |
|
namn = "AntiCounter Error Report"; |
1141 |
|
t->DrawLatex(37,94,namn); |
1142 |
|
t->SetTextColor(1); |
1143 |
|
namn = "MAIN card"; |
1144 |
|
t->DrawLatex(15,87,namn); |
1145 |
|
t->SetTextColor(1); |
1146 |
|
namn = "EXTRA card"; |
1147 |
|
t->DrawLatex(65,87,namn); |
1148 |
|
t->SetTextSize(0.015); |
1149 |
|
|
1150 |
|
|
1151 |
|
//for(Int_t i=0;i<Err_type.size();i++) |
1152 |
|
UInt_t iter = 0; |
1153 |
|
while(iter<Err_type.size()) |
1154 |
|
{ |
1155 |
|
mystring = Form("%s error obt %d \t event nmb %d",merr[Err_type.at(iter)].Data(),(int)Err_obt.at(iter),Err_evt.at(iter)); |
1156 |
|
t->SetTextColor(2); |
1157 |
|
if(Err_type.at(iter) < 7 && mposition>10){ |
1158 |
|
mposition -= 2; |
1159 |
|
t->DrawLatex(15,mposition,mystring); |
1160 |
|
} |
1161 |
|
else if(eposition>10){ |
1162 |
|
eposition -= 2; |
1163 |
|
t->DrawLatex(65,eposition,mystring); |
1164 |
|
} |
1165 |
|
iter++; |
1166 |
|
} |
1167 |
|
if(mposition<10) |
1168 |
|
t->DrawLatex(15,5,"More errors in run!"); |
1169 |
|
if(eposition<10) |
1170 |
|
t->DrawLatex(65,5,"More errors in run!"); |
1171 |
|
|
1172 |
|
figsave = Form("%s/%s_AcQLOOK_Error.%s",outDir.Data(),fileName.Data(),format.Data()); |
1173 |
|
sheetError->SaveAs(figsave); |
1174 |
|
} |
1175 |
|
|
1176 |
|
figsave = Form("%s/%s_AcQLOOK_Status.%s",outDir.Data(),fileName.Data(),format.Data()); |
1177 |
sheet1->SaveAs(figsave); |
sheet1->SaveAs(figsave); |
1178 |
|
|
1179 |
figsave = Form("%s/%s_AcQLOOK2.%s",outDir.Data(),fileName.Data(),format.Data()); |
figsave = Form("%s/%s_AcQLOOK_Trigger.%s",outDir.Data(),fileName.Data(),format.Data()); |
1180 |
sheet2->SaveAs(figsave); |
sheet2->SaveAs(figsave); |
1181 |
|
|
1182 |
figsave = Form("%s/%s_AcQLOOK3.%s",outDir.Data(),fileName.Data(),format.Data()); |
figsave = Form("%s/%s_AcQLOOK_Singles.%s",outDir.Data(),fileName.Data(),format.Data()); |
1183 |
sheet3->SaveAs(figsave); |
sheet3->SaveAs(figsave); |
1184 |
|
|
1185 |
figsave = Form("%s/%s_AcQLOOK4.%s",outDir.Data(),fileName.Data(),format.Data()); |
figsave = Form("%s/%s_AcQLOOK_Shift.%s",outDir.Data(),fileName.Data(),format.Data()); |
1186 |
sheet4->SaveAs(figsave); |
sheet4->SaveAs(figsave); |
1187 |
|
|
|
|
|
1188 |
delete sheet1; |
delete sheet1; |
1189 |
delete hitmap_h[0]; |
delete hitmap_h[0]; |
1190 |
delete hitmap_h[1]; |
delete hitmap_h[1]; |
1193 |
//printf("Draw time: %f\n\n",(Double_t) (stopTime - time2) / (Double_t) CLOCKS_PER_SEC); |
//printf("Draw time: %f\n\n",(Double_t) (stopTime - time2) / (Double_t) CLOCKS_PER_SEC); |
1194 |
//printf("Exc time: %f\n",(Double_t) (stopTime-startTime) / (Double_t) CLOCKS_PER_SEC); |
//printf("Exc time: %f\n",(Double_t) (stopTime-startTime) / (Double_t) CLOCKS_PER_SEC); |
1195 |
|
|
|
|
|
1196 |
return 1; |
return 1; |
1197 |
|
|
1198 |
} |
} |