| 2 |
* FTrkCalibQLookExpert.cpp |
* FTrkCalibQLookExpert.cpp |
| 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 |
* step - select =1 in order to analyze one event at time |
* step - select =1 in order to analyze one event at time |
| 70 |
// |
// |
| 71 |
// obtain information about the data file and select the output dir |
// obtain information about the data file and select the output dir |
| 72 |
const string filepath=file.Data(); |
const string filepath=file.Data(); |
| 73 |
Int_t dwpos = filepath.rfind("DW_"); |
Int_t dwpos = filepath.rfind("/"); |
| 74 |
Int_t dwpos1 = filepath.find(".root"); |
Int_t dwpos1 = filepath.rfind(".root"); |
| 75 |
TString fpath=(filepath.c_str()); |
TString fpath=(filepath.c_str()); |
| 76 |
TString base,ffile; |
TString base,ffile; |
| 77 |
stringcopy(base,fpath,0,dwpos); |
stringcopy(base,fpath,0,dwpos); |
| 78 |
stringcopy(ffile,fpath,dwpos,dwpos1); |
stringcopy(ffile,fpath,dwpos+1,dwpos1); |
| 79 |
|
if(dwpos>0) base+="/"; |
| 80 |
|
|
| 81 |
TString out; |
TString out; |
| 82 |
if(outdir.Length()==0){ |
if(outdir.Length()==0){ |
| 307 |
TH1F *histoasig[12]; //histos of sigma |
TH1F *histoasig[12]; //histos of sigma |
| 308 |
TH1F *histoaped[12]; //histos of pedestals |
TH1F *histoaped[12]; //histos of pedestals |
| 309 |
|
|
| 310 |
Double_t posy = 0.95; // up y-coord - top pads |
Float_t posy = 0.95; // up y-coord - top pads |
| 311 |
Double_t hpad = 0.15; // pad height |
Float_t hpad = 0.15; // pad height |
| 312 |
Double_t posx1=0; // left x-coord - pad column |
Float_t posx1=0; // left x-coord - pad column |
| 313 |
Double_t posx2=0; // right x-coord - pad olumn |
Float_t posx2=0; // right x-coord - pad olumn |
| 314 |
Double_t posx0=0; // x-coord - column division |
Float_t posx0=0; // x-coord - column division |
| 315 |
Double_t wrel = 0.6; // relative x size of first sub-column |
Float_t wrel = 0.6; // relative x size of first sub-column |
| 316 |
Double_t marg = 0.004; // margin among pads |
Float_t marg = 0.004; // margin among pads |
| 317 |
stringstream title; |
stringstream title; |
| 318 |
stringstream hid; |
stringstream hid; |
| 319 |
|
|
| 336 |
/* -----------> HISTOGRAMS */ |
/* -----------> HISTOGRAMS */ |
| 337 |
/* calibration parameters */ |
/* calibration parameters */ |
| 338 |
title<<"DSP "<<n+1; |
title<<"DSP "<<n+1; |
| 339 |
hid<<"h"<<n; |
hid<<"h"<<n<<"i"<<i; |
| 340 |
histosig[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3072,0.5,3072.5); |
histosig[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3072,0.5,3072.5); |
| 341 |
hid.str(""); |
hid.str(""); |
| 342 |
hid<<"hh"<<n; |
hid<<"hh"<<n<<"i"<<i; |
| 343 |
histoped[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3072,0.5,3072.5); |
histoped[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3072,0.5,3072.5); |
| 344 |
hid.str(""); |
hid.str(""); |
| 345 |
hid<<"hhh"<<n; |
hid<<"hhh"<<n<<"i"<<i; |
| 346 |
title.str(""); |
title.str(""); |
| 347 |
hid.str(""); |
hid.str(""); |
| 348 |
/* AVERAGE calibration parameters */ |
/* AVERAGE calibration parameters */ |
| 349 |
hid<<"ah"<<n; |
hid<<"ah"<<n<<"i"<<i; |
| 350 |
histoasig[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3,0.5,3072.5); |
histoasig[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3,0.5,3072.5); |
| 351 |
hid.str(""); |
hid.str(""); |
| 352 |
hid<<"ahh"<<n; |
hid<<"ahh"<<n<<"i"<<i; |
| 353 |
histoaped[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3,0.5,3072.5); |
histoaped[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3,0.5,3072.5); |
| 354 |
hid.str(""); |
hid.str(""); |
| 355 |
}; //end loop on views |
}; //end loop on views |
| 454 |
li.SetLineStyle(3); |
li.SetLineStyle(3); |
| 455 |
li.SetLineWidth(2); |
li.SetLineWidth(2); |
| 456 |
|
|
| 457 |
|
Float_t maxhist=0; |
| 458 |
|
TBox b; |
| 459 |
|
b.SetFillColor(6); |
| 460 |
|
b.SetFillStyle(3945); |
| 461 |
/* plot PEDESTAL */ |
/* plot PEDESTAL */ |
| 462 |
c1->cd(); |
c1->cd(); |
| 463 |
trkpadtext[nn]->Draw(); |
trkpadtext[nn]->Draw(); |
| 470 |
histoped[nn]->SetLineWidth(1); |
histoped[nn]->SetLineWidth(1); |
| 471 |
histoped[nn]->GetYaxis()->SetTitle("PED (ADC channels)"); |
histoped[nn]->GetYaxis()->SetTitle("PED (ADC channels)"); |
| 472 |
histoped[nn]->GetYaxis()->CenterTitle(); |
histoped[nn]->GetYaxis()->CenterTitle(); |
| 473 |
if((nn+1)%2==1) histoped[nn]->GetYaxis()->SetRangeUser(2500,3200); |
if((nn+1)%2==1) histoped[nn]->GetYaxis()->SetRangeUser(2200,3200); |
| 474 |
if((nn+1)%2==0) histoped[nn]->GetYaxis()->SetRangeUser(1000,1700); |
if((nn+1)%2==0) histoped[nn]->GetYaxis()->SetRangeUser(700,1700); |
| 475 |
histoaped[nn]->SetLineColor(5); |
histoaped[nn]->SetLineColor(5); |
| 476 |
histoaped[nn]->SetLineWidth(1); |
histoaped[nn]->SetLineWidth(1); |
| 477 |
if(ctrk.good0[0]==1 && ctrk.good0[1]==1) histoped[nn]->Draw("b"); |
if(ctrk.good0[0]==1 && ctrk.good0[1]==1){ |
| 478 |
|
histoped[nn]->Draw("b"); |
| 479 |
|
if(nn==1){ |
| 480 |
|
maxhist=histoped[nn]->GetMaximum(); |
| 481 |
|
b.DrawBox(2816.,700.,3060.,maxhist); |
| 482 |
|
} |
| 483 |
|
else if(nn==6){ |
| 484 |
|
maxhist=histoped[nn]->GetMaximum(); |
| 485 |
|
b.DrawBox(2560.,2200.,2816.,maxhist); |
| 486 |
|
b.DrawBox(512.,2200.,768.,maxhist); |
| 487 |
|
b.DrawBox(1024.,2200.,1792.,maxhist); |
| 488 |
|
} |
| 489 |
|
else if(nn==11){ |
| 490 |
|
maxhist=histoped[nn]->GetMaximum(); |
| 491 |
|
b.DrawBox(768.,700.,1024.,maxhist); |
| 492 |
|
} |
| 493 |
|
} |
| 494 |
else histoped[nn]->Draw("axis"); |
else histoped[nn]->Draw("axis"); |
| 495 |
histoaped[nn]->Draw("same"); |
histoaped[nn]->Draw("same"); |
| 496 |
if((nn+1)%2==1) { |
if((nn+1)%2==1) { |
| 497 |
li.DrawLine(1024.5,2500,1024.5,3200); |
li.DrawLine(1024.5,2200,1024.5,3200); |
| 498 |
li.DrawLine(2048.5,2500,2048.5,3200); |
li.DrawLine(2048.5,2200,2048.5,3200); |
| 499 |
} |
} |
| 500 |
if((nn+1)%2==0) { |
if((nn+1)%2==0) { |
| 501 |
li.DrawLine(1024.5,1000,1024.5,1700); |
li.DrawLine(1024.5,700,1024.5,1700); |
| 502 |
li.DrawLine(2048.5,1000,2048.5,1700); |
li.DrawLine(2048.5,700,2048.5,1700); |
| 503 |
} |
} |
| 504 |
|
|
| 505 |
|
|
| 506 |
|
|
| 507 |
/* plot SIGMA */ |
/* plot SIGMA */ |
| 508 |
Double_t max=500.; |
Float_t max=500.; |
| 509 |
c2->cd(); |
c2->cd(); |
| 510 |
trkpadtext[nn]->Draw(); |
trkpadtext[nn]->Draw(); |
| 511 |
trkpad2[nn]->SetLogy(); |
trkpad2[nn]->SetLogy(); |
| 522 |
histosig[nn]->GetYaxis()->CenterTitle(); |
histosig[nn]->GetYaxis()->CenterTitle(); |
| 523 |
histoasig[nn]->SetLineColor(5); |
histoasig[nn]->SetLineColor(5); |
| 524 |
histoasig[nn]->SetLineWidth(1); |
histoasig[nn]->SetLineWidth(1); |
| 525 |
if(ctrk.good0[0]==1 && ctrk.good0[1]==1) histosig[nn]->Draw("b"); |
if(ctrk.good0[0]==1 && ctrk.good0[1]==1){ |
| 526 |
|
histosig[nn]->Draw("b"); |
| 527 |
|
if(nn==1){ |
| 528 |
|
maxhist=histosig[nn]->GetMaximum(); |
| 529 |
|
b.DrawBox(2816.,0.,3060.,maxhist); |
| 530 |
|
} |
| 531 |
|
else if(nn==6){ |
| 532 |
|
maxhist=histosig[nn]->GetMaximum(); |
| 533 |
|
b.DrawBox(2560.,0.,2816.,maxhist); |
| 534 |
|
b.DrawBox(512.,0.,768.,maxhist); |
| 535 |
|
b.DrawBox(1024.,0.,1792.,maxhist); |
| 536 |
|
} |
| 537 |
|
else if(nn==11){ |
| 538 |
|
maxhist=histosig[nn]->GetMaximum(); |
| 539 |
|
b.DrawBox(768.,0.,1024.,maxhist); |
| 540 |
|
} |
| 541 |
|
} |
| 542 |
else histosig[nn]->Draw("axis"); |
else histosig[nn]->Draw("axis"); |
| 543 |
histoasig[nn]->Draw("same"); |
histoasig[nn]->Draw("same"); |
| 544 |
li.DrawLine(1024.5,0,1024.5,max); |
li.DrawLine(1024.5,0,1024.5,max); |
| 545 |
li.DrawLine(2048.5,0,2048.5,max); |
li.DrawLine(2048.5,0,2048.5,max); |
| 546 |
|
|
| 547 |
|
|
| 548 |
|
|
| 549 |
};//end loop on views |
};//end loop on views |
| 550 |
|
|
| 551 |
c1->Update();//draw pads in canvas |
c1->Update();//draw pads in canvas |