- Timestamp:
- 10/19/06 21:39:08 (18 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r8135 r8136 55 55 * datacenter/macros/plotoptical.C: 56 56 - added 57 58 * mhalpha/MHAlpha.[h,cc]: 59 - added the DrawNicePlot feature 57 60 58 61 -
trunk/MagicSoft/Mars/NEWS
r8135 r8136 8 8 websites. 9 9 10 - database: Order 10 - database: Order-by is now working also on printtable.php and when 11 11 group-by is chosen. 12 12 … … 33 33 over all possible set of weights. This also gives correct numbers 34 34 for the lo-gains which were totally wrong before. 35 36 - ganymed: To get a nice Theta-Sq plot (instead of the all-information 37 debug plot displayed as a standard plot) use the context menu 38 somewhere between the two upper plots, click on "DrawNicePlot" 39 and enjoy the result. (It is the same context menu which contains 40 the "DrawAll" option) 41 PLEASE ALWAYS USE THIS PLOT FOR ANY KIND OF PRESENTATION! 35 42 36 43 -
trunk/MagicSoft/Mars/mhflux/MHAlpha.cc
r8016 r8136 885 885 } 886 886 887 void MHAlpha::DrawNicePlot(Bool_t newc, const char *title) 888 { 889 if (!newc && !fDisplay) 890 return; 891 892 if (!fOffData) 893 return; 894 895 // Open and setup canvas/pad 896 TCanvas &c = newc ? *new TCanvas : fDisplay->AddTab("ThetsSq"); 897 898 c.SetBorderMode(0); 899 c.SetFrameBorderMode(0); 900 c.SetFillColor(kWhite); 901 902 c.SetLeftMargin(0.12); 903 c.SetRightMargin(0.01); 904 c.SetBottomMargin(0.16); 905 c.SetTopMargin(0.18); 906 907 c.SetGridy(); 908 909 gStyle->SetOptStat(0); 910 911 // Get on-data 912 TH1D *hon = (TH1D*)fHist.ProjectionZ("Proj", -1, 9999, -1, 9999, "E"); 913 hon->SetDirectory(NULL); 914 hon->SetBit(kCanDelete); 915 hon->SetMarkerSize(0); 916 hon->SetLineWidth(2); 917 hon->SetLineColor(kBlack); 918 hon->SetMarkerColor(kBlack); 919 920 // Get off-data 921 TH1D *hoff = 0; 922 if (fOffData) 923 { 924 hoff = (TH1D*)fOffData->ProjectionZ("ProjOff", -1, 9999, -1, 9999, "E"); 925 hoff->SetDirectory(NULL); 926 hoff->SetBit(kCanDelete); 927 hoff->SetFillColor(17); 928 hoff->SetMarkerSize(0); 929 hoff->SetLineColor(kBlack); 930 hoff->SetMarkerColor(kBlack); 931 } 932 933 // Setup plot which is drawn first 934 TH1D *h = hoff ? hoff : hon; 935 h->GetXaxis()->SetLabelSize(0.06); 936 h->GetXaxis()->SetTitleSize(0.06); 937 h->GetXaxis()->SetTitleOffset(0.95); 938 h->GetYaxis()->SetLabelSize(0.06); 939 h->GetYaxis()->SetTitleSize(0.06); 940 h->GetYaxis()->CenterTitle(); 941 h->SetYTitle("Counts"); 942 h->SetTitleSize(0.07); 943 h->SetTitle(""); 944 945 const Double_t imax = fFit.GetSignalIntegralMax(); 946 if (imax<1) 947 h->GetXaxis()->SetRangeUser(0, 0.6*0.6); 948 949 // scale off-data 950 fFit.Scale(*hoff, *hon); 951 952 hon->SetMinimum(0); 953 hoff->SetMinimum(0); 954 955 // draw data 956 if (hoff) 957 { 958 hoff->SetMaximum(TMath::Max(hon->GetMaximum(),hoff->GetMaximum())*1.1); 959 hoff->Draw("bar"); 960 hon->Draw("same"); 961 } 962 else 963 { 964 hon->SetMaximum(); 965 hon->Draw(); 966 } 967 968 // draw a preliminary tag 969 TLatex text; 970 text.SetTextColor(kWhite); 971 text.SetBit(TLatex::kTextNDC); 972 text.SetTextSize(0.07); 973 text.SetTextAngle(2.5); 974 text.DrawLatex(0.45, 0.2, "preliminary"); 975 //enum { kTextNDC = BIT(14) }; 976 977 // draw line showing cut 978 TLine line; 979 line.SetLineColor(14); 980 line.SetLineStyle(7); 981 line.DrawLine(imax, 0, imax, h->GetMaximum()); 982 983 // Add a title above the plot 984 TPaveText *pave=new TPaveText(0.12, 0.83, 0.99, 0.975, "blNDC"); 985 pave->SetBorderSize(1); 986 pave->SetLabel(title); 987 988 char txt[1000]; 989 TText *ptxt; 990 sprintf(txt, " "); 991 ptxt = pave->AddText(txt); 992 ptxt->SetTextAlign(23); 993 994 sprintf(txt, "Significance %.1f\\sigma, off-scale %.2f (\\omega=%.2f\\circ)", 995 fFit.GetSignificance(), fFit.GetScaleFactor(), fFit.GetGausSigma()); 996 ptxt = pave->AddText(txt); 997 ptxt->SetTextAlign(23); 998 999 sprintf(txt, "%.1f excess events, %.1f background events", 1000 fFit.GetEventsExcess(), fFit.GetEventsBackground()); 1001 ptxt = pave->AddText(txt); 1002 ptxt->SetTextAlign(23); 1003 pave->SetBit(kCanDelete); 1004 pave->Draw(); 1005 } 887 1006 888 1007 Bool_t MHAlpha::Finalize() -
trunk/MagicSoft/Mars/mhflux/MHAlpha.h
r7778 r8136 132 132 void ForceUsingSize(Bool_t b=kTRUE) { fForceUsingSize=b; } 133 133 134 void DrawNicePlot(const char *title="MAGIC Telescope observation") { DrawNicePlot(kTRUE, title); } //*MENU* 135 void DrawNicePlot(Bool_t newc, const char *title=0); 134 136 void DrawAll() { DrawAll(kTRUE); } //*MENU* 135 137 void DrawAll(Bool_t newc);
Note:
See TracChangeset
for help on using the changeset viewer.