Ignore:
Timestamp:
10/20/03 21:32:30 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhist
Files:
9 edited

Legend:

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

    r2414 r2416  
    324324    const Ssiz_t length = last-first-1;
    325325
    326     //
    327     // Make a copy before stripping leading and trailing White Spaces.
    328     //
    329326    TString strip = fHName(first+1, length);
    330327    return strip.Strip(TString::kBoth);
     
    343340        return kTRUE;
    344341
     342    if (!fH->OverwritesDraw())
     343        return kTRUE;
     344
    345345    if (TestBit(kDoNotDisplay))
    346346        return kTRUE;
    347347
    348     const Bool_t dr = fH->OverwritesDraw();
    349     const Bool_t ts = fH->OverwritesDraw(NULL, "TS");
    350     if (!dr && !ts)
    351         return kTRUE;
    352 
    353     if (!ts)
    354     {
    355         *fLog << warn << "You overwrote " << fH->ClassName() << "::";
    356         *fLog << "Draw instead of " << fH->ClassName() << "::DrawTS" << endl;
    357         *fLog << "This is not thread safe and might result in trouble using" << endl;
    358         *fLog << "multithreaded programs like MONA." << endl;
    359         *fLog << "" << endl;
    360         return kTRUE;
    361     }
    362 
    363348    fCanvas = &fDisplay->AddTab(fH->GetName());
    364     fH->DrawTS(fCanvas);
    365 
    366     return kTRUE;
    367 }
    368 
    369 // --------------------------------------------------------------------------
    370 //
    371 //
    372 Bool_t MFillH::DrawCloneToDisplay()
    373 {
    374     fH->DrawCloneTS(fCanvas);
    375     fCanvas->Modified();
    376     fCanvas->Update();
     349    fH->Draw();
    377350
    378351    return kTRUE;
     
    533506    //
    534507    if (fDisplay && fDisplay->HasCanvas(fCanvas))
    535         DrawCloneToDisplay();
     508    {
     509        fCanvas->cd();
     510        fH->DrawClone("nonew");
     511        fCanvas->Modified();
     512        fCanvas->Update();
     513    }
    536514
    537515    return kTRUE;
  • trunk/MagicSoft/Mars/mhist/MFillH.h

    r2414 r2416  
    4444
    4545    Bool_t DrawToDisplay();
    46     Bool_t DrawCloneToDisplay();
    4746
    4847public:
     
    6463    Int_t PostProcess();
    6564
    66     MH *GetH() { return fH; }
    6765    TCanvas *GetCanvas() { return fCanvas; }
    6866
  • trunk/MagicSoft/Mars/mhist/MH.cc

    r2413 r2416  
    700700// Also layout the two statistic boxes and a legend.
    701701//
    702 void MH::DrawSame(TH1 &hist1, TH1 &hist2, const TString title, TVirtualPad *pad)
     702void MH::DrawSame(TH1 &hist1, TH1 &hist2, const TString title)
    703703{
    704704    //
    705705    // Draw first histogram
    706706    //
    707     if (!pad)
    708         pad = gPad;
    709 
    710     MParContainer::DrawTS(&hist1, pad);
    711     pad->SetBorderMode(0);
    712     pad->Update();
     707    hist1.Draw();
     708    gPad->SetBorderMode(0);
     709    gPad->Update();
    713710
    714711    if (hist1.GetEntries()>0 && hist2.GetEntries()>0)
     
    729726    }
    730727
    731     TPaveText *t = (TPaveText*)pad->FindObject("title");
     728    TPaveText *t = (TPaveText*)gPad->FindObject("title");
    732729    if (t)
    733730    {
     
    741738        // (see THistPainter::PaintTitle) title
    742739        //
    743         pad->Modified();  // indicates a change
    744         pad->Update();    // recreates the original title
     740        gPad->Modified();  // indicates a change
     741        gPad->Update();    // recreates the original title
    745742        t->Pop();          // bring our title on top
    746743    }
     
    750747    //
    751748    // Where to get the TPaveStats depends on the root version
    752     TPaveStats *s1 = (TPaveStats*)pad->FindObject("stats");
     749    TPaveStats *s1 = (TPaveStats*)gPad->FindObject("stats");
    753750    if (!s1)
    754751        s1 = (TPaveStats*)hist1.GetListOfFunctions()->FindObject("stats");
     
    766763    // Draw second histogram
    767764    //
    768     MParContainer::DrawTS(&hist2, pad, "sames");
    769     pad->Update();
     765    hist2.Draw("sames");
     766    gPad->Update();
    770767
    771768    //
     
    773770    //
    774771    // Where to get the TPaveStats depends on the root version
    775     TPaveStats *s2 = (TPaveStats*)pad->FindObject("stats");
     772    TPaveStats *s2 = (TPaveStats*)gPad->FindObject("stats");
    776773    if (!s2)
    777774        s2 = (TPaveStats*)hist2.GetListOfFunctions()->FindObject("stats");
     
    790787        l.SetBorderSize(s2->GetBorderSize());
    791788        l.SetBit(kCanDelete);
    792         MParContainer::DrawTS(&l, pad);
     789        l.Draw();
    793790    }
    794791}
     
    833830// to the present pad. The kCanDelete bit is set for the clone.
    834831//
    835 TObject *MH::DrawCloneTS(TVirtualPad *pad, Option_t *opt, Int_t w, Int_t h) const
     832TObject *MH::DrawClone(Option_t *opt, Int_t w, Int_t h) const
    836833{
    837834    TString option(opt);
    838835
    839     //gLog << dbg << "DrawCloneTS: Arg=" << pad << " " << gPad << endl;
    840 
    841     TVirtualPad *p = GetNewPad(option) || pad ? pad : NULL;
    842     //gLog << dbg << "DrawCloneTS: nonew&&gpad=" << p << " " << opt << endl;
    843     if (!p)
    844         p = MakeDefCanvas(this, w, h);
    845     else
    846     /*{
    847         gLog << dbg << "--> Clear" << endl;*/
    848         p->Clear();
    849     //}
    850     //gLog << dbg << "DrawCloneTS: " << p << endl;
    851 
    852     TObject *o = MParContainer::DrawCloneTS(pad, option);
    853     o->SetBit(kCanDelete);
    854     return o;
    855 }
    856 
    857 /*
    858 // --------------------------------------------------------------------------
    859 //
    860 // If the opt string contains 'nonew' or gPad is not given a new canvas
    861 // with size w/h is created. Otherwise the object is cloned and drawn
    862 // to the present pad. The kCanDelete bit is set for the clone.
    863 //
    864 TObject *MH::DrawClone(Option_t *opt, Int_t w, Int_t h) const
    865 {
    866     TString option(opt);
    867 
    868     gLog << dbg << "DrawCloneTS: Arg=" << gPad << endl;
    869 
    870     TVirtualPad *p = GetNewPad(option) ? gPad : NULL;
    871     gLog << dbg << "DrawCloneTS: nonew&&gpad=" << p << " " << opt << endl;
     836    TVirtualPad *p = GetNewPad(option);
    872837    if (!p)
    873838        p = MakeDefCanvas(this, w, h);
    874839    else
    875840        p->Clear();
    876     gLog << dbg << "DrawCloneTS: " << p << endl;
    877 
    878     TObject *o = Clone(option);
     841
     842    gROOT->SetSelectedPad(NULL);
     843
     844    TObject *o = MParContainer::DrawClone(option);
    879845    o->SetBit(kCanDelete);
    880846    return o;
    881847}
    882 */
    883848
    884849// --------------------------------------------------------------------------
     
    886851// Check whether a class inheriting from MH overwrites the Draw function
    887852//
    888 Bool_t MH::OverwritesDraw(TClass *cls, const char *ext) const
     853Bool_t MH::OverwritesDraw(TClass *cls) const
    889854{
    890855    if (!cls)
     
    900865    // Check whether the class cls overwrites Draw
    901866    //
    902     TString name("Draw");
    903     name += ext;
    904     if (cls->GetMethodAny(name))
     867    if (cls->GetMethodAny("Draw"))
    905868        return kTRUE;
    906869
     
    912875    while ((base=(TBaseClass*)NextBase()))
    913876    {
    914         if (OverwritesDraw(base->GetClassPointer(), ext))
     877        if (OverwritesDraw(base->GetClassPointer()))
    915878            return kTRUE;
    916879    }
  • trunk/MagicSoft/Mars/mhist/MH.h

    r2413 r2416  
    2222    MH(const char *name=NULL, const char *title=NULL);
    2323
    24     Bool_t OverwritesDraw(TClass *cls=NULL, const char *ext="") const;
     24    Bool_t OverwritesDraw(TClass *cls=NULL) const;
    2525
    2626    virtual Bool_t SetupFill(const MParList *pList) { return kTRUE; }
     
    6464
    6565    static void DrawSameCopy(const TH1 &hist1, const TH1 &hist2, const TString title);
    66     static void DrawSame(TH1 &hist1, TH1 &hist2, const TString title, TVirtualPad *pad=NULL);
     66    static void DrawSame(TH1 &hist1, TH1 &hist2, const TString title);
    6767
    6868    TObject *Clone(const char *name="") const;
    6969
    70     TObject *DrawClone(Option_t *opt, Int_t w, Int_t h) const
    71     {
    72         return MH::DrawCloneTS(NULL, opt, 625, 440);
    73     }
     70    TObject *DrawClone(Option_t *opt, Int_t w, Int_t h) const;
    7471    TObject *DrawClone(Option_t *opt="") const
    7572    {
    76         return MH::DrawCloneTS(NULL, opt, 625, 440);
    77     }
    78     TObject *DrawCloneTS(TVirtualPad *pad, Option_t *opt, Int_t w, Int_t h) const;
    79     TObject *DrawCloneTS(TVirtualPad *pad=NULL, Option_t *opt="") const
    80     {
    81         return MH::DrawCloneTS(pad, opt, 625, 440);
     73        return MH::DrawClone(opt, 625, 440);
    8274    }
    8375
  • trunk/MagicSoft/Mars/mhist/MHCamEvent.cc

    r2415 r2416  
    137137}
    138138
    139 // --------------------------------------------------------------------------
    140 //
    141 // Print pixel indices which value is higher than mean+sigma*rms
    142 //
    143 void MHCamEvent::PrintOutliers(Float_t sigma) const
     139void MHCamEvent::PrintOutliers(Float_t s) const
    144140{
    145141    const Double_t mean = fSum->GetMean();
     
    153149            continue;
    154150
    155         if ((*fSum)[i+1]>mean+sigma*rms)
    156             *fLog << "Contents of Pixel-Index #" << i << ": " << (*fSum)[i+1] << " > " << sigma << "*rms" << endl;
     151        if ((*fSum)[i+1]>mean+s*rms)
     152            *fLog << "Contents of Pixel-Index #" << i << ": " << (*fSum)[i+1] << " > " << s << "*rms" << endl;
    157153        // if ((*fSum)[i+1]==0)
    158154        //     *fLog << "Contents of Pixel-Index #" << i << ": " << (*fSum)[i+1] << " == 0" << endl;
     
    171167}
    172168
    173 void MHCamEvent::DrawTS(TVirtualPad *p, Option_t *)
     169void MHCamEvent::Draw(Option_t *)
    174170{
    175     if (!fSum)
    176     {
    177         *fLog << warn << "MHCamEvent::Draw - fSum==NULL not initialized." << endl;
    178         return;
    179     }
    180 
    181     TVirtualPad *pad = p ? p : MakeDefCanvas(this);
     171    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
    182172    pad->SetBorderMode(0);
    183173
    184174    pad->Divide(1,2);
    185175
    186     p = pad->GetPad(1);
    187     p->SetBorderMode(0);
     176    pad->cd(1);
     177    gPad->SetBorderMode(0);
     178    gPad->Divide(1,1);
     179    gPad->cd(1);
     180    gPad->SetBorderMode(0);
     181    fSum->Draw();
    188182
    189     // fSum doesn't derive from MParContainer
    190     MParContainer::DrawTS(fSum, p);
    191 
    192     p = pad->GetPad(2);
    193     p->SetBorderMode(0);
    194 
    195     // fSum doesn't derive from MParContainer
    196     MParContainer::DrawTS(fSum, p, "EPhist");
    197 
    198     // fSum doesn't derive from MParContainer
    199     //MParContainer::DrawTS(fSum, pad);
     183    pad->cd(2);
     184    gPad->SetBorderMode(0);
     185    fSum->Draw("EPhist");
    200186}
  • trunk/MagicSoft/Mars/mhist/MHCamEvent.h

    r2415 r2416  
    3232    TH1 *GetHistByName(const TString name="");
    3333
    34     void DrawTS(TVirtualPad *pad=NULL, Option_t *o="");
     34    void Draw(Option_t *o="");
    3535
    36     void PrintOutliers(Float_t sigma) const;
     36    void PrintOutliers(Float_t s) const;
    3737
    3838    ClassDef(MHCamEvent, 1) // Histogram to sum camera events
  • trunk/MagicSoft/Mars/mhist/MHCamera.cc

    r2409 r2416  
    11351135    if (fNotify && fNotify->GetSize()>0)
    11361136    {
    1137         TCanvas *c=new TCanvas;
    1138         fNotify->ForEach(MCamEvent, DrawPixelContent)(idx, c);
     1137        new TCanvas;
     1138        fNotify->ForEach(MCamEvent, DrawPixelContent)(idx);
    11391139    }
    11401140}
     
    11481148{
    11491149    gPad=NULL;
    1150     return TH1D::DrawCopy();
     1150    return TH1D::DrawCopy(fName+";cpy");
    11511151}
  • trunk/MagicSoft/Mars/mhist/MHTriggerLvl0.cc

    r2414 r2416  
    171171}
    172172
    173 void MHTriggerLvl0::DrawTS(TVirtualPad *p=NULL, Option_t * ="")
     173void MHTriggerLvl0::Draw(Option_t *)
    174174{
    175     TVirtualPad *pad = p ? p : MakeDefCanvas(this);
     175    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
    176176    pad->SetBorderMode(0);
    177177
    178     //-----------------------------
    179178    pad->Divide(1,2);
    180179
    181     p = pad->GetPad(1);
    182     p->SetBorderMode(0);
    183     p->Divide(1,1);
    184     p->cd(1);
    185     p->SetBorderMode(0);
    186     // fSum does not derive from MParContainer
    187     MParContainer::DrawTS(fSum, p);
     180    pad->cd(1);
     181    gPad->SetBorderMode(0);
     182    gPad->Divide(1,1);
     183    gPad->cd(1);
     184    gPad->SetBorderMode(0);
     185    fSum->Draw();
    188186
    189     p = pad->GetPad(2);
    190     p->SetBorderMode(0);
    191     // fSum does not derive from MParContainer
    192     MParContainer::DrawTS(fSum, p, "EPhist");
    193     //-----------------------------
    194 
    195     //MParContainer::DrawTS(fSum, p);
     187    pad->cd(2);
     188    gPad->SetBorderMode(0);
     189    fSum->Draw("EPhist");
    196190}
  • trunk/MagicSoft/Mars/mhist/MHTriggerLvl0.h

    r2414 r2416  
    3434    TH1 *GetHistByName(const TString name="");
    3535
    36     //void Draw(Option_t * ="");
    37     void DrawTS(TVirtualPad *pad=NULL, Option_t * ="");
     36    void Draw(Option_t * ="");
    3837
    3938    void PrintOutlayers(Float_t s) const;
Note: See TracChangeset for help on using the changeset viewer.