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 |
#include <utils/yodaUtility.h> |
#include <sys/stat.h> |
20 |
|
#include <cstdlib> |
21 |
|
//#include <utils/yodaUtility.h> |
22 |
|
|
23 |
#define DEBUG 0 |
#define DEBUG 0 |
24 |
#define VERSION 1.4 |
#define VERSION 1.5 |
25 |
#define INTERVAL 100 |
#define INTERVAL 100 |
26 |
|
#define FORMAT "png" |
27 |
|
|
28 |
using namespace std; |
using namespace std; |
29 |
|
|
30 |
|
UInt_t found; |
31 |
Int_t minevent,maxevent; |
Int_t minevent,maxevent; |
32 |
UShort_t ACheader[2]; |
UShort_t ACheader[2]; |
33 |
TString *cardname = new TString[2]; |
TString *cardname = new TString[2]; |
34 |
TString *detector = new TString[16]; |
TString *detector = new TString[16]; |
35 |
|
|
36 |
|
|
37 |
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){ |
38 |
|
|
39 |
ofstream outputFile; |
ofstream outputFile; |
40 |
stringstream oss; |
stringstream oss; |
41 |
|
|
42 |
pamela::anticounter::AnticounterEvent *ace = 0; |
pamela::anticounter::AnticounterEvent *ace = 0; |
43 |
pamela::EventHeader *eh = 0; |
pamela::EventHeader *eh = 0; |
44 |
pamela::PscuHeader *ph = 0; |
// pamela::PscuHeader *ph = 0; |
45 |
TFile *rootFile = new TFile(base); |
TFile *rootFile = new TFile(base); |
46 |
if (rootFile->IsZombie()) |
if (rootFile->IsZombie()) |
47 |
exit(-1); |
exit(-1); |
53 |
//Takes the tree of the header file |
//Takes the tree of the header file |
54 |
TTree *tr = (TTree*)rootFile->Get("Physics"); |
TTree *tr = (TTree*)rootFile->Get("Physics"); |
55 |
|
|
56 |
|
tr->SetBranchStatus("*",0,&found); //disable all branches |
57 |
|
|
58 |
|
tr->SetBranchStatus("header*",1,&found); |
59 |
|
// printf("header: enabled %i branches \n",found); |
60 |
|
found = 0; |
61 |
|
tr->SetBranchStatus("status*",1,&found); |
62 |
|
// printf("status: enabled %i branches \n",found); |
63 |
|
found = 0; |
64 |
|
tr->SetBranchStatus("hitmap*",1,&found); |
65 |
|
// printf("hitmap: enabled %i branches \n",found); |
66 |
|
found = 0; |
67 |
|
tr->SetBranchStatus("regist*",1,&found); |
68 |
|
// printf("regist: enabled %i branches \n",found); |
69 |
|
found = 0; |
70 |
|
tr->SetBranchStatus("shift*",1,&found); |
71 |
|
// printf("shift: enabled %i branches \n",found); |
72 |
|
found = 0; |
73 |
|
tr->SetBranchStatus("counters*",1,&found); |
74 |
|
// printf("counters: enabled %i branches \n",found); |
75 |
|
found = 0; |
76 |
|
tr->SetBranchStatus("coinc*",1,&found); |
77 |
|
// printf("coinc: enabled %i branches \n",found); |
78 |
|
found = 0; |
79 |
|
tr->SetBranchStatus("trigg*",1,&found); |
80 |
|
// printf("trigg: enabled %i branches \n",found); |
81 |
|
found = 0; |
82 |
|
tr->SetBranchStatus("clock*",1,&found); |
83 |
|
// printf("clock: enabled %i branches \n",found); |
84 |
|
found = 0; |
85 |
|
tr->SetBranchStatus("temp*",1,&found); |
86 |
|
// printf("temp: enabled %i branches \n",found); |
87 |
|
found = 0; |
88 |
|
tr->SetBranchStatus("DAC*",1,&found); |
89 |
|
// printf("DAC: enabled %i branches \n",found); |
90 |
|
found = 0; |
91 |
|
tr->SetBranchStatus("CRC*",1,&found); |
92 |
|
// printf("CRC: enabled %i branches \n",found); |
93 |
|
|
94 |
|
found = 0; |
95 |
|
tr->SetBranchStatus("Pscu*",1,&found); |
96 |
|
// printf("enabled %i branches \n",found); |
97 |
|
found = 0; |
98 |
|
tr->SetBranchStatus("Anticounter*",1,&found); |
99 |
|
// printf("Ac enabled %i branches \n",found); |
100 |
|
found = 0; |
101 |
|
tr->SetBranchStatus("Header*",1,&found); |
102 |
|
// printf("head enabled %i branches \n",found); |
103 |
|
|
104 |
tr->SetBranchAddress("Anticounter", &ace); |
tr->SetBranchAddress("Anticounter", &ace); |
105 |
tr->SetBranchAddress("Header", &eh); |
tr->SetBranchAddress("Header", &eh); |
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
Int_t nevents = tr->GetEntries(); |
Int_t nevents = tr->GetEntries(); |
111 |
|
|
112 |
//check that the selected range of events is ok |
//check that the selected range of events is ok |
169 |
for (Int_t i = minevent; i < maxevent; i++){ |
for (Int_t i = minevent; i < maxevent; i++){ |
170 |
|
|
171 |
tr->GetEntry(i); |
tr->GetEntry(i); |
172 |
ph = eh->GetPscuHeader(); |
// ph = eh->GetPscuHeader(); |
173 |
|
|
174 |
for(Int_t card=0;card<2;card++) |
for(Int_t card=0;card<2;card++) |
175 |
{ |
{ |
203 |
|
|
204 |
/***************************************** PLOTTING *****************************************/ |
/***************************************** PLOTTING *****************************************/ |
205 |
|
|
206 |
char *namn = "KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK"; |
const char *namn = "KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK"; |
207 |
int mposition = 80; |
int mposition = 80; |
208 |
int eposition = 80; |
int eposition = 80; |
209 |
char *figsave1 = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"; |
const char *figsave1 = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"; |
210 |
char *mystring = "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"; |
const char *mystring = "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"; |
211 |
|
|
212 |
TBox *b1,*b2,*b3,*b4,*b5; |
TBox *b1,*b2,*b3,*b4,*b5; |
213 |
gStyle->SetOptDate(0); |
gStyle->SetOptDate(0); |
310 |
} //end AcBasic |
} //end AcBasic |
311 |
|
|
312 |
|
|
313 |
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){ |
314 |
|
|
315 |
|
//Float_t startTime,stopTime; |
316 |
|
//Float_t time1,time2,time3,time4; |
317 |
|
|
318 |
|
//startTime = clock(); |
319 |
|
|
320 |
ofstream outputFile; |
ofstream outputFile; |
321 |
stringstream oss; |
stringstream oss; |
333 |
|
|
334 |
//Takes the tree of the header file |
//Takes the tree of the header file |
335 |
TTree *tr = (TTree*)rootFile->Get("Physics"); |
TTree *tr = (TTree*)rootFile->Get("Physics"); |
336 |
|
|
337 |
|
tr->SetBranchStatus("*",0,&found); //disable all branches |
338 |
|
|
339 |
|
tr->SetBranchStatus("header*",1,&found); |
340 |
|
// printf("header: enabled %i branches \n",found); |
341 |
|
found = 0; |
342 |
|
tr->SetBranchStatus("status*",1,&found); |
343 |
|
// printf("status: enabled %i branches \n",found); |
344 |
|
found = 0; |
345 |
|
tr->SetBranchStatus("hitmap*",1,&found); |
346 |
|
// printf("hitmap: enabled %i branches \n",found); |
347 |
|
found = 0; |
348 |
|
tr->SetBranchStatus("regist*",1,&found); |
349 |
|
// printf("regist: enabled %i branches \n",found); |
350 |
|
found = 0; |
351 |
|
tr->SetBranchStatus("shift*",1,&found); |
352 |
|
// printf("shift: enabled %i branches \n",found); |
353 |
|
found = 0; |
354 |
|
tr->SetBranchStatus("counters*",1,&found); |
355 |
|
// printf("counters: enabled %i branches \n",found); |
356 |
|
found = 0; |
357 |
|
tr->SetBranchStatus("coinc*",1,&found); |
358 |
|
// printf("coinc: enabled %i branches \n",found); |
359 |
|
found = 0; |
360 |
|
tr->SetBranchStatus("trigg*",1,&found); |
361 |
|
// printf("trigg: enabled %i branches \n",found); |
362 |
|
found = 0; |
363 |
|
tr->SetBranchStatus("clock*",1,&found); |
364 |
|
// printf("clock: enabled %i branches \n",found); |
365 |
|
found = 0; |
366 |
|
tr->SetBranchStatus("temp*",1,&found); |
367 |
|
// printf("temp: enabled %i branches \n",found); |
368 |
|
found = 0; |
369 |
|
tr->SetBranchStatus("DAC*",1,&found); |
370 |
|
// printf("DAC: enabled %i branches \n",found); |
371 |
|
found = 0; |
372 |
|
tr->SetBranchStatus("CRC*",1,&found); |
373 |
|
// printf("CRC: enabled %i branches \n",found); |
374 |
|
found = 0; |
375 |
|
|
376 |
|
tr->SetBranchStatus("Pscu*",1,&found); |
377 |
|
// printf("enabled %i branches \n",found); |
378 |
|
found = 0; |
379 |
|
tr->SetBranchStatus("Anticounter*",1,&found); |
380 |
|
// printf("Ac enabled %i branches \n",found); |
381 |
|
found = 0; |
382 |
|
tr->SetBranchStatus("Header*",1,&found); |
383 |
|
// printf("head enabled %i branches \n",found); |
384 |
|
|
385 |
tr->SetBranchAddress("Anticounter", &ace); |
tr->SetBranchAddress("Anticounter", &ace); |
386 |
tr->SetBranchAddress("Header", &eh); |
tr->SetBranchAddress("Header", &eh); |
387 |
|
|
424 |
|
|
425 |
// MISC VARIABLES |
// MISC VARIABLES |
426 |
|
|
427 |
Double_t obt; |
// UInt_t obt; |
428 |
Int_t hitsCARD,hitsCAT,hitsCAS; |
Int_t hitsCARD,hitsCAT,hitsCAS; |
429 |
Int_t interval_cnt = 0; |
Int_t interval_cnt = 0; |
430 |
Int_t paramEvent = 0; |
Int_t paramEvent = 0; |
431 |
Int_t paramEvents; |
Int_t paramEvents; |
432 |
Int_t minevent,maxevent; |
Int_t minevent,maxevent; |
433 |
char *figsave = " "; |
const char *figsave = " "; |
|
Int_t ch_cnt; |
|
434 |
UShort_t ACheader[2]; |
UShort_t ACheader[2]; |
435 |
ACheader[0]=0xAC11; |
ACheader[0]=0xAC11; |
436 |
ACheader[1]=0xAC22; |
ACheader[1]=0xAC22; |
437 |
|
|
438 |
|
vector<int> Err_type(0); |
439 |
|
vector<float> Err_obt(0); |
440 |
|
vector<int> Err_evt(0); |
441 |
|
|
442 |
|
|
443 |
Int_t *det_map = new Int_t[12]; |
Int_t *det_map = new Int_t[12]; |
444 |
det_map[0]=2; |
det_map[0]=2; |
445 |
det_map[1]=14; |
det_map[1]=14; |
547 |
} |
} |
548 |
} |
} |
549 |
|
|
550 |
TH1D *status_h = new TH1D("Status","Status",10,0.,10.); |
TH1D *status_h = new TH1D("Status","Status",12,0.,12.); |
551 |
status_h->GetXaxis()->SetBinLabel(1,"CRC event M"); |
status_h->GetXaxis()->SetBinLabel(1,"Headers M"); |
552 |
status_h->GetXaxis()->SetBinLabel(2,"Headers M"); |
status_h->GetXaxis()->SetBinLabel(2,"CRC M"); |
553 |
status_h->GetXaxis()->SetBinLabel(3,"CRC M"); |
status_h->GetXaxis()->SetBinLabel(3,"Dsp M"); |
554 |
status_h->GetXaxis()->SetBinLabel(4,"Dsp M"); |
status_h->GetXaxis()->SetBinLabel(4,"Temp M"); |
555 |
status_h->GetXaxis()->SetBinLabel(5,"Reg M"); |
status_h->GetXaxis()->SetBinLabel(5,"Reg M"); |
556 |
status_h->GetXaxis()->SetBinLabel(6,"CRC event E"); |
status_h->GetXaxis()->SetBinLabel(6,"CRC Event M"); |
557 |
status_h->GetXaxis()->SetBinLabel(7,"Headers E"); |
status_h->GetXaxis()->SetBinLabel(7,"Headers E"); |
558 |
status_h->GetXaxis()->SetBinLabel(8,"CRC E"); |
status_h->GetXaxis()->SetBinLabel(8,"CRC E"); |
559 |
status_h->GetXaxis()->SetBinLabel(9,"Dsp E"); |
status_h->GetXaxis()->SetBinLabel(9,"Dsp E"); |
560 |
status_h->GetXaxis()->SetBinLabel(10,"Reg E"); |
status_h->GetXaxis()->SetBinLabel(10,"Temp E"); |
561 |
|
status_h->GetXaxis()->SetBinLabel(11,"Reg E"); |
562 |
|
status_h->GetXaxis()->SetBinLabel(12,"CRC Event E"); |
563 |
status_h->GetYaxis()->SetTitle("# of Errors"); |
status_h->GetYaxis()->SetTitle("# of Errors"); |
564 |
status_h->SetMinimum(0); |
status_h->SetMinimum(0); |
565 |
|
|
599 |
|
|
600 |
/********************* MAIN LOOP **********************/ |
/********************* MAIN LOOP **********************/ |
601 |
|
|
602 |
//UShort_t tshift[16]; |
//time1 = clock(); |
603 |
|
//printf("Init time: %f\n",(Double_t) (time1 - startTime) / (Double_t) CLOCKS_PER_SEC); |
604 |
|
|
605 |
|
//iterators used in the loop |
606 |
|
Int_t card, ch, bin; |
607 |
|
|
608 |
for (Int_t i = minevent; i < maxevent; i++){ |
for (Int_t i = minevent; i < maxevent; i++){ |
609 |
|
|
611 |
|
|
612 |
tr->GetEntry(i); |
tr->GetEntry(i); |
613 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
614 |
obt = ph->GetOrbitalTime(); |
// obt = ph->GetOrbitalTime(); |
615 |
|
|
616 |
hitsCARD=hitsCAT=hitsCAS=0; |
hitsCARD=hitsCAT=hitsCAS=0; |
617 |
|
|
618 |
/* |
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++) |
|
619 |
{ |
{ |
620 |
//proceed only if crc of event is ok |
//proceed only if crc of event is ok |
621 |
/******************************************************/ |
//printf("CRC: %hx\n",ace->CRCcheck[card]); |
622 |
|
//printf("Hitmap: %hx\n\n",ace->hitmap[card]); |
623 |
if(ace->CRCcheck[card]==1) |
if(ace->CRCcheck[card]==1) |
624 |
{ |
{ |
625 |
//clock |
//clock |
634 |
time_between_trigg_h[card]->Fill( 0.000000025*ac_clock_diff[card] ); |
time_between_trigg_h[card]->Fill( 0.000000025*ac_clock_diff[card] ); |
635 |
|
|
636 |
//counters, singlesrate & shift reg content |
//counters, singlesrate & shift reg content |
637 |
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++) |
|
638 |
{ |
{ |
639 |
if( (ace->hitmap[card] & (0x1<<ch_cnt)) > 0 ){ |
counter_old[card][ch] = counter_new[card][ch]; |
640 |
hitmap_h[card]->Fill(ch_cnt,1.); |
counter_new[card][ch] = ace->counters[card][ch]; |
641 |
if(ch_cnt==0 || ch_cnt==4 || ch_cnt==8 || ch_cnt==12) |
if(counter_new[card][ch] - counter_old[card][ch] < 0.) |
642 |
|
counter_diff[card][ch] = 0xFFFF + counter_new[card][ch] - counter_old[card][ch]; |
643 |
|
else |
644 |
|
counter_diff[card][ch] = counter_new[card][ch] - counter_old[card][ch]; |
645 |
|
|
646 |
|
singles_gr[card][ch][paramEvent] += (Double_t)counter_diff[card][ch]; |
647 |
|
|
648 |
|
for(bin = 0; bin < 16; bin++){ |
649 |
|
shiftreg_h[card][bin]->Fill(ch,ace->shift[card][ch] & 0x1<<bin); |
650 |
|
} |
651 |
|
|
652 |
|
//hitmap |
653 |
|
if( (ace->hitmap[card] & (0x1<<ch)) > 0 ){ |
654 |
|
hitmap_h[card]->Fill(ch,1.); |
655 |
|
if(ch==0 || ch==4 || ch==8 || ch==12) |
656 |
hitsCARD++; |
hitsCARD++; |
657 |
else if(ch_cnt==1 || ch_cnt==5 || ch_cnt==9 || ch_cnt==13) |
else if(ch==1 || ch==5 || ch==9 || ch==13) |
658 |
hitsCAT++; |
hitsCAT++; |
659 |
else if(ch_cnt==2 || ch_cnt==6 || ch_cnt==10 || ch_cnt==14) |
else if(ch==2 || ch==6 || ch==10 || ch==14) |
660 |
hitsCAS++; |
hitsCAS++; |
661 |
} |
} |
662 |
|
|
663 |
} |
} |
664 |
|
|
665 |
//Status |
//Status |
666 |
if((ace->header[card][0] != 0xACAC) || (ace->header[card][1] != ACheader[card])) |
if((ace->header[card][0] != 0xACAC) || (ace->header[card][1] != ACheader[card])){ |
667 |
status_h->Fill(1.+5.*card,1.); |
status_h->Fill(6.*card,1.); |
668 |
if((ace->status[card] & 0x8000) < 0x8000) //crc |
Err_type.push_back(6*card); |
669 |
status_h->Fill(2.+5.*card,1.); |
Err_obt.push_back(ph->GetOrbitalTime()); |
670 |
if((ace->status[card] & 0x4000) < 0x4000) //dsp |
Err_evt.push_back(i); |
671 |
status_h->Fill(3.+5.*card,1.); |
} |
672 |
if((ace->status[card] & 0x01FF) < 0x01FF) //reg |
if((ace->status[card] & 0x8000) < 0x8000){ //crc |
673 |
status_h->Fill(4.+5*card,1.); |
status_h->Fill(1.+6.*card,1.); |
674 |
|
Err_type.push_back(1+6*card); |
675 |
|
Err_obt.push_back(ph->GetOrbitalTime()); |
676 |
|
Err_evt.push_back(i); |
677 |
|
} |
678 |
|
if((ace->status[card] & 0x6000) < 0x6000){ //dsp |
679 |
|
status_h->Fill(2.+6.*card,1.); |
680 |
|
Err_type.push_back(2+6*card); |
681 |
|
Err_obt.push_back(ph->GetOrbitalTime()); |
682 |
|
Err_evt.push_back(i); |
683 |
|
} |
684 |
|
if((ace->status[card] & 0x0E00) < 0x0E00){ //temp |
685 |
|
status_h->Fill(3.+6.*card,1.); |
686 |
|
Err_type.push_back(3+6*card); |
687 |
|
Err_obt.push_back(ph->GetOrbitalTime()); |
688 |
|
Err_evt.push_back(i); |
689 |
|
} |
690 |
|
if((ace->status[card] & 0x01FF) < 0x01FF){ //reg |
691 |
|
status_h->Fill(4.+6.*card,1.); |
692 |
|
Err_type.push_back(4+6*card); |
693 |
|
Err_obt.push_back(ph->GetOrbitalTime()); |
694 |
|
Err_evt.push_back(i); |
695 |
|
} |
696 |
|
|
697 |
//temperature (left on cards) |
//temperature (left on cards) |
698 |
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; |
701 |
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; |
702 |
|
|
703 |
}//if(crc check) |
}//if(crc check) |
704 |
/******************************************************/ |
else{ |
705 |
else |
status_h->Fill(5.+6.*card,1.); //event crc |
706 |
status_h->Fill(5.*card,1.); //event crc |
Err_type.push_back(5+6*card); |
707 |
|
Err_obt.push_back(ph->GetOrbitalTime()); |
708 |
|
Err_evt.push_back(i); |
709 |
|
} |
710 |
}//for(card) |
}//for(card) |
711 |
|
|
712 |
nmbhitpmtCARD_h->Fill(hitsCARD); |
nmbhitpmtCARD_h->Fill(hitsCARD); |
714 |
nmbhitpmtCAT_h->Fill(hitsCAT); |
nmbhitpmtCAT_h->Fill(hitsCAT); |
715 |
|
|
716 |
|
|
|
if(interval_cnt==(Int_t)((Float_t)INTERVAL/2.)) |
|
|
event_obt[paramEvent] = ph->GetOrbitalTime(); |
|
|
|
|
717 |
if(interval_cnt==INTERVAL) |
if(interval_cnt==INTERVAL) |
718 |
{ |
{ |
719 |
for(Int_t card=0;card<2;card++) |
event_obt[paramEvent] = ph->GetOrbitalTime(); |
720 |
|
|
721 |
|
for(card=0;card<2;card++) |
722 |
{ |
{ |
723 |
ac_clock100_old[card] = ac_clock100_new[card]; |
ac_clock100_old[card] = ac_clock100_new[card]; |
724 |
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]; |
729 |
|
|
730 |
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]); |
731 |
|
|
732 |
for(Int_t ch=0;ch<16;ch++) |
for(ch=0;ch<16;ch++) |
733 |
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]); |
734 |
|
|
735 |
}//for(card) |
}//for(card) |
736 |
interval_cnt=0; |
interval_cnt=0; |
737 |
paramEvent++; |
paramEvent++; |
738 |
}//if(interval_cnt)) |
}//if(interval_cnt)) |
739 |
/* |
|
|
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]); |
|
|
*/ |
|
740 |
} //for(events) |
} //for(events) |
741 |
|
|
742 |
|
//for(Int_t i=0;i<Err_type.size();i++) |
743 |
|
//printf("%d\t%f\t%d\n\n",Err_type.at(i),Err_obt.at(i),Err_evt.at(i)); |
744 |
|
|
745 |
|
//Time2 = clock(); |
746 |
|
//printf("Loop time: %f\n",(Double_t) (time2 - time1) / (Double_t) CLOCKS_PER_SEC); |
747 |
|
|
748 |
/****************************** PLOTTING ***************************/ |
/****************************** PLOTTING ***************************/ |
749 |
|
|
772 |
pd4->Draw(); |
pd4->Draw(); |
773 |
|
|
774 |
pd4->cd(); |
pd4->cd(); |
|
char *namn2 = "Anticounter Quicklook"; |
|
775 |
char namn3[30]; |
char namn3[30]; |
776 |
sprintf(namn3,"Version %.1f",VERSION); |
char namn4[40]; |
777 |
|
char namn5[30]; |
778 |
|
sprintf(namn3,"Anticounter Quicklook v%.1f",VERSION); |
779 |
|
sprintf(namn4,"File: %s",fileName.Data()); |
780 |
|
sprintf(namn5,"Events: %d",nevents); |
781 |
|
t->SetTextSize(0.1); |
782 |
|
t->DrawLatex(5,90,namn3); |
783 |
t->SetTextSize(0.1); |
t->SetTextSize(0.1); |
784 |
t->DrawLatex(20,60,namn2); |
t->DrawLatex(20,50,namn4); |
785 |
t->DrawLatex(20,40,namn3); |
t->DrawLatex(20,40,namn5); |
786 |
|
|
787 |
t->SetTextSize(0.02); |
t->SetTextSize(0.02); |
788 |
|
|
789 |
pd3->cd(); |
pd3->cd(); |
805 |
temperatureACTEL_M_g->SetMarkerColor(2); |
temperatureACTEL_M_g->SetMarkerColor(2); |
806 |
temperatureLEFT_M_g->SetMarkerColor(3); |
temperatureLEFT_M_g->SetMarkerColor(3); |
807 |
temperatureDSP_M_g->SetMarkerColor(4); |
temperatureDSP_M_g->SetMarkerColor(4); |
808 |
temperatureRIGHT_M_g->Draw("AP"); |
temperatureRIGHT_M_g->SetLineColor(1); |
809 |
temperatureACTEL_M_g->Draw("PSAME"); |
temperatureACTEL_M_g->SetLineColor(2); |
810 |
temperatureLEFT_M_g->Draw("PSAME"); |
temperatureLEFT_M_g->SetLineColor(3); |
811 |
temperatureDSP_M_g->Draw("PSAME"); |
temperatureDSP_M_g->SetLineColor(4); |
812 |
|
temperatureRIGHT_M_g->Draw("AL"); |
813 |
|
temperatureACTEL_M_g->Draw("LSAME"); |
814 |
|
temperatureLEFT_M_g->Draw("LSAME"); |
815 |
|
temperatureDSP_M_g->Draw("LSAME"); |
816 |
|
|
817 |
TLegend *legTempM = new TLegend(0.72,0.63,0.85,0.8); |
TLegend *legTempM = new TLegend(0.72,0.63,0.85,0.8); |
818 |
legTempM->AddEntry(temperatureRIGHT_M_g,"Right","P"); |
legTempM->AddEntry(temperatureRIGHT_M_g,"Right","P"); |
833 |
temperatureACTEL_E_g->SetMarkerColor(2); |
temperatureACTEL_E_g->SetMarkerColor(2); |
834 |
temperatureLEFT_E_g->SetMarkerColor(3); |
temperatureLEFT_E_g->SetMarkerColor(3); |
835 |
temperatureDSP_E_g->SetMarkerColor(4); |
temperatureDSP_E_g->SetMarkerColor(4); |
836 |
|
temperatureRIGHT_E_g->SetLineColor(1); |
837 |
|
temperatureACTEL_E_g->SetLineColor(2); |
838 |
|
temperatureLEFT_E_g->SetLineColor(3); |
839 |
|
temperatureDSP_E_g->SetLineColor(4); |
840 |
|
|
841 |
|
|
842 |
temperatureRIGHT_E_g->SetMaximum(50.); |
temperatureRIGHT_E_g->SetMaximum(50.); |
843 |
temperatureRIGHT_E_g->SetMinimum(0.); |
temperatureRIGHT_E_g->SetMinimum(0.); |
844 |
temperatureRIGHT_E_g->Draw("AP"); |
temperatureRIGHT_E_g->Draw("AL"); |
845 |
temperatureACTEL_E_g->Draw("PSAME"); |
temperatureACTEL_E_g->Draw("LSAME"); |
846 |
temperatureLEFT_E_g->Draw("PSAME"); |
temperatureLEFT_E_g->Draw("LSAME"); |
847 |
temperatureDSP_E_g->Draw("PSAME"); |
temperatureDSP_E_g->Draw("LSAME"); |
848 |
|
|
849 |
TLegend *legTempE = new TLegend(0.72,0.63,0.86,0.8); |
TLegend *legTempE = new TLegend(0.72,0.63,0.86,0.8); |
850 |
legTempE->AddEntry(temperatureRIGHT_E_g,"Right","P"); |
legTempE->AddEntry(temperatureRIGHT_E_g,"Right","L"); |
851 |
legTempE->AddEntry(temperatureACTEL_E_g,"Actel","P"); |
legTempE->AddEntry(temperatureACTEL_E_g,"Actel","L"); |
852 |
legTempE->AddEntry(temperatureLEFT_E_g,"Left","P"); |
legTempE->AddEntry(temperatureLEFT_E_g,"Left","L"); |
853 |
legTempE->AddEntry(temperatureDSP_E_g,"Dsp","P"); |
legTempE->AddEntry(temperatureDSP_E_g,"Dsp","L"); |
854 |
legTempE->Draw(); |
legTempE->Draw(); |
855 |
|
|
856 |
/************************/ |
/************************/ |
889 |
triggM_gr->GetYaxis()->SetTitle("f [Hz]"); |
triggM_gr->GetYaxis()->SetTitle("f [Hz]"); |
890 |
triggM_gr->SetMarkerColor(1); |
triggM_gr->SetMarkerColor(1); |
891 |
triggE_gr->SetMarkerColor(2); |
triggE_gr->SetMarkerColor(2); |
892 |
triggM_gr->Draw("AP"); |
triggM_gr->SetLineColor(1); |
893 |
triggE_gr->Draw("PSAME"); |
triggE_gr->SetLineColor(2); |
894 |
|
triggM_gr->Draw("AL"); |
895 |
|
triggE_gr->Draw("LSAME"); |
896 |
|
|
897 |
pd23->cd(); |
pd23->cd(); |
898 |
gPad->SetLogy(1); |
gPad->SetLogy(1); |
983 |
t->SetTextColor(1); |
t->SetTextColor(1); |
984 |
t->SetTextAlign(12); |
t->SetTextAlign(12); |
985 |
t->SetTextSize(0.035); |
t->SetTextSize(0.035); |
986 |
char *namn = " "; |
const char *namn = " "; |
987 |
|
|
988 |
namn="Singles Rate"; |
namn="Singles Rate"; |
989 |
t->DrawLatex(40.,95,namn); |
t->DrawLatex(40.,95,namn); |
1026 |
singles_Pads[k]->cd(); |
singles_Pads[k]->cd(); |
1027 |
singles_gr[card][det_map[k]][0]=0.0; |
singles_gr[card][det_map[k]][0]=0.0; |
1028 |
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]]); |
1029 |
singlesrate_g[card][k]->SetMarkerColor(card+1); |
singlesrate_g[card][k]->SetLineColor(card+1); |
1030 |
singlesrate_g[card][k]->GetXaxis()->SetTitle("Obt [ms]"); |
singlesrate_g[card][k]->GetXaxis()->SetTitle("Obt [ms]"); |
1031 |
singlesrate_g[card][k]->GetYaxis()->SetTitle("f [Hz]"); |
singlesrate_g[card][k]->GetYaxis()->SetTitle("f [Hz]"); |
1032 |
singlesrate_g[card][k]->SetTitle(detector[det_map[k]].Data()); |
singlesrate_g[card][k]->SetTitle(detector[det_map[k]].Data()); |
1033 |
if(card==0) |
if(card==0) |
1034 |
singlesrate_g[card][k]->Draw("AP"); |
singlesrate_g[card][k]->Draw("AL"); |
1035 |
else |
else |
1036 |
singlesrate_g[card][k]->Draw("PSAME"); |
singlesrate_g[card][k]->Draw("LSAME"); |
1037 |
k++; |
k++; |
1038 |
} |
} |
1039 |
} |
} |
1097 |
} |
} |
1098 |
} |
} |
1099 |
} |
} |
1100 |
|
|
1101 |
|
// Plot error report if any error occurs |
1102 |
|
|
1103 |
|
//char *namn6 = "KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK"; |
1104 |
|
int mposition = 80; |
1105 |
|
int eposition = 80; |
1106 |
|
const char *mystring = "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"; |
1107 |
|
TString *merr; |
1108 |
|
TBox *b1,*b2; |
1109 |
|
|
1110 |
|
TCanvas *sheetError; |
1111 |
|
|
1112 |
|
if(Err_type.size() > 0) |
1113 |
|
{ |
1114 |
|
merr = new TString[12]; |
1115 |
|
merr[0]="Header"; |
1116 |
|
merr[1]="CRC"; |
1117 |
|
merr[2]="Dsp"; |
1118 |
|
merr[3]="Temp"; |
1119 |
|
merr[4]="Reg"; |
1120 |
|
merr[5]="Event CRC"; |
1121 |
|
merr[6]="Header"; |
1122 |
|
merr[7]="CRC"; |
1123 |
|
merr[8]="Dsp"; |
1124 |
|
merr[9]="Temp"; |
1125 |
|
merr[10]="Reg"; |
1126 |
|
merr[11]="Event CRC"; |
1127 |
|
|
1128 |
|
sheetError = new TCanvas("Sheet Error","Sheet Error"); //base |
1129 |
|
sheetError->Range(0,0,100,100); |
1130 |
|
sheetError->Draw(); |
1131 |
|
b1 = new TBox(10,83.5,90,84.5); |
1132 |
|
b2 = new TBox(49.5,90,50.5,5); |
1133 |
|
b1->SetFillColor(1); |
1134 |
|
b2->SetFillColor(1); |
1135 |
|
b1->Draw(); |
1136 |
|
b2->Draw(); |
1137 |
|
|
1138 |
figsave = Form("%s/%s_AcQLOOK1.%s",outDir.Data(),fileName.Data(),format.Data()); |
t->SetTextFont(40); |
1139 |
|
t->SetTextColor(1); |
1140 |
|
t->SetTextAlign(12); |
1141 |
|
t->SetTextSize(0.04); |
1142 |
|
namn = "AntiCounter Error Report"; |
1143 |
|
t->DrawLatex(37,94,namn); |
1144 |
|
t->SetTextColor(1); |
1145 |
|
namn = "MAIN card"; |
1146 |
|
t->DrawLatex(15,87,namn); |
1147 |
|
t->SetTextColor(1); |
1148 |
|
namn = "EXTRA card"; |
1149 |
|
t->DrawLatex(65,87,namn); |
1150 |
|
t->SetTextSize(0.015); |
1151 |
|
|
1152 |
|
|
1153 |
|
//for(Int_t i=0;i<Err_type.size();i++) |
1154 |
|
UInt_t iter = 0; |
1155 |
|
while(iter<Err_type.size()) |
1156 |
|
{ |
1157 |
|
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)); |
1158 |
|
t->SetTextColor(2); |
1159 |
|
if(Err_type.at(iter) < 7 && mposition>10){ |
1160 |
|
mposition -= 2; |
1161 |
|
t->DrawLatex(15,mposition,mystring); |
1162 |
|
} |
1163 |
|
else if(eposition>10){ |
1164 |
|
eposition -= 2; |
1165 |
|
t->DrawLatex(65,eposition,mystring); |
1166 |
|
} |
1167 |
|
iter++; |
1168 |
|
} |
1169 |
|
if(mposition<10) |
1170 |
|
t->DrawLatex(15,5,"More errors in run!"); |
1171 |
|
if(eposition<10) |
1172 |
|
t->DrawLatex(65,5,"More errors in run!"); |
1173 |
|
|
1174 |
|
figsave = Form("%s/%s_AcQLOOK_Error.%s",outDir.Data(),fileName.Data(),format.Data()); |
1175 |
|
sheetError->SaveAs(figsave); |
1176 |
|
} |
1177 |
|
|
1178 |
|
figsave = Form("%s/%s_AcQLOOK_Status.%s",outDir.Data(),fileName.Data(),format.Data()); |
1179 |
sheet1->SaveAs(figsave); |
sheet1->SaveAs(figsave); |
1180 |
|
|
1181 |
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()); |
1182 |
sheet2->SaveAs(figsave); |
sheet2->SaveAs(figsave); |
1183 |
|
|
1184 |
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()); |
1185 |
sheet3->SaveAs(figsave); |
sheet3->SaveAs(figsave); |
1186 |
|
|
1187 |
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()); |
1188 |
sheet4->SaveAs(figsave); |
sheet4->SaveAs(figsave); |
1189 |
|
|
|
|
|
1190 |
delete sheet1; |
delete sheet1; |
1191 |
delete hitmap_h[0]; |
delete hitmap_h[0]; |
1192 |
delete hitmap_h[1]; |
delete hitmap_h[1]; |
1193 |
|
|
1194 |
|
//stopTime = clock(); |
1195 |
|
//printf("Draw time: %f\n\n",(Double_t) (stopTime - time2) / (Double_t) CLOCKS_PER_SEC); |
1196 |
|
//printf("Exc time: %f\n",(Double_t) (stopTime-startTime) / (Double_t) CLOCKS_PER_SEC); |
1197 |
|
|
1198 |
return 1; |
return 1; |
1199 |
|
|
1200 |
} |
} |
1202 |
|
|
1203 |
int main(int argc, char* argv[]){ |
int main(int argc, char* argv[]){ |
1204 |
TString outDir = "."; |
TString outDir = "."; |
1205 |
TString format = "jpg"; |
TString format = FORMAT; |
1206 |
int from = 0; |
int from = 0; |
1207 |
int to = 0; |
int to = 0; |
1208 |
int mode = 0; |
int mode = 0; |
1271 |
if (isdigit(*argv[i]) && (atoi(argv[i]) > 0)) { |
if (isdigit(*argv[i]) && (atoi(argv[i]) > 0)) { |
1272 |
to = atoi(argv[i]); |
to = atoi(argv[i]); |
1273 |
} else { |
} else { |
1274 |
cerr << "-to needs a integer value. \n"; |
//err << "-to needs a integer value. \n"; |
1275 |
cout << "Try '--help' for more information. \n"; |
cout << "Try '--help' for more information. \n"; |
1276 |
exit(1); |
exit(1); |
1277 |
} |
} |
1286 |
if (isdigit(*argv[i]) && (atoi(argv[i]) > 0)) { |
if (isdigit(*argv[i]) && (atoi(argv[i]) > 0)) { |
1287 |
from = atoi(argv[i]); |
from = atoi(argv[i]); |
1288 |
} else { |
} else { |
1289 |
cerr << "-from needs a integer value. \n"; |
//cerr << "-from needs a integer value. \n"; |
1290 |
cout << "Try '--help' for more information. \n"; |
cout << "Try '--help' for more information. \n"; |
1291 |
exit(1); |
exit(1); |
1292 |
} |
} |