- Timestamp:
- 07/01/08 17:14:31 (16 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r8990 r8991 93 93 - removed all the obsolste and confusing projections of the 94 94 individual sectors and camera halves 95 96 * mhflux/MHAlpha.cc: 97 - replaced EventsExcess/SignificanceExc by just ErrorEvents 98 - for the moment do not propagate Excesses<=0 to the pads 99 (not to spoil the logarithmic display, this still needs a fix) 100 - replaced -1 in ProjectionZ by the bin numbers (including 101 under- and overflow bins), otherwise it won't work with 102 root 5.20/00 103 - propagate all result to the timing histogram (it is not 104 logarithmic anyway) 105 - made Paint also work with the new implementation of ProjectionZ 106 via Project3D in root 5.20/00 (it won't reuse the correct 107 histogram from the pad :( ) 108 - replaced kFullDotMedium by 0 (no marker) where appropriate 109 - changed the rule not to display the time-histogram 95 110 96 111 -
trunk/MagicSoft/Mars/NEWS
r8988 r8991 7 7 * should work now with root 5.20/00 8 8 9 * Sequences and Datasets are now stored as "MDataSet" and "MSequence" 10 instead of the base name of the file. This makes them easier to 11 access from the code 9 12 10 13 -
trunk/MagicSoft/Mars/mhflux/MHAlpha.cc
r8879 r8991 164 164 continue; 165 165 166 if (fit.GetSignificanceExc()<=0) 166 // FIXME: Calculate UL! 167 if (fit.GetEventsExcess()<=0) 167 168 continue; 168 169 169 170 fHEnergy.SetBinContent(i, fit.GetEventsExcess()); 170 fHEnergy.SetBinError(i, fit.GetE ventsExcess()/fit.GetSignificanceExc());171 172 mean += fit.Get SignificanceExc()*fit.GetSignificanceExc();171 fHEnergy.SetBinError(i, fit.GetErrorExcess()); 172 173 mean += fit.GetEventsExcess()*fit.GetEventsExcess()/fit.GetErrorExcess()/fit.GetErrorExcess(); 173 174 num++; 174 175 } … … 190 191 continue; 191 192 192 if (fit.GetSignificanceExc()<=0) 193 // FIXME: Calculate UL! 194 if (fit.GetEventsExcess()<=0) 193 195 continue; 194 196 195 197 fHTheta.SetBinContent(i, fit.GetEventsExcess()); 196 fHTheta.SetBinError(i, fit.GetE ventsExcess()/fit.GetSignificanceExc());198 fHTheta.SetBinError(i, fit.GetErrorExcess()); 197 199 } 198 200 } … … 400 402 MAlphaFitter fit(fFit); 401 403 402 TH1D *h = fOffData ? fOffData->ProjectionZ("ProjTimeTemp", -1, -1, -1, -1, "E") : 0;404 TH1D *h = fOffData ? fOffData->ProjectionZ("ProjTimeTemp", 0, fOffData->GetNbinsX()+1, 0, fOffData->GetNbinsY()+1, "E") : 0; 403 405 const Bool_t rc = fit.ScaleAndFit(fHistTime, h); 406 404 407 if (h) 405 408 delete h; … … 418 421 time->Plus1ns(); 419 422 420 // Get number of bins421 const Int_t n = fHTime.GetNbinsX();422 423 423 // Enhance binning 424 424 MBinning bins; … … 430 430 // Fill histogram 431 431 // 432 if (fit.GetSignificanceExc()>0)433 {434 fHTime.SetBinContent(n+1, fit.GetEventsExcess()); 435 fHTime.SetBinError(n+1, fit.GetEventsExcess()/fit.GetSignificanceExc());436 }437 438 *fLog << all << *fTimeEffOn << " : " << fit.GetEventsExcess() << endl;432 // Get number of bins 433 const Int_t n = fHTime.GetNbinsX(); 434 435 fHTime.SetBinContent(n, fit.GetEventsExcess()); 436 fHTime.SetBinError(n, fit.GetErrorExcess()); 437 438 *fLog << all << *fTimeEffOn << " (" << n << "): " << fit.GetEventsExcess() << endl; 439 439 440 440 fNumRebin = fNumTimeBins; … … 549 549 550 550 TString o(opt); 551 551 552 if (o==(TString)"proj") 552 553 { … … 572 573 573 574 padsave->cd(1); 574 TH1D *hon = fHist.ProjectionZ("Proj"); 575 if (fOffData) 576 { 577 TH1D *hoff = fOffData->ProjectionZ("ProjOff"); 578 const Double_t alpha = fFit.Scale(*hoff, *hon); 579 580 hon->SetMaximum(); 581 hon->SetMaximum(TMath::Max(hon->GetMaximum(), hoff->GetMaximum())*1.05); 582 583 // BE CARFEULL: This is a really weird workaround! 584 hoff->SetMaximum(alpha); 585 586 // For some reason the line-color is resetted 587 hoff->SetLineColor(kRed); 588 589 if ((h0=(TH1D*)gPad->FindObject("ProjOnOff"))) 575 576 TH1D *hon = (TH1D*)gPad->FindObject("Proj"); 577 if (hon) 578 { 579 TH1D *dum = fHist.ProjectionZ("dum", 0, fHist.GetNbinsX()+1, 0, fHist.GetNbinsY()+1); 580 dum->SetDirectory(0); 581 hon->Reset(); 582 hon->Add(dum); 583 delete dum; 584 585 if (fOffData) 590 586 { 591 h0->Reset(); 592 h0->Add(hoff, hon, -1); 593 const Float_t min = h0->GetMinimum()*1.05; 594 hon->SetMinimum(min<0 ? min : 0); 587 TH1D *hoff = (TH1D*)gPad->FindObject("ProjOff"); 588 if (hoff) 589 { 590 TH1D *dum = fOffData->ProjectionZ("dum", 0, fOffData->GetNbinsX()+1, 0, fOffData->GetNbinsY()+1); 591 dum->SetDirectory(0); 592 hoff->Reset(); 593 hoff->Add(dum); 594 delete dum; 595 596 const Double_t alpha = fFit.Scale(*hoff, *hon); 597 598 hon->SetMaximum(); 599 hon->SetMaximum(TMath::Max(hon->GetMaximum(), hoff->GetMaximum())*1.05); 600 601 // BE CARFEULL: This is a really weird workaround! 602 hoff->SetMaximum(alpha); 603 604 // For some reason the line-color is resetted 605 hoff->SetLineColor(kRed); 606 607 if ((h0=(TH1D*)gPad->FindObject("ProjOnOff"))) 608 { 609 h0->Reset(); 610 h0->Add(hoff, hon, -1); 611 const Float_t min = h0->GetMinimum()*1.05; 612 hon->SetMinimum(min<0 ? min : 0); 613 } 614 } 595 615 } 596 }597 else598 hon->SetMinimum(0);616 else 617 hon->SetMinimum(0); 618 } 599 619 FitEnergyBins(); 600 620 FitThetaBins(); … … 617 637 618 638 if (o==(TString)"time") 619 PaintText(fHTime); //.Integral(), 0);639 PaintText(fHTime); 620 640 621 641 if (o==(TString)"theta") … … 631 651 delete h2; 632 652 } 633 PaintText(fHTheta); //.Integral(), 0);653 PaintText(fHTheta); 634 654 } 635 655 … … 646 666 delete h2; 647 667 } 648 PaintText(fHEnergy); //.Integral(), 0);668 PaintText(fHEnergy); 649 669 650 670 if (fHEnergy.GetMaximum()>1) … … 686 706 gPad->SetBorderMode(0); 687 707 688 h = fHist.ProjectionZ("Proj", -1, 9999, -1, 9999, "E");708 h = fHist.ProjectionZ("Proj", 0, fHist.GetNbinsX()+1, 0, fHist.GetNbinsY()+1, "E"); 689 709 h->SetBit(TH1::kNoTitle); 690 710 h->SetStats(kTRUE); … … 692 712 h->SetYTitle("Counts"); 693 713 h->SetDirectory(NULL); 694 h->SetMarkerStyle( kFullDotMedium);714 h->SetMarkerStyle(0); 695 715 h->SetBit(kCanDelete); 696 716 h->Draw(""); … … 702 722 //h->SetLineColor(kGreen); 703 723 704 h = fOffData->ProjectionZ("ProjOff", -1, 9999, -1, 9999, "E");724 h = fOffData->ProjectionZ("ProjOff", 0, fOffData->GetNbinsX()+1, 0, fOffData->GetNbinsY()+1, "E"); 705 725 h->SetBit(TH1::kNoTitle); 706 726 h->SetXTitle(fHist.GetZaxis()->GetTitle()); 707 727 h->SetYTitle("Counts"); 708 728 h->SetDirectory(NULL); 709 h->SetMarkerStyle( kFullDotMedium);729 h->SetMarkerStyle(0); 710 730 h->SetBit(kCanDelete); 711 731 h->SetMarkerColor(kRed); … … 714 734 h->Draw("same"/*"bar same"*/); 715 735 716 h = (TH1D*)h->Clone("ProjOnOff"); 736 // This is the only way to make it work... 737 // Clone and copy constructor give strange crashes :( 738 h = fOffData->ProjectionZ("ProjOnOff", 0, fOffData->GetNbinsX()+1, 0, fOffData->GetNbinsY()+1, "E"); 717 739 h->SetBit(TH1::kNoTitle); 718 740 h->SetXTitle(fHist.GetZaxis()->GetTitle()); 719 741 h->SetYTitle("Counts"); 720 742 h->SetDirectory(NULL); 721 h->SetMarkerStyle( kFullDotMedium);743 h->SetMarkerStyle(0); 722 744 h->SetBit(kCanDelete); 723 745 h->SetMarkerColor(kBlue); … … 749 771 h->SetYTitle("Counts"); 750 772 h->SetDirectory(NULL); 751 h->SetMarkerStyle(kFullDot Medium);773 h->SetMarkerStyle(kFullDotSmall); 752 774 h->SetBit(kCanDelete); 753 775 h->SetMarkerColor(kCyan); … … 758 780 delete pad->GetPad(2); 759 781 760 if (fTimeEffOn && fTime || fHTime.GetNbinsX()>1 || fHTime.GetBinContent(1) >0)782 if (fTimeEffOn && fTime || fHTime.GetNbinsX()>1 || fHTime.GetBinContent(1)!=0) 761 783 { 762 784 pad->cd(3); … … 785 807 h->SetYTitle("Counts"); 786 808 h->SetDirectory(NULL); 787 h->SetMarkerStyle(kFullDot Medium);809 h->SetMarkerStyle(kFullDotSmall); 788 810 h->SetBit(kCanDelete); 789 811 h->SetMarkerColor(kCyan); … … 817 839 gPad->SetFrameBorderMode(0); 818 840 819 TH1D *hon = fHist.ProjectionZ("Proj", -1, 9999, i, i, "E");841 TH1D *hon = fHist.ProjectionZ("Proj", 0, fHist.GetNbinsX()+1, i, i, "E"); 820 842 hon->SetBit(TH1::kNoTitle); 821 843 hon->SetStats(kTRUE); … … 823 845 hon->SetYTitle("Counts"); 824 846 hon->SetDirectory(NULL); 825 hon->SetMarkerStyle( kFullDotMedium);847 hon->SetMarkerStyle(0); 826 848 hon->SetBit(kCanDelete); 827 849 hon->Draw(""); … … 834 856 hon->SetMarkerColor(kGreen); 835 857 836 hof = fOffData->ProjectionZ("ProjOff", -1, 9999, i, i, "E");858 hof = fOffData->ProjectionZ("ProjOff", 0, fOffData->GetNbinsX()+1, i, i, "E"); 837 859 hof->SetBit(TH1::kNoTitle|TH1::kNoStats); 838 860 hof->SetXTitle(fHist.GetZaxis()->GetTitle()); 839 861 hof->SetYTitle("Counts"); 840 862 hof->SetDirectory(NULL); 841 hof->SetMarkerStyle( kFullDotMedium);863 hof->SetMarkerStyle(0); 842 864 hof->SetBit(kCanDelete); 843 865 hof->SetMarkerColor(kRed); … … 856 878 diff->SetYTitle("Counts"); 857 879 diff->SetDirectory(NULL); 858 diff->SetMarkerStyle( kFullDotMedium);880 diff->SetMarkerStyle(0); 859 881 diff->SetBit(kCanDelete); 860 882 diff->SetMarkerColor(kBlue); … … 871 893 if (hof ? fit.Fit(*hon, *hof, alpha) : fit.Fit(*hon)) 872 894 { 873 *fLog << dbg << "Bin " << i << ": sigmaexc=" << fit.Get SignificanceExc() << " omega=" << fit.GetGausSigma() << " events=" << fit.GetEventsExcess() << " scale=" << fit.GetScaleFactor() << endl;895 *fLog << dbg << "Bin " << i << ": sigmaexc=" << fit.GetEventsExcess()/fit.GetErrorExcess() << " omega=" << fit.GetGausSigma() << " events=" << fit.GetEventsExcess() << " scale=" << fit.GetScaleFactor() << endl; 874 896 fit.DrawResult(); 875 897 } … … 909 931 910 932 // Get on-data 911 TH1D *hon = (TH1D*)fHist.ProjectionZ("Proj", -1, 9999, binlo, binhi, "E");933 TH1D *hon = (TH1D*)fHist.ProjectionZ("Proj", 0, fHist.GetNbinsX()+1, binlo, binhi, "E"); 912 934 hon->SetDirectory(NULL); 913 935 hon->SetBit(kCanDelete); … … 921 943 if (fOffData) 922 944 { 923 hoff = (TH1D*)fOffData->ProjectionZ("ProjOff", -1, 9999, binlo, binhi, "E");945 hoff = (TH1D*)fOffData->ProjectionZ("ProjOff", 0, fHist.GetNbinsX()+1, binlo, binhi, "E"); 924 946 hoff->SetDirectory(NULL); 925 947 hoff->SetBit(kCanDelete);
Note:
See TracChangeset
for help on using the changeset viewer.