Changeset 9155


Ignore:
Timestamp:
11/12/08 13:38:17 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/datacenter/macros/plotstat.C

    r9120 r9155  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: plotstat.C,v 1.9 2008-08-15 12:14:52 dorner Exp $
     2! $Name: not supported by cvs2svn $:$Id: plotstat.C,v 1.10 2008-11-12 13:38:17 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    190190void DrawCake(TH1F *h, Int_t p0=-1, Int_t p1=9999)
    191191{
    192     gPad->Range(-1, -0.9, 1, 1.1);
     192    gPad->Range(-1, -0.84, 1, 1.16);
    193193
    194194    gPad->SetFillColor(kWhite);
     
    208208    const Double_t tot7 = h[7].Integral(p0, p1);
    209209
     210
     211    TPaveText *pave = new TPaveText(-0.99, 0.87, 0.99, 1.15);
     212    pave->SetBorderSize(1);
     213
    210214    TString title = Form("Total = %.1fh (excl=%.1fh)", tot1, tot1-tot2);
    211 
    212215    if (p0>0 && p1<9000 && p0==p1)
    213216        title.Prepend(Form("P%d: ", TMath::Nint(h[0].GetBinCenter(p0))));
    214217
    215     TPaveText *pave = new TPaveText(-0.99, 0.92, 0.99, 1.09);
    216     pave->SetBorderSize(1);
    217218    pave->AddText(title)->SetTextAlign(22);
     219
     220    if (p0>0 && p1<9000)
     221    {
     222        MTime t0, t1;
     223        t0.SetMagicPeriodStart(p0);
     224        t1.SetMagicPeriodStart(p1+1);
     225
     226        pave->AddText(Form("%s 12h  -  %s 12h", t0.GetStringFmt("%Y/%m/%d").Data(), t1.GetStringFmt("%Y/%m/%d").Data()));
     227    }
    218228    pave->SetBit(kCanDelete);
    219229    pave->Draw();
     
    286296}
    287297
    288 void DrawLegend(TH1F *h)
     298TObject *DrawLegend(TH1F *h)
    289299{
    290300    TLegend leg(0.01, 0.12, 0.99, 0.98, "Data Statistics");
     
    311321
    312322    gROOT->SetSelectedPad(0);
    313     leg.DrawClone()->SetBit(kCanDelete);;
     323    TObject *obj = leg.DrawClone();
     324    obj->SetBit(kCanDelete);;
     325    return obj;
    314326}
    315327
     
    440452    // --------------------------------------------
    441453
    442     TCanvas &c0 = d.AddTab("ObsDist");
     454    TCanvas &c0 = d.AddTab("ObsDist", h8.GetTitle());
    443455    c0.SetFillColor(kWhite);
    444456
     
    463475    // --------------------------------------------
    464476
    465     TCanvas &c1 = d.AddTab("Hist");
     477    TCanvas &c1 = d.AddTab("Hist", "Bar chart of the processing status of all data");
    466478    c1.SetFillColor(kWhite);
    467479    c1.Divide(2,2);
     
    536548    // --------------------------------------------
    537549
    538     TCanvas &cx = d.AddTab("All");
     550    TCanvas &cx = d.AddTab("All", "Pie charts for all periods");
    539551    cx.SetBorderMode(0);
    540552    cx.SetFrameBorderMode(0);
    541553    cx.SetFillColor(kWhite);
    542     cx.Divide(9,5);
     554    cx.Divide(12,7);
    543555    cx.cd(1);
    544     DrawLegend(h);
    545 
    546     for (int i=0; i<h[0].GetNbinsX(); i++)
     556    TObject *leg=DrawLegend(h);
     557
     558    for (int i=h[0].GetNbinsX()-1; i>=40; i--)
    547559    {
    548560        const Int_t num = TMath::Nint(h[0].GetBinCenter(i+1));
    549561
    550         TCanvas &c = d.AddTab(Form("P%d", num));
     562        TCanvas &c = d.AddTab(Form("P%d", num), Form("Pie char for period %d", num));
    551563        c.SetBorderMode(0);
    552564        c.SetFrameBorderMode(0);
     
    555567        c.cd();
    556568
    557         TPad *pad1 = new TPad(Form("Pad%da", num), "", 0.05, 0, 0.55, 1);
     569        TPad *pad0 = new TPad(Form("Pad%dl", num), "", 0.59, 0.5, 1, 1);
     570        pad0->SetBorderMode(0);
     571        pad0->SetFrameBorderMode(0);
     572        pad0->SetFillColor(kWhite);
     573        pad0->SetBit(kCanDelete);
     574        pad0->Draw();
     575        pad0->cd();
     576
     577        leg->Draw();
     578
     579        c.cd();
     580
     581        TPad *pad1 = new TPad(Form("Pad%da", num), "", 0.03, 0, 0.50, 1);
    558582        pad1->SetBorderMode(0);
    559583        pad1->SetFrameBorderMode(0);
     
    565589        DrawCake(h, i+1, i+1);
    566590
    567         if (i<4*8)
    568         {
    569             cx.cd(i+2);
    570             DrawCake(h, i+1, i+1);
    571         }
     591        cx.cd(i+2);
     592        DrawCake(h, i+1, i+1);
    572593
    573594        c.cd();
    574595
    575         TPad *pad2 = new TPad(Form("Pad%db", num), "", 0.6, 0.02, 1, 0.48);
     596        TPad *pad2 = new TPad(Form("Pad%db", num), "", 0.55, 0.02, 1, 0.48);
    576597        pad2->SetBorderMode(0);
    577598        pad2->SetFrameBorderMode(0);
     
    719740
    720741    d->SaveAsRoot(path+"plotstat.root");
    721     //d->SaveAsPS("plotstat.ps");
     742    //d->SaveAsPS(path+"plotstat.ps");
    722743
    723744    return 1;
Note: See TracChangeset for help on using the changeset viewer.