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