| 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> |
| 15 |
#include <TObjString.h> |
#include <TObjString.h> |
| 16 |
#include <TGraph.h> |
#include <TGraph.h> |
| 17 |
#include <TH1.h> |
#include <TH1.h> |
| 18 |
|
#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.4 |
#define VERSION 1.5 |
| 24 |
#define INTERVAL 100 |
#define INTERVAL 100 |
| 25 |
|
#define FORMAT "png" |
| 26 |
|
|
| 27 |
using namespace std; |
using namespace std; |
| 28 |
|
|
| 29 |
|
UInt_t found; |
| 30 |
Int_t minevent,maxevent; |
Int_t minevent,maxevent; |
| 31 |
UShort_t ACheader[2]; |
UShort_t ACheader[2]; |
| 32 |
TString *cardname = new TString[2]; |
TString *cardname = new TString[2]; |
| 33 |
TString *detector = new TString[16]; |
TString *detector = new TString[16]; |
| 34 |
|
|
| 35 |
|
|
| 36 |
int AcQLOOKbasic(TString base,int fromevent=0, int toevent=0, TString outDir = "./", TString format = "jpg"){ |
int AcQLOOKbasic(TString base,int fromevent=0, int toevent=0, TString outDir = "./", TString format = FORMAT){ |
| 37 |
|
|
| 38 |
ofstream outputFile; |
ofstream outputFile; |
| 39 |
stringstream oss; |
stringstream oss; |
| 52 |
//Takes the tree of the header file |
//Takes the tree of the header file |
| 53 |
TTree *tr = (TTree*)rootFile->Get("Physics"); |
TTree *tr = (TTree*)rootFile->Get("Physics"); |
| 54 |
|
|
| 55 |
|
tr->SetBranchStatus("*",0,&found); //disable all branches |
| 56 |
|
|
| 57 |
|
tr->SetBranchStatus("header*",1,&found); |
| 58 |
|
// printf("header: enabled %i branches \n",found); |
| 59 |
|
found = 0; |
| 60 |
|
tr->SetBranchStatus("status*",1,&found); |
| 61 |
|
// printf("status: enabled %i branches \n",found); |
| 62 |
|
found = 0; |
| 63 |
|
tr->SetBranchStatus("hitmap*",1,&found); |
| 64 |
|
// printf("hitmap: enabled %i branches \n",found); |
| 65 |
|
found = 0; |
| 66 |
|
tr->SetBranchStatus("regist*",1,&found); |
| 67 |
|
// printf("regist: enabled %i branches \n",found); |
| 68 |
|
found = 0; |
| 69 |
|
tr->SetBranchStatus("shift*",1,&found); |
| 70 |
|
// printf("shift: enabled %i branches \n",found); |
| 71 |
|
found = 0; |
| 72 |
|
tr->SetBranchStatus("counters*",1,&found); |
| 73 |
|
// printf("counters: enabled %i branches \n",found); |
| 74 |
|
found = 0; |
| 75 |
|
tr->SetBranchStatus("coinc*",1,&found); |
| 76 |
|
// printf("coinc: enabled %i branches \n",found); |
| 77 |
|
found = 0; |
| 78 |
|
tr->SetBranchStatus("trigg*",1,&found); |
| 79 |
|
// printf("trigg: enabled %i branches \n",found); |
| 80 |
|
found = 0; |
| 81 |
|
tr->SetBranchStatus("clock*",1,&found); |
| 82 |
|
// printf("clock: enabled %i branches \n",found); |
| 83 |
|
found = 0; |
| 84 |
|
tr->SetBranchStatus("temp*",1,&found); |
| 85 |
|
// printf("temp: enabled %i branches \n",found); |
| 86 |
|
found = 0; |
| 87 |
|
tr->SetBranchStatus("DAC*",1,&found); |
| 88 |
|
// printf("DAC: enabled %i branches \n",found); |
| 89 |
|
found = 0; |
| 90 |
|
tr->SetBranchStatus("CRC*",1,&found); |
| 91 |
|
// printf("CRC: enabled %i branches \n",found); |
| 92 |
|
|
| 93 |
|
found = 0; |
| 94 |
|
tr->SetBranchStatus("Pscu*",1,&found); |
| 95 |
|
// printf("enabled %i branches \n",found); |
| 96 |
|
found = 0; |
| 97 |
|
tr->SetBranchStatus("Anticounter*",1,&found); |
| 98 |
|
// printf("Ac enabled %i branches \n",found); |
| 99 |
|
found = 0; |
| 100 |
|
tr->SetBranchStatus("Header*",1,&found); |
| 101 |
|
// printf("head enabled %i branches \n",found); |
| 102 |
|
|
| 103 |
tr->SetBranchAddress("Anticounter", &ace); |
tr->SetBranchAddress("Anticounter", &ace); |
| 104 |
tr->SetBranchAddress("Header", &eh); |
tr->SetBranchAddress("Header", &eh); |
| 105 |
|
|
| 106 |
|
|
| 107 |
|
|
| 108 |
|
|
| 109 |
Int_t nevents = tr->GetEntries(); |
Int_t nevents = tr->GetEntries(); |
| 110 |
|
|
| 111 |
//check that the selected range of events is ok |
//check that the selected range of events is ok |
| 309 |
} //end AcBasic |
} //end AcBasic |
| 310 |
|
|
| 311 |
|
|
| 312 |
int AcQLOOKpro(TString base,int fromevent=0, int toevent=0, TString outDir = "./", TString format = "jpg"){ |
int AcQLOOKpro(TString base,int fromevent=0, int toevent=0, TString outDir = "./", TString format = FORMAT){ |
| 313 |
|
|
| 314 |
|
//Float_t startTime,stopTime; |
| 315 |
|
//Float_t time1,time2,time3,time4; |
| 316 |
|
|
| 317 |
|
//startTime = clock(); |
| 318 |
|
|
| 319 |
ofstream outputFile; |
ofstream outputFile; |
| 320 |
stringstream oss; |
stringstream oss; |
| 332 |
|
|
| 333 |
//Takes the tree of the header file |
//Takes the tree of the header file |
| 334 |
TTree *tr = (TTree*)rootFile->Get("Physics"); |
TTree *tr = (TTree*)rootFile->Get("Physics"); |
| 335 |
|
|
| 336 |
|
tr->SetBranchStatus("*",0,&found); //disable all branches |
| 337 |
|
|
| 338 |
|
tr->SetBranchStatus("header*",1,&found); |
| 339 |
|
// printf("header: enabled %i branches \n",found); |
| 340 |
|
found = 0; |
| 341 |
|
tr->SetBranchStatus("status*",1,&found); |
| 342 |
|
// printf("status: enabled %i branches \n",found); |
| 343 |
|
found = 0; |
| 344 |
|
tr->SetBranchStatus("hitmap*",1,&found); |
| 345 |
|
// printf("hitmap: enabled %i branches \n",found); |
| 346 |
|
found = 0; |
| 347 |
|
tr->SetBranchStatus("regist*",1,&found); |
| 348 |
|
// printf("regist: enabled %i branches \n",found); |
| 349 |
|
found = 0; |
| 350 |
|
tr->SetBranchStatus("shift*",1,&found); |
| 351 |
|
// printf("shift: enabled %i branches \n",found); |
| 352 |
|
found = 0; |
| 353 |
|
tr->SetBranchStatus("counters*",1,&found); |
| 354 |
|
// printf("counters: enabled %i branches \n",found); |
| 355 |
|
found = 0; |
| 356 |
|
tr->SetBranchStatus("coinc*",1,&found); |
| 357 |
|
// printf("coinc: enabled %i branches \n",found); |
| 358 |
|
found = 0; |
| 359 |
|
tr->SetBranchStatus("trigg*",1,&found); |
| 360 |
|
// printf("trigg: enabled %i branches \n",found); |
| 361 |
|
found = 0; |
| 362 |
|
tr->SetBranchStatus("clock*",1,&found); |
| 363 |
|
// printf("clock: enabled %i branches \n",found); |
| 364 |
|
found = 0; |
| 365 |
|
tr->SetBranchStatus("temp*",1,&found); |
| 366 |
|
// printf("temp: enabled %i branches \n",found); |
| 367 |
|
found = 0; |
| 368 |
|
tr->SetBranchStatus("DAC*",1,&found); |
| 369 |
|
// printf("DAC: enabled %i branches \n",found); |
| 370 |
|
found = 0; |
| 371 |
|
tr->SetBranchStatus("CRC*",1,&found); |
| 372 |
|
// printf("CRC: enabled %i branches \n",found); |
| 373 |
|
found = 0; |
| 374 |
|
|
| 375 |
|
tr->SetBranchStatus("Pscu*",1,&found); |
| 376 |
|
// printf("enabled %i branches \n",found); |
| 377 |
|
found = 0; |
| 378 |
|
tr->SetBranchStatus("Anticounter*",1,&found); |
| 379 |
|
// printf("Ac enabled %i branches \n",found); |
| 380 |
|
found = 0; |
| 381 |
|
tr->SetBranchStatus("Header*",1,&found); |
| 382 |
|
// printf("head enabled %i branches \n",found); |
| 383 |
|
|
| 384 |
tr->SetBranchAddress("Anticounter", &ace); |
tr->SetBranchAddress("Anticounter", &ace); |
| 385 |
tr->SetBranchAddress("Header", &eh); |
tr->SetBranchAddress("Header", &eh); |
| 386 |
|
|
| 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; |
| 430 |
Int_t paramEvents; |
Int_t paramEvents; |
| 431 |
Int_t minevent,maxevent; |
Int_t minevent,maxevent; |
| 432 |
char *figsave = " "; |
char *figsave = " "; |
|
Int_t ch_cnt; |
|
| 433 |
UShort_t ACheader[2]; |
UShort_t ACheader[2]; |
| 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; |
| 546 |
} |
} |
| 547 |
} |
} |
| 548 |
|
|
| 549 |
TH1D *status_h = new TH1D("Status","Status",10,0.,10.); |
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,"Reg M"); |
status_h->GetXaxis()->SetBinLabel(5,"Reg M"); |
| 555 |
status_h->GetXaxis()->SetBinLabel(6,"CRC event E"); |
status_h->GetXaxis()->SetBinLabel(6,"CRC Event M"); |
| 556 |
status_h->GetXaxis()->SetBinLabel(7,"Headers E"); |
status_h->GetXaxis()->SetBinLabel(7,"Headers E"); |
| 557 |
status_h->GetXaxis()->SetBinLabel(8,"CRC E"); |
status_h->GetXaxis()->SetBinLabel(8,"CRC E"); |
| 558 |
status_h->GetXaxis()->SetBinLabel(9,"Dsp E"); |
status_h->GetXaxis()->SetBinLabel(9,"Dsp E"); |
| 559 |
status_h->GetXaxis()->SetBinLabel(10,"Reg E"); |
status_h->GetXaxis()->SetBinLabel(10,"Temp E"); |
| 560 |
|
status_h->GetXaxis()->SetBinLabel(11,"Reg E"); |
| 561 |
|
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 |
|
|
| 598 |
|
|
| 599 |
/********************* MAIN LOOP **********************/ |
/********************* MAIN LOOP **********************/ |
| 600 |
|
|
| 601 |
//UShort_t tshift[16]; |
//time1 = clock(); |
| 602 |
|
//printf("Init time: %f\n",(Double_t) (time1 - startTime) / (Double_t) CLOCKS_PER_SEC); |
| 603 |
|
|
| 604 |
|
//iterators used in the loop |
| 605 |
|
Int_t card, ch, bin; |
| 606 |
|
|
| 607 |
for (Int_t i = minevent; i < maxevent; i++){ |
for (Int_t i = minevent; i < maxevent; i++){ |
| 608 |
|
|
| 614 |
|
|
| 615 |
hitsCARD=hitsCAT=hitsCAS=0; |
hitsCARD=hitsCAT=hitsCAS=0; |
| 616 |
|
|
| 617 |
/* |
for(card=0;card<2;card++) |
|
for(Int_t ii=0;ii<16;ii++) |
|
|
tshift[ii]=0; |
|
|
for(Int_t ii=0;ii<16;ii++) |
|
|
{ |
|
|
for(Int_t jj=0;jj<16;jj++) |
|
|
{ |
|
|
if(ace->shift[0][jj] & (1<<ii)) |
|
|
tshift[ii]=(1<<jj) | tshift[ii]; |
|
|
else |
|
|
tshift[ii]=(~(1<<jj)) & tshift[ii]; |
|
|
} |
|
|
for(Int_t kk=0;kk<16;kk++) |
|
|
shiftreg_h[0][ii]->Fill(kk,tshift[ii] & 0x1<<kk); |
|
|
} |
|
|
*/ |
|
|
//printf("johan %hx\n",tshift[0]); |
|
|
|
|
|
for(Int_t card=0;card<2;card++) |
|
| 618 |
{ |
{ |
| 619 |
//proceed only if crc of event is ok |
//proceed only if crc of event is ok |
| 620 |
/******************************************************/ |
//printf("CRC: %hx\n",ace->CRCcheck[card]); |
| 621 |
|
//printf("Hitmap: %hx\n\n",ace->hitmap[card]); |
| 622 |
if(ace->CRCcheck[card]==1) |
if(ace->CRCcheck[card]==1) |
| 623 |
{ |
{ |
| 624 |
//clock |
//clock |
| 633 |
time_between_trigg_h[card]->Fill( 0.000000025*ac_clock_diff[card] ); |
time_between_trigg_h[card]->Fill( 0.000000025*ac_clock_diff[card] ); |
| 634 |
|
|
| 635 |
//counters, singlesrate & shift reg content |
//counters, singlesrate & shift reg content |
| 636 |
for(Int_t ch=0;ch<16;ch++){ |
for(ch=0;ch<16;ch++) |
|
counter_old[card][ch] = counter_new[card][ch]; |
|
|
counter_new[card][ch] = ace->counters[card][ch]; |
|
|
if(counter_new[card][ch] - counter_old[card][ch] < 0.) |
|
|
counter_diff[card][ch] = 0xFFFF + counter_new[card][ch] - counter_old[card][ch]; |
|
|
else |
|
|
counter_diff[card][ch] = counter_new[card][ch] - counter_old[card][ch]; |
|
|
|
|
|
singles_gr[card][ch][paramEvent] += (Double_t)counter_diff[card][ch]; |
|
|
|
|
|
|
|
|
for(Int_t bin = 0; bin < 16; bin++){ |
|
|
shiftreg_h[card][bin]->Fill(ch,ace->shift[card][ch] & 0x1<<bin); |
|
|
} |
|
|
} |
|
|
|
|
|
//hitmap |
|
|
for(ch_cnt=0;ch_cnt<16;ch_cnt++) |
|
| 637 |
{ |
{ |
| 638 |
if( (ace->hitmap[card] & (0x1<<ch_cnt)) > 0 ){ |
counter_old[card][ch] = counter_new[card][ch]; |
| 639 |
hitmap_h[card]->Fill(ch_cnt,1.); |
counter_new[card][ch] = ace->counters[card][ch]; |
| 640 |
if(ch_cnt==0 || ch_cnt==4 || ch_cnt==8 || ch_cnt==12) |
if(counter_new[card][ch] - counter_old[card][ch] < 0.) |
| 641 |
|
counter_diff[card][ch] = 0xFFFF + counter_new[card][ch] - counter_old[card][ch]; |
| 642 |
|
else |
| 643 |
|
counter_diff[card][ch] = counter_new[card][ch] - counter_old[card][ch]; |
| 644 |
|
|
| 645 |
|
singles_gr[card][ch][paramEvent] += (Double_t)counter_diff[card][ch]; |
| 646 |
|
|
| 647 |
|
for(bin = 0; bin < 16; bin++){ |
| 648 |
|
shiftreg_h[card][bin]->Fill(ch,ace->shift[card][ch] & 0x1<<bin); |
| 649 |
|
} |
| 650 |
|
|
| 651 |
|
//hitmap |
| 652 |
|
if( (ace->hitmap[card] & (0x1<<ch)) > 0 ){ |
| 653 |
|
hitmap_h[card]->Fill(ch,1.); |
| 654 |
|
if(ch==0 || ch==4 || ch==8 || ch==12) |
| 655 |
hitsCARD++; |
hitsCARD++; |
| 656 |
else if(ch_cnt==1 || ch_cnt==5 || ch_cnt==9 || ch_cnt==13) |
else if(ch==1 || ch==5 || ch==9 || ch==13) |
| 657 |
hitsCAT++; |
hitsCAT++; |
| 658 |
else if(ch_cnt==2 || ch_cnt==6 || ch_cnt==10 || ch_cnt==14) |
else if(ch==2 || ch==6 || ch==10 || ch==14) |
| 659 |
hitsCAS++; |
hitsCAS++; |
| 660 |
} |
} |
| 661 |
|
|
| 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(1.+5.*card,1.); |
status_h->Fill(6.*card,1.); |
| 667 |
if((ace->status[card] & 0x8000) < 0x8000) //crc |
Err_type.push_back(6*card); |
| 668 |
status_h->Fill(2.+5.*card,1.); |
Err_obt.push_back(ph->GetOrbitalTime()); |
| 669 |
if((ace->status[card] & 0x4000) < 0x4000) //dsp |
Err_evt.push_back(i); |
| 670 |
status_h->Fill(3.+5.*card,1.); |
} |
| 671 |
if((ace->status[card] & 0x01FF) < 0x01FF) //reg |
if((ace->status[card] & 0x8000) < 0x8000){ //crc |
| 672 |
status_h->Fill(4.+5*card,1.); |
status_h->Fill(1.+6.*card,1.); |
| 673 |
|
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.); |
| 679 |
|
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.); |
| 685 |
|
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.); |
| 691 |
|
Err_type.push_back(4+6*card); |
| 692 |
|
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{ |
| 704 |
else |
status_h->Fill(5.+6.*card,1.); //event crc |
| 705 |
status_h->Fill(5.*card,1.); //event crc |
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); |
| 713 |
nmbhitpmtCAT_h->Fill(hitsCAT); |
nmbhitpmtCAT_h->Fill(hitsCAT); |
| 714 |
|
|
| 715 |
|
|
|
if(interval_cnt==(Int_t)((Float_t)INTERVAL/2.)) |
|
|
event_obt[paramEvent] = ph->GetOrbitalTime(); |
|
|
|
|
| 716 |
if(interval_cnt==INTERVAL) |
if(interval_cnt==INTERVAL) |
| 717 |
{ |
{ |
| 718 |
for(Int_t card=0;card<2;card++) |
event_obt[paramEvent] = ph->GetOrbitalTime(); |
| 719 |
|
|
| 720 |
|
for(card=0;card<2;card++) |
| 721 |
{ |
{ |
| 722 |
ac_clock100_old[card] = ac_clock100_new[card]; |
ac_clock100_old[card] = ac_clock100_new[card]; |
| 723 |
ac_clock100_new[card] = (ace->clock[card][1])*0xFFFF + ace->clock[card][0]; |
ac_clock100_new[card] = (ace->clock[card][1])*0xFFFF + ace->clock[card][0]; |
| 728 |
|
|
| 729 |
trigger_gr[card][paramEvent] = (Float_t)INTERVAL/(0.000000025*ac_clock100_diff[card]); |
trigger_gr[card][paramEvent] = (Float_t)INTERVAL/(0.000000025*ac_clock100_diff[card]); |
| 730 |
|
|
| 731 |
for(Int_t ch=0;ch<16;ch++) |
for(ch=0;ch<16;ch++) |
| 732 |
singles_gr[card][ch][paramEvent] = singles_gr[card][ch][paramEvent]/(Double_t)(0.000000025*ac_clock100_diff[card]); |
singles_gr[card][ch][paramEvent] = singles_gr[card][ch][paramEvent]/(Double_t)(0.000000025*ac_clock100_diff[card]); |
| 733 |
|
|
| 734 |
}//for(card) |
}//for(card) |
| 735 |
interval_cnt=0; |
interval_cnt=0; |
| 736 |
paramEvent++; |
paramEvent++; |
| 737 |
}//if(interval_cnt)) |
}//if(interval_cnt)) |
| 738 |
/* |
|
|
for(card=0;card<2;card++) |
|
|
for(Int_t ch=0;ch<16;ch++) |
|
|
for(Int_t bin=0;bin<16;bin++) |
|
|
shiftreg_h[card][ch]->Fill(bin,vec[card][bin][ch]); |
|
|
*/ |
|
| 739 |
} //for(events) |
} //for(events) |
| 740 |
|
|
| 741 |
|
//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); |
| 746 |
|
|
| 747 |
/****************************** PLOTTING ***************************/ |
/****************************** PLOTTING ***************************/ |
| 748 |
|
|
| 771 |
pd4->Draw(); |
pd4->Draw(); |
| 772 |
|
|
| 773 |
pd4->cd(); |
pd4->cd(); |
|
char *namn2 = "Anticounter Quicklook"; |
|
| 774 |
char namn3[30]; |
char namn3[30]; |
| 775 |
sprintf(namn3,"Version %.1f",VERSION); |
char namn4[40]; |
| 776 |
|
char namn5[30]; |
| 777 |
|
sprintf(namn3,"Anticounter Quicklook v%.1f",VERSION); |
| 778 |
|
sprintf(namn4,"File: %s",fileName.Data()); |
| 779 |
|
sprintf(namn5,"Events: %d",nevents); |
| 780 |
t->SetTextSize(0.1); |
t->SetTextSize(0.1); |
| 781 |
t->DrawLatex(20,60,namn2); |
t->DrawLatex(5,90,namn3); |
| 782 |
t->DrawLatex(20,40,namn3); |
t->SetTextSize(0.1); |
| 783 |
|
t->DrawLatex(20,50,namn4); |
| 784 |
|
t->DrawLatex(20,40,namn5); |
| 785 |
|
|
| 786 |
t->SetTextSize(0.02); |
t->SetTextSize(0.02); |
| 787 |
|
|
| 788 |
pd3->cd(); |
pd3->cd(); |
| 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"); |
| 832 |
temperatureACTEL_E_g->SetMarkerColor(2); |
temperatureACTEL_E_g->SetMarkerColor(2); |
| 833 |
temperatureLEFT_E_g->SetMarkerColor(3); |
temperatureLEFT_E_g->SetMarkerColor(3); |
| 834 |
temperatureDSP_E_g->SetMarkerColor(4); |
temperatureDSP_E_g->SetMarkerColor(4); |
| 835 |
|
temperatureRIGHT_E_g->SetLineColor(1); |
| 836 |
|
temperatureACTEL_E_g->SetLineColor(2); |
| 837 |
|
temperatureLEFT_E_g->SetLineColor(3); |
| 838 |
|
temperatureDSP_E_g->SetLineColor(4); |
| 839 |
|
|
| 840 |
|
|
| 841 |
temperatureRIGHT_E_g->SetMaximum(50.); |
temperatureRIGHT_E_g->SetMaximum(50.); |
| 842 |
temperatureRIGHT_E_g->SetMinimum(0.); |
temperatureRIGHT_E_g->SetMinimum(0.); |
| 843 |
temperatureRIGHT_E_g->Draw("AP"); |
temperatureRIGHT_E_g->Draw("AL"); |
| 844 |
temperatureACTEL_E_g->Draw("PSAME"); |
temperatureACTEL_E_g->Draw("LSAME"); |
| 845 |
temperatureLEFT_E_g->Draw("PSAME"); |
temperatureLEFT_E_g->Draw("LSAME"); |
| 846 |
temperatureDSP_E_g->Draw("PSAME"); |
temperatureDSP_E_g->Draw("LSAME"); |
| 847 |
|
|
| 848 |
TLegend *legTempE = new TLegend(0.72,0.63,0.86,0.8); |
TLegend *legTempE = new TLegend(0.72,0.63,0.86,0.8); |
| 849 |
legTempE->AddEntry(temperatureRIGHT_E_g,"Right","P"); |
legTempE->AddEntry(temperatureRIGHT_E_g,"Right","L"); |
| 850 |
legTempE->AddEntry(temperatureACTEL_E_g,"Actel","P"); |
legTempE->AddEntry(temperatureACTEL_E_g,"Actel","L"); |
| 851 |
legTempE->AddEntry(temperatureLEFT_E_g,"Left","P"); |
legTempE->AddEntry(temperatureLEFT_E_g,"Left","L"); |
| 852 |
legTempE->AddEntry(temperatureDSP_E_g,"Dsp","P"); |
legTempE->AddEntry(temperatureDSP_E_g,"Dsp","L"); |
| 853 |
legTempE->Draw(); |
legTempE->Draw(); |
| 854 |
|
|
| 855 |
/************************/ |
/************************/ |
| 888 |
triggM_gr->GetYaxis()->SetTitle("f [Hz]"); |
triggM_gr->GetYaxis()->SetTitle("f [Hz]"); |
| 889 |
triggM_gr->SetMarkerColor(1); |
triggM_gr->SetMarkerColor(1); |
| 890 |
triggE_gr->SetMarkerColor(2); |
triggE_gr->SetMarkerColor(2); |
| 891 |
triggM_gr->Draw("AP"); |
triggM_gr->SetLineColor(1); |
| 892 |
triggE_gr->Draw("PSAME"); |
triggE_gr->SetLineColor(2); |
| 893 |
|
triggM_gr->Draw("AL"); |
| 894 |
|
triggE_gr->Draw("LSAME"); |
| 895 |
|
|
| 896 |
pd23->cd(); |
pd23->cd(); |
| 897 |
gPad->SetLogy(1); |
gPad->SetLogy(1); |
| 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 |
figsave = Form("%s/%s_AcQLOOK1.%s",outDir.Data(),fileName.Data(),format.Data()); |
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_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]; |
| 1192 |
|
|
| 1193 |
|
//stopTime = clock(); |
| 1194 |
|
//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); |
| 1196 |
|
|
| 1197 |
return 1; |
return 1; |
| 1198 |
|
|
| 1199 |
} |
} |
| 1201 |
|
|
| 1202 |
int main(int argc, char* argv[]){ |
int main(int argc, char* argv[]){ |
| 1203 |
TString outDir = "."; |
TString outDir = "."; |
| 1204 |
TString format = "jpg"; |
TString format = FORMAT; |
| 1205 |
int from = 0; |
int from = 0; |
| 1206 |
int to = 0; |
int to = 0; |
| 1207 |
int mode = 0; |
int mode = 0; |
| 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 |
} |
} |