| 2 |
* FTrkScanQlook_EXPERT.cxx |
* FTrkScanQlook_EXPERT.cxx |
| 3 |
* |
* |
| 4 |
* autor: D.Fedele |
* autor: D.Fedele |
| 5 |
* version v1r18 |
* version v2r00 |
| 6 |
* Parameters: |
* Parameters: |
| 7 |
* file - the path to the root file to analyze |
* file - the path to the root file to analyze |
| 8 |
* outdir - total path of output file |
* outdir - total path of output file |
| 9 |
* event - the number of the single event to analyze |
* event - the number of the single event to analyze |
| 10 |
* DSPprint - the number of a particular DSP to draw (0 don't draw) |
* va1 - the number of the single va1 to analyze (dsp*100+va1) |
| 11 |
* outfile - extension of output file (pdf,ps,gif,jpg) |
* outfile - extension of output file (pdf,ps,gif,jpg) |
| 12 |
* |
* |
| 13 |
*/ |
*/ |
| 14 |
// |
// |
| 118 |
} |
} |
| 119 |
|
|
| 120 |
|
|
| 121 |
void FTrkScanQLook_EXPERT(TString file, TString outdir,Int_t event, Int_t DSPprint, TString outfile) |
void FTrkScanQLook_EXPERT(TString file, TString outdir,Int_t event, Int_t va1, TString outfile) |
| 122 |
{ |
{ |
| 123 |
|
|
| 124 |
// |
// |
| 175 |
printf(" Number of Header Entries: %d\n",neventH); |
printf(" Number of Header Entries: %d\n",neventH); |
| 176 |
|
|
| 177 |
Long64_t obt=0; |
Long64_t obt=0; |
| 178 |
Int_t ev[2],cin=0; |
Int_t eve,cin=0;//,p=0; |
| 179 |
|
// if(event<0) Int_t eve[abs(event)]; |
| 180 |
TString cal=""; |
TString cal=""; |
| 181 |
|
|
| 182 |
ev[0]=3; |
eve=3; |
| 183 |
ev[1]=4; |
//ev[0]=3; |
| 184 |
|
// ev[1]=4; |
| 185 |
for(Int_t i=0;i<neventH;i++){ |
for(Int_t i=0;i<neventH;i++){ |
| 186 |
otr->GetEntry(i); |
otr->GetEntry(i); |
| 187 |
pH = eH->GetPscuHeader(); |
pH = eH->GetPscuHeader(); |
| 192 |
} |
} |
| 193 |
if(i==neventH-1){ |
if(i==neventH-1){ |
| 194 |
cal="***** ONLINE CALIBRATION NOT FOUND IN THIS FILE *****"; |
cal="***** ONLINE CALIBRATION NOT FOUND IN THIS FILE *****"; |
| 195 |
ev[0]=2; |
eve=2; |
| 196 |
ev[1]=3; |
// ev[0]=2; |
| 197 |
|
//ev[1]=3; |
| 198 |
} |
} |
| 199 |
} |
} |
| 200 |
if(ev[0]==3){ |
if(eve==3){ |
| 201 |
for(Int_t i=0;i<nevents;i++){ |
for(Int_t i=0;i<nevents;i++){ |
| 202 |
tr->GetEntry(i); |
tr->GetEntry(i); |
| 203 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
| 205 |
if(i==0) cin=cod->Get(pctp->CalibTrk1); |
if(i==0) cin=cod->Get(pctp->CalibTrk1); |
| 206 |
if(reh->TRK_CALIB_USED==104) continue; |
if(reh->TRK_CALIB_USED==104) continue; |
| 207 |
if(event<0 && cod->Get(pctp->CalibTrk1)==cin+1){ |
if(event<0 && cod->Get(pctp->CalibTrk1)==cin+1){ |
| 208 |
ev[0]=i+3; |
eve=i+3; |
|
ev[1]=i+4; |
|
| 209 |
break; |
break; |
| 210 |
} |
} |
| 211 |
else if(event>=0 && ph->GetOrbitalTime()>obt){ |
else if(event>=0 && ph->GetOrbitalTime()>obt){ |
| 212 |
ev[0]=i+3; |
eve=i+3; |
| 213 |
ev[1]=i+4; |
//ev[0]=i+3; |
| 214 |
|
//ev[1]=i+4; |
| 215 |
break; |
break; |
| 216 |
} |
} |
| 217 |
} |
} |
| 218 |
} |
} |
| 219 |
|
|
| 220 |
|
int tot=2; |
| 221 |
|
if(event<0) tot=abs(event); |
| 222 |
|
|
| 223 |
|
TH1F *histomax[12][tot]; //histos of max signals |
| 224 |
|
TH1F *histocomp[12][tot]; //histos of compressed data |
| 225 |
|
TH1F *histofull[12][tot]; //histos of full data |
| 226 |
|
TCanvas *c1[tot]; |
| 227 |
|
TH1F *histova[tot]; //histos of va1 signals |
| 228 |
|
TCanvas *cva[tot]; |
| 229 |
|
|
| 230 |
|
|
| 231 |
|
TLatex *t=new TLatex(); |
| 232 |
|
t->SetTextFont(32); |
| 233 |
|
t->SetTextColor(1); |
| 234 |
|
t->SetTextAlign(12); |
| 235 |
|
t->SetTextSize(0.02); |
| 236 |
|
|
|
TH1F *histomax[12][2]; //histos of max signals |
|
|
TH1F *histocomp[12][2]; //histos of compressed data |
|
|
TH1F *histofull[12][2]; //histos of full data |
|
|
TCanvas *c1[2]; |
|
| 237 |
|
|
| 238 |
for(Int_t e=0;e<2;e++){ |
for(Int_t e=0;e<tot;e++){ |
| 239 |
if(event<=0) |
if(event<=0) |
| 240 |
event=ev[e]; |
event=eve; |
| 241 |
else { |
else { |
| 242 |
event=event+e; |
event=event+e; |
| 243 |
if(event>ev[e]-3 && ev[0]>2) |
if(event>eve-3 && eve>2) |
| 244 |
cal="Event with online calibration"; |
cal="Event with online calibration"; |
| 245 |
else |
else |
| 246 |
cal="***** ONLINE CALIBRATION NOT FOUND IN THIS FILE *****"; |
cal="***** ONLINE CALIBRATION NOT FOUND IN THIS FILE *****"; |
| 252 |
|
|
| 253 |
gStyle->SetLabelSize(0.06,"x"); |
gStyle->SetLabelSize(0.06,"x"); |
| 254 |
gStyle->SetLabelSize(0.06,"y"); |
gStyle->SetLabelSize(0.06,"y"); |
| 255 |
gStyle->SetTitleFontSize(0.1); |
//gStyle->SetTitleFontSize(0.1); |
| 256 |
gStyle->SetFillColor(10); |
gStyle->SetFillColor(10); |
| 257 |
gStyle->SetTitleFillColor(10); |
gStyle->SetTitleFillColor(10); |
| 258 |
gStyle->SetTitleOffset(-1,"Y"); |
gStyle->SetTitleOffset(-1,"Y"); |
| 260 |
|
|
| 261 |
// draw display area |
// draw display area |
| 262 |
|
|
| 263 |
|
stringstream fromfile,title,hid,message; |
| 264 |
|
TString figsa="",figsav="",figsava=""; |
| 265 |
|
|
| 266 |
Int_t canvasx=1200; |
Int_t canvasx=1200; |
| 267 |
Int_t canvasy=900; |
Int_t canvasy=900; |
| 268 |
stringstream figsav; |
figsav=out+ffile+"_FTrkScanQLook_EXPERT_ev"; |
| 269 |
figsav.str(""); |
figsav+=event+1; |
| 270 |
figsav<<out<<ffile<<"_FTrkScanQLook_EXPERT_ev"<<event+1<<"."<<outfile.Data(); |
c1[e] = new TCanvas(figsav.Data(),"FTrkQLookSCAN",canvasx,canvasy); |
|
c1[e] = new TCanvas(figsav.str().c_str(),"FTrkQLookSCAN",canvasx,canvasy); |
|
| 271 |
c1[e]->SetFillColor(10); |
c1[e]->SetFillColor(10); |
| 272 |
c1[e]->Range(0,0,1,1); |
c1[e]->Range(0,0,1,1); |
| 273 |
stringstream fromfile; |
fromfile.str(""); |
| 274 |
fromfile<<"FTrkScanQLook_EXPERT File: "<<ffile<<" ----> Entry "<<event; |
fromfile<<"FTrkScanQLook_EXPERT File: "<<ffile<<" ----> Entry "<<event; |
|
TLatex *t=new TLatex(); |
|
|
t->SetTextFont(32); |
|
|
t->SetTextColor(1); |
|
|
t->SetTextAlign(12); |
|
|
t->SetTextSize(0.02); |
|
| 275 |
t->DrawLatex(0.02,0.98,fromfile.str().c_str()); |
t->DrawLatex(0.02,0.98,fromfile.str().c_str()); |
| 276 |
t->DrawLatex(0.60,0.98,cal.Data()); |
t->DrawLatex(0.60,0.98,cal.Data()); |
| 277 |
|
|
| 278 |
|
if(va1!=0){ |
| 279 |
|
figsava=out+ffile+"_FTrkScanQLook_EXPERT_ev"; |
| 280 |
|
figsava+=event+1; |
| 281 |
|
figsava+="_DSP"; |
| 282 |
|
figsava+=(int)(va1/100); |
| 283 |
|
figsava+="_VA1-"; |
| 284 |
|
figsava+=va1%100; |
| 285 |
|
cva[e] = new TCanvas(figsava.Data(),"TrkQLookSCAN VA1",canvasx,canvasy); |
| 286 |
|
cva[e]->SetFillColor(10); |
| 287 |
|
cva[e]->Range(0,0,1,1); |
| 288 |
|
fromfile.str(""); |
| 289 |
|
fromfile<<"FTrkScanQLook_EXPERT File: "<<ffile<<" ----> Entry "<<event<<" --> DSP "<<(int)(va1/100)<<" --> va1 "<<va1%100; |
| 290 |
|
t->DrawLatex(0.02,0.98,fromfile.str().c_str()); |
| 291 |
|
// t->DrawLatex(0.65,0.98,cal.Data()); |
| 292 |
|
} |
| 293 |
|
|
| 294 |
// draw pads |
// draw pads |
| 295 |
TPad *trkpad[12]; //pad for histos |
TPad *trkpad[12],*pad; //pad for histos |
| 296 |
TPaveText *trkpadtext[12]; //pad for header |
TPaveText *trkpadtext[12]; //pad for header |
| 297 |
Double_t posy = 0.95; // up y-coord - top pads |
Double_t posy = 0.95; // up y-coord - top pads |
| 298 |
Double_t hpad = 0.15; // pad height |
Double_t hpad = 0.15; // pad height |
| 302 |
Double_t wrel = 0.6; // relative x size of first sub-column |
Double_t wrel = 0.6; // relative x size of first sub-column |
| 303 |
Double_t marg = 0.004; // margin among pads |
Double_t marg = 0.004; // margin among pads |
| 304 |
|
|
|
|
|
|
stringstream title; |
|
|
stringstream hid; |
|
| 305 |
for(Int_t n = 0; n<12; n++){ |
for(Int_t n = 0; n<12; n++){ |
| 306 |
if ( (n+1)%2 ) { |
if ( (n+1)%2 ) { |
| 307 |
if(n>1)posy = posy-(marg*2+hpad); |
if(n>1)posy = posy-(marg*2+hpad); |
| 331 |
histofull[n][e] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
histofull[n][e] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
| 332 |
title.str(""); |
title.str(""); |
| 333 |
hid.str(""); |
hid.str(""); |
| 334 |
} //end loop on views |
} |
| 335 |
|
if(va1!=0){ |
| 336 |
|
title.str(""); |
| 337 |
|
title<<"DSP "<<(int)(va1/100)<<" -- va1 "<<va1%100; |
| 338 |
|
hid<<"va"<<e; |
| 339 |
|
histova[e] = new TH1F(hid.str().c_str(),title.str().c_str(),129,-0.5,128.5); |
| 340 |
|
} //end loop on views |
| 341 |
|
|
| 342 |
|
/* -----------> pad for histograms */ |
| 343 |
|
pad = new TPad("padva"," ",0,0,1,0.97,18,0,0); |
| 344 |
|
pad->SetFillColor(19); |
| 345 |
|
pad->SetFrameFillColor(10); |
| 346 |
|
|
| 347 |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
| 348 |
// create header dump retrieving event info |
// create header dump retrieving event info |
| 349 |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
| 350 |
Int_t ndsp=0; |
Int_t ndsp=0; |
|
stringstream message; |
|
| 351 |
|
|
| 352 |
Double_t whistomax[3072]; |
Double_t whistomax[3072]; |
| 353 |
Double_t whisto[3072]; |
Double_t whisto[3072]; |
| 514 |
histomax[nn][e]->Fill((Float_t)i,whistomax[i]); |
histomax[nn][e]->Fill((Float_t)i,whistomax[i]); |
| 515 |
histocomp[nn][e]->Fill((Float_t)i,whistocomp[i]); |
histocomp[nn][e]->Fill((Float_t)i,whistocomp[i]); |
| 516 |
histofull[nn][e]->Fill((Float_t)i,whistofull[i]); |
histofull[nn][e]->Fill((Float_t)i,whistofull[i]); |
| 517 |
|
if(va1!=0 && ndsp==(int)(va1/100) && i>=128*((va1%100)-1)){ |
| 518 |
|
if(i<128*(va1%100)) |
| 519 |
|
histova[e]->Fill((Float_t)(i-128*((va1%100)-1)+1),whistofull[i]); |
| 520 |
|
} |
| 521 |
} |
} |
| 522 |
|
|
| 523 |
TBox b; |
TBox b; |
| 524 |
|
TLine li,liva1; |
| 525 |
|
li.SetLineColor(38); |
| 526 |
|
li.SetLineStyle(4); |
| 527 |
|
li.SetLineWidth(2); |
| 528 |
|
liva1.SetLineColor(42); |
| 529 |
|
liva1.SetLineStyle(3); |
| 530 |
|
liva1.SetLineWidth(1); |
| 531 |
|
|
| 532 |
|
Float_t va1x=0; |
| 533 |
|
|
| 534 |
|
if(va1!=0){ |
| 535 |
|
cva[e]->cd(); |
| 536 |
|
pad->Draw(); |
| 537 |
|
pad->cd(); |
| 538 |
|
pad->SetFillColor(10); |
| 539 |
|
histova[e]->SetTitleSize(0.01); |
| 540 |
|
histova[e]->GetYaxis()->SetRangeUser(1500,4500); |
| 541 |
|
histova[e]->SetLineColor(40); |
| 542 |
|
histova[e]->SetFillColor(40); |
| 543 |
|
histova[e]->SetLineWidth(1); |
| 544 |
|
histova[e]->SetLineStyle(2); |
| 545 |
|
// histova[e]->GetYaxis()->SetLabelSize(0.03); |
| 546 |
|
histova[e]->Draw(""); |
| 547 |
|
cva[e]->Update(); |
| 548 |
|
} |
| 549 |
|
|
| 550 |
c1[e]->cd(); |
c1[e]->cd(); |
| 551 |
trkpadtext[nn]->Draw(); |
trkpadtext[nn]->Draw(); |
| 553 |
trkpad[nn]->cd(); |
trkpad[nn]->cd(); |
| 554 |
trkpad[nn]->SetFillColor(10); |
trkpad[nn]->SetFillColor(10); |
| 555 |
|
|
| 556 |
|
histocomp[nn][e]->SetTitleSize(0.1); |
| 557 |
histocomp[nn][e]->GetYaxis()->SetRangeUser(-500,4500); |
histocomp[nn][e]->GetYaxis()->SetRangeUser(-500,4500); |
| 558 |
histocomp[nn][e]->SetLineStyle(1); |
histocomp[nn][e]->SetLineStyle(1); |
| 559 |
histocomp[nn][e]->SetLineColor(38); |
histocomp[nn][e]->SetLineColor(38); |
| 638 |
b.DrawBox(0.,-500.,512.,4500.); |
b.DrawBox(0.,-500.,512.,4500.); |
| 639 |
b.DrawBox(1920.,-500.,2560.,4500.); |
b.DrawBox(1920.,-500.,2560.,4500.); |
| 640 |
} |
} |
| 641 |
|
for(int va=1; va<24; va++){ |
| 642 |
|
va1x=128*va; |
| 643 |
|
liva1.DrawLine(va1x,-500.,va1x,4500.); |
| 644 |
|
} |
| 645 |
|
li.DrawLine(1024.5,-500.,1024.5,4500.); |
| 646 |
|
li.DrawLine(2048.5,-500.,2048.5,4500.); |
| 647 |
c1[e]->Update(); |
c1[e]->Update(); |
| 648 |
} |
} |
| 649 |
} |
} |
| 650 |
|
|
| 651 |
}//end loop on views |
}//end loop on views |
| 652 |
|
|
| 653 |
c1[e]->Print(figsav.str().c_str()); |
stringstream nom1,nom2,nom3; |
| 654 |
|
nom1<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps("; |
| 655 |
|
nom2<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps"; |
| 656 |
|
nom3<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps)"; |
| 657 |
|
|
| 658 |
|
if(!strcmp(outfile.Data(),"ps")||!strcmp(outfile.Data(),"pdf")){ |
| 659 |
|
if(e==0){ |
| 660 |
|
c1[e]->Print(nom1.str().c_str(),"Portrait"); |
| 661 |
|
if(va1!=0) cva[e]->Print(nom2.str().c_str(),"Portrait"); |
| 662 |
|
} |
| 663 |
|
if(e>0 && tot>2){ |
| 664 |
|
c1[e]->Print(nom2.str().c_str(),"Portrait"); |
| 665 |
|
if(va1!=0) cva[e]->Print(nom2.str().c_str(),"Portrait"); |
| 666 |
|
} |
| 667 |
|
if(e==tot-1){ |
| 668 |
|
c1[e]->Print(nom2.str().c_str(),"Portrait"); |
| 669 |
|
if(va1!=0) cva[e]->Print(nom3.str().c_str(),"Portrait"); |
| 670 |
|
} |
| 671 |
|
} |
| 672 |
|
else{ |
| 673 |
|
figsav+="."+outfile; |
| 674 |
|
c1[e]->Print(figsav.Data()); |
| 675 |
|
if(va1!=0){ |
| 676 |
|
figsava+="."+outfile; |
| 677 |
|
cva[e]->Print(figsava.Data()); |
| 678 |
|
} |
| 679 |
|
} |
| 680 |
} |
} |
| 681 |
|
|
| 682 |
|
// |
| 683 |
|
// Convert ps to pdf if required |
| 684 |
|
if(!strcmp(outfile.Data(),"pdf")){ |
| 685 |
|
stringstream com; |
| 686 |
|
com<<"ps2pdf13 "<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps "<<out<<ffile<<"_FTrkScanQLook_EXPERT.pdf"; |
| 687 |
|
system(com.str().c_str()); |
| 688 |
|
printf("\n---> ps file converted in pdf format!\n"); |
| 689 |
|
com.str(""); |
| 690 |
|
com<<"rm -f "<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps "; |
| 691 |
|
system(com.str().c_str()); |
| 692 |
|
printf("---> ps file removed!\n\n"); |
| 693 |
|
com.str(""); |
| 694 |
|
} |
| 695 |
|
|
| 696 |
return; |
return; |
| 697 |
} |
} |