Ignore:
Timestamp:
02/13/04 16:52:50 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhist
Files:
3 edited

Legend:

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

    r2947 r3142  
    3535// Be carefull: Entries in this context means Entries/bin or Events
    3636//
     37// FIXME? Maybe MHCamera can take the fLog object from MGeomCam?
     38//
    3739////////////////////////////////////////////////////////////////////////////
    3840#include "MHCamera.h"
     
    8385
    8486    fNotify  = new TList;
     87    fNotify->SetBit(kMustCleanup);
     88    gROOT->GetListOfCleanups()->Add(fNotify);
    8589
    8690#if ROOT_VERSION_CODE < ROOT_VERSION(3,01,06)
     
    611615void MHCamera::Print(Option_t *) const
    612616{
    613     cout << "Minimum: " << GetMinimum();
     617    gLog << all << "Minimum: " << GetMinimum();
    614618    if (fMinimum==-1111)
    615         cout << " <autoscaled>";
    616     cout << endl;
    617     cout << "Maximum: " << GetMaximum();
     619        gLog << " <autoscaled>";
     620    gLog << endl;
     621    gLog << "Maximum: " << GetMaximum();
    618622    if (fMaximum==-1111)
    619         cout << " <autoscaled>";
    620     cout << endl;
     623        gLog << " <autoscaled>";
     624    gLog << endl;
    621625}
    622626
     
    718722    if (ncolors>1 && ncolors<50)
    719723    {
    720         cout << "MHCamera::SetPalette: Only default palettes with 50 colors are allowed... ignored." << endl;
     724        gLog << err << "MHCamera::SetPalette: Only default palettes with 50 colors are allowed... ignored." << endl;
    721725        return;
    722726    }
     
    11571161void MHCamera::SavePrimitive(ofstream &out, Option_t *opt)
    11581162{
    1159     cout << "MHCamera::SavePrimitive: Must be rewritten!" << endl;
     1163    gLog << err << "MHCamera::SavePrimitive: Must be rewritten!" << endl;
    11601164    /*
    11611165    if (!gROOT->ClassSaved(TCanvas::Class()))
     
    12571261// ------------------------------------------------------------------------
    12581262//
     1263// Add a MCamEvent which should be displayed when the user clicks on a
     1264// pixel.
     1265// Warning: The object MUST inherit from TObject AND MCamEvent
     1266//
     1267void MHCamera::AddNotify(TObject *obj)
     1268{
     1269    // Make sure, that the object derives from MCamEvent!
     1270    MCamEvent *evt = dynamic_cast<MCamEvent*>(obj);
     1271    if (!evt)
     1272    {
     1273        gLog << err << "ERROR: MHCamera::AddNotify - TObject doesn't inherit from MCamEvent... ignored." << endl;
     1274        return;
     1275    }
     1276
     1277    // Make sure, that it is deleted from the list too, if the obj is deleted
     1278    obj->SetBit(kMustCleanup);
     1279
     1280    // Add object to list
     1281    fNotify->Add(obj);
     1282}
     1283
     1284// ------------------------------------------------------------------------
     1285//
    12591286// Execute a mouse event on the camera
    12601287//
     
    12751302        return;
    12761303
    1277     cout << GetTitle() << " <" << GetName() << ">" << endl;
    1278     cout << "Software Pixel Index: " << idx << endl;
    1279     cout << "Hardware Pixel Id:    " << idx+1 << endl;
    1280     cout << "Contents:             " << GetBinContent(idx+1);
     1304    gLog << all << GetTitle() << " <" << GetName() << ">" << endl;
     1305    gLog << "Software Pixel Index: " << idx << endl;
     1306    gLog << "Hardware Pixel Id:    " << idx+1 << endl;
     1307    gLog << "Contents:             " << GetBinContent(idx+1);
    12811308    if (GetBinError(idx+1)>0)
    1282         cout << " +/- " << GetBinError(idx+1);
    1283     cout << "  <" << (IsUsed(idx)?"on":"off") << ">" << endl;
     1309        gLog << " +/- " << GetBinError(idx+1);
     1310    gLog << "  <" << (IsUsed(idx)?"on":"off") << ">" << endl;
    12841311
    12851312    if (fNotify && fNotify->GetSize()>0)
     
    13061333        // FIXME: Make sure, that the old histograms are really deleted.
    13071334        //        Are they already deleted?
    1308         fNotify->ForEach(MCamEvent, DrawPixelContent)(idx);
     1335
     1336        // The dynamic_cast is necessary here: We cannot use ForEach
     1337        TIter Next(fNotify);
     1338        MCamEvent *evt;
     1339        while ((evt=dynamic_cast<MCamEvent*>(Next())))
     1340            evt->DrawPixelContent(idx);
     1341
    13091342        gPad->Modified();
    13101343        gPad->Update();
  • trunk/MagicSoft/Mars/mhist/MHCamera.h

    r2894 r3142  
    179179    //void  SetOptStat(Int_t os=-1) { fOptStat = os; } // *MENU*
    180180
    181     void     AddNotify(const MCamEvent &event) { fNotify->Add((TObject*)(&event)); }
     181    void     AddNotify(TObject *event);
    182182
    183183    Stat_t   GetMean(Int_t axis=-1) const;
     
    187187
    188188    TH1D    *Projection(const char *name="_py") const;
    189 
    190     //void SetStatusBar(TGStatusBar *bar) { fStatusBar = bar; }
    191189
    192190    const MGeomCam &GetGeomCam() const { return *fGeomCam; }
  • trunk/MagicSoft/Mars/mhist/MHEvent.cc

    r2979 r3142  
    118118
    119119    fHist = new MHCamera(*cam);
    120     fHist->AddNotify(*fClone);
     120    fHist->AddNotify(fClone);
    121121
    122122    switch (fType)
     
    182182    switch (fType)
    183183    {
    184     case kEvtSignal:
     184    case kEvtSignal: // Get NumPhotons without pixel-size scaling
     185        //        fHist->SetCamContent(*event, 3);
     186        //        break;
    185187    case kEvtPedestal:
    186188        fHist->SetCamContent(*event, 0);
Note: See TracChangeset for help on using the changeset viewer.