Changeset 17053 for trunk/Mars
- Timestamp:
- 08/29/13 10:11:06 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/fact/analysis/gain/fit_spectra.C
r17033 r17053 111 111 bool fast = false; // Switch off using integral 112 112 113 // Values which should be read from the file but not available atm 114 Int_t integration_window = 30; 115 113 116 // Map for which pixel shall be plotted and which not 114 117 TArrayC usePixel(1440); … … 180 183 } 181 184 182 MParameterI win("IntegrationWindow");183 if (win.Read()<=0)184 {185 cout << "IntegrationWindow not found in '" << filename << "'." << endl;186 return 5;187 }188 189 Int_t integration_window = win.GetVal();190 191 185 MArrayI ext; 192 186 if (ext.Read("ExtractionRange")<=0) 193 187 { 194 188 cout << "ExtractionRange not found in '" << filename << "'." << endl; 195 return 6;189 return 5; 196 190 197 191 } … … 215 209 MHCamera cNormGain(fact); 216 210 MHCamera cFitProb(fact); 211 MHCamera cCrosstalkP(fact); 212 MHCamera cCoeffR(fact); 217 213 218 214 // Set name and title for the histograms … … 226 222 cNormGain.SetNameTitle ("NormGain", "Normalized gain"); 227 223 cFitProb.SetNameTitle ("FitProb", "Root's fit probability"); 224 cCrosstalkP.SetNameTitle("Pxtalk", "Crosstalk coeff. P"); 225 cCoeffR.SetNameTitle ("CoeffR", "Coefficient R"); 228 226 229 227 // Instantiate 1D histograms for the distributions 230 TH1F hRate ("Rate", "Dark count rate", 200, 0, 10);228 TH1F hRate ("Rate", "Dark count rate", 100, 0, 10); 231 229 TH1F hGain ("Gain", "Gain distribution", 100, 0, 400); 232 230 TH1F hRelSigma ("RelSigma", "Rel. Sigma", 160, 0, 0.40); 233 TH1F hCrosstalk("Crosstalk", "Crosstalk probability", 120, 0, 0.30);231 TH1F hCrosstalk("Crosstalk", "Crosstalk probability", 90, 0, 0.30); 234 232 TH1F hBaseline ("Baseline", "Baseline per sample", 75, -7.5, 7.5); 235 233 TH1F hNoise ("Noise", "Noise per sample", 60, 0, 30); … … 237 235 TH1F hNormGain ("NormGain", "Normalized gain", 51, 0.5, 1.5); 238 236 TH1F hFitProb ("FitProb", "FitProb distribution", 100, 0, 1); 237 TH1F hCrosstalkP("Pxtalk", "Crosstalk coeff.", 90, 0, 0.3); 238 TH1F hCoeffR ("CoeffR", "Coefficient R", 90, -1, 2); 239 239 240 240 // Histigram for the sum of all spectrums … … 347 347 Double_t res_par[7]; 348 348 func.GetParameters(res_par); 349 350 //func.FixParameter(6, func.GetParameter(6)); // Expo 349 351 350 352 // ------------------ display result ------------------------------- … … 423 425 424 426 // For individual spectra, the average fit yields 1 anyway 425 func. FixParameter(6, 1); // Expo427 func.SetParameter(6, 0); // Expo 426 428 427 429 // ----------- Fit Pixels spectrum --------------- … … 459 461 const float fGain = func.GetParameter(1); 460 462 const float fGainRMS = func.GetParameter(2); 463 const float fCrosstalkP= func.GetParameter(3); 461 464 const float fCrosstlk = xtalk(func); 462 465 const float fOffset = func.GetParameter(4); 463 466 const float fNoise = func.GetParameter(5)/sqrt(integration_window); 467 const float fCoeffR = func.GetParameter(6); 464 468 465 469 // Fill histograms with result values … … 473 477 cNormGain.SetBinContent( pixel+1, fGain/gain); 474 478 cFitProb.SetBinContent( pixel+1, fit_prob); 479 cCrosstalkP.SetBinContent(pixel+1, fCrosstalkP); 480 cCoeffR.SetBinContent( pixel+1, fCoeffR); 475 481 476 482 // ====================================================== … … 576 582 cNormGain.SetUsed(usePixel); 577 583 cFitProb.SetUsed(usePixel); 584 cCrosstalkP.SetUsed(usePixel); 585 cCoeffR.SetUsed(usePixel); 578 586 579 587 // -------------------------------------------------------- 580 588 // Display data 581 589 582 TCanvas *canv = &d->AddTab("Cams ");583 canv->Divide( 4,2);590 TCanvas *canv = &d->AddTab("Cams1"); 591 canv->Divide(3,2); 584 592 585 593 canv->cd(1); … … 590 598 591 599 canv->cd(3); 600 cBaseline.DrawCopy(); 601 602 canv->cd(4); 592 603 cRelSigma.DrawCopy(); 593 604 594 canv->cd( 4);605 canv->cd(5); 595 606 cCrosstalk.DrawCopy(); 596 597 canv->cd(5);598 cBaseline.DrawCopy();599 607 600 608 canv->cd(6); 601 609 cNoise.DrawCopy(); 602 610 603 canv->cd(7); 611 612 canv = &d->AddTab("Cams2"); 613 canv->Divide(3,2); 614 615 canv->cd(1); 604 616 cFitProb.DrawCopy(); 605 617 606 canv->cd( 8);618 canv->cd(2); 607 619 cChi2.DrawCopy(); 608 620 621 canv->cd(4); 622 cCoeffR.DrawCopy(); 623 624 canv->cd(5); 625 cCrosstalkP.DrawCopy(); 626 609 627 // -------------------------------------------------------- 610 628 611 629 gStyle->SetOptFit(1); 612 630 613 canv = &d->AddTab("Hists ");614 canv->Divide( 4,2);631 canv = &d->AddTab("Hists1"); 632 canv->Divide(3,2); 615 633 616 634 TH1 *hh = 0; … … 624 642 625 643 canv->cd(3); 644 hh = hBaseline.DrawCopy(); 645 hh->Fit("gaus"); 646 647 canv->cd(4); 626 648 hh = hRelSigma.DrawCopy(); 627 649 hh->Fit("gaus"); 628 650 629 canv->cd( 4);651 canv->cd(5); 630 652 hh = hCrosstalk.DrawCopy(); 631 hh->Fit("gaus");632 633 canv->cd(5);634 hh = hBaseline.DrawCopy();635 653 hh->Fit("gaus"); 636 654 … … 639 657 hh->Fit("gaus"); 640 658 641 canv->cd(7); 659 // -------------------------------------------------------- 660 661 canv = &d->AddTab("Hists2"); 662 canv->Divide(3,2); 663 664 canv->cd(1); 642 665 gPad->SetLogy(); 643 hFitProb.DrawCopy(); 644 645 canv->cd(8); 666 hh = hFitProb.DrawCopy(); 667 hh->Fit("gaus"); 668 669 canv->cd(2); 646 670 hChi2.DrawCopy(); 671 672 canv->cd(4); 673 hh = hCoeffR.DrawCopy(); 674 hh->Fit("gaus"); 675 676 canv->cd(5); 677 hh = hCrosstalkP.DrawCopy(); 678 hh->Fit("gaus"); 647 679 648 680 // --------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.