Changeset 13388 for trunk/Mars/mhist


Ignore:
Timestamp:
04/19/12 09:54:54 (13 years ago)
Author:
tbretz
Message:
Added a possibility to also filla ratio; removed obsolete DrawClone; removed DrawCopy
Location:
trunk/Mars/mhist
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/mhist/MHCamera.cc

    r13001 r13388  
    644644// ------------------------------------------------------------------------
    645645//
    646 // This is TObject::DrawClone but completely ignores
    647 // gROOT->GetSelectedPad(). tbretz had trouble with this in the past.
    648 // If this makes trouble please write a bug report.
    649 //
    650 TObject *MHCamera::DrawClone(Option_t *option) const
    651 {
    652     return TObject::Clone();
    653 
    654    // Draw a clone of this object in the current pad
    655 
    656    //TVirtualPad *pad = gROOT->GetSelectedPad();
    657    TVirtualPad *padsav = gPad;
    658    //if (pad) pad->cd();
    659 
    660    TObject *newobj = Clone();
    661 
    662    if (!newobj)
    663        return 0;
    664 
    665    /*
    666    if (pad) {
    667       if (strlen(option)) pad->GetListOfPrimitives()->Add(newobj,option);
    668       else                pad->GetListOfPrimitives()->Add(newobj,GetDrawOption());
    669       pad->Modified(kTRUE);
    670       pad->Update();
    671       if (padsav) padsav->cd();
    672       return newobj;
    673    }
    674    */
    675 
    676    TString opt(option);
    677    opt.ToLower();
    678 
    679    newobj->Draw(opt.IsNull() ? GetDrawOption() : option);
    680 
    681    if (padsav)
    682        padsav->cd();
    683 
    684    return newobj;
    685 }
    686 
    687 // ------------------------------------------------------------------------
    688 //
    689646// Creates a TH1D which contains the projection of the contents of the
    690647// MHCamera onto the y-axis. The maximum and minimum are calculated
     
    14271384// ------------------------------------------------------------------------
    14281385//
    1429 void MHCamera::AddCamDifference(const MCamEvent &event1, const MCamEvent &event2, Int_t type)
     1386void MHCamera::AddCamDifference(const MCamEvent &event1, const MCamEvent &event2, Int_t type, Stat_t weight)
    14301387{
    14311388    if (fNcells<=1 || IsFreezed())
     
    14441401
    14451402        SetUsed(idx);
    1446         Fill(idx, val1-val2); // FIXME: Slow!
     1403        Fill(idx, (val1-val2)*weight); // FIXME: Slow!
     1404    }
     1405    fEntries++;
     1406}
     1407
     1408// ------------------------------------------------------------------------
     1409//
     1410void MHCamera::AddCamRatio(const MCamEvent &event1, const MCamEvent &event2, Int_t type, Stat_t weight)
     1411{
     1412    if (fNcells<=1 || IsFreezed())
     1413        return;
     1414
     1415    // FIXME: Security check missing!
     1416    for (Int_t idx=0; idx<fNcells-2; idx++)
     1417    {
     1418        Double_t val1=0;
     1419        if (!event1.GetPixelContent(val1, idx, *fGeomCam, type))
     1420            continue;
     1421
     1422        Double_t val2=0;
     1423        if (!event2.GetPixelContent(val2, idx, *fGeomCam, type))
     1424            continue;
     1425
     1426        if (val2==0)
     1427            continue;
     1428
     1429        SetUsed(idx);
     1430        Fill(idx, weight*val1/val2); // FIXME: Slow!
    14471431    }
    14481432    fEntries++;
     
    22342218    return fGeomCam ? fGeomCam->GetNumPixels() : 0;
    22352219}
    2236 
    2237 TH1 *MHCamera::DrawCopy() const
    2238 {
    2239     gPad=NULL;
    2240     return TH1D::DrawCopy(fName+";cpy");
    2241 }
    22422220
    22432221// --------------------------------------------------------------------------
  • trunk/Mars/mhist/MHCamera.h

    r13295 r13388  
    163163
    164164    virtual Double_t GetPixContent(Int_t idx) const { return GetBinContent(idx+1); }
    165     virtual void     AddCamDifference(const MCamEvent &evt, const MCamEvent &evt2, Int_t type=0);
     165    virtual void     AddCamDifference(const MCamEvent &evt, const MCamEvent &evt2, Int_t type=0, Stat_t weight=1);
     166    virtual void     AddCamRatio(const MCamEvent &evt, const MCamEvent &evt2, Int_t type=0, Stat_t weight=1);
    166167    virtual void     AddCamContent(const MCamEvent &evt, Int_t type=0, Stat_t weight=1);
    167168    virtual void     AddCamContent(const MHCamera &evt, Int_t type=0);
     
    226227    void     Reset(Option_t *);
    227228    void     Reset() { Reset(""); } // *MENU*
    228     TH1     *DrawCopy() const/* { gPad=NULL; return TH1D::DrawCopy(); }*/; // *MENU*
    229     TH1     *DrawCopy(Option_t *o) const { return TH1D::DrawCopy(o); }
    230229
    231230    void     Print(Option_t *) const;
    232231    void     Paint(Option_t *option="");
    233232    void     Draw(Option_t *option="");
    234     TObject *DrawClone(Option_t *option="") const;
    235233    void     DrawProjection (Int_t fit=0) const;
    236234    void     DrawRadialProfile()           const;
Note: See TracChangeset for help on using the changeset viewer.