2 |
* FTrkQLook_EXPERT |
* FTrkQLook_EXPERT |
3 |
* |
* |
4 |
* autor: D.Fedele |
* autor: D.Fedele |
5 |
* version 2.0 |
* version 3.0 |
6 |
* Parameters: |
* Parameters: |
7 |
* file - the data file to analyze |
* file - the data file to analyze |
8 |
* fromevent - first event to analyze |
* fromevent - first event to analyze |
80 |
pamela::PacketType *pctp=0; |
pamela::PacketType *pctp=0; |
81 |
|
|
82 |
TFile *datafile = new TFile(file); |
TFile *datafile = new TFile(file); |
83 |
|
if ( !datafile ){ |
84 |
|
printf("No data file, exiting...\n"); |
85 |
|
return; |
86 |
|
} |
87 |
|
|
88 |
TTree *tree = (TTree*)datafile->Get("TsbT"); |
TTree *tree = (TTree*)datafile->Get("TsbT"); |
89 |
tree->SetBranchAddress("TsbT",&event); |
tree->SetBranchAddress("TsbT",&event); |
144 |
nevent=maxevent-minevent ; |
nevent=maxevent-minevent ; |
145 |
} |
} |
146 |
|
|
147 |
Long64_t obt=0; |
// |
148 |
const Int_t sizeH=neventH; |
// information about the RunHeader |
149 |
ULong64_t HOBT[sizeH]; |
ULong64_t HOBT[neventH]; |
150 |
Int_t trk_cal_us[sizeH],countrun=1; |
Int_t trk_cal_us[neventH]; |
151 |
for (Int_t vi=0; vi<sizeH;vi++){ |
for (Int_t vi=0; vi<neventH;vi++){ |
152 |
HOBT[vi]=0; |
HOBT[vi]=0; |
153 |
trk_cal_us[vi]=0; |
trk_cal_us[vi]=0; |
154 |
} |
} |
157 |
pH = eH->GetPscuHeader(); |
pH = eH->GetPscuHeader(); |
158 |
HOBT[ev]= pH->GetOrbitalTime(); |
HOBT[ev]= pH->GetOrbitalTime(); |
159 |
trk_cal_us[ev]=reh->TRK_CALIB_USED; |
trk_cal_us[ev]=reh->TRK_CALIB_USED; |
|
// if((HOBT[ev]<HOBT[ev-1]) && ev>0) |
|
|
// countrun+=1; |
|
|
// printf("\n%lld\t\tcountrun=%d\n",HOBT[ev],countrun); |
|
160 |
} |
} |
161 |
|
|
162 |
// |
// |
175 |
} |
} |
176 |
const Int_t tsize=maxsize; |
const Int_t tsize=maxsize; |
177 |
Int_t tempt[tsize][5],xt[tsize], tempt_tmp[tsize]; |
Int_t tempt[tsize][5],xt[tsize], tempt_tmp[tsize]; |
178 |
|
Int_t countnboot=1; |
179 |
// |
// |
180 |
// information about the temperatures |
// information about the temperatures |
181 |
for (Int_t ev=0; ev<tnevent; ev++){ |
for (Int_t ev=0; ev<tnevent; ev++){ |
183 |
tmpSize = event->Records->GetEntries(); |
tmpSize = event->Records->GetEntries(); |
184 |
for (Int_t j = 0; j < tmpSize; j++){ |
for (Int_t j = 0; j < tmpSize; j++){ |
185 |
record = (pamela::TsbTRecord*)event->Records->At(j); |
record = (pamela::TsbTRecord*)event->Records->At(j); |
186 |
xt[siztmp]=record->RECORD_OBT; //0.051*record->RECORD_OBT; |
xt[siztmp]=record->RECORD_OBT; |
187 |
if((xt[siztmp]<xt[siztmp-1]) && siztmp>0) |
if((xt[siztmp]<xt[siztmp-1]) && siztmp>0) |
188 |
countrun+=1; |
countnboot+=1; |
189 |
|
|
190 |
for (Int_t z = 0; z < 5; z++){ |
for (Int_t z = 0; z < 5; z++){ |
191 |
tempt[siztmp][z] = record->TEMPERATURES[z+1]; |
tempt[siztmp][z] = record->TEMPERATURES[z+1]; |
193 |
siztmp++; |
siztmp++; |
194 |
} |
} |
195 |
} |
} |
196 |
// printf("\ncountrun=%d\n",countrun); |
countnboot+=2*(Int_t)nevent/MAXSTORAGE; |
197 |
countrun+=(Int_t)nevent/30000; |
// printf("\ncountnboot=%d\n",countnboot); |
198 |
|
|
199 |
// |
// |
200 |
// open the output text files for the alarms |
// open the output text files for the alarms |
214 |
// write the file for the TrkAlarm packet |
// write the file for the TrkAlarm packet |
215 |
if(alnevent==0) alarm1 <<endl<< "------> NO ALARM!!! <-------"<< endl; |
if(alnevent==0) alarm1 <<endl<< "------> NO ALARM!!! <-------"<< endl; |
216 |
else{ |
else{ |
217 |
|
Long64_t obt=0; |
218 |
for (Int_t ev=0; ev<alnevent; ev++){ |
for (Int_t ev=0; ev<alnevent; ev++){ |
219 |
altr->GetEntry(ev); |
altr->GetEntry(ev); |
220 |
ph = aleh->GetPscuHeader(); |
ph = aleh->GetPscuHeader(); |
272 |
} |
} |
273 |
} |
} |
274 |
|
|
275 |
|
// |
276 |
|
// Set Style options |
277 |
gStyle->SetLabelSize(0.05,"x"); |
gStyle->SetLabelSize(0.05,"x"); |
278 |
gStyle->SetLabelSize(0.06,"y"); |
gStyle->SetLabelSize(0.06,"y"); |
279 |
gStyle->SetStatFontSize(0.075); |
gStyle->SetStatFontSize(0.075); |
287 |
gStyle->SetTitleSize(0.06,"y"); |
gStyle->SetTitleSize(0.06,"y"); |
288 |
gStyle->SetTitleSize(0.055,"x"); |
gStyle->SetTitleSize(0.055,"x"); |
289 |
|
|
290 |
//************************************************************************************* |
// |
291 |
//book pads and histos |
// Define output canvas, histos and graphs |
292 |
//*************************************************************************************** |
TCanvas *CompTimeCanv[countnboot],*EventNumCanv[countnboot],*TempCanv[countnboot]; |
|
|
|
|
TCanvas *CompTimeCanv[countrun],*EventNumCanv[countrun],*TempCanv[countrun]; |
|
293 |
TCanvas *IlluminaCanv,*LandauCanv1,*LandauCanv2,*LandauCanv3; |
TCanvas *IlluminaCanv,*LandauCanv1,*LandauCanv2,*LandauCanv3; |
294 |
|
|
295 |
TH1F *landau1[12],*landau2[12],*landau3[12],*illuminazione[12]; |
TH1F *landau1[12],*landau2[12],*landau3[12],*illuminazione[12]; |
296 |
|
TGraph *comprtime[12][countnboot],*temp[5][countnboot],*eventnumb[countnboot]; |
297 |
TPad *pad1[12],*pad2[12],*pad3[12],*pad4[12],*pad5[12],*pad6[5]; |
TPad *pad1[12],*pad2[12],*pad3[12],*pad4[12],*pad5[12],*pad6[5]; |
298 |
|
|
299 |
for(Int_t n = 0; n<12; n++) { |
for(Int_t n = 0; n<12; n++) { |
320 |
}; |
}; |
321 |
|
|
322 |
|
|
|
|
|
323 |
//*************************************************************************************** |
//*************************************************************************************** |
324 |
// LOOP on each event |
// LOOP on each event |
325 |
//*************************************************************************************** |
//*************************************************************************************** |
334 |
|
|
335 |
Int_t cntpgtemp=0,cntpgdat=0; |
Int_t cntpgtemp=0,cntpgdat=0; |
336 |
Int_t minev=minevent,maxev=maxevent,countTEMP=0; |
Int_t minev=minevent,maxev=maxevent,countTEMP=0; |
|
TGraph *comprtime[12][countrun],*temp[5][countrun],*eventnumb[countrun]; |
|
337 |
|
|
338 |
for(Int_t ii=0; ii<countrun;ii++){ |
// |
339 |
|
// Fill temperature graphs |
340 |
|
for(Int_t ii=0; ii<countnboot;ii++){ |
341 |
//**************************************************************************************** |
//**************************************************************************************** |
342 |
//Output figures --- Fifth sheet: |
//Temperature Output Pages |
343 |
//**************************************************************************************** |
//**************************************************************************************** |
344 |
fromfile.str(""); |
fromfile.str(""); |
345 |
fromfile<<"FTrkQLook_EXPERT File: "<<ffile; |
fromfile<<"FTrkQLook_EXPERT File: "<<ffile; |
431 |
} |
} |
432 |
|
|
433 |
|
|
434 |
for(Int_t ii=0; ii<countrun;ii++){ |
// |
435 |
|
// Fill compressiontime and eventnumber graphs and DSP warnings |
436 |
|
for(Int_t ii=0; ii<countnboot;ii++){ |
437 |
TPaveText *pt1; |
TPaveText *pt1; |
438 |
TPad *pt,*pt0; //pad for histos |
TPad *pt,*pt0; //pad for histos |
439 |
|
|
440 |
ofstream warning(out + "warning.txt",ios::out); |
ofstream warning(out + "warning.txt",ios::out); |
441 |
|
|
442 |
//**************************************************************************************** |
//**************************************************************************************** |
443 |
//Output figures --- First sheet: |
//COMPRESSIONTIME vs. OBT Output Pages |
444 |
//**************************************************************************************** |
//**************************************************************************************** |
445 |
fromfile.str(""); |
fromfile.str(""); |
446 |
fromfile<<"FTrkQLook_EXPERT File: "<<ffile; |
fromfile<<"FTrkQLook_EXPERT File: "<<ffile; |
461 |
isfile.str(""); |
isfile.str(""); |
462 |
|
|
463 |
//**************************************************************************************** |
//**************************************************************************************** |
464 |
//Output figures --- Second sheet: |
//DSP EVENT NUMBER Output Pages |
465 |
//**************************************************************************************** |
//**************************************************************************************** |
466 |
|
|
467 |
isfile<<"WARNINGS on DSP EVENT NUMBER pag"<<ii+1; |
isfile<<"WARNINGS on DSP EVENT NUMBER pag"<<ii+1; |
509 |
pad4[n] = new TPad("pad4"," ",posx1,posy-hpad,posx0,posy,18,0,0); |
pad4[n] = new TPad("pad4"," ",posx1,posy-hpad,posx0,posy,18,0,0); |
510 |
pad5[n] = new TPad("pad5"," ",posx1,posy-hpad,posx0,posy,18,0,0); |
pad5[n] = new TPad("pad5"," ",posx1,posy-hpad,posx0,posy,18,0,0); |
511 |
} |
} |
|
//********************************************************************************** |
|
|
// Fill Graphs and Histos |
|
|
//********************************************************************************** |
|
512 |
|
|
513 |
// |
// |
514 |
// information about the tracker data |
// Obtain information about the tracker data |
515 |
Int_t warning_dspnumber=0; |
// and fill graphs and histos |
516 |
|
Int_t warning_dspnumber=0,al=0; |
517 |
Float_t x[MAXSTORAGE]; |
Float_t x[MAXSTORAGE]; |
518 |
Float_t yc[MAXSTORAGE][12]; |
Float_t yc[MAXSTORAGE][12]; |
519 |
Float_t eventint[MAXSTORAGE]; |
Float_t eventint[MAXSTORAGE]; |
538 |
dsp=te->DSPnumber[i]-1; |
dsp=te->DSPnumber[i]-1; |
539 |
yc[(ev-minev)][dsp]= 0.051*te->compressiontime[i]; |
yc[(ev-minev)][dsp]= 0.051*te->compressiontime[i]; |
540 |
|
|
541 |
|
// |
542 |
|
// Fill Cluster Signal and Lighting of the view histos |
543 |
for(Int_t j=0;j<3;j++){ |
for(Int_t j=0;j<3;j++){ |
544 |
if(te->signcluster[i][j]!=0){ |
if(te->signcluster[i][j]!=0){ |
545 |
if((te->addrcluster[i][j]>6 && te->addrcluster[i][j]<505) ||(te->addrcluster[i][j]>518 && te->addrcluster[i][j]<1018)){ |
if((te->addrcluster[i][j]>6 && te->addrcluster[i][j]<505) ||(te->addrcluster[i][j]>518 && te->addrcluster[i][j]<1018)){ |
549 |
} |
} |
550 |
if(trk_cal_us[cod->Get(pctp->RunHeader)]!=104){ |
if(trk_cal_us[cod->Get(pctp->RunHeader)]!=104){ |
551 |
if(!(dsp%2)){ |
if(!(dsp%2)){ |
552 |
// if((te->addrcluster[i][0]>6 && te->addrcluster[i][0]<505) ||(te->addrcluster[i][0]>518 && te->addrcluster[i][0]<1018)) |
if(te->signcluster[i][0]!=0) landau1[dsp]->Fill((Float_t)(1024.-te->signcluster[i][0])); |
553 |
if(te->signcluster[i][0]!=0) landau1[dsp]->Fill((Float_t)(1024.-te->signcluster[i][0])); |
if(te->signcluster[i][1]!=0) landau2[dsp]->Fill((Float_t)(1024.-te->signcluster[i][1])); |
554 |
// if((te->addrcluster[i][1]>6 && te->addrcluster[i][1]<505) ||(te->addrcluster[i][1]>518 && te->addrcluster[i][1]<1018)) |
if(te->signcluster[i][2]!=0) landau3[dsp]->Fill((Float_t)(1024.-te->signcluster[i][2])); |
|
if(te->signcluster[i][1]!=0) landau2[dsp]->Fill((Float_t)(1024.-te->signcluster[i][1])); |
|
|
// if((te->addrcluster[i][2]>6 && te->addrcluster[i][2]<505) ||(te->addrcluster[i][2]>518 && te->addrcluster[i][2]<1018)) |
|
|
if(te->signcluster[i][2]!=0) landau3[dsp]->Fill((Float_t)(1024.-te->signcluster[i][2])); |
|
555 |
} |
} |
556 |
else{ |
else{ |
557 |
// if((te->addrcluster[i][0]>6 && te->addrcluster[i][0]<505) ||(te->addrcluster[i][0]>518 && te->addrcluster[i][0]<1018)) |
if(te->signcluster[i][0]!=0) landau1[dsp]->Fill((Float_t)te->signcluster[i][0]); |
558 |
if(te->signcluster[i][0]!=0) landau1[dsp]->Fill((Float_t)te->signcluster[i][0]); |
if(te->signcluster[i][1]!=0) landau2[dsp]->Fill((Float_t)te->signcluster[i][1]); |
559 |
// if((te->addrcluster[i][1]>6 && te->addrcluster[i][1]<505) ||(te->addrcluster[i][1]>518 && te->addrcluster[i][1]<1018)) |
if(te->signcluster[i][2]!=0) landau3[dsp]->Fill((Float_t)te->signcluster[i][2]); |
|
if(te->signcluster[i][1]!=0) landau2[dsp]->Fill((Float_t)te->signcluster[i][1]); |
|
|
// if((te->addrcluster[i][2]>6 && te->addrcluster[i][2]<505) ||(te->addrcluster[i][2]>518 && te->addrcluster[i][2]<1018)) |
|
|
if(te->signcluster[i][2]!=0) landau3[dsp]->Fill((Float_t)te->signcluster[i][2]); |
|
560 |
} |
} |
561 |
} |
} |
562 |
|
|
563 |
WARNING[i]=0; |
WARNING[i]=0; |
564 |
if(te->fc[i]!=0 || te->fl1[i]!=0 || te->fl2[i]!=0 || te->fl3[i]!=0 || te->fl4[i]!=0 || te->fl5[i]!=0 || te->fl6[i]!=0){ |
if(te->fc[i]!=0 || te->fl1[i]!=0 || te->fl2[i]!=0 || te->fl3[i]!=0 || te->fl4[i]!=0 || te->fl5[i]!=0 || te->fl6[i]!=0){ |
565 |
ALARM = 1; //general alarm |
ALARM = 1; //general alarm |
566 |
|
al=1; |
567 |
WARNING[i] = 1; // DSP warning |
WARNING[i] = 1; // DSP warning |
568 |
}; |
}; |
569 |
|
|
570 |
if(te->alarm[i]!=0){ // hardware alarm |
if(te->alarm[i]!=0){ // hardware alarm |
571 |
ALARM = 1; |
ALARM = 1; |
572 |
|
al=1; |
573 |
}; |
}; |
574 |
|
|
575 |
//************************************************************************************** |
//************************************************************************************** |
597 |
} |
} |
598 |
|
|
599 |
//******************************************************************************************** |
//******************************************************************************************** |
600 |
// file ALARM |
// file DSP warning |
601 |
//******************************************************************************************** |
//******************************************************************************************** |
602 |
|
|
603 |
if(ALARM==1) { |
if(ALARM==1) { |
604 |
alarm <<endl<< "================================================="<< endl; |
alarm <<endl<< "================================================="<< endl; |
605 |
alarm << "PSCU-Pkt N. "<< ph->GetCounter() ; |
alarm << "PSCU-Pkt N. "<< ph->GetCounter() ; |
606 |
alarm << " - OBT "<< ph->GetOrbitalTime() << " ms"<<endl; |
alarm << " - OBT "<< ph->GetOrbitalTime() << " ms"<<endl; |
607 |
alarm << "(ROOT-tree entry "<<ev<<")"<<endl; |
alarm << "(ROOT-tree entry "<<ev<<" in page "<<ii+1<<" )"<<endl; |
608 |
alarm << "================================================="<< endl; |
alarm << "================================================="<< endl; |
609 |
|
|
610 |
alarm << " DSPn"; |
alarm << " DSPn"; |
638 |
} |
} |
639 |
} |
} |
640 |
} |
} |
641 |
if(ALARM==0) alarm << endl<< "------> NO ALARM!!! <-------"<<endl; |
if(al==0) alarm << endl<< "Page "<<ii+1<< ": ------> NO ALARM!!! <-------"<<endl; |
642 |
if(warning_dspnumber==0) warning<<"NONE"<<endl; |
if(warning_dspnumber==0) warning<<"NONE"<<endl; |
643 |
|
|
644 |
|
// |
645 |
|
// Draw the graphs |
646 |
for (Int_t i=0; i<12 ; i++){ |
for (Int_t i=0; i<12 ; i++){ |
647 |
Float_t yyc[maxev-minev]; |
Float_t yyc[maxev-minev]; |
648 |
for (Int_t v=0; v<maxev-minev; v++){ |
for (Int_t v=0; v<maxev-minev; v++){ |
687 |
pt->cd(); |
pt->cd(); |
688 |
eventnumb[ii]=new TGraph(maxev-minev,x,eventint); |
eventnumb[ii]=new TGraph(maxev-minev,x,eventint); |
689 |
eventnumb[ii]->SetTitle(""); |
eventnumb[ii]->SetTitle(""); |
690 |
eventnumb[ii]->GetXaxis()->SetLabelSize(0.04); |
eventnumb[ii]->GetXaxis()->SetLabelSize(0.03); |
691 |
eventnumb[ii]->GetXaxis()->SetTitleSize(0.04); |
eventnumb[ii]->GetXaxis()->SetTitleSize(0.04); |
692 |
eventnumb[ii]->GetXaxis()->SetTitle("OBT (ms)"); |
eventnumb[ii]->GetXaxis()->SetTitle("OBT (ms)"); |
693 |
eventnumb[ii]->GetXaxis()->CenterTitle(); |
eventnumb[ii]->GetXaxis()->CenterTitle(); |
694 |
eventnumb[ii]->GetXaxis()->SetTickLength(0.01); |
eventnumb[ii]->GetXaxis()->SetTickLength(0.01); |
695 |
eventnumb[ii]->GetXaxis()->SetTitleOffset(1.2); |
eventnumb[ii]->GetXaxis()->SetTitleOffset(1.2); |
696 |
eventnumb[ii]->GetYaxis()->SetLabelSize(0.04); |
eventnumb[ii]->GetYaxis()->SetLabelSize(0.03); |
697 |
eventnumb[ii]->GetYaxis()->SetTitleSize(0.04); |
eventnumb[ii]->GetYaxis()->SetTitleSize(0.04); |
698 |
eventnumb[ii]->GetYaxis()->SetTitle("DSP event-number"); |
eventnumb[ii]->GetYaxis()->SetTitle("DSP event-number"); |
699 |
eventnumb[ii]->GetYaxis()->CenterTitle(); |
eventnumb[ii]->GetYaxis()->CenterTitle(); |
716 |
alarm.close(); |
alarm.close(); |
717 |
|
|
718 |
//**************************************************************************************** |
//**************************************************************************************** |
719 |
//Output figures --- Third sheet: |
//Cluster Signal ladder1 Output Pages |
720 |
//**************************************************************************************** |
//**************************************************************************************** |
721 |
|
|
722 |
fromfile.str(""); |
fromfile.str(""); |
739 |
isfile.str(""); |
isfile.str(""); |
740 |
|
|
741 |
//**************************************************************************************** |
//**************************************************************************************** |
742 |
//Output figures --- Third sheet: |
//Cluster Signal ladder2 Output Pages |
743 |
//**************************************************************************************** |
//**************************************************************************************** |
744 |
|
|
745 |
isfile<<"Cluster Signal ladder2"; |
isfile<<"Cluster Signal ladder2"; |
760 |
isfile.str(""); |
isfile.str(""); |
761 |
|
|
762 |
//**************************************************************************************** |
//**************************************************************************************** |
763 |
//Output figures --- Third sheet: |
//Cluster Signal ladder3 Output Pages |
764 |
//**************************************************************************************** |
//**************************************************************************************** |
765 |
|
|
766 |
isfile<<"Cluster Signal ladder3"; |
isfile<<"Cluster Signal ladder3"; |
781 |
isfile.str(""); |
isfile.str(""); |
782 |
|
|
783 |
//**************************************************************************************** |
//**************************************************************************************** |
784 |
//Output figures --- Fourth sheet: |
//Lighting of the views Output Pages |
785 |
//**************************************************************************************** |
//**************************************************************************************** |
786 |
|
|
787 |
isfile<<"lighting of the views"; |
isfile<<"lighting of the views"; |
800 |
t1->DrawLatex(70.,98.7,isfile.str().c_str()); |
t1->DrawLatex(70.,98.7,isfile.str().c_str()); |
801 |
isfile.str(""); |
isfile.str(""); |
802 |
|
|
803 |
|
// |
804 |
|
// Draw the histos |
805 |
for (Int_t i=0; i<12 ; i++){ |
for (Int_t i=0; i<12 ; i++){ |
806 |
|
|
807 |
TBox b; |
TBox b; |
866 |
} |
} |
867 |
|
|
868 |
printf("... end of packets. \n"); |
printf("... end of packets. \n"); |
869 |
|
|
870 |
//************************************************************************* |
//************************************************************************* |
871 |
// Save output Files |
// Save output Files |
872 |
//************************************************************************* |
//************************************************************************* |
917 |
out1.str(""); |
out1.str(""); |
918 |
out1<<ffile<<"_FTrkQLook_EXPERT-EvNum-pag"<<fl+1<<"."<<outfile.Data(); |
out1<<ffile<<"_FTrkQLook_EXPERT-EvNum-pag"<<fl+1<<"."<<outfile.Data(); |
919 |
if(fl<cntpgdat) EventNumCanv[fl]->Print(out+out1.str().c_str()); |
if(fl<cntpgdat) EventNumCanv[fl]->Print(out+out1.str().c_str()); |
920 |
if(fl==countrun-1){ |
if(fl==totpg-1){ |
921 |
out1.str(""); |
out1.str(""); |
922 |
out1<<ffile<<"_FTrkQLook_EXPERT-LandauL1."<<outfile.Data(); |
out1<<ffile<<"_FTrkQLook_EXPERT-LandauL1."<<outfile.Data(); |
923 |
LandauCanv1->Print(out+out1.str().c_str()); |
LandauCanv1->Print(out+out1.str().c_str()); |
934 |
} |
} |
935 |
} |
} |
936 |
|
|
937 |
|
// |
938 |
|
// Convert ps to pdf if required |
939 |
if(!strcmp(outfile.Data(),"pdf")){ |
if(!strcmp(outfile.Data(),"pdf")){ |
940 |
stringstream com; |
stringstream com; |
941 |
com<<"ps2pdf13 "<<out<<ffile<<"_FTrkQLook_EXPERT.ps "<<out<<ffile<<"_FTrkQLook_EXPERT.pdf"; |
com<<"ps2pdf13 "<<out<<ffile<<"_FTrkQLook_EXPERT.ps "<<out<<ffile<<"_FTrkQLook_EXPERT.pdf"; |