Changeset 1966


Ignore:
Timestamp:
04/20/03 12:51:47 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
35 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r1965 r1966  
    11                                                 -*-*- END OF LINE -*-*-
     2
     3 2003/04/21: Thomas Bretz
     4
     5   * macros/plot.C:
     6     - Added MStatusDisplay support
     7     
     8   * macros/status.C:
     9     - added MHNewImagePar
     10
     11   * manalysis/MBlindPixelCalc.cc:
     12     - updated class reference
     13     
     14   * meventdisp/MGCamDisplay.[h,cc]:
     15     - fixed
     16     
     17   * meventdisp/MGEvtDisplay.cc:
     18     - changed function adding the tab
     19     
     20   * mgui/MCamDisplay.cc, mhist/MHCerPhotEvt.cc:
     21     - as a preliminary solution removed inner pad
     22
     23   * mhist/MFillH.cc:
     24     - make sure canvas is updated correctly in PostProcess
     25
     26   * mhist/MH.cc:
     27     - changed DrawCopy(TH1, TH1) and Draw(TH1, TH1) to fit the new needs
     28       display the range correctly and exchanged the two stat boxes
     29   
     30   * mhist/MH3.cc:
     31     - fixed a bug in the default constructor
     32     - removed DrawClone
     33     - updated Draw function
     34     
     35   * mhist/MHMcIntRate.[h,cc], mhist/MHRanForest.[h,cc],
     36     mhist/MHRanForestGini.[h,cc], mhist/MHSigmaPixel.[h,cc],
     37     mhist/MHSigmaTheta.[h,cc], mhist/MHSigmabarTheta.[h,cc],
     38     mhist/MHThetabarTheta.[h,cc], mhist/MHThetabarTime.[h,cc],
     39     mhist/MHTimeDiffTheta.[h,cc], mhist/MHTimeDiffTime.[h,cc],
     40     mimage/MHNewImagePar.[h,cc]:
     41     - removed old DrawClone
     42     - updated Draw function
     43     - replaced some titles by latex titles in some classes
     44
     45   * mimage/MHNewImagePar.[h,cc], mimage/MNewImagePar.[h,cc]:
     46     - removed scaling stuff
     47
     48   * mmain/MStatusDisplay.cc:
     49     - fixed some minor bugs
     50
     51
     52
     53 2003/04/20: Thomas Bretz
    254
    355   * Makefile:
  • trunk/MagicSoft/Mars/macros/plot.C

    r1543 r1966  
    2323!
    2424\* ======================================================================== */
    25 
     25#include <MH.h>
    2626// -------------------------------------------------------------------------
    2727//
     
    3232void plot()
    3333{
     34    MStatusDisplay *d = new MStatusDisplay;
     35    d->SetLogStream(&gLog);
     36
    3437    //
    3538    // Create a empty Parameter List and an empty Task List
     
    4851    // First Task: Read file with image parameters
    4952    // (created with the star.C macro)
    50     MReadMarsFile  read("Events", "star.root");
     53    MReadMarsFile  read("Events", "MC_OFF1.root");
     54    read.AddFile("MC_ON1.root");
    5155    read.DisableAutoScheme();
    5256    tlist.AddToList(&read);
     
    6468    // set the name of the variable to plot and the binning
    6569    //
    66     TString var("MHillas.fSize");
     70    TString var("Hillas.fSize");
    6771
    6872    MBinning bins("BinningMH3X");
     
    99103    // Execute your analysis
    100104    //
    101     MProgressBar bar;
    102     evtloop.SetProgressBar(&bar);
     105    evtloop.SetDisplay(d);
    103106    if (!evtloop.Eventloop())
    104107        return;
     
    106109    tlist.PrintStatistics();
    107110
    108     // Create a default canvas called Plot and set the
     111    // Create a pad, check if MStatusDisplay was not closed meanwhile
     112    if (evtloop.GetDisplay())
     113        d->AddTab("Size");
     114    else
     115        MH::MakeDefCanvas("Plot");
     116
    109117    // x-axis to logarithmic scale
    110     MH::MakeDefCanvas("Plot");
    111118    gPad->SetLogx();
    112119
     
    114121    // and draw a copy of both
    115122    h3h.GetHist().SetLineColor(kRed);
    116     h3h.GetHist().SetFillStyle(4000);
    117     h3g.GetHist().DrawCopy();
    118     h3h.GetHist().DrawCopy("same");
     123    MH::DrawCopy(h3h.GetHist(), h3g.GetHist(), "Size");
    119124
    120125    // Now create a new histogram, fill it with the division of the
     
    124129    h.Divide(&h3g.GetHist(), &h3h.GetHist());
    125130    h.SetLineColor(kGreen);
    126     h.SetFillStyle(4000);
    127131    h.DrawCopy("same");
    128132}
  • trunk/MagicSoft/Mars/macros/status.C

    r1965 r1966  
    8080
    8181    // ------------- user change -----------------
    82     //read.AddFile("data/Pro*.root");
    8382    read.AddFile("data/Gam*.root");
     83    //read.AddFile("200*.root");
    8484
    8585    MMcPedestalCopy   pcopy;
     
    9393    MHillasCalc       hcalc;
    9494    MHillasSrcCalc    scalc; // !!Preliminary!! Will be removed later!
     95    MNewImageParCalc  icalc;
    9596
    9697    // -------------------------------------------
     
    99100    MFillH hfill3("MHHillasExtSrc [MHHillasExt]");
    100101    MFillH hfill4("MHHillasSrc","MHillasSrc");
     102    MFillH hfill4("MHNewImagePar","MNewImagePar");
    101103    MFillH hfill5("MHStarMap", "MHillas");
    102104    MFillH hfill6("MHCerPhotEvt", "MCerPhotEvt");
     
    107109
    108110    tlist.AddToList(&ncalc);
    109 
    110111    tlist.AddToList(&blind);
    111112    tlist.AddToList(&clean);
    112113    tlist.AddToList(&hcalc);
    113114    tlist.AddToList(&scalc);
     115    tlist.AddToList(&icalc);
    114116    tlist.AddToList(&hfill1);
    115117    tlist.AddToList(&hfill2);
  • trunk/MagicSoft/Mars/manalysis/MBlindPixelCalc.cc

    r1965 r1966  
    1919!   Author(s): Thomas Bretz    08/2002 <mailto:tbretz@astro.uni.wuerzburg.de>
    2020!
    21 !   Copyright: MAGIC Software Development, 2000-2002
     21!   Copyright: MAGIC Software Development, 2000-2003
    2222!
    2323!
     
    2525
    2626/////////////////////////////////////////////////////////////////////////////
    27 //                                                                         //
    28 //  MBlindPixelCalc                                                        //
    29 //                                                                         //
    30 //  This is the specific image cleaning for a list of pixels. This task    //
    31 //  sets the pixels listed in fPixelsID to unused so they should not be    //
    32 //  used for analysis (eg calculation of hillas parameters).               //
    33 //                                                                         //
    34 //  If you specify an array of pixel IDs this pixels are disabled.         //
    35 //  In all other cases the task tries to determin the starfield from the   //
    36 //  MMcRunHeader and disables pixels correspoding to the starfield.        //
    37 //                                                                         //
    38 //  Implemented star fields:                                               //
    39 //   - Crab: 400, 401, 402, 437, 438, 439                                  //
    40 //                                                                         //
    41 //  You can use MBlindPixelCalc::SetUseInterpolation to replaced the       //
    42 //  blind pixels by the average of its neighbors instead of unmapping      //
    43 //  them. If you want to include the central pixel use                     //
    44 //  MBlindPixelCalc::SetUseCentralPixel                                    //
    45 //                                                                         //
    46 //  Input Containers:                                                      //
    47 //   MCerPhotEvt                                                           //
    48 //                                                                         //
    49 //  Output Containers:                                                     //
    50 //   MBlindPixels                                                          //
    51 //                                                                         //
     27//
     28//  MBlindPixelCalc
     29//
     30//  This is the specific image cleaning for a list of pixels. This task
     31//  sets the pixels listed in fPixelsID to unused so they should not be
     32//  used for analysis (eg calculation of hillas parameters).
     33//
     34//  You can use MBlindPixelCalc::SetUseInterpolation to replaced the
     35//  blind pixels by the average of its neighbors instead of unmapping
     36//  them. If you want to include the central pixel use
     37//  MBlindPixelCalc::SetUseCentralPixel.
     38//
     39//  You have three options:
     40//   1) Call SetUseBlindPixels():
     41//      This will take an existing MBlindPixels container filled from
     42//      elsewhere (eg. MCT1ReadPreProc) and use this pixels as blind
     43//      pixels.
     44//   2) Call SetPixels():
     45//      This will setup an array with pixel numbers. These pixels are used
     46//      as blind pixels.
     47//   3) Neither 1) nor 2)
     48//      This options tries to identify the starfield from the
     49//      MMcRunHeader container and tries to identifies it. If it is known
     50//      (eg. Crab) the fixed build in pixel numbers are used as blind
     51//      pixels.
     52//
     53//  If neither an array of pixels is given (or its size is 0) and
     54//  MMcRunHeader couldn't be found the task removes itself from the
     55//  tasklist.
     56//
     57//  Implemented star fields:
     58//   - Crab: 400, 401, 402, 437, 438, 439
     59//
     60//  Input Containers:
     61//   MCerPhotEvt[, MBlindPixels]
     62//
     63//  Output Containers:
     64//   MCerPhotEvt, MBlindPixels
     65//
    5266/////////////////////////////////////////////////////////////////////////////
    5367#include "MBlindPixelCalc.h"
     
    140154//
    141155//  Replaces each pixel by the average of its surrounding pixels.
    142 //  If TESTBIT(fFlags, kUseCentralPixel) is set the central pixel is also included.
     156//  If TESTBIT(fFlags, kUseCentralPixel) is set the central pixel is also
     157//  included.
    143158//
    144159void MBlindPixelCalc::Interpolate() const
  • trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc

    r1965 r1966  
    150150                           const TGWindow *p, /*const TGWindow *main,*/
    151151                           UInt_t w, UInt_t h)
    152 : MGEvtDisplay(filename, "Events", p, /*main,*/ w, h), fDisplay(NULL)
     152: MGEvtDisplay(filename, "Events", p, /*main,*/ w, h)
    153153{
    154154    //
     
    162162    AddSetupElements();
    163163
    164     fCanvas2 = AddTab("Errors");
    165     fCanvas3 = AddTab("Phot/Err");
    166     fCanvas4 = AddTab("Levels");
    167     fCanvas5 = AddTab("Pedestals");
     164    fCanvas2[0] = fCanvas;
     165    fCanvas2[1] = AddTab("Errors");
     166    fCanvas2[2] = AddTab("Phot/Err");
     167    fCanvas2[3] = AddTab("Levels");
     168    fCanvas2[4] = AddTab("Pedestals");
    168169
    169170    //
    170171    // Show camera display for the actual geometry
    171172    //
    172     fDisplay  = new MCamDisplay(geom);
    173     fDisplay2 = new MCamDisplay(geom);
    174     fDisplay3 = new MCamDisplay(geom);
    175     fDisplay4 = new MCamDisplay(geom);
    176     fDisplay5 = new MCamDisplay(geom);
    177 
    178     fList->Add(fDisplay);
    179     fList->Add(fDisplay2);
    180     fList->Add(fDisplay3);
    181     fList->Add(fDisplay4);
    182     fList->Add(fDisplay5);
    183 
    184     fCanvas->cd();
    185     fDisplay->Draw();
    186     fCanvas2->cd();
    187     fDisplay2->Draw();
    188     fCanvas3->cd();
    189     fDisplay3->Draw();
    190     fCanvas4->cd();
    191     fDisplay4->Draw();
    192     fCanvas5->cd();
    193     fDisplay5->Draw();
    194 
     173    for (int i=0; i<5; i++)
     174    {
     175        fCanvas2[i]->cd();
     176        fDisplay[i]  = new MCamDisplay(geom);
     177        fDisplay[i]->Draw();
     178        fCanvas2[i]->Update();
     179        fList->Add(fDisplay[i]);
     180    }
    195181
    196182    ReadFirstEvent();
     
    203189    Layout();
    204190
    205     SetWindowName("Hillas Event Display");
    206     SetIconName("Hillas");
     191    SetWindowName("Image Event Display");
     192    SetIconName("Image");
    207193
    208194    MapWindow();
     
    242228    if (fDisplayRaw)
    243229    {
    244         //
    245230        // Get a clone of MCerPhotEvt which is made before the image cleaning
    246         //
    247231        const MClone *clone = (MClone*)GetTaskList()->FindObject("MClone");
    248232        evt = (MCerPhotEvt*)clone->GetClone();
     
    250234    else
    251235    {
    252         //
    253236        // Get MCerPhotEvt which containes the cleaned data
    254         //
    255237        evt = (MCerPhotEvt*)plist->FindObject("MCerPhotEvt");
    256238    }
     
    259241    const MPedestalCam *ped   = (MPedestalCam*)plist->FindObject("MPedestalCam");
    260242
    261     fDisplay->FillPhotNum(*evt);
    262     fCanvas->Modified();
    263     fCanvas->Update();
    264     fDisplay2->FillErrorPhot(*evt);
    265     fCanvas2->Modified();
    266     fCanvas2->Update();
    267     fDisplay3->FillRatio(*evt);
    268     fCanvas3->Modified();
    269     fCanvas3->Update();
    270     fDisplay4->FillLevels(*evt, *clean);
    271     fCanvas4->Modified();
    272     fCanvas4->Update();
    273     fDisplay5->FillPedestals(*ped);
    274     fCanvas5->Modified();
    275     fCanvas5->Update();
     243    fDisplay[0]->FillPhotNum(*evt);
     244    fDisplay[1]->FillErrorPhot(*evt);
     245    fDisplay[2]->FillRatio(*evt);
     246    fDisplay[3]->FillLevels(*evt, *clean);
     247    fDisplay[4]->FillPedestals(*ped);
     248
     249    for (int i=0; i<5; i++)
     250    {
     251        fCanvas2[i]->Modified();
     252        fCanvas2[i]->Update();
     253    }
    276254}
    277255
  • trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.h

    r1965 r1966  
    1919    TGListBox   *fPixelList;
    2020
    21     MCamDisplay *fDisplay;
    22     MCamDisplay *fDisplay2;
    23     MCamDisplay *fDisplay3;
    24     MCamDisplay *fDisplay4;
    25     MCamDisplay *fDisplay5;
    26 
    27     TCanvas *fCanvas2;
    28     TCanvas *fCanvas3;
    29     TCanvas *fCanvas4;
    30     TCanvas *fCanvas5;
     21    MCamDisplay *fDisplay[5];
     22    TCanvas     *fCanvas2[5];
    3123
    3224    void AddSetupElements();
  • trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.cc

    r1836 r1966  
    216216    fList->Add(laycanvas);
    217217
    218     TGCompositeFrame *frame = fEvtDisplay->AddTab(name);
    219     TRootEmbeddedCanvas *canvas = new TRootEmbeddedCanvas(name+"Display", frame, 400, 400);
    220     frame->AddFrame(canvas, laycanvas);
    221     fList->Add(canvas);
    222     return canvas->GetCanvas();
     218    // Add new tab
     219    TGCompositeFrame *f = fEvtDisplay->AddTab(name);
     220
     221    // create root embedded canvas and add it to the tab
     222    TRootEmbeddedCanvas *ec = new TRootEmbeddedCanvas(name+"Display", f, f->GetWidth(), f->GetHeight());
     223    f->AddFrame(ec, laycanvas);
     224    fList->Add(ec);
     225
     226    // set background and border mode of the canvas
     227    TCanvas &c = *ec->GetCanvas();
     228    c.SetBorderMode(0);
     229
     230    // layout and map new tab
     231#if ROOT_VERSION_CODE < ROOT_VERSION(3,03,00)
     232    MapSubwindows();
     233    Layout();
     234#else
     235    Layout();
     236    MapSubwindows();
     237#endif
     238
     239    // display new tab in the main frame
     240    gClient->ProcessEventsFor(fEvtDisplay);
     241
     242    // return pointer to new canvas
     243    return &c;
    223244}
    224245
  • trunk/MagicSoft/Mars/mgui/MCamDisplay.cc

    r1965 r1966  
    278278    pad->SetFillColor(16);
    279279
    280     //
    281     // All this is necessary to get the background in the correct color
    282     //
    283     pad->Divide(1,1);
    284     pad->cd(1);
    285 
    286     gPad->SetBorderMode(0);
    287     gPad->SetFillColor(16);
    288 
    289     //
    290     // set the color palette for the TBox elements
    291     //
    292280    AppendPad("");
    293 
    294     //
    295     // Necessary to visualize the background color (FIXME?)
    296     //
    297     gPad->Modified();
    298     gPad->Update();
    299281}
    300282
     
    309291    const float w = gPad->GetWw();
    310292    const float h = gPad->GetWh()*ratio;
     293
     294    gPad->Range(-fRange, -fRange, (2*ratio-1)*fRange, fRange);
    311295
    312296    if (h<w)
     
    314298    else
    315299        gPad->SetPad(0, (1.-w/h)/2, 1, (w/h+1)/2);
    316 
    317     gPad->Range(-fRange, -fRange, (2*ratio-1)*fRange, fRange);
    318300}
    319301
     
    741723
    742724        TText &txt = *GetText(i);
    743         txt.SetText(txt.GetX(), txt.GetY(), Form("%5.1f", val));
     725        txt.SetText(txt.GetX(), txt.GetY(), Form(val<1e6?"%5.1f":"%5.1e", val));
    744726    }
    745727}
  • trunk/MagicSoft/Mars/mhist/MFillH.cc

    r1965 r1966  
    469469        fCanvas->cd();
    470470        fH->DrawClone("nonew");
     471        fCanvas->Modified();
     472        fCanvas->Update();
    471473    }
    472474
  • trunk/MagicSoft/Mars/mhist/MH.cc

    r1965 r1966  
    584584    // Draw first histogram
    585585    //
    586     TH1 *h1 = (TH1*)((TH1&)hist1).DrawCopy();
     586    TH1 *h1 = ((TH1&)hist1).DrawCopy();
    587587    gPad->SetBorderMode(0);
    588588    gPad->Update();
     589
     590    h1->SetMaximum(TMath::Max(hist1.GetMaximum(), hist2.GetMaximum()));
     591    h1->SetMinimum(TMath::Min(hist1.GetMinimum(), hist2.GetMinimum()));
    589592
    590593    TPaveText *t = (TPaveText*)gPad->FindObject("title");
     
    609612    //
    610613    TPaveStats &s1 = *(TPaveStats*)gPad->FindObject("stats");
    611     s1.SetX1NDC(s1.GetX1NDC()-0.01);
    612     s1.SetName("MHStat");
     614    const Double_t x1 = s1.GetX1NDC()-0.01;
     615    s1.SetName((TString)"Stat"+hist1.GetTitle());
     616    s1.SetX1NDC(x1-(s1.GetX2NDC()-s1.GetX1NDC()));
     617    s1.SetX2NDC(x1);
    613618
    614619    //
    615620    // Draw second histogram
    616621    //
    617     TH1 *h2 = (TH1*)((TH1&)hist2).DrawCopy("sames");
     622    ((TH1&)hist2).DrawCopy("sames");
    618623    gPad->Update();
    619624
    620625    //
    621     // Set new position of second statistics box
     626    // Draw Legend
    622627    //
    623628    TPaveStats &s2 = *(TPaveStats*)gPad->FindObject("stats");
    624     s2.SetX1NDC(s1.GetX1NDC()-(s2.GetX2NDC()-s2.GetX1NDC())-0.01);
    625     s2.SetX2NDC(s1.GetX1NDC()-0.01);
    626 
    627     //
    628     // Draw Legend
    629     //
    630     const Int_t    n = s1.GetListOfLines()->GetSize();
    631     const Double_t h = s1.GetY2NDC()-s1.GetY1NDC();
    632     TLegend &l = *new TLegend(s1.GetX1NDC(), s1.GetY1NDC()-0.015-h*2/n,
    633                               s1.GetX2NDC(), s1.GetY1NDC()-0.01
    634                             );
    635     l.AddEntry(h1, h1->GetTitle());
    636     l.AddEntry(h2, h2->GetTitle());
     629    TLegend &l = *new TLegend(s2.GetX1NDC(),
     630                              s2.GetY1NDC()-0.015-(s2.GetY2NDC()-s2.GetY1NDC())/2,
     631                              s2.GetX2NDC(),
     632                              s2.GetY1NDC()-0.01
     633                             );
     634    l.AddEntry((TH1*)&hist1, hist1.GetTitle());
     635    l.AddEntry((TH1*)&hist2, hist2.GetTitle());
    637636    l.SetTextSize(s2.GetTextSize());
    638637    l.SetTextFont(s2.GetTextFont());
    639638    l.SetBorderSize(s2.GetBorderSize());
    640639    l.SetBit(kCanDelete);
    641 
    642640    l.Draw();
    643641}
     
    656654    gPad->SetBorderMode(0);
    657655    gPad->Update();
     656
     657    hist1.SetMaximum(TMath::Max(hist1.GetMaximum(), hist2.GetMaximum()));
     658    hist1.SetMinimum(TMath::Min(hist1.GetMinimum(), hist2.GetMinimum()));
    658659
    659660    TPaveText *t = (TPaveText*)gPad->FindObject("title");
     
    678679    //
    679680    TPaveStats &s1 = *(TPaveStats*)gPad->FindObject("stats");
    680     s1.SetX1NDC(s1.GetX1NDC()-0.01);
     681    const Double_t x1 = s1.GetX1NDC()-0.01;
    681682    s1.SetName((TString)"Stat"+hist1.GetTitle());
     683    s1.SetX1NDC(x1-(s1.GetX2NDC()-s1.GetX1NDC()));
     684    s1.SetX2NDC(x1);
    682685
    683686    //
     
    685688    //
    686689    hist2.Draw("sames");
    687 
    688690    gPad->Update();
    689691
    690692    //
    691     // Set new position of second statistics box
     693    // Draw Legend
    692694    //
    693695    TPaveStats &s2 = *(TPaveStats*)gPad->FindObject("stats");
    694     s2.SetX1NDC(s1.GetX1NDC()-(s2.GetX2NDC()-s2.GetX1NDC())-0.01);
    695     s2.SetX2NDC(s1.GetX1NDC()-0.01);
    696 
    697     //
    698     // Draw Legend
    699     //
    700     TLegend &l = *new TLegend(s1.GetX1NDC(),
    701                               s1.GetY1NDC()-0.015-(s1.GetY2NDC()-s1.GetY1NDC())/2,
    702                               s1.GetX2NDC(),
    703                               s1.GetY1NDC()-0.01
     696    TLegend &l = *new TLegend(s2.GetX1NDC(),
     697                              s2.GetY1NDC()-0.015-(s2.GetY2NDC()-s2.GetY1NDC())/2,
     698                              s2.GetX2NDC(),
     699                              s2.GetY1NDC()-0.01
    704700                             );
    705701    l.AddEntry(&hist1, hist1.GetTitle());
  • trunk/MagicSoft/Mars/mhist/MH3.cc

    r1965 r1966  
    112112    fTitle = Form(gsDefTitle.Data(), 1);
    113113
    114     fHist->SetDirectory(NULL);
     114    if (fHist)
     115        fHist->SetDirectory(NULL);
    115116
    116117    fScale[0] = 1;
     
    451452// pointer to it from this function
    452453//
     454/*
    453455TObject *MH3::DrawClone(Option_t *opt) const
    454456{
     
    499501    return c;
    500502}
     503*/
    501504
    502505// --------------------------------------------------------------------------
     
    517520void MH3::Draw(Option_t *opt)
    518521{
    519     if (!gPad)
    520         MH::MakeDefCanvas(fHist);
     522    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fHist);
     523    pad->SetBorderMode(0);
     524
     525    AppendPad("");
    521526
    522527    TString str(opt);
    523528
     529    // FIXME: Do it in Paint()
    524530    if (str.Contains("COL", TString::kIgnoreCase))
    525531        SetColors();
     532
     533    fHist->SetFillStyle(4000);
    526534
    527535    Bool_t only = str.Contains("ONLY", TString::kIgnoreCase) && fDimension==2;
     
    546554    }
    547555
    548     if (fHist->TestBit(kIsLogx)) gPad->SetLogx();
    549     if (fHist->TestBit(kIsLogy)) gPad->SetLogy();
    550     if (fHist->TestBit(kIsLogz)) gPad->SetLogz();
    551 
    552     gPad->Modified();
    553     gPad->Update();
     556    if (fHist->TestBit(kIsLogx)) pad->SetLogx();
     557    if (fHist->TestBit(kIsLogy)) pad->SetLogy();
     558    if (fHist->TestBit(kIsLogz)) pad->SetLogz();
     559
     560    pad->Modified();
     561    pad->Update();
    554562}
    555563
  • trunk/MagicSoft/Mars/mhist/MHCerPhotEvt.cc

    r1965 r1966  
    165165    pad->SetBorderMode(0);
    166166
    167     //
    168     // All this is necessary to get the background in the correct color
    169     //
    170     pad->Divide(1,1);
    171     pad->cd(1);
    172 
    173     gPad->SetBorderMode(0);
    174     gPad->SetFillColor(gPad->GetFillColor());
    175 
    176     //
    177     // set the color palette for the TBox elements
    178     //
    179167    AppendPad("");
    180 
    181     //
    182     // Necessary to visualize the background color (FIXME?)
    183     //
    184     gPad->Modified();
    185     gPad->Update();
    186168}
    187169
  • trunk/MagicSoft/Mars/mhist/MHMcIntRate.cc

    r1606 r1966  
    8181}
    8282
    83 //-------------------------------------------------------------------------
    84 //
    85 //  Defualt Destructor
    86 //
    87 MHMcIntRate::~MHMcIntRate()
    88 {
    89 }
    90 
    9183// ------------------------------------------------------------------------
    9284//
     
    9587void MHMcIntRate::Draw(Option_t *option)
    9688{
    97     if (!gPad)
    98         MH::MakeDefCanvas(&fHist);
     89    TVirtualPad *pad = gPad ? gPad : MH::MakeDefCanvas(this);
     90    pad->SetBorderMode(0);
    9991
    100     gPad->SetLogx();
     92    AppendPad("");
     93
     94    pad->SetLogx();
    10195
    10296    fHist.Draw(option);
    10397
    104     gPad->Modified();
    105     gPad->Update();
    106 }
    107 
    108 TObject *MHMcIntRate::DrawClone(Option_t *option) const
    109 {
    110     TCanvas *c = MH::MakeDefCanvas(&fHist);
    111 
    112     c->SetLogx();
    113 
    114     //
    115     // This is necessary to get the expected bahviour of DrawClone
    116     //
    117     gROOT->SetSelectedPad(NULL);
    118 
    119     ((TH1D&)fHist).DrawCopy(option);
    120 
    121     c->Modified();
    122     c->Update();
    123 
    124     return c;
     98    pad->Modified();
     99    pad->Update();
    125100}
    126101
  • trunk/MagicSoft/Mars/mhist/MHMcIntRate.h

    r1663 r1966  
    2121public:
    2222    MHMcIntRate(const char *name=NULL, const char *title=NULL);
    23     ~MHMcIntRate();
    2423
    2524    void SetName(const char *name);
     
    3231
    3332    void Draw(Option_t* option = "");
    34     TObject *DrawClone(Option_t* option = "") const;
    3533
    3634    void Calc(const MHMcDifRate &rate);
  • trunk/MagicSoft/Mars/mhist/MHRanForest.cc

    r1929 r1966  
    6767    fGraphSigma->SetTitle("Evolution of Standard deviation of estimated hadronness in tree combination");
    6868    fGraphSigma->SetMaximum(1);
     69    fGraphSigma->SetMarkerStyle(kFullDotSmall);
    6970}
    7071
     
    157158// --------------------------------------------------------------------------
    158159//
    159 // Draw clone of histogram
    160 //
    161 TObject *MHRanForest::DrawClone(Option_t *opt) const
    162 {
    163     if (fGraphSigma->GetN()==0)
    164         return NULL;
    165 
    166     TCanvas &c = *MakeDefCanvas("RanForest", fTitle);
    167     gROOT->SetSelectedPad(NULL);
    168 
    169     //gStyle->SetOptStat(10);
    170     TGraph &g = (TGraph&)*fGraphSigma->DrawClone("AL");
    171     g.SetBit(kCanDelete);
    172     gPad->Modified();
    173     gPad->Update();
    174     if (g.GetHistogram())
    175     {
    176         g.GetXaxis()->SetRangeUser(0, fNumEvent);
    177         g.GetXaxis()->SetTitle("Number of Trees");
    178         g.GetYaxis()->SetTitle("Standard deviation of estimated hadronness");
    179         g.SetMarkerStyle(kFullDotMedium);
    180         gPad->Modified();
    181         gPad->Update();
    182         //g.Draw("P");
    183     }
    184     gPad->SetGrid();
    185 
    186     return &c;
    187 }
    188 
    189 // --------------------------------------------------------------------------
    190 //
    191160// Draw histogram. (For the Meaning see class description)
    192161//
     
    196165        return;
    197166
    198    if (!gPad)
    199         MakeDefCanvas("RanForest", fTitle);
     167    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
     168    pad->SetBorderMode(0);
    200169
    201     //gStyle->SetOptStat(10);
     170    AppendPad("");
     171
    202172    fGraphSigma->Draw("ALP");
    203     gPad->Modified();
    204     gPad->Update();
    205     if (fGraphSigma->GetHistogram())
    206     {
    207         fGraphSigma->GetXaxis()->SetRangeUser(0, 1);
    208         fGraphSigma->GetXaxis()->SetTitle("Number of Trees");
    209         fGraphSigma->GetYaxis()->SetTitle("Standard deviation of estimated hadronness");
     173    pad->Modified();
     174    pad->Update();
    210175
    211         fGraphSigma->SetMarkerStyle(kFullDotSmall);
    212         //fGraphSigma->Draw("P");
    213         gPad->Modified();
    214         gPad->Update();
    215     }   
     176    TH1 *h=fGraphSigma->GetHistogram();
     177    if (!h)
     178        return;
     179
     180    h->GetXaxis()->SetRangeUser(0, 1);
     181    h->SetXTitle("No.of Trees");
     182    h->SetYTitle("\\sigma of est.hadronness");
     183
     184    pad->Modified();
     185    pad->Update();
    216186}
  • trunk/MagicSoft/Mars/mhist/MHRanForest.h

    r1880 r1966  
    3737
    3838    void Draw(Option_t *opt="");
    39     TObject *DrawClone(Option_t *opt="") const;
    4039
    4140    ClassDef(MHRanForest, 1) // Histogram showing variance of estimated Hadronness
  • trunk/MagicSoft/Mars/mhist/MHRanForestGini.cc

    r1929 r1966  
    6565    fGraphGini->SetTitle("Importance of RF-input parameters measured by mean Gini decrease");
    6666    fGraphGini->SetMaximum(1);
     67    fGraphGini->SetMarkerStyle(kFullDotSmall);
    6768}
    6869
     
    140141// --------------------------------------------------------------------------
    141142//
    142 // Draw clone of histogram (For the Meaning see class description)
    143 //
    144 TObject *MHRanForestGini::DrawClone(Option_t *opt) const
    145 {
    146     if (fGraphGini->GetN()==0)
    147         return NULL;
    148 
    149     TCanvas &c = *MakeDefCanvas("RanForestGini", fTitle);
    150     gROOT->SetSelectedPad(NULL);
    151 
    152     //gStyle->SetOptStat(10);
    153     TGraph &g = (TGraph&)*fGraphGini->DrawClone("AL");
    154     g.SetBit(kCanDelete);
    155     gPad->Modified();
    156     gPad->Update();
    157     if (g.GetHistogram())
    158     {
    159         g.GetXaxis()->SetRangeUser(0, fRanForest->GetNumTrees());
    160         g.GetXaxis()->SetTitle("No. of RF-input parameter");
    161         g.GetYaxis()->SetTitle("Mean decrease in Gini-index [a.u.]");
    162         g.SetMarkerStyle(kFullDotMedium);
    163         //g.Draw("P");
    164         gPad->Modified();
    165         gPad->Update();
    166     }
    167     gPad->SetGrid();
    168 
    169     return &c;
    170 }
    171 
    172 // --------------------------------------------------------------------------
    173 //
    174143// Draw histogram. (For the Meaning see class description)
    175144//
    176145void MHRanForestGini::Draw(Option_t *)
    177146{
    178    if (fGraphGini->GetN()==0)
     147    if (fGraphGini->GetN()==0)
    179148        return;
    180149
    181    if (!gPad)
    182         MakeDefCanvas("RanForest", fTitle);
     150    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
     151    pad->SetBorderMode(0);
    183152
    184     //gStyle->SetOptStat(10);
     153    AppendPad("");
     154
    185155    fGraphGini->Draw("ALP");
    186     gPad->Modified();
    187     gPad->Update();
    188     if (fGraphGini->GetHistogram())
    189     {
    190         fGraphGini->GetXaxis()->SetRangeUser(0, 1);
    191         fGraphGini->GetXaxis()->SetTitle("No. of RF-input parameter");
    192         fGraphGini->GetYaxis()->SetTitle("Mean decrease in Gini-index [a.u.]");
     156    pad->Modified();
     157    pad->Update();
    193158
    194         fGraphGini->SetMarkerStyle(kFullDotSmall);
    195         //fGraphGini->Draw("P");
    196         gPad->Modified();
    197         gPad->Update();
    198     }
     159    TH1 *h = fGraphGini->GetHistogram();
     160    if (!h)
     161        return;
     162
     163    h->GetXaxis()->SetRangeUser(0, 1);
     164    h->SetXTitle("No.of RF-input parameter");
     165    h->SetYTitle("Mean decrease in Gini-index [a.u.]");
     166
     167    pad->Modified();
     168    pad->Update();
    199169}
  • trunk/MagicSoft/Mars/mhist/MHRanForestGini.h

    r1880 r1966  
    3535
    3636    void Draw(Option_t *opt="");
    37     TObject *DrawClone(Option_t *opt="") const;
    3837
    3938    ClassDef(MHRanForestGini, 1)
  • trunk/MagicSoft/Mars/mhist/MHSigmaPixel.cc

    r1951 r1966  
    124124void MHSigmaPixel::Draw(Option_t *opt)
    125125{
    126   //gStyle->SetOptStat(1000);
    127   if (!gPad)
    128     MakeDefCanvas("SigmaPixel", fTitle);
    129  
    130   fHist.Draw(opt);
    131  
    132   gPad->Modified();
    133   gPad->Update();
     126    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
     127    pad->SetBorderMode(0);
     128
     129    AppendPad("");
     130
     131    fHist.Draw(opt);
     132
     133    gPad->Modified();
     134    gPad->Update();
    134135}
    135136
    136 // --------------------------------------------------------------------------
    137 //
    138 // Draw copies of the histogram
    139 //
    140 TObject *MHSigmaPixel::DrawClone(Option_t *opt) const
    141 {
    142   //gStyle->SetOptStat(1000);
    143   TCanvas &c = *MakeDefCanvas("SigmaPixel", fTitle);
    144  
    145   ((TH2&)fHist).DrawCopy(opt);
    146  
    147   c.Modified();
    148   c.Update();
    149  
    150   return &c;
    151 }
    152 
  • trunk/MagicSoft/Mars/mhist/MHSigmaPixel.h

    r1951 r1966  
    3535
    3636    void Draw(Option_t *option="");
    37     TObject *DrawClone(Option_t *option="") const;
    3837
    3938    ClassDef(MHSigmaPixel, 1) //2D-histogram in Sigma and Pixel number
  • trunk/MagicSoft/Mars/mhist/MHSigmaTheta.cc

    r1961 r1966  
    249249TObject *MHSigmaTheta::DrawClone(Option_t *opt)
    250250{
    251     TCanvas &c = *MakeDefCanvas("SigmaThetaPlot", "Sigmabar vs. Theta",
    252                                  900, 900);
    253     c.Divide(3, 3);
    254 
    255     gROOT->SetSelectedPad(NULL);
    256 
    257     //--------------------------------------------------------------------
     251    return MH::DrawClone(opt, 900, 900);
     252}
     253
     254// --------------------------------------------------------------------------
     255//
     256// Draw the histogram
     257//
     258void MHSigmaTheta::Draw(Option_t *opt)
     259{
     260    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this, 900, 900);
     261    pad->SetBorderMode(0);
     262
     263    AppendPad("");
     264
     265    pad->Divide(3, 3);
     266
    258267    // draw the 2D histogram Sigmabar versus Theta
    259     TH1D *h;
    260 
    261     c.cd(1);
    262     h = ((TH2*)&fSigmaTheta)->ProjectionX("ProjX-Theta", -1, 9999, "E");
     268    TH1 *h;
     269
     270    pad->cd(1);
     271    gPad->SetLogy();
     272    h = fSigmaTheta.ProjectionX("ProjX-Theta", -1, 9999, "E");
    263273    h->SetDirectory(NULL);
    264274    h->SetTitle("Distribution of \\Theta");
    265275    h->SetXTitle("\\Theta [\\circ]");
    266276    h->SetYTitle("No.of events");
    267 
    268     h->DrawCopy(opt);
    269     h->SetBit(kCanDelete);;
    270     gPad->SetLogy();
    271 
    272     c.cd(4);
    273     h = ((TH2*)&fSigmaTheta)->ProjectionY("ProjY-sigma", -1, 9999, "E");
    274     h->SetDirectory(NULL);
    275     h->SetTitle("Distribution of Sigmabar");
    276     h->SetXTitle("Sigmabar");
     277    h->Draw("box");
     278    h->SetBit(kCanDelete);
     279
     280    pad->cd(2);
     281    h = fDiffPixTheta.Project3D("zx");
     282    h->SetDirectory(NULL);
     283    h->SetTitle("\\sigma_{ped}^{2}-\\bar{\\sigma}_{ped}^{2} vs. \\Theta (all pixels)");
     284    h->SetXTitle("\\Theta [\\circ]");
     285    h->SetYTitle("\\sigma_{ped}^2-\\bar{\\sigma}_{ped}^{2}");
     286    h->SetBit(kCanDelete);
     287
     288    pad->cd(3);
     289    h = fSigmaPixTheta.Project3D("zx");
     290    h->SetDirectory(NULL);
     291    h->SetTitle("\\sigma_{ped} vs. \\Theta (all pixels)");
     292    h->SetXTitle("\\Theta [\\circ]");
     293    h->SetYTitle("\\sigma_{ped}");
     294    h->Draw("box");
     295    h->SetBit(kCanDelete);
     296
     297    pad->cd(4);
     298    h = fSigmaTheta.ProjectionY("ProjY-sigma", -1, 9999, "E");
     299    h->SetDirectory(NULL);
     300    h->SetTitle("Distribution of \\bar{\\sigma}_{ped}");
     301    h->SetXTitle("\\bar{\\sigma}_{ped}");
    277302    h->SetYTitle("No.of events");
    278 
    279     h->DrawCopy(opt);
    280     h->SetBit(kCanDelete);;
    281 
    282     c.cd(7);
    283     ((TH2*)&fSigmaTheta)->DrawCopy(opt);
    284 
    285     //--------------------------------------------------------------------
    286     // draw the 3D histogram : Theta, pixel, Sigma^2-Sigmabar^2
    287 
    288     TH2D *l;
    289 
    290     c.cd(2);
    291     l = (TH2D*) ((TH3*)&fDiffPixTheta)->Project3D("zx");
    292     l->SetDirectory(NULL);
    293     l->SetTitle("Sigma^2-Sigmabar^2 vs. \\Theta (all pixels)");
    294     l->SetXTitle("\\Theta [\\circ]");
    295     l->SetYTitle("Sigma^2-Sigmabar^2");
    296 
    297     l->DrawCopy("box");
    298     l->SetBit(kCanDelete);;
    299 
    300     c.cd(5);
    301     l = (TH2D*) ((TH3*)&fDiffPixTheta)->Project3D("zy");
    302     l->SetDirectory(NULL);
    303     l->SetTitle("Sigma^2-Sigmabar^2 vs. pixel number (all \\Theta)");
    304     l->SetXTitle("pixel");
    305     l->SetYTitle("Sigma^2-Sigmabar^2");
    306 
    307     l->DrawCopy("box");
    308     l->SetBit(kCanDelete);;
    309 
    310     //c.cd(8);
    311     //((TH2*)&fDiffPixTheta)->DrawCopy(opt);
    312 
    313     c.cd(8);
    314     ((TH1*)&fBlindId)->DrawCopy(opt);
    315 
    316 
    317     //--------------------------------------------------------------------
    318     // draw the 3D histogram : Theta, pixel, Sigma
    319 
    320     TH2D *k;
    321 
    322     c.cd(3);
    323     k = (TH2D*) ((TH3*)&fSigmaPixTheta)->Project3D("zx");
    324     k->SetDirectory(NULL);
    325     k->SetTitle("Sigma vs. \\Theta (all pixels)");
    326     k->SetXTitle("\\Theta [\\circ]");
    327     k->SetYTitle("Sigma");
    328 
    329     k->DrawCopy("box");
    330     k->SetBit(kCanDelete);;
    331 
    332     c.cd(6);
    333     k = (TH2D*) ((TH3*)&fSigmaPixTheta)->Project3D("zy");
    334     k->SetDirectory(NULL);
    335     k->SetTitle("Sigma vs. pixel number (all \\Theta)");
    336     k->SetXTitle("pixel");
    337     k->SetYTitle("Sigma");
    338 
    339     k->DrawCopy("box");
    340     k->SetBit(kCanDelete);;
    341 
    342     //c.cd(9);
    343     //((TH2*)&fSigmaPixTheta)->DrawCopy(opt);
    344 
    345     c.cd(9);
    346     ((TH1*)&fNpix)->DrawCopy(opt);
    347 
    348     //--------------------------------------------------------------------
    349     c.Modified();
    350     c.Update();
    351 
    352     return &c;
    353 }
    354 
    355 // --------------------------------------------------------------------------
    356 //
    357 // Draw the histogram
    358 //
    359 void MHSigmaTheta::Draw(Option_t *opt)
    360 {
    361     if (!gPad)
    362         MakeDefCanvas("SigmaTheta", "Sigmabar vs. Theta", 600, 600);
    363 
    364     TH1D *h;
    365 
    366     gPad->Divide(2,2);
    367 
    368     gPad->cd(1);
    369     h = ((TH2*)&fSigmaTheta)->ProjectionX("ProjX-Theta", -1, 9999, "E");
    370     h->SetTitle("Distribution of \\Theta");
    371     h->SetXTitle("\\Theta [\\circ]");
    372     h->SetYTitle("No.of events");
    373 
    374303    h->Draw(opt);
    375     h->SetBit(kCanDelete);;
    376     gPad->SetLogy();
    377 
    378     gPad->cd(2);
    379     h = ((TH2*)&fSigmaTheta)->ProjectionY("ProjY-sigma", -1, 9999, "E");
    380     h->SetTitle("Distribution of Sigmabar");
    381     h->SetXTitle("Sigmabar");
    382     h->SetYTitle("No.of events");
    383 
    384     h->Draw(opt);
    385     h->SetBit(kCanDelete);;
    386 
    387     gPad->cd(3);
    388     fSigmaTheta.DrawCopy(opt);
    389 
    390     gPad->Modified();
    391     gPad->Update();
    392 }
    393 // --------------------------------------------------------------------------
    394 
    395 
    396 
    397 
     304    h->SetBit(kCanDelete);
     305
     306    pad->cd(5);
     307    h = fDiffPixTheta.Project3D("zy");
     308    h->SetDirectory(NULL);
     309    h->SetTitle("\\sigma_{ped}^{2}-\\bar{\\sigma}_{ped}^{2} vs. pixel Id (all \\Theta)");
     310    h->SetXTitle("Id");
     311    h->SetYTitle("\\sigma_{ped}^{2}-\\bar{\\sigma}_{ped}^{2}");
     312    h->Draw("box");
     313    h->SetBit(kCanDelete);
     314
     315    pad->cd(6);
     316    h = fSigmaPixTheta.Project3D("zy");
     317    h->SetDirectory(NULL);
     318    h->SetTitle("\\sigma_{ped} vs. pixel Id (all \\Theta)");
     319    h->SetXTitle("Id");
     320    h->SetYTitle("\\sigma_{ped}");
     321    h->Draw("box");
     322    h->SetBit(kCanDelete);
     323
     324    pad->cd(7);
     325    fSigmaTheta.Draw(opt);
     326
     327    pad->cd(8);
     328    fDiffPixTheta.Draw(opt);
     329
     330    pad->cd(9);
     331    fSigmaPixTheta.Draw(opt);
     332}
  • trunk/MagicSoft/Mars/mhist/MHSigmabarTheta.cc

    r1951 r1966  
    6363    fHist.SetTitle("3D-plot of sigmabar and theta");
    6464    fHist.SetXTitle("\\theta [\\circ]");
    65     fHist.SetYTitle("\\overline{\\sigma}");
     65    fHist.SetYTitle("\\bar{\\sigma}");
    6666    fHist.SetZTitle("N");
    6767}
     
    123123void MHSigmabarTheta::Draw(Option_t *opt)
    124124{
    125     if (!gPad)
    126         MakeDefCanvas("SigmabarTheta", fTitle);
    127    
     125    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
     126    pad->SetBorderMode(0);
     127
     128    AppendPad("");
     129
    128130    fHist.Draw(opt);
    129131   
    130     gPad->Modified();
    131     gPad->Update();
     132    pad->Modified();
     133    pad->Update();
    132134}
    133135
    134 // --------------------------------------------------------------------------
    135 //
    136 // Draw copies of the histogram
    137 //
    138 TObject *MHSigmabarTheta::DrawClone(Option_t *opt) const
    139 {
    140     TCanvas &c = *MakeDefCanvas("SigmabarTheta", fTitle);
    141    
    142     ((TH2&)fHist).DrawCopy(opt);
    143 
    144     c.Modified();
    145     c.Update();
    146 
    147     return &c;
    148 }
    149 
  • trunk/MagicSoft/Mars/mhist/MHSigmabarTheta.h

    r1951 r1966  
    3636
    3737    void Draw(Option_t *option="");
    38     TObject *DrawClone(Option_t *option="") const;
    3938
    4039    ClassDef(MHSigmabarTheta, 1) //3D-histogram in alpha, Energy and theta
  • trunk/MagicSoft/Mars/mhist/MHThetabarTheta.cc

    r1668 r1966  
    6161
    6262    fHist.SetXTitle("\\Theta [\\circ]");
    63     fHist.SetYTitle("Theta-bar [ \\circ]");
     63    fHist.SetYTitle("\\bar{\\Theta} [ \\circ]");
    6464}
    6565
     
    9191// --------------------------------------------------------------------------
    9292//
    93 // Draw a copy of the histogram
    94 //
    95 TObject *MHThetabarTheta::DrawClone(Option_t *opt) const
    96 {
    97     TCanvas &c = *MakeDefCanvas("ThetabarTheta", "Thetabar vs. Theta");
    98 
    99     gROOT->SetSelectedPad(NULL);
    100 
    101     ((TProfile)fHist).DrawCopy(opt);
    102 
    103     c.Modified();
    104     c.Update();
    105 
    106     return &c;
    107 }
    108 
    109 // --------------------------------------------------------------------------
    110 //
    11193// Draw the histogram
    11294//
    11395void MHThetabarTheta::Draw(Option_t *opt)
    11496{
    115     if (!gPad)
    116         MakeDefCanvas("ThetabarTheta", "Thetabar vs. Theta");
     97    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
     98    pad->SetBorderMode(0);
    11799
    118     fHist.DrawCopy(opt);
     100    AppendPad("");
    119101
    120     gPad->Modified();
    121     gPad->Update();
     102    fHist.Draw(opt);
     103
     104    pad->Modified();
     105    pad->Update();
    122106}
    123107
  • trunk/MagicSoft/Mars/mhist/MHThetabarTheta.h

    r1668 r1966  
    3434
    3535    void Draw(Option_t *option="");
    36     TObject *DrawClone(Option_t *option="") const;
    3736
    3837    ClassDef(MHThetabarTheta, 0) //Profile histogram Thetabar vs. time
  • trunk/MagicSoft/Mars/mhist/MHThetabarTime.cc

    r1412 r1966  
    6363
    6464    fHist.SetXTitle("time [s]");
    65     fHist.SetYTitle("Theta-bar [ \\circ]");
     65    fHist.SetYTitle("\\bar{\\Theta} [ \\circ]");
    6666}
    6767
     
    100100// --------------------------------------------------------------------------
    101101//
    102 // Draw a copy of the histogram
    103 //
    104 TObject *MHThetabarTime::DrawClone(Option_t *opt) const
    105 {
    106     TCanvas &c = *MakeDefCanvas("ThetabarTime", "Thetabar vs. time");
    107 
    108     gROOT->SetSelectedPad(NULL);
    109 
    110     ((TProfile*)&fHist)->DrawCopy(opt);
    111 
    112     c.Modified();
    113     c.Update();
    114 
    115     return &c;
    116 }
    117 
    118 // --------------------------------------------------------------------------
    119 //
    120102// Draw the histogram
    121103//
    122104void MHThetabarTime::Draw(Option_t *opt)
    123105{
    124     if (!gPad)
    125         MakeDefCanvas("ThetabarTime", "Thetabar vs. time");
     106    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
     107    pad->SetBorderMode(0);
    126108
    127     fHist.DrawCopy(opt);
     109    AppendPad("");
    128110
    129     gPad->Modified();
    130     gPad->Update();
     111    fHist.Draw(opt);
     112
     113    pad->Modified();
     114    pad->Update();
    131115}
    132116
  • trunk/MagicSoft/Mars/mhist/MHThetabarTime.h

    r1668 r1966  
    3737
    3838    void Draw(Option_t *option="");
    39     TObject *DrawClone(Option_t *option="") const;
    4039
    4140    ClassDef(MHThetabarTime, 0) //Profile histogram Thetabar vs. time
  • trunk/MagicSoft/Mars/mhist/MHTimeDiffTheta.cc

    r1668 r1966  
    102102// --------------------------------------------------------------------------
    103103//
    104 // Draw a copy of the histogram
    105 //
    106 TObject *MHTimeDiffTheta::DrawClone(Option_t *opt) const
    107 {
    108     TCanvas &c = *MakeDefCanvas("DiffTimeTheta", "Distrib of \\Delta t, Theta");
    109 
    110     c.Divide(2, 2);
    111 
    112     gROOT->SetSelectedPad(NULL);
    113 
    114     //
    115     // FIXME: ProjectionX,Y is not const within root
    116     //
    117 
    118     TH1D *h;
    119 
    120     c.cd(1);
    121     h = ((TH2*)&fHist)->ProjectionX("ProjX-Theta", -1, 9999, "E");
    122 
    123     h->SetTitle("Distribution of \\Delta t [s]");
    124     h->SetXTitle("\\Delta t [s]");
    125     h->SetYTitle("Counts");
    126 
    127     h->Draw(opt);
    128     h->SetBit(kCanDelete);;
    129     gPad->SetLogy();
    130 
    131     c.cd(2);
    132     h = ((TH2*)&fHist)->ProjectionY("ProjY-timediff", -1, 9999, "E");
    133 
    134     h->SetTitle("Distribution of \\Theta [\\circ]");
    135     h->SetXTitle("\\Theta [\\circ]");
    136     h->SetYTitle("Counts");
    137 
    138     h->Draw(opt);
    139     h->SetBit(kCanDelete);;
    140 
    141     c.cd(3);
    142     ((TH2*)&fHist)->DrawCopy(opt);
    143 
    144     c.Modified();
    145     c.Update();
    146 
    147     return &c;
    148 }
    149 
    150 // --------------------------------------------------------------------------
    151 //
    152104// Draw the histogram
    153105//
    154106void MHTimeDiffTheta::Draw(Option_t *opt)
    155107{
    156     if (!gPad)
    157         MakeDefCanvas("DiffTimeTheta", "Distrib of Delta t, Theta");
     108    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
     109    pad->SetBorderMode(0);
    158110
    159     TH1D *h;
     111    AppendPad("");
    160112
    161     gPad->Divide(2,2);
     113    TH1 *h;
    162114
    163     gPad->cd(1);
     115    pad->Divide(2,2);
     116
     117    pad->cd(1);
     118    gPad->SetLogy();
    164119    h = fHist.ProjectionX("ProjX_Theta", -1, 9999, "E");
    165 
    166120    h->SetTitle("Distribution of \\Delta t [s]");
    167121    h->SetXTitle("\\Delta t [s]");
    168122    h->SetYTitle("Counts");
    169 
    170123    h->Draw(opt);
    171124    h->SetBit(kCanDelete);;
    172     gPad->SetLogy();
    173125
    174     gPad->cd(2);
     126    pad->cd(2);
    175127    h = fHist.ProjectionY("ProjY_timediff", -1, 9999, "E");
    176 
    177128    h->SetTitle("Distribution of \\Theta [\\circ]");
    178129    h->SetXTitle("\\Theta [\\circ]");
    179130    h->SetYTitle("Counts");
    180 
    181131    h->Draw(opt);
    182132    h->SetBit(kCanDelete);;
    183133
    184     gPad->cd(3);
    185     fHist.DrawCopy(opt);
     134    pad->cd(3);
     135    fHist.Draw(opt);
    186136
    187     gPad->Modified();
    188     gPad->Update();
     137    pad->Modified();
     138    pad->Update();
    189139}
    190140
  • trunk/MagicSoft/Mars/mhist/MHTimeDiffTheta.h

    r1668 r1966  
    3535
    3636    void Draw(Option_t *option="");
    37     TObject *DrawClone(Option_t *option="") const;
    3837
    3938    ClassDef(MHTimeDiffTheta, 0) //2D-histogram  time-diff vs. Theta
  • trunk/MagicSoft/Mars/mhist/MHTimeDiffTime.cc

    r1668 r1966  
    9595// --------------------------------------------------------------------------
    9696//
    97 // Draw a copy of the histogram
    98 //
    99 TObject *MHTimeDiffTime::DrawClone(Option_t *opt) const
    100 {
    101 
    102     TCanvas &c = *MakeDefCanvas("DiffTimeTime", "Distrib of dt and t");
    103 
    104     c.Divide(2, 2);
    105 
    106     gROOT->SetSelectedPad(NULL);
    107 
    108     TH1D *h;
    109 
    110     c.cd(1);
    111     h = ((TH2*)&fHist)->ProjectionX("ProjX-sumtime", -1, 9999, "E");
    112 
    113     h->SetTitle("Distribution of \\Delta t [s]");
    114     h->SetXTitle("\\Delta t [s]");
    115     h->SetYTitle("Counts");
    116 
    117     h->Draw(opt);
    118     h->SetBit(kCanDelete);
    119     gPad->SetLogy();
    120 
    121     c.cd(2);
    122     h = ((TH2*)&fHist)->ProjectionY("ProjY-sumtimediff", -1, 9999, "E");
    123 
    124     h->SetTitle("Distribution of time [s]");
    125     h->SetXTitle("time [s]");
    126     h->SetYTitle("Counts");
    127 
    128     h->Draw(opt);
    129     h->SetBit(kCanDelete);
    130 
    131     c.cd(3);
    132     ((TH2*)&fHist)->DrawCopy(opt);
    133 
    134     c.Modified();
    135     c.Update();
    136 
    137     return &c;
    138 }
    139 
    140 // --------------------------------------------------------------------------
    141 //
    14297// Draw the histogram
    14398//
    14499void MHTimeDiffTime::Draw(Option_t *opt)
    145100{
    146     if (!gPad)
    147         MakeDefCanvas("DiffTimeTime", "Distrib of \\Delta t, time");
     101    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
     102    pad->SetBorderMode(0);
    148103
    149     gPad->Divide(2,2);
     104    AppendPad("");
     105
     106    pad->Divide(2,2);
    150107
    151108    TH1D *h;
    152109
    153     gPad->cd(1);
     110    pad->cd(1);
     111    gPad->SetLogy();
    154112    h = fHist.ProjectionX("ProjX_sumtime", -1, 9999, "E");
    155 
    156113    h->SetTitle("Distribution of \\Delta t [s]");
    157114    h->SetXTitle("\\Delta t [s]");
    158115    h->SetYTitle("Counts");
    159 
    160116    h->Draw(opt);
    161117    h->SetBit(kCanDelete);
    162     gPad->SetLogy();
    163118
    164     gPad->cd(2);
     119    pad->cd(2);
    165120    h = fHist.ProjectionY("ProjY_sumtimediff", -1, 9999, "E");
    166 
    167121    h->SetTitle("Distribution of time [s]");
    168122    h->SetXTitle("time [s]");
    169123    h->SetYTitle("Counts");
    170 
    171124    h->Draw(opt);
    172125    h->SetBit(kCanDelete);
    173126
    174     gPad->cd(3);
     127    pad->cd(3);
    175128    fHist.DrawCopy(opt);
    176129
    177     gPad->Modified();
    178     gPad->Update();
    179 
     130    pad->Modified();
     131    pad->Update();
    180132}
    181133
  • trunk/MagicSoft/Mars/mhist/MHTimeDiffTime.h

    r1668 r1966  
    3333
    3434    void Draw(Option_t *option="");
    35     TObject *DrawClone(Option_t *option="") const;
    3635
    3736    ClassDef(MHTimeDiffTime, 0) //2D-histogram  time-diff vs. time
  • trunk/MagicSoft/Mars/mimage/MHNewImagePar.cc

    r1965 r1966  
    5555//
    5656MHNewImagePar::MHNewImagePar(const char *name, const char *title)
    57     : fUseMmScale(kTRUE)
    5857{
    5958    fName  = name  ? name  : "MHNewImagePar";
    60     fTitle = title ? title : "Container for histograms of new image parameters";
     59    fTitle = title ? title : "Histograms of new image parameters";
    6160
    62     fLeakage1 = new TH1F("Leakage1", "Leakage1", 100, 0.0, 1.0);
     61    fLeakage1 = new TH1F("Leakage1", "Leakage_{1}", 100, 0.0, 1.0);
    6362    fLeakage1->SetDirectory(NULL);
    64     fLeakage1->SetXTitle("Leakage1");
     63    fLeakage1->SetXTitle("Leakage");
    6564    fLeakage1->SetYTitle("Counts");
    6665
    67     fLeakage2 = new TH1F("Leakage2", "Leakage2", 100, 0.0, 1.0);
     66    fLeakage2 = new TH1F("Leakage2", "Leakage_{2}", 100, 0.0, 1.0);
    6867    fLeakage2->SetDirectory(NULL);
    69     fLeakage2->SetXTitle("Leakage2");
     68    fLeakage2->SetXTitle("Leakage");
    7069    fLeakage2->SetYTitle("Counts");
     70    fLeakage2->SetLineColor(kBlue);
    7171}
    7272
     
    7979    delete fLeakage1;
    8080    delete fLeakage2;
    81 }
    82 
    83 // --------------------------------------------------------------------------
    84 //
    85 // Setup the Binning for the histograms automatically if the correct
    86 // instances of MBinning (with the names 'BinningAlpha' and 'BinningDist')
    87 // are found in the parameter list
    88 // Use this function if you want to set the conversion factor which
    89 // is used to convert the mm-scale in the camera plain into the deg-scale
    90 // used for histogram presentations. The conversion factor is part of
    91 // the camera geometry. Please create a corresponding MGeomCam container.
    92 //
    93 Bool_t MHNewImagePar::SetupFill(const MParList *plist)
    94 {
    95     const MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam");
    96     if (!geom)
    97         *fLog << warn << dbginf << "No Camera Geometry available. Using mm-scale for histograms." << endl;
    98     else
    99     {
    100         fMm2Deg = geom->GetConvMm2Deg();
    101         SetMmScale(kFALSE);
    102     }
    103 
    104     //ApplyBinning(*plist, "Alpha",    fAlpha);
    105     //ApplyBinning(*plist, "Dist",     fDist);
    106     //ApplyBinning(*plist, "HeadTail", fHeadTail);
    107 
    108     return kTRUE;
    10981}
    11082
     
    12597// --------------------------------------------------------------------------
    12698//
    127 // Use this function to setup your own conversion factor between degrees
    128 // and millimeters. The conversion factor should be the one calculated in
    129 // MGeomCam. Use this function with Caution: You could create wrong values
    130 // by setting up your own scale factor.
    131 //
    132 void MHNewImagePar::SetMm2Deg(Float_t mmdeg)
    133 {
    134     if (mmdeg<=0)
    135     {
    136         *fLog << warn << dbginf << "Warning - Conversion factor <= 0 - nonsense. Ignored." << endl;
    137         return;
    138     }
    139 
    140     if (fMm2Deg>0)
    141         *fLog << warn << dbginf << "Warning - Conversion factor already set. Overwriting" << endl;
    142 
    143     fMm2Deg = mmdeg;
    144 }
    145 
    146 // --------------------------------------------------------------------------
    147 //
    148 // With this function you can convert the histogram ('on the fly') between
    149 // degrees and millimeters.
    150 //
    151 void MHNewImagePar::SetMmScale(Bool_t mmscale)
    152 {
    153     if (fUseMmScale == mmscale)
    154         return;
    155 
    156     if (fMm2Deg<0)
    157     {
    158         *fLog << warn << GetDescriptor() << ": Warning - Sorry, no conversion factor for conversion available." << endl;
    159         return;
    160     }
    161 
    162     //const Double_t scale = mmscale ? 1./fMm2Deg : fMm2Deg;
    163     //MH::ScaleAxis(fDist,     scale);
    164     //MH::ScaleAxis(fHeadTail, scale);
    165 
    166     if (mmscale)
    167     {
    168       //    fDist->SetXTitle("Dist [mm]");
    169       //    fHeadTail->SetXTitle("Head-Tail [mm]");
    170     }
    171     else
    172     {
    173       //    fDist->SetXTitle("Dist [\\circ]");
    174       //    fHeadTail->SetXTitle("Head-Tail [\\circ]");
    175     }
    176 
    177     fUseMmScale = mmscale;
    178 }
    179 
    180 // --------------------------------------------------------------------------
    181 //
    182 // Draw clones of all two histograms. So that the object can be deleted
    183 // and the histograms are still visible in the canvas.
    184 // The cloned object are deleted together with the canvas if the canvas is
    185 // destroyed. If you want to handle dostroying the canvas you can get a
    186 // pointer to it from this function
    187 //
    188 TObject *MHNewImagePar::DrawClone(Option_t *opt) const
    189 {
    190     return MH::DrawClone(opt, 300, 600);
    191 }
    192 
    193 // --------------------------------------------------------------------------
    194 //
    19599// Creates a new canvas and draws the two histograms into it.
    196100// Be careful: The histograms belongs to this object and won't get deleted
     
    199103void MHNewImagePar::Draw(Option_t *)
    200104{
    201     TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this, 300, 600);
     105    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
    202106    pad->SetBorderMode(0);
    203107
    204108    AppendPad("");
    205109
    206     pad->Divide(1, 2);
    207 
    208     pad->cd(1);
    209     pad->SetBorderMode(0);
    210     fLeakage1->Draw();
    211 
    212     pad->cd(2);
    213     pad->SetBorderMode(0);
    214     fLeakage2->Draw();
     110    MH::Draw(*fLeakage1, *fLeakage2, "Leakage1 and Leakage2");
    215111
    216112    pad->Modified();
     
    228124    return NULL;
    229125}
    230 
    231 
    232 
    233 
    234 
    235 
    236 
    237 
    238 
    239 
    240 
    241 
    242 
    243 
    244 
    245 
    246 
  • trunk/MagicSoft/Mars/mimage/MHNewImagePar.h

    r1940 r1966  
    1515    TH1F *fLeakage2;     //->
    1616
    17     Float_t fMm2Deg;
    18     Bool_t  fUseMmScale;
    19 
    2017public:
    2118    MHNewImagePar(const char *name=NULL, const char *title=NULL);
    2219    ~MHNewImagePar();
    2320
    24     void SetMmScale(Bool_t mmscale=kTRUE);
    25     void SetMm2Deg(Float_t mmdeg);
    26 
    27     Bool_t SetupFill(const MParList *pList);
    2821    Bool_t Fill(const MParContainer *par);
    2922
     
    3427
    3528    void Draw(Option_t *opt=NULL);
    36     TObject *DrawClone(Option_t *opt=NULL) const;
    3729
    38     ClassDef(MHNewImagePar, 1) // Container which holds histograms for the new image parameters
     30    ClassDef(MHNewImagePar, 1) // Histograms of new image parameters
    3931};
    4032
  • trunk/MagicSoft/Mars/mimage/MNewImagePar.cc

    r1940 r1966  
    7272                          const MHillas *hillas)
    7373{
    74     //fHillas = (MHillas*)hillas;
    75 
    7674    const UInt_t npixevt = evt.GetNumPixels();
    7775
    78     Double_t edgepix1 = 0.0;
    79     Double_t edgepix2 = 0.0;
     76    Double_t edgepix1 = 0;
     77    Double_t edgepix2 = 0;
    8078
    8179    for (UInt_t i=0; i<npixevt; i++)
     
    8785        const MGeomPix &gpix = geom[pix.GetPixId()];
    8886
    89         Double_t nphot = pix.GetNumPhotons();                       
     87        const Double_t nphot = pix.GetNumPhotons();
    9088
    9189        // count photons in outer rings of camera
  • trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc

    r1965 r1966  
    372372    txt += cont.GetTitle();
    373373
    374     cout << txt << endl;
    375 
    376374    SetStatusLine2(txt);
    377375}
     
    552550
    553551    // layout and map new tab
     552#if ROOT_VERSION_CODE < ROOT_VERSION(3,03,00)
     553    MapSubwindows();
     554    Layout();
     555#else
    554556    Layout();
    555557    MapSubwindows();
     558#endif
    556559
    557560    // display new tab in the main frame
     
    804807        return kTRUE;
    805808
    806     if (timer==&fTimer)
    807     {
    808         TGCompositeFrame *f=fTab->GetCurrentContainer();
    809         if (f!=fLogBox)
    810             return kTRUE;
    811 
    812         UpdateTab(f);
    813         return kTRUE;
    814     }
     809    // Update a canvas tab (if visible)
     810    if (timer==&fTimer && c!=fLogIdx)
     811    {
     812        UpdateTab(fTab->GetCurrentContainer());
     813        return kTRUE;
     814    }
     815
     816    // update the logbook tab (if visible)
    815817    if (timer==&fLogTimer && c==fLogIdx)
    816818    {
Note: See TracChangeset for help on using the changeset viewer.