Rev 146 | Rev 172 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 146 | Rev 167 | ||
---|---|---|---|
Line 24... | Line 24... | ||
24 | { |
24 | { |
25 | TGFileInfo file_info; |
25 | TGFileInfo file_info; |
26 | const char *filetypes[] = {"Histograms",histextall,0,0}; |
26 | const char *filetypes[] = {"Histograms",histextall,0,0}; |
27 | char *cTemp; |
27 | char *cTemp; |
28 | file_info.fFileTypes = filetypes; |
28 | file_info.fFileTypes = filetypes; |
29 |
|
29 | // cTemp = new char[1024]; |
30 |
|
30 | // sprintf(cTemp, "%s/results", rootdir); |
31 |
|
31 | // file_info.fIniDir = StrDup(cTemp); |
- | 32 | file_info.fIniDir = StrDup(currentOpenDir); |
|
32 | file_info.fMultipleSelection = kFALSE; |
33 | file_info.fMultipleSelection = kFALSE; |
33 | new TGFileDialog(gClient->GetDefaultRoot(), fMain, kFDOpen, &file_info); |
34 | new TGFileDialog(gClient->GetDefaultRoot(), fMain, kFDOpen, &file_info); |
34 |
|
35 | // delete[] cTemp; |
35 | 36 | ||
36 | if(file_info.fFilename != NULL) |
37 | if(file_info.fFilename != NULL) |
37 | { |
38 | { |
38 | darkRun->widgetTE->SetText(file_info.fFilename); |
39 | darkRun->widgetTE->SetText(file_info.fFilename); |
39 | fileList->AddEntry(file_info.fFilename, fileList->GetNumberOfEntries()); |
40 | fileList->AddEntry(file_info.fFilename, fileList->GetNumberOfEntries()); |
Line 243... | Line 244... | ||
243 | m += evtdata.adcdata[j]; |
244 | m += evtdata.adcdata[j]; |
244 | } |
245 | } |
245 | } |
246 | } |
246 | 247 | ||
247 | // X, Y and Z values from each file (table units or microns) |
248 | // X, Y and Z values from each file (table units or microns) |
248 | if( |
249 | if(posUnitsPlot->widgetCB->GetSelected() == 0) |
249 | { |
250 | { |
250 | if(direction == 1) |
251 | if(direction == 1) |
251 | surfxy[i] = (double)(evtheader.xpos); |
252 | surfxy[i] = (double)(evtheader.xpos); |
252 | else if(direction == 2) |
253 | else if(direction == 2) |
253 | surfxy[i] = (double)(evtheader.ypos); |
254 | surfxy[i] = (double)(evtheader.ypos); |
254 | surfz[i] = (double)(evtheader.zpos); |
255 | surfz[i] = (double)(evtheader.zpos); |
255 | } |
256 | } |
256 | else if( |
257 | else if(posUnitsPlot->widgetCB->GetSelected() == 1) |
257 | { |
258 | { |
258 | if(direction == 1) |
259 | if(direction == 1) |
259 | surfxy[i] = (double)(evtheader.xpos*lenconversion); |
260 | surfxy[i] = (double)(evtheader.xpos*lenconversion); |
260 | else if(direction == 2) |
261 | else if(direction == 2) |
261 | surfxy[i] = (double)(evtheader.ypos*lenconversion); |
262 | surfxy[i] = (double)(evtheader.ypos*lenconversion); |
Line 415... | Line 416... | ||
415 | gScan2D->GetXaxis()->SetRangeUser(range[0], range[1]); |
416 | gScan2D->GetXaxis()->SetRangeUser(range[0], range[1]); |
416 | gScan2D->GetXaxis()->SetNoExponent(kTRUE); |
417 | gScan2D->GetXaxis()->SetNoExponent(kTRUE); |
417 | gScan2D->GetYaxis()->SetTitleOffset(1.9); |
418 | gScan2D->GetYaxis()->SetTitleOffset(1.9); |
418 | gScan2D->GetYaxis()->CenterTitle(kTRUE); |
419 | gScan2D->GetYaxis()->CenterTitle(kTRUE); |
419 | gScan2D->GetYaxis()->SetLabelSize(0.027); |
420 | gScan2D->GetYaxis()->SetLabelSize(0.027); |
420 | gScan2D-> |
421 | gScan2D->GetYaxis()->SetLabelOffset(0.02); |
421 | gScan2D->GetYaxis()->SetRangeUser(range[2], range[3]); |
422 | gScan2D->GetYaxis()->SetRangeUser(range[2], range[3]); |
422 | gScan2D->GetYaxis()->SetNoExponent(kTRUE); |
423 | gScan2D->GetYaxis()->SetNoExponent(kTRUE); |
423 | 424 | ||
424 | /* TGaxis *yax = (TGaxis*)gScan2D->GetYaxis(); |
425 | /* TGaxis *yax = (TGaxis*)gScan2D->GetYaxis(); |
425 | yax->SetMaxDigits(4);*/ |
426 | yax->SetMaxDigits(4);*/ |
426 | 427 | ||
427 | if(!cleanPlots) |
428 | if(!cleanPlots) |
428 | { |
429 | { |
429 | if(direction == 1) |
430 | if(direction == 1) |
430 | { |
431 | { |
431 | if( |
432 | if(posUnitsPlot->widgetCB->GetSelected() == 0) |
432 | gScan2D->SetTitle("Laser focal point;X [table units];Z [table units]"); |
433 | gScan2D->SetTitle("Laser focal point;X [table units];Z [table units]"); |
433 | else if( |
434 | else if(posUnitsPlot->widgetCB->GetSelected() == 1) |
434 | gScan2D->SetTitle("Laser focal point;X [#mum];Z [#mum]"); |
435 | gScan2D->SetTitle("Laser focal point;X [#mum];Z [#mum]"); |
435 | } |
436 | } |
436 | else if(direction == 2) |
437 | else if(direction == 2) |
437 | { |
438 | { |
438 | if( |
439 | if(posUnitsPlot->widgetCB->GetSelected() == 0) |
439 | gScan2D->SetTitle("Laser focal point;Y [table units];Z [table units]"); |
440 | gScan2D->SetTitle("Laser focal point;Y [table units];Z [table units]"); |
440 | else if( |
441 | else if(posUnitsPlot->widgetCB->GetSelected() == 1) |
441 | gScan2D->SetTitle("Laser focal point;Y [#mum];Z [#mum]"); |
442 | gScan2D->SetTitle("Laser focal point;Y [#mum];Z [#mum]"); |
442 | } |
443 | } |
443 | } |
444 | } |
444 | else |
445 | else |
445 | { |
446 | { |
446 | if(direction == 1) |
447 | if(direction == 1) |
447 | { |
448 | { |
448 | if( |
449 | if(posUnitsPlot->widgetCB->GetSelected() == 0) |
449 | gScan2D->SetTitle(";X [table units];Z [table units]"); |
450 | gScan2D->SetTitle(";X [table units];Z [table units]"); |
450 | else if( |
451 | else if(posUnitsPlot->widgetCB->GetSelected() == 1) |
451 | gScan2D->SetTitle(";X [#mum];Z [#mum]"); |
452 | gScan2D->SetTitle(";X [#mum];Z [#mum]"); |
452 | } |
453 | } |
453 | else if(direction == 2) |
454 | else if(direction == 2) |
454 | { |
455 | { |
455 | if( |
456 | if(posUnitsPlot->widgetCB->GetSelected() == 0) |
456 | gScan2D->SetTitle(";Y [table units];Z [table units]"); |
457 | gScan2D->SetTitle(";Y [table units];Z [table units]"); |
457 | else if( |
458 | else if(posUnitsPlot->widgetCB->GetSelected() == 1) |
458 | gScan2D->SetTitle(";Y [#mum];Z [#mum]"); |
459 | gScan2D->SetTitle(";Y [#mum];Z [#mum]"); |
459 | } |
460 | } |
460 | } |
461 | } |
461 | 462 | ||
462 | gCanvas->Modified(); |
463 | gCanvas->Modified(); |
Line 478... | Line 479... | ||
478 | if(edit == 0) |
479 | if(edit == 0) |
479 | { |
480 | { |
480 | delete gScan2D; |
481 | delete gScan2D; |
481 | delete gCanvas; |
482 | delete gCanvas; |
482 | } |
483 | } |
483 | } |
484 | } |
484 | else |
485 | else |
485 | { |
486 | { |
486 | // Update the progress bar |
487 | // Update the progress bar |
487 | analysisProgress->widgetPB->SetPosition(100.0); |
488 | analysisProgress->widgetPB->SetPosition(100.0); |
488 | gVirtualX->Update(1); |
489 | gVirtualX->Update(1); |
Line 496... | Line 497... | ||
496 | int pdfmax = -1; |
497 | int pdfmax = -1; |
497 | int count = 0; |
498 | int count = 0; |
498 | char ctemp[1024]; |
499 | char ctemp[1024]; |
499 | char exportname[1024]; |
500 | char exportname[1024]; |
500 | TCanvas *gCanvas; |
501 | TCanvas *gCanvas; |
501 | 502 | ||
502 | // Prepare the CDF plot |
503 | // Prepare the CDF plot |
503 | gScan[1] = new TGraph(); |
504 | gScan[1] = new TGraph(); |
504 | for(int i = 0; i < points; i++) |
505 | for(int i = 0; i < points; i++) |
505 | { |
506 | { |
506 | count = filenr - points + i; |
507 | count = filenr - points + i; |
507 | gScan[1]->SetPoint(i, (double)xy[count], (double)integAcc[i]/(*max)); |
508 | gScan[1]->SetPoint(i, (double)xy[count], (double)integAcc[i]/(*max)); |
508 | if(DBGSIG) printf("PlotEdgeDistribution(): CDF %d: %lf, %lf\n", i, (double)xy[count], (double)integAcc[i]/(*max)); |
509 | if(DBGSIG) printf("PlotEdgeDistribution(): CDF %d: %lf, %lf\n", i, (double)xy[count], (double)integAcc[i]/(*max)); |
509 | 510 | ||
510 | if( ((integAcc[i+1]-integAcc[i])/(*max) > pdfmax) && (i < points-1) ) |
511 | if( ((integAcc[i+1]-integAcc[i])/(*max) > pdfmax) && (i < points-1) ) |
511 | pdfmax = (integAcc[i+1]-integAcc[i])/(*max); |
512 | pdfmax = (integAcc[i+1]-integAcc[i])/(*max); |
512 | } |
513 | } |
513 | 514 | ||
514 | pdfmax = (TMath::Ceil(pdfmax*10))/10.; |
515 | pdfmax = (TMath::Ceil(pdfmax*10))/10.; |
515 | 516 | ||
516 | // Prepare the PDF plot |
517 | // Prepare the PDF plot |
517 | gScan[0] = new TGraph(); |
518 | gScan[0] = new TGraph(); |
518 | for(int i = points-1; i >= 0; i--) |
519 | for(int i = points-1; i >= 0; i--) |
519 | { |
520 | { |
520 | count = (filenr-1) - (points-1) + i; |
521 | count = (filenr-1) - (points-1) + i; |
521 | // Set any negative values of the PDF to 0 |
522 | // Set any negative values of the PDF to 0 |
522 | if( (integAcc[i]-integAcc[i-1])/(*max) < 0 ) |
523 | if( (integAcc[i]-integAcc[i-1])/(*max) < 0 ) |
523 | gScan[0]->SetPoint(i, (double)xy[count], 0); |
524 | gScan[0]->SetPoint(i, (double)xy[count], 0); |
524 | else |
525 | else |
Line 550... | Line 551... | ||
550 | TPaveStats *stats = (TPaveStats*)gScan[0]->FindObject("stats"); |
551 | TPaveStats *stats = (TPaveStats*)gScan[0]->FindObject("stats"); |
551 | if(!cleanPlots) |
552 | if(!cleanPlots) |
552 | { |
553 | { |
553 | stats->SetX1NDC(0.86); stats->SetX2NDC(1.0); |
554 | stats->SetX1NDC(0.86); stats->SetX2NDC(1.0); |
554 | stats->SetY1NDC(0.87); stats->SetY2NDC(1.0); |
555 | stats->SetY1NDC(0.87); stats->SetY2NDC(1.0); |
555 | } |
556 | } |
556 | else |
557 | else |
557 | { |
558 | { |
558 | stats->SetX1NDC(1.1); stats->SetX2NDC(1.3); |
559 | stats->SetX1NDC(1.1); stats->SetX2NDC(1.3); |
559 | stats->SetY1NDC(1.1); stats->SetY2NDC(1.3); |
560 | stats->SetY1NDC(1.1); stats->SetY2NDC(1.3); |
560 | } |
561 | } |
Line 569... | Line 570... | ||
569 | gScan[1]->GetXaxis()->CenterTitle(kTRUE); |
570 | gScan[1]->GetXaxis()->CenterTitle(kTRUE); |
570 | gScan[1]->GetXaxis()->SetLabelSize(0.027); |
571 | gScan[1]->GetXaxis()->SetLabelSize(0.027); |
571 | gScan[1]->GetXaxis()->SetLabelOffset(0.02); |
572 | gScan[1]->GetXaxis()->SetLabelOffset(0.02); |
572 | gScan[1]->GetXaxis()->SetNoExponent(kTRUE); |
573 | gScan[1]->GetXaxis()->SetNoExponent(kTRUE); |
573 | gScan[1]->GetYaxis()->SetTitle("Normalized ADC integral"); |
574 | gScan[1]->GetYaxis()->SetTitle("Normalized ADC integral"); |
574 | 575 | ||
575 | gScan[1]->GetYaxis()->CenterTitle(kTRUE); |
576 | gScan[1]->GetYaxis()->CenterTitle(kTRUE); |
576 | gScan[1]->GetYaxis()->SetLabelSize(0.027); |
577 | gScan[1]->GetYaxis()->SetLabelSize(0.027); |
577 | gScan[1]->GetYaxis()->SetLabelOffset(0.02); |
578 | gScan[1]->GetYaxis()->SetLabelOffset(0.02); |
578 | gScan[1]->GetYaxis()->SetRangeUser(0,1); |
579 | gScan[1]->GetYaxis()->SetRangeUser(0,1); |
579 | gScan[1]->GetYaxis()->SetTitleOffset(1.4); |
580 | gScan[1]->GetYaxis()->SetTitleOffset(1.4); |
Line 581... | Line 582... | ||
581 | 582 | ||
582 | if(!cleanPlots) |
583 | if(!cleanPlots) |
583 | { |
584 | { |
584 | if(axis == 1) |
585 | if(axis == 1) |
585 | { |
586 | { |
586 | if( |
587 | if(posUnitsPlot->widgetCB->GetSelected() == 0) |
587 | gScan[1]->SetTitle("SiPM edge detection;X [table units];Normalized ADC integral"); |
588 | gScan[1]->SetTitle("SiPM edge detection;X [table units];Normalized ADC integral"); |
588 | else if( |
589 | else if(posUnitsPlot->widgetCB->GetSelected() == 1) |
589 | gScan[1]->SetTitle("SiPM edge detection;X [#mum];Normalized ADC integral"); |
590 | gScan[1]->SetTitle("SiPM edge detection;X [#mum];Normalized ADC integral"); |
590 | } |
591 | } |
591 | else if(axis == 2) |
592 | else if(axis == 2) |
592 | { |
593 | { |
593 | if( |
594 | if(posUnitsPlot->widgetCB->GetSelected() == 0) |
594 | gScan[1]->SetTitle("SiPM edge detection;Y [table units];Normalized ADC integral"); |
595 | gScan[1]->SetTitle("SiPM edge detection;Y [table units];Normalized ADC integral"); |
595 | else if( |
596 | else if(posUnitsPlot->widgetCB->GetSelected() == 1) |
596 | gScan[1]->SetTitle("SiPM edge detection;Y [#mum];Normalized ADC integral"); |
597 | gScan[1]->SetTitle("SiPM edge detection;Y [#mum];Normalized ADC integral"); |
597 | } |
598 | } |
598 | } |
599 | } |
599 | else |
600 | else |
600 | { |
601 | { |
601 | if(axis == 1) |
602 | if(axis == 1) |
602 | { |
603 | { |
603 | if( |
604 | if(posUnitsPlot->widgetCB->GetSelected() == 0) |
604 | gScan[1]->SetTitle(";X [table units];Normalized ADC integral"); |
605 | gScan[1]->SetTitle(";X [table units];Normalized ADC integral"); |
605 | else if( |
606 | else if(posUnitsPlot->widgetCB->GetSelected() == 1) |
606 | gScan[1]->SetTitle(";X [#mum];Normalized ADC integral"); |
607 | gScan[1]->SetTitle(";X [#mum];Normalized ADC integral"); |
607 | } |
608 | } |
608 | else if(axis == 2) |
609 | else if(axis == 2) |
609 | { |
610 | { |
610 | if( |
611 | if(posUnitsPlot->widgetCB->GetSelected() == 0) |
611 | gScan[1]->SetTitle(";Y [table units];Normalized ADC integral"); |
612 | gScan[1]->SetTitle(";Y [table units];Normalized ADC integral"); |
612 | else if( |
613 | else if(posUnitsPlot->widgetCB->GetSelected() == 1) |
613 | gScan[1]->SetTitle(";Y [#mum];Normalized ADC integral"); |
614 | gScan[1]->SetTitle(";Y [#mum];Normalized ADC integral"); |
614 | } |
615 | } |
615 | } |
616 | } |
616 | gScan[1]->SetLineColor(kBlue); |
617 | gScan[1]->SetLineColor(kBlue); |
617 | gScan[0]->SetLineWidth(2); |
618 | gScan[0]->SetLineWidth(2); |
618 | gScan[1]->SetLineWidth(2); |
619 | gScan[1]->SetLineWidth(2); |
619 | 620 | ||
620 | gCanvas->Modified(); |
621 | gCanvas->Modified(); |
621 | gCanvas->Update(); |
622 | gCanvas->Update(); |
622 | 623 | ||
623 | gCanvas->SaveAs(exportname); |
624 | gCanvas->SaveAs(exportname); |
624 | 625 | ||
Line 691... | Line 692... | ||
691 | // Start if we select at least one file |
692 | // Start if we select at least one file |
692 | if(nrfiles > 0) |
693 | if(nrfiles > 0) |
693 | { |
694 | { |
694 | for(int i = 0; i < (int)nrfiles; i++) |
695 | for(int i = 0; i < (int)nrfiles; i++) |
695 | { |
696 | { |
696 | if( |
697 | if( (nrfiles == 1) || (!multiSelect->widgetChBox[0]->IsDown()) ) |
697 | { |
698 | { |
- | 699 | printf("PhotonMu(): Only one file selected. Not running analysis, just showing the fit.\n"); |
|
- | 700 | ||
- | 701 | // Replot the spectrum on analysisCanvas and do not close the input file |
|
- | 702 | DisplayHistogram( (char*)(files->At(i)->GetTitle()), 0, 1); |
|
- | 703 | analysisCanvas->GetCanvas()->Modified(); |
|
- | 704 | analysisCanvas->GetCanvas()->Update(); |
|
- | 705 | ||
- | 706 | // Get the spectrum |
|
- | 707 | histtemp = (TH1F*)analysisCanvas->GetCanvas()->GetPrimitive(histname); |
|
- | 708 | npeaks = 15; |
|
- | 709 | double par[300]; |
|
- | 710 | spec = new TSpectrum(npeaks); |
|
- | 711 | // Find spectrum background |
|
- | 712 | histback = spec->Background(histtemp, (int)fitInter->widgetNE[0]->GetNumber(), "same"); |
|
- | 713 | // Clone histogram and subtract background from it if we select that option |
|
- | 714 | h2 = (TH1F*)histtemp->Clone("h2"); |
|
- | 715 | if(fitChecks->widgetChBox[0]->IsDown()) |
|
- | 716 | h2->Add(histback, -1); |
|
- | 717 | // Search for the peaks |
|
- | 718 | int found = spec->Search(h2, fitSigma->widgetNE[0]->GetNumber(), "goff", fitTresh->widgetNE[0]->GetNumber() ); |
|
- | 719 | printf("PhotonMu(): Found %d candidates to fit.\n",found); |
|
- | 720 | npeaks = found; |
|
- | 721 | ||
- | 722 | // Set initial peak parameters |
|
- | 723 | xpeaks = spec->GetPositionX(); |
|
- | 724 | for(j = 0; j < found; j++) |
|
- | 725 | { |
|
- | 726 | float xp = xpeaks[j]; |
|
- | 727 | int bin = h2->GetXaxis()->FindBin(xp); |
|
- | 728 | float yp = h2->GetBinContent(bin); |
|
- | 729 | par[3*j] = yp; |
|
- | 730 | par[3*j+1] = xp; |
|
- | 731 | par[3*j+2] = (double)fitSigma->widgetNE[0]->GetNumber(); |
|
- | 732 | } |
|
- | 733 | ||
- | 734 | // Fit the histogram |
|
- | 735 | fit = new TF1("fit", FindPeaks, adcRange->widgetNE[0]->GetNumber(), adcRange->widgetNE[1]->GetNumber(), 3*npeaks); |
|
- | 736 | TVirtualFitter::Fitter(histtemp, 3*npeaks); |
|
- | 737 | fit->SetParameters(par); |
|
- | 738 | fit->SetNpx(300); |
|
- | 739 | h2->Fit("fit","Q"); |
|
- | 740 | // Get the fitted parameters |
|
- | 741 | fittingfunc = h2->GetFunction("fit"); |
|
- | 742 | fparam = fittingfunc->GetParameters(); |
|
- | 743 | fparamerr = fittingfunc->GetParErrors(); |
|
- | 744 | ||
- | 745 | // Gather the parameters (mean peak value for now) |
|
- | 746 | int j = 1; |
|
- | 747 | int nrfit = 0; |
|
- | 748 | while(1) |
|
- | 749 | { |
|
- | 750 | if( (fparam[j] < 1.E-30) || (nrfit > 8) ) |
|
- | 751 | break; |
|
- | 752 | else |
|
- | 753 | { |
|
- | 754 | // Check if pedestal is above the lower limit and sigma is smaller than the mean |
|
- | 755 | if( (fparam[j] > pedesLow->widgetNE[0]->GetNumber()) && ((double)fparamerr[j]/fparam[j] < accError->widgetNE[0]->GetNumber()) ) |
|
- | 756 | { |
|
- | 757 | // With the additional ADC offset, we can shift the mean values slightly, so they are not close to the X.5, but to the X.0 values |
|
- | 758 | meansel[nrfit] = fparam[j]+(adcOffset->widgetNE[0]->GetNumber()); |
|
- | 759 | sigmasel[nrfit] = fparam[j+1]; |
|
- | 760 | nrfit++; |
|
- | 761 | } |
|
- | 762 | } |
|
- | 763 | ||
- | 764 | j+=3; |
|
- | 765 | } |
|
- | 766 | TMath::Sort(nrfit, meansel, sortindex, kFALSE); |
|
- | 767 | ||
- | 768 | fittingfunc->Draw("SAME"); |
|
- | 769 | analysisCanvas->GetCanvas()->Modified(); |
|
- | 770 | analysisCanvas->GetCanvas()->Update(); |
|
- | 771 | ||
- | 772 | meanparam = meansel[sortindex[0]]; |
|
- | 773 | paramsigma = sigmasel[sortindex[0]]; |
|
- | 774 | ||
- | 775 | for(j = 0; j < nrfit; j++) |
|
- | 776 | printf("PhotonMu(): %d: peak mean = %lf\n", j, meansel[sortindex[j]]); |
|
- | 777 | ||
- | 778 | ||
- | 779 | ||
- | 780 | return; |
|
- | 781 | } |
|
- | 782 | if(files->At(i)) |
|
- | 783 | { |
|
698 | if(strcmp(files->At(i)->GetTitle(),darkRun->widgetTE->GetText()) == 0) |
784 | if(strcmp(files->At(i)->GetTitle(),darkRun->widgetTE->GetText()) == 0) |
699 | { |
785 | { |
700 | printf("PhotonMu(): %s is the dark histogram file.\n", files->At(i)->GetTitle()); |
786 | printf("PhotonMu(): %s is the dark histogram file.\n", files->At(i)->GetTitle()); |
701 | darkhist = i; |
787 | darkhist = i; |
702 | } |
788 | } |
703 | 789 | ||
704 | // Replot the spectrum on analysisCanvas and do not close the input file |
790 | // Replot the spectrum on analysisCanvas and do not close the input file |
705 | DisplayHistogram( (char*)(files->At(i)->GetTitle()), 0, 1); |
791 | DisplayHistogram( (char*)(files->At(i)->GetTitle()), 0, 1); |
706 | analysisCanvas->GetCanvas()->Modified(); |
792 | analysisCanvas->GetCanvas()->Modified(); |
707 | analysisCanvas->GetCanvas()->Update(); |
793 | analysisCanvas->GetCanvas()->Update(); |
Line 759... | Line 845... | ||
759 | { |
845 | { |
760 | // With the additional ADC offset, we can shift the mean values slightly, so they are not close to the X.5, but to the X.0 values |
846 | // With the additional ADC offset, we can shift the mean values slightly, so they are not close to the X.5, but to the X.0 values |
761 | meansel[nrfit] = fparam[j]+(adcOffset->widgetNE[0]->GetNumber()); |
847 | meansel[nrfit] = fparam[j]+(adcOffset->widgetNE[0]->GetNumber()); |
762 | sigmasel[nrfit] = fparam[j+1]; |
848 | sigmasel[nrfit] = fparam[j+1]; |
763 | nrfit++; |
849 | nrfit++; |
764 | } |
850 | } |
765 | } |
851 | } |
766 | 852 | ||
767 | j+=3; |
853 | j+=3; |
768 | } |
854 | } |
769 | TMath::Sort(nrfit, meansel, sortindex, kFALSE); |
855 | TMath::Sort(nrfit, meansel, sortindex, kFALSE); |
770 | 856 | ||
771 | meanparam = meansel[sortindex[0]]; |
857 | meanparam = meansel[sortindex[0]]; |
Line 868... | Line 954... | ||
868 | 954 | ||
869 | k = 0; |
955 | k = 0; |
870 | k2 = 0; |
956 | k2 = 0; |
871 | m = 0; |
957 | m = 0; |
872 | m2 = 0; |
958 | m2 = 0; |
873 | 959 | ||
874 | // Reading the data |
960 | // Reading the data |
875 | for(int e = 0; e < meas_data->GetEntries(); e++) |
961 | for(int e = 0; e < meas_data->GetEntries(); e++) |
876 | { |
962 | { |
877 | sprintf(rdc, "ADC%d", j); |
963 | sprintf(rdc, "ADC%d", j); |
878 | meas_data->SetBranchAddress(rdc, &evtdata.adcdata[j]); |
964 | meas_data->SetBranchAddress(rdc, &evtdata.adcdata[j]); |
879 | meas_data->GetEntry(e); |
965 | meas_data->GetEntry(e); |
880 | 966 | ||
881 | sprintf(rdc, "TDC%d", j); |
967 | sprintf(rdc, "TDC%d", j); |
Line 982... | Line 1068... | ||
982 | if(DBGSIG) printf("PhotonMu(): m = %d, i = %d: muval = %lf, ", m, i, muval[i]); |
1068 | if(DBGSIG) printf("PhotonMu(): m = %d, i = %d: muval = %lf, ", m, i, muval[i]); |
983 | 1069 | ||
984 | // Subtract the dark value from all values |
1070 | // Subtract the dark value from all values |
985 | angle[m] = angle[i]; |
1071 | angle[m] = angle[i]; |
986 | muval[m] = muval[i] - muval[darkhist]; |
1072 | muval[m] = muval[i] - muval[darkhist]; |
987 | 1073 | ||
988 | if(DBGSIG) printf("angle = %lf, newmuval = %lf, darkmuval = %lf, ", angle[m], muval[m], muval[darkhist]); |
1074 | if(DBGSIG) printf("angle = %lf, newmuval = %lf, darkmuval = %lf, ", angle[m], muval[m], muval[darkhist]); |
989 | 1075 | ||
990 | // Calculate relative PDE |
1076 | // Calculate relative PDE |
991 | // pdeval[m] = muval[m]/(muval[zeromu]*TMath::Cos(angle[m]*TMath::ACos(-1.)/180.)); |
1077 | // pdeval[m] = muval[m]/(muval[zeromu]*TMath::Cos(angle[m]*TMath::ACos(-1.)/180.)); |
992 | pdeval[m] = muval[m]/((meansel[1]-muval[darkhist])*TMath::Cos(angle[m]*TMath::ACos(-1.)/180.)); |
1078 | pdeval[m] = muval[m]/((meansel[1]-muval[darkhist])*TMath::Cos(angle[m]*TMath::ACos(-1.)/180.)); |
Line 1008... | Line 1094... | ||
1008 | if(!exclude) |
1094 | if(!exclude) |
1009 | m++; |
1095 | m++; |
1010 | } |
1096 | } |
1011 | printf("PhotonMu(): %lf\t%lf\t%lf\n", angle[i], muval[i], pdeval[i]); |
1097 | printf("PhotonMu(): %lf\t%lf\t%lf\n", angle[i], muval[i], pdeval[i]); |
1012 | } |
1098 | } |
- | 1099 | ||
- | 1100 | // Check for range of values to plot |
|
- | 1101 | double plotMax = 0.; |
|
- | 1102 | for(int i = 0; i < (int)nrfiles; i++) |
|
- | 1103 | { |
|
- | 1104 | plotMax = TMath::Max(plotMax, muval[i]); |
|
- | 1105 | plotMax = TMath::Max(plotMax, pdeval[i]); |
|
- | 1106 | } |
|
- | 1107 | if(plotMax <= 0.) |
|
- | 1108 | plotMax = 1.1; |
|
- | 1109 | printf("PhotonMu(): Maximum value: %lf\n", plotMax); |
|
1013 | 1110 | ||
1014 | if(DBGSIG) printf("\n"); |
1111 | if(DBGSIG) printf("\n"); |
1015 | if(darkhist != -1) |
1112 | if(darkhist != -1) |
1016 | printf("PhotonMu(): Number of excluded points: %d\n", (nrfiles-1-m)); |
1113 | printf("PhotonMu(): Number of excluded points: %d\n", (nrfiles-1-m)); |
1017 | else |
1114 | else |
1018 | printf("PhotonMu(): Number of excluded points: %d\n", (nrfiles-m)); |
1115 | printf("PhotonMu(): Number of excluded points: %d\n", (nrfiles-m)); |
1019 | 1116 | ||
1020 | // Plot mu and PDE angle dependance plots |
1117 | // Plot mu and PDE angle dependance plots |
1021 | if(edit == 0) |
1118 | if(edit == 0) |
1022 | gCanvas = new TCanvas("canv","canv",1200,900); |
1119 | gCanvas = new TCanvas("canv","canv",1200,900); |
1023 | else if(edit == 1) |
1120 | else if(edit == 1) |
1024 | gCanvas = tempAnalysisCanvas->GetCanvas(); |
1121 | gCanvas = tempAnalysisCanvas->GetCanvas(); |
1025 | gCanvas->cd(); |
1122 | gCanvas->cd(); |
1026 | gCanvas->SetGrid(); |
1123 | gCanvas->SetGrid(); |
1027 | 1124 | ||
1028 | TGraph *pde = new TGraph(m, angle, pdeval); |
1125 | TGraph *pde = new TGraph(m, angle, pdeval); |
Line 1033... | Line 1130... | ||
1033 | pde->SetLineColor(2); |
1130 | pde->SetLineColor(2); |
1034 | pde->GetXaxis()->SetLabelSize(0.030); |
1131 | pde->GetXaxis()->SetLabelSize(0.030); |
1035 | pde->GetXaxis()->CenterTitle(); |
1132 | pde->GetXaxis()->CenterTitle(); |
1036 | // pde->GetXaxis()->SetRange(angle[0],angle[nrfiles-1]); |
1133 | // pde->GetXaxis()->SetRange(angle[0],angle[nrfiles-1]); |
1037 | // pde->GetXaxis()->SetRangeUser(angle[0],angle[nrfiles-1]); |
1134 | // pde->GetXaxis()->SetRangeUser(angle[0],angle[nrfiles-1]); |
1038 | pde->GetXaxis()->SetRange(- |
1135 | pde->GetXaxis()->SetRange(-90.0,90.0); |
1039 | pde->GetXaxis()->SetRangeUser(- |
1136 | pde->GetXaxis()->SetRangeUser(-90.0,90.0); |
1040 | pde->GetXaxis()->SetLimits(- |
1137 | pde->GetXaxis()->SetLimits(-90.0,90.0); |
1041 | pde->GetYaxis()->SetTitleOffset(1.2); |
1138 | pde->GetYaxis()->SetTitleOffset(1.2); |
1042 | pde->GetYaxis()->SetLabelSize(0.030); |
1139 | pde->GetYaxis()->SetLabelSize(0.030); |
1043 | pde->GetYaxis()->CenterTitle(); |
1140 | pde->GetYaxis()->CenterTitle(); |
- | 1141 | pde->GetYaxis()->SetRange(0., 1.1*plotMax); |
|
1044 | pde->GetYaxis()->SetRangeUser(0., 1. |
1142 | pde->GetYaxis()->SetRangeUser(0., 1.1*plotMax); |
- | 1143 | pde->GetYaxis()->SetLimits(0., 1.1*plotMax); |
|
1045 | pde->SetName("pde"); |
1144 | pde->SetName("pde"); |
1046 | pde->Draw("ALP"); |
1145 | pde->Draw("ALP"); |
1047 | 1146 | ||
1048 | pde->SetTitle(";Incidence angle (#circ);Relative PDE(#theta) / #mu(#theta)"); |
1147 | pde->SetTitle(";Incidence angle (#circ);Relative PDE(#theta) / #mu(#theta)"); |
1049 | 1148 | ||
Line 1137... | Line 1236... | ||
1137 | // Start if we select at least one file |
1236 | // Start if we select at least one file |
1138 | if(nrfiles > 0) |
1237 | if(nrfiles > 0) |
1139 | { |
1238 | { |
1140 | for(int i = 0; i < (int)nrfiles; i++) |
1239 | for(int i = 0; i < (int)nrfiles; i++) |
1141 | { |
1240 | { |
- | 1241 | if( (nrfiles == 1) || (!multiSelect->widgetChBox[0]->IsDown()) ) |
|
- | 1242 | { |
|
- | 1243 | printf("BreakdownVolt(): Only one file selected. Not running analysis, just showing the fit.\n"); |
|
- | 1244 | ||
- | 1245 | // Replot the spectrum on analysisCanvas and do not close the input file |
|
- | 1246 | DisplayHistogram( (char*)(files->At(i)->GetTitle()), 0, 1); |
|
- | 1247 | analysisCanvas->GetCanvas()->Modified(); |
|
- | 1248 | analysisCanvas->GetCanvas()->Update(); |
|
- | 1249 | ||
- | 1250 | // Get the spectrum |
|
- | 1251 | histtemp = (TH1F*)analysisCanvas->GetCanvas()->GetPrimitive(histname); |
|
- | 1252 | npeaks = 15; |
|
- | 1253 | double par[300]; |
|
- | 1254 | spec = new TSpectrum(npeaks); |
|
- | 1255 | // Find spectrum background |
|
- | 1256 | histback = spec->Background(histtemp, (int)fitInter->widgetNE[0]->GetNumber(), "same"); |
|
- | 1257 | // Clone histogram and subtract background from it if we select that option |
|
- | 1258 | h2 = (TH1F*)histtemp->Clone("h2"); |
|
- | 1259 | if(fitChecks->widgetChBox[0]->IsDown()) |
|
- | 1260 | h2->Add(histback, -1); |
|
- | 1261 | // Search for the peaks |
|
- | 1262 | int found = spec->Search(h2, fitSigma->widgetNE[0]->GetNumber(), "goff", fitTresh->widgetNE[0]->GetNumber() ); |
|
- | 1263 | printf("PhotonMu(): Found %d candidates to fit.\n",found); |
|
- | 1264 | npeaks = found; |
|
- | 1265 | ||
- | 1266 | // Set initial peak parameters |
|
- | 1267 | xpeaks = spec->GetPositionX(); |
|
- | 1268 | for(j = 0; j < found; j++) |
|
- | 1269 | { |
|
- | 1270 | float xp = xpeaks[j]; |
|
- | 1271 | int bin = h2->GetXaxis()->FindBin(xp); |
|
- | 1272 | float yp = h2->GetBinContent(bin); |
|
- | 1273 | par[3*j] = yp; |
|
- | 1274 | par[3*j+1] = xp; |
|
- | 1275 | par[3*j+2] = (double)fitSigma->widgetNE[0]->GetNumber(); |
|
- | 1276 | } |
|
- | 1277 | ||
- | 1278 | // Fit the histogram |
|
- | 1279 | fit = new TF1("fit", FindPeaks, adcRange->widgetNE[0]->GetNumber(), adcRange->widgetNE[1]->GetNumber(), 3*npeaks); |
|
- | 1280 | TVirtualFitter::Fitter(histtemp, 3*npeaks); |
|
- | 1281 | fit->SetParameters(par); |
|
- | 1282 | fit->SetNpx(300); |
|
- | 1283 | h2->Fit("fit","Q"); |
|
- | 1284 | // Get the fitted parameters |
|
- | 1285 | fittingfunc = h2->GetFunction("fit"); |
|
- | 1286 | fparam = fittingfunc->GetParameters(); |
|
- | 1287 | fparamerr = fittingfunc->GetParErrors(); |
|
- | 1288 | ||
- | 1289 | // Gather the parameters (mean peak value for now) |
|
- | 1290 | int j = 1; |
|
- | 1291 | int nrfit = 0; |
|
- | 1292 | while(1) |
|
- | 1293 | { |
|
- | 1294 | if( (fparam[j] < 1.E-30) || (nrfit > 8) ) |
|
- | 1295 | break; |
|
- | 1296 | else |
|
- | 1297 | { |
|
- | 1298 | // Check if pedestal is above the lower limit and sigma is smaller than the mean |
|
- | 1299 | if( (fparam[j] > pedesLow->widgetNE[0]->GetNumber()) && ((double)fparamerr[j]/fparam[j] < accError->widgetNE[0]->GetNumber()) ) |
|
- | 1300 | { |
|
- | 1301 | // With the additional ADC offset, we can shift the mean values slightly, so they are not close to the X.5, but to the X.0 values |
|
- | 1302 | meansel[nrfit] = fparam[j]+(adcOffset->widgetNE[0]->GetNumber()); |
|
- | 1303 | sigmasel[nrfit] = fparam[j+1]; |
|
- | 1304 | nrfit++; |
|
- | 1305 | } |
|
- | 1306 | } |
|
- | 1307 | ||
- | 1308 | j+=3; |
|
- | 1309 | } |
|
- | 1310 | TMath::Sort(nrfit, meansel, sortindex, kFALSE); |
|
- | 1311 | ||
- | 1312 | fittingfunc->Draw("SAME"); |
|
- | 1313 | analysisCanvas->GetCanvas()->Modified(); |
|
- | 1314 | analysisCanvas->GetCanvas()->Update(); |
|
- | 1315 | ||
- | 1316 | meanparam = meansel[sortindex[0]]; |
|
- | 1317 | meanparamerr = meanselerr[sortindex[0]]; |
|
- | 1318 | paramsigma = sigmasel[sortindex[0]]; |
|
- | 1319 | ||
- | 1320 | for(j = 0; j < nrfit; j++) |
|
- | 1321 | printf("BreakdownVolt(): %d: peak mean = %lf, peak err = %lf\n", j, meansel[sortindex[j]], meanselerr[sortindex[j]]); |
|
- | 1322 | ||
- | 1323 | return; |
|
- | 1324 | } |
|
1142 | if(files->At(i)) |
1325 | if(files->At(i)) |
1143 | { |
1326 | { |
1144 | // Replot the spectrum on analysisCanvas and do not close the input file |
1327 | // Replot the spectrum on analysisCanvas and do not close the input file |
1145 | DisplayHistogram( (char*)(files->At(i)->GetTitle()), 0, 1); |
1328 | DisplayHistogram( (char*)(files->At(i)->GetTitle()), 0, 1); |
1146 | analysisCanvas->GetCanvas()->Modified(); |
1329 | analysisCanvas->GetCanvas()->Modified(); |
Line 1315... | Line 1498... | ||
1315 | printf("Point (at %.2lfV) rejected due to too large errors: %lf, %lf\n", volt[p], seperr[0][p]/sep[0][p], seperr[1][p]/sep[1][p]); |
1498 | printf("Point (at %.2lfV) rejected due to too large errors: %lf, %lf\n", volt[p], seperr[0][p]/sep[0][p], seperr[1][p]/sep[1][p]); |
1316 | else if(nrfit > 4) |
1499 | else if(nrfit > 4) |
1317 | printf("Point (at %.2lfV) rejected due to too large errors: %lf, %lf, %lf\n", volt[p], seperr[0][p]/sep[0][p], seperr[1][p]/sep[1][p], seperr[2][p]/sep[2][p]); |
1500 | printf("Point (at %.2lfV) rejected due to too large errors: %lf, %lf, %lf\n", volt[p], seperr[0][p]/sep[0][p], seperr[1][p]/sep[1][p], seperr[2][p]/sep[2][p]); |
1318 | } |
1501 | } |
1319 | fclose(fp); |
1502 | fclose(fp); |
1320 | } |
1503 | } |
1321 | 1504 | ||
1322 | if(nrfiles == 1) break; |
1505 | if(nrfiles == 1) break; |
1323 | first = 1; |
1506 | first = 1; |
1324 | 1507 | ||
1325 | // Update the progress bar |
1508 | // Update the progress bar |
1326 | progVal = (float)(90.00/nrfiles)*i; |
1509 | progVal = (float)(90.00/nrfiles)*i; |
Line 1341... | Line 1524... | ||
1341 | 1524 | ||
1342 | TGraphErrors* bdplot; |
1525 | TGraphErrors* bdplot; |
1343 | k = peakSepCalc->widgetNE[0]->GetNumber(); |
1526 | k = peakSepCalc->widgetNE[0]->GetNumber(); |
1344 | if(k < 4) |
1527 | if(k < 4) |
1345 | bdplot = new TGraphErrors(p, volt, sep[k-1], volterr, seperr[k-1]); |
1528 | bdplot = new TGraphErrors(p, volt, sep[k-1], volterr, seperr[k-1]); |
1346 | else |
1529 | else |
1347 | { |
1530 | { |
1348 | printf("BreakdownVold(): Unsupported peak separation selected (%d).\n", k); |
1531 | printf("BreakdownVold(): Unsupported peak separation selected (%d).\n", k); |
1349 | return; |
1532 | return; |
1350 | } |
1533 | } |
1351 | 1534 | ||
1352 | bdplot->SetMarkerStyle(20); |
1535 | bdplot->SetMarkerStyle(20); |
Line 1381... | Line 1564... | ||
1381 | { |
1564 | { |
1382 | sprintf(ctemp, "#splitline{#Delta_{p}(U) = (%.2lf #pm %.2lf)#timesU + (%.2lf #pm %.3lf)}{U_{0} = %.2lf #pm %.3lf}", meansel[0], meanselerr[0], meansel[1], meanselerr[1], meansel[2], meansel[2]*(TMath::Abs(meanselerr[0]/meansel[0]) + TMath::Abs(meanselerr[1]/meansel[1])) ); |
1565 | sprintf(ctemp, "#splitline{#Delta_{p}(U) = (%.2lf #pm %.2lf)#timesU + (%.2lf #pm %.3lf)}{U_{0} = %.2lf #pm %.3lf}", meansel[0], meanselerr[0], meansel[1], meanselerr[1], meansel[2], meansel[2]*(TMath::Abs(meanselerr[0]/meansel[0]) + TMath::Abs(meanselerr[1]/meansel[1])) ); |
1383 | latex = new TLatex(); |
1566 | latex = new TLatex(); |
1384 | latex->SetTextSize(0.039); |
1567 | latex->SetTextSize(0.039); |
1385 | latex->DrawLatex(volt[0], 0.97*sep[0][sortindex[p-1]], ctemp); |
1568 | latex->DrawLatex(volt[0], 0.97*sep[0][sortindex[p-1]], ctemp); |
- | 1569 | printf("#Delta_{p}(U) = (%.6lf #pm %.8lf)#timesU + (%.6lf #pm %.8lf)}{U_{0} = %.6lf #pm %.8lf\n", meansel[0], meanselerr[0], meansel[1], meanselerr[1], meansel[2], meansel[2]*(TMath::Abs(meanselerr[0]/meansel[0]) + TMath::Abs(meanselerr[1]/meansel[1])) ); |
|
1386 | } |
1570 | } |
1387 | else |
1571 | else |
1388 | printf("#Delta_{p}(U) = (%.2lf #pm %.2lf)#timesU + (%.2lf #pm %.3lf)}{U_{0} = %.2lf #pm %.3lf", meansel[0], meanselerr[0], meansel[1], meanselerr[1], meansel[2], meansel[2]*(TMath::Abs(meanselerr[0]/meansel[0]) + TMath::Abs(meanselerr[1]/meansel[1])) ); |
1572 | printf("#Delta_{p}(U) = (%.2lf #pm %.2lf)#timesU + (%.2lf #pm %.3lf)}{U_{0} = %.2lf #pm %.3lf\n", meansel[0], meanselerr[0], meansel[1], meanselerr[1], meansel[2], meansel[2]*(TMath::Abs(meanselerr[0]/meansel[0]) + TMath::Abs(meanselerr[1]/meansel[1])) ); |
1389 | 1573 | ||
1390 | if(edit == 0) |
1574 | if(edit == 0) |
1391 | { |
1575 | { |
1392 | remove_from_last((char*)files->At(0)->GetTitle(), '_', ctemp); |
1576 | remove_from_last((char*)files->At(0)->GetTitle(), '_', ctemp); |
1393 | sprintf(exportname, "%s_breakdown.pdf", ctemp); |
1577 | sprintf(exportname, "%s_breakdown.pdf", ctemp); |
Line 1421... | Line 1605... | ||
1421 | double *surfx, *surfy; |
1605 | double *surfx, *surfy; |
1422 | surfx = new double[nrfiles]; |
1606 | surfx = new double[nrfiles]; |
1423 | surfy = new double[nrfiles]; |
1607 | surfy = new double[nrfiles]; |
1424 | double xsurfmin = 0, ysurfmin = 0; |
1608 | double xsurfmin = 0, ysurfmin = 0; |
1425 | int nrentries; |
1609 | int nrentries; |
1426 |
|
1610 | double minInteg, maxInteg; |
1427 | bool norm = surfScanOpt->widgetChBox[0]->IsDown(); |
1611 | bool norm = surfScanOpt->widgetChBox[0]->IsDown(); |
1428 |
|
1612 | double curyval; |
1429 | // bool edge2d = false; |
1613 | // bool edge2d = false; |
1430 | 1614 | ||
1431 | TCanvas *gCanvas; |
1615 | TCanvas *gCanvas; |
1432 | 1616 | ||
1433 | float progVal = 0; |
1617 | float progVal = 0; |
Line 1485... | Line 1669... | ||
1485 | m += evtdata.adcdata[j]; |
1669 | m += evtdata.adcdata[j]; |
1486 | } |
1670 | } |
1487 | } |
1671 | } |
1488 | 1672 | ||
1489 | // X, Y and Z values from each file (table units or microns) |
1673 | // X, Y and Z values from each file (table units or microns) |
1490 | if( |
1674 | if(posUnitsPlot->widgetCB->GetSelected() == 0) |
1491 | { |
1675 | { |
1492 | if(n == 1) |
1676 | if(n == 1) |
1493 | { |
1677 | { |
1494 | xsurfmin = (double)(evtheader.xpos); |
1678 | xsurfmin = (double)(evtheader.xpos); |
1495 | ysurfmin = (double)(evtheader.ypos); |
1679 | ysurfmin = (double)(evtheader.ypos); |
1496 | } |
1680 | } |
1497 | 1681 | ||
1498 | surfx[i] = (double)(evtheader.xpos); |
1682 | surfx[i] = (double)(evtheader.xpos); |
1499 | surfy[i] = (double)(evtheader.ypos); |
1683 | surfy[i] = (double)(evtheader.ypos); |
1500 | } |
1684 | } |
1501 | else if( |
1685 | else if(posUnitsPlot->widgetCB->GetSelected() == 1) |
1502 | { |
1686 | { |
1503 | if(n == 1) |
1687 | if(n == 1) |
1504 | { |
1688 | { |
1505 | xsurfmin = (double)(evtheader.xpos*lenconversion); |
1689 | xsurfmin = (double)(evtheader.xpos*lenconversion); |
1506 | ysurfmin = (double)(evtheader.ypos*lenconversion); |
1690 | ysurfmin = (double)(evtheader.ypos*lenconversion); |
Line 1527... | Line 1711... | ||
1527 | } |
1711 | } |
1528 | 1712 | ||
1529 | nrentries = n; |
1713 | nrentries = n; |
1530 | printf("SurfaceScan(): %d files were selected.\n", nrfiles); |
1714 | printf("SurfaceScan(): %d files were selected.\n", nrfiles); |
1531 | 1715 | ||
1532 | / |
1716 | // Check for Minimum and Maximum values and normalize to 1, if normalization is selected |
1533 |
|
1717 | if(norm) |
1534 |
|
1718 | { |
1535 |
|
1719 | minInteg = TMath::MinElement(nrfiles, integralCount); |
1536 |
|
1720 | for(int i = 0; i < nrfiles; i++) |
- | 1721 | { |
|
1537 |
|
1722 | integralCount[i] -= minInteg; |
1538 |
|
1723 | if(DBGSIG) printf("Subtraction: %lf\n", integralCount[i]); |
1539 |
|
1724 | } |
1540 | // |
1725 | |
1541 |
|
1726 | maxInteg = TMath::MaxElement(nrfiles, integralCount); |
1542 | // curzval = surfz[0]; |
- | |
1543 | // j = 0; |
- | |
1544 | // int acc = 0; |
- | |
1545 | // int zb; |
- | |
1546 |
|
1727 | for(int i = 0; i < nrfiles; i++) |
1547 |
|
1728 | { |
1548 | // // Collect the accumulated integral in order to produce a PDF from a CDF |
- | |
1549 | // // While we are at the same Z value, save under one set |
- | |
1550 | // if( (surfz[i] == curzval) && (acc != nrfiles) ) |
- | |
1551 | // { |
- | |
1552 |
|
1729 | integralCount[i] = integralCount[i]/maxInteg; |
1553 | // if(DBGSIG) printf("IntegSpectrum(): Integral check 1 (i=%d,j=%d,z=%.2lf): %lf\t%lf\n", i, j, surfz[i], integralCount[i], integralAcc[j]); |
- | |
1554 | // j++; |
- | |
1555 | // acc++; |
- | |
1556 | // } |
- | |
1557 | // // When we switch to a new set of Z values and at the end, we must save the previous ones to make 1D edge plots |
- | |
1558 | // else |
- | |
1559 | // { |
- | |
1560 | // // Find minimal and maximal integral values to subtract the offset and normate PDF to 1 |
- | |
1561 |
|
1730 | if(DBGSIG) printf("Normalization: %lf\n", integralCount[i]); |
1562 | // |
- | |
1563 | // if(acc != nrfiles) |
- | |
1564 | // { |
- | |
1565 | // curzval = surfz[i]; |
- | |
1566 | // // PDF and CDF plot |
- | |
1567 | // PlotEdgeDistribution(files, i, j, &minInteg, &maxInteg, surfxy, integralAcc, direction, edge2d, edit); |
- | |
1568 | // i--; |
- | |
1569 | // j = 0; |
- | |
1570 | // } |
- | |
1571 | // else |
- | |
1572 | // { |
- | |
1573 | // // PDF and CDF plot |
- | |
1574 | // PlotEdgeDistribution(files, i, j, &minInteg, &maxInteg, surfxy, integralAcc, direction, edge2d, edit); |
- | |
1575 | // i--; |
- | |
1576 | // break; |
- | |
1577 | // } |
- | |
1578 | // } |
- | |
1579 |
|
1731 | } |
1580 | // // Update the progress bar |
- | |
1581 | // progVal = (float)(15.00/nrfiles)*i+75.00; |
- | |
1582 | // analysisProgress->widgetPB->SetPosition(progVal); |
- | |
1583 | // gVirtualX->Update(1); |
- | |
1584 |
|
1732 | } |
1585 | 1733 | ||
1586 | // Make the 2D surface plot |
1734 | // Make the 2D surface plot |
1587 | if(edit == 0) |
1735 | if(edit == 0) |
1588 | gCanvas = new TCanvas("canv","canv",1100,900); |
1736 | gCanvas = new TCanvas("canv","canv",1100,900); |
1589 | else |
1737 | else |
Line 1622... | Line 1770... | ||
1622 | { |
1770 | { |
1623 | range[1] -= range[0]; |
1771 | range[1] -= range[0]; |
1624 | range[3] -= range[2]; |
1772 | range[3] -= range[2]; |
1625 | range[0] -= range[0]; |
1773 | range[0] -= range[0]; |
1626 | range[2] -= range[2]; |
1774 | range[2] -= range[2]; |
1627 | } |
1775 | } |
1628 | 1776 | ||
1629 | gCanvas->cd(); |
1777 | gCanvas->cd(); |
1630 | gStyle->SetPalette(1); |
1778 | gStyle->SetPalette(1); |
1631 | gCanvas->SetLeftMargin(0.15); |
1779 | gCanvas->SetLeftMargin(0.15); |
1632 | gCanvas->SetRightMargin(0.126); |
1780 | gCanvas->SetRightMargin(0.126); |
1633 | gCanvas->SetTopMargin(0.077); |
1781 | gCanvas->SetTopMargin(0.077); |
Line 1636... | Line 1784... | ||
1636 | gCanvas->Modified(); |
1784 | gCanvas->Modified(); |
1637 | gCanvas->Update(); |
1785 | gCanvas->Update(); |
1638 | 1786 | ||
1639 | if(!cleanPlots) |
1787 | if(!cleanPlots) |
1640 | { |
1788 | { |
1641 | if( |
1789 | if(posUnitsPlot->widgetCB->GetSelected() == 0) |
1642 | gScan2D->SetTitle("Surface scan;X [table units];Y [table units]"); |
1790 | gScan2D->SetTitle("Surface scan;X [table units];Y [table units]"); |
1643 | else if( |
1791 | else if(posUnitsPlot->widgetCB->GetSelected() == 1) |
1644 | gScan2D->SetTitle("Surface scan;X [#mum];Y [#mum]"); |
1792 | gScan2D->SetTitle("Surface scan;X [#mum];Y [#mum]"); |
1645 | } |
1793 | } |
1646 | else |
1794 | else |
1647 | { |
1795 | { |
1648 | if( |
1796 | if(posUnitsPlot->widgetCB->GetSelected() == 0) |
1649 | gScan2D->SetTitle(";X [table units];Y [table units]"); |
1797 | gScan2D->SetTitle(";X [table units];Y [table units]"); |
1650 | else if( |
1798 | else if(posUnitsPlot->widgetCB->GetSelected() == 1) |
1651 | gScan2D->SetTitle(";X [#mum];Y [#mum]"); |
1799 | gScan2D->SetTitle(";X [#mum];Y [#mum]"); |
1652 | } |
1800 | } |
1653 | /* TGaxis *xax = (TGaxis*)gScan2D->GetXaxis(); |
1801 | /* TGaxis *xax = (TGaxis*)gScan2D->GetXaxis(); |
1654 | xax->SetMaxDigits(4); |
1802 | xax->SetMaxDigits(4); |
1655 | TGaxis *yax = (TGaxis*)gScan2D->GetYaxis(); |
1803 | TGaxis *yax = (TGaxis*)gScan2D->GetYaxis(); |
Line 1668... | Line 1816... | ||
1668 | gScan2D->GetXaxis()->SetRangeUser(range[0], range[1]); |
1816 | gScan2D->GetXaxis()->SetRangeUser(range[0], range[1]); |
1669 | gScan2D->GetXaxis()->SetNoExponent(kTRUE); |
1817 | gScan2D->GetXaxis()->SetNoExponent(kTRUE); |
1670 | gScan2D->GetYaxis()->SetTitleOffset(1.9); |
1818 | gScan2D->GetYaxis()->SetTitleOffset(1.9); |
1671 | gScan2D->GetYaxis()->CenterTitle(kTRUE); |
1819 | gScan2D->GetYaxis()->CenterTitle(kTRUE); |
1672 | gScan2D->GetYaxis()->SetLabelSize(0.027); |
1820 | gScan2D->GetYaxis()->SetLabelSize(0.027); |
1673 | gScan2D-> |
1821 | gScan2D->GetYaxis()->SetLabelOffset(0.02); |
1674 | gScan2D->GetYaxis()->SetRangeUser(range[2], range[3]); |
1822 | gScan2D->GetYaxis()->SetRangeUser(range[2], range[3]); |
1675 | gScan2D->GetYaxis()->SetNoExponent(kTRUE); |
1823 | gScan2D->GetYaxis()->SetNoExponent(kTRUE); |
1676 | 1824 | ||
1677 | gCanvas->Modified(); |
1825 | gCanvas->Modified(); |
1678 | gCanvas->Update(); |
1826 | gCanvas->Update(); |
1679 | 1827 | ||
1680 | remove_from_last((char*)files->At(0)->GetTitle(), '_', ctemp); |
1828 | remove_from_last((char*)files->At(0)->GetTitle(), '_', ctemp); |
1681 | sprintf(exportname, "%s_surfscan.pdf", ctemp); |
1829 | sprintf(exportname, "%s_surfscan.pdf", ctemp); |