Ignore:
Timestamp:
01/25/05 14:47:59 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhbase
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhbase/MFillH.cc

    r5713 r5994  
    358358// if fDisplay is set and the MH-class overwrites the Draw function
    359359//
     360// If the draw-option contains 'same' (case insensitive) a tab with the
     361// same name as the one which would be created is searched and the
     362// MH is drawn to this canvas. If it is not found a new tab is created.
     363//
    360364Bool_t MFillH::DrawToDisplay()
    361365{
     
    371375        return kTRUE;
    372376
    373     fCanvas = &fDisplay->AddTab(fNameTab.IsNull() ? fH->GetName() : fNameTab.Data());
     377    const TString tabname = fNameTab.IsNull() ? fH->GetName() : fNameTab.Data();
     378
     379    fCanvas = 0;
     380    if (fDrawOption.Contains("same", TString::kIgnoreCase))
     381        fCanvas = fDisplay->GetCanvas(tabname);
     382    if (!fCanvas)
     383        fCanvas = &fDisplay->AddTab(tabname);
     384
     385    fCanvas->cd();
    374386    fH->Draw(fDrawOption);
    375387
  • trunk/MagicSoft/Mars/mhbase/MH.cc

    r5869 r5994  
    795795// Also layout the two statistic boxes and a legend.
    796796//
    797 void MH::DrawSame(TH1 &hist1, TH1 &hist2, const TString title)
     797void MH::DrawSame(TH1 &hist1, TH1 &hist2, const TString title, Bool_t same)
    798798{
    799799    //
    800800    // Draw first histogram
    801801    //
    802     hist1.Draw();
     802    hist1.Draw(same?"same":"");
    803803    gPad->SetBorderMode(0);
    804804    gPad->Update();
  • trunk/MagicSoft/Mars/mhbase/MH.h

    r4991 r5994  
    8585
    8686    static void DrawSameCopy(const TH1 &hist1, const TH1 &hist2, const TString title);
    87     static void DrawSame(TH1 &hist1, TH1 &hist2, const TString title);
     87    static void DrawSame(TH1 &hist1, TH1 &hist2, const TString title, Bool_t same=kFALSE);
    8888
    8989    TObject *Clone(const char *name="") const;
  • trunk/MagicSoft/Mars/mhbase/MH3.cc

    r5956 r5994  
    103103//
    104104MH3::MH3(const unsigned int dim)
    105     : fDimension(dim>3?3:dim), fHist(NULL)/*,
    106     fNameProfX(Form("ProfX_%p", this)),
    107     fNameProfY(Form("ProfY_%p", this))*/
     105    : fDimension(dim>3?3:dim), fHist(NULL)
    108106
    109107    switch (fDimension)
     
    205203//
    206204MH3::MH3(const char *memberx, const char *membery)
    207     : fDimension(2)/*, fNameProfX(Form("ProjX_%p", this)), fNameProfY(Form("ProjY_%p", this))*/
     205    : fDimension(2)
    208206{
    209207    fHist = new TH2F;
     
    539537
    540538    TString str(o);
    541     str = str.Strip(TString::kBoth);
    542 
    543     Bool_t only = str.Contains("ONLY", TString::kIgnoreCase) && fDimension==2;
    544     Bool_t same = str.Contains("SAME", TString::kIgnoreCase) && fDimension==2;
    545     Bool_t blue = str.Contains("BLUE", TString::kIgnoreCase) && fDimension==2;
     539    str.ToLower();
     540
     541    const Bool_t only  = str.Contains("only")  && fDimension==2;
     542    const Bool_t same  = str.Contains("same")  && fDimension==2;
     543    const Bool_t blue  = str.Contains("blue")  && fDimension==2;
     544    const Bool_t profx = str.Contains("profx") && fDimension==2;
     545    const Bool_t profy = str.Contains("profy") && fDimension==2;
     546    // Do NOT replace 'same'-option
     547    str.ReplaceAll("only",  "");
     548    str.ReplaceAll("blue",  "");
     549    str.ReplaceAll("profx", "");
     550    str.ReplaceAll("profy", "");
    546551
    547552    // FIXME: We may have to remove all our own options from str!
     
    549554        fHist->Draw(str);
    550555
    551     if (str.Contains("PROFX", TString::kIgnoreCase) && fDimension==2)
     556    if (profx)
    552557    {
    553558        TProfile *p = ((TH2*)fHist)->ProfileX("ProfX", -1, 9999, "s");
     
    563568        }
    564569    }
    565     if (str.Contains("PROFY", TString::kIgnoreCase) && fDimension==2)
     570    if (profy)
    566571    {
    567572        TProfile *p = ((TH2*)fHist)->ProfileY("ProfY", -1, 9999, "s");
Note: See TracChangeset for help on using the changeset viewer.