Ignore:
Timestamp:
07/03/07 15:20:17 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mmain/MEventDisplay.cc

    r8617 r8632  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MEventDisplay.cc,v 1.61 2007-06-28 19:49:30 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MEventDisplay.cc,v 1.62 2007-07-03 14:18:03 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    120120//  Constructor.
    121121//
    122 MEventDisplay::MEventDisplay(const char *fname, const char *path) : MStatusDisplay(), fEvtLoop(0)
     122MEventDisplay::MEventDisplay(const char *fname, const char *path) : MStatusDisplay(756), fEvtLoop(0)
    123123{
    124124    //
     
    517517    fList->Add(laystd2);
    518518    frame->AddFrame(top2, laystd2);
    519 
    520     //
    521     // Add trailing line...
    522     //
    523     TGHorizontal3DLine *line = new TGHorizontal3DLine(frame);
    524     TGLayoutHints *layline = new TGLayoutHints(kLHintsExpandX);
    525     fList->Add(line);
    526     fList->Add(layline);
    527     frame->AddFrame(line, layline);
     519}
     520
     521void MEventDisplay::AddMiddleFrame(TGCompositeFrame *frame)
     522{
     523    //
     524    // Create the gui elements
     525    //
     526    TGCheckButton *imgpar = new TGCheckButton(frame, "ImgPar", kShowImgPar);
     527    imgpar->SetState(kButtonDown);
     528    imgpar->Associate(this);
     529    fList->Add(imgpar);
     530
     531    TGCheckButton *muon = new TGCheckButton(frame, "Muon", kShowMuon);
     532    muon->Associate(this);
     533    muon->SetState(kButtonDown);
     534    fList->Add(muon);
     535
     536    //
     537    // add the gui elements to the frame
     538    //
     539//    TGLayoutHints *laystd = new TGLayoutHints(kLHintsLeft|kLHintsCenterY, 5, 5);
     540//    fList->Add(laystd);
     541//    top2->AddFrame(prevevt,    laystd);
     542
     543    frame->AddFrame(imgpar);
     544    frame->AddFrame(muon);
    528545}
    529546
     
    538555    TGCompositeFrame *vf1 = new TGVerticalFrame(fUserFrame, 1, 1);
    539556    TGCompositeFrame *vf2 = new TGVerticalFrame(fUserFrame, 1, 1);
    540 
    541     AddTopFramePart1(vf1, filename, "Events");
    542     AddTopFramePart2(vf1);
     557    TGCompositeFrame *hor = new TGHorizontalFrame(vf1, 1, 1);
     558    TGCompositeFrame *ver = new TGVerticalFrame(hor, 1, 1);
     559    TGCompositeFrame *vfb = new TGVerticalFrame(hor, 1, 1);
     560
     561    TGHorizontal3DLine *line = new TGHorizontal3DLine(vf1);
     562    TGLayoutHints *expx = new TGLayoutHints(kLHintsExpandX);
     563    TGLayoutHints *right = new TGLayoutHints(kLHintsRight|kLHintsTop);
     564    fList->Add(line);
     565    fList->Add(expx);
     566    fList->Add(right);
     567
     568    hor->AddFrame(ver);
     569    hor->AddFrame(vfb, right);
     570
     571    AddMiddleFrame(vfb);
     572
     573    //
     574    // Add trailing line...
     575    //
     576    vf1->AddFrame(hor,  expx);
     577    vf1->AddFrame(line, expx);
     578
     579    AddTopFramePart1(ver, filename, "Events");
     580    AddTopFramePart2(ver);
    543581
    544582    // create root embedded canvas and add it to the tab
     
    555593    //fCanvas->SetFillColor(16);
    556594
    557     TGLayoutHints *lay = new TGLayoutHints(kLHintsExpandX);
    558     fUserFrame->AddFrame(vf1, lay);
     595    fUserFrame->AddFrame(vf1, expx);
    559596    fUserFrame->AddFrame(vf2);
    560597}
     
    635672}
    636673
     674void MEventDisplay::ShowHide()
     675{
     676    TGCheckButton *but1 = (TGCheckButton*)fList->FindWidget(kShowMuon);
     677    TGCheckButton *but2 = (TGCheckButton*)fList->FindWidget(kShowImgPar);
     678
     679    const Bool_t imgpar = but1 && but1->IsDown();
     680    const Bool_t muon   = but2 && but2->IsDown();
     681
     682    //
     683    // Get parlist
     684    //
     685    MParList *plist = fEvtLoop->GetParList();
     686    if (!plist)
     687        return;
     688
     689    //
     690    // Draw ellipse on top of all pads
     691    //
     692    const Int_t n = 5;
     693
     694    TObject *obj[n] = {
     695        plist->FindObject("MHillas"),
     696        plist->FindObject("MHillasSrc"),
     697        plist->FindObject("MHillasExt"),
     698        plist->FindObject("MSrcPosCam"),
     699        plist->FindObject("MMuonSearchPar")
     700    };
     701
     702    const Bool_t state[n] = {
     703        imgpar,
     704        imgpar,
     705        imgpar,
     706        imgpar,
     707        muon,
     708    };
     709
     710
     711    for (int i=1; i<7; i++)
     712    {
     713        TCanvas *c = GetCanvas(i);
     714        c->GetPad(1)->cd(1);
     715
     716        TList *list = gPad->GetListOfPrimitives();
     717
     718        for (int j=0;j<n; j++)
     719            if (obj[j])
     720                if (state[j] && !list->FindObject(obj[j]))
     721                    list->Add(obj[j]);
     722                else
     723                    list->Remove(obj[j]);
     724
     725        gPad->Modified(kTRUE);
     726    }
     727}
     728
    637729// --------------------------------------------------------------------------
    638730//
     
    648740
    649741    //
    650     // Get parlist
    651     //
    652     MParList *plist = (MParList*)fEvtLoop->GetParList();
    653 
    654     //
    655742    // Add Geometry tab
    656743    //
     
    668755    fNumOfEvts->SetText(txt);
    669756
    670     //
    671     // Draw ellipse on top of all pads
    672     //
    673     TObject *hillas1 = plist->FindObject("MHillas");
    674     TObject *hillas2 = plist->FindObject("MHillasSrc");
    675     TObject *hillas3 = plist->FindObject("MHillasExt");
    676     TObject *hmuon   = plist->FindObject("MMuonSearchPar");
    677     for (int i=1; i<7;i++)
    678     {
    679         TCanvas *c = GetCanvas(i);
    680         c->GetPad(1)->cd(1);
    681         hmuon->Draw();
    682         hillas1->Draw();
    683         hillas2->Draw();
    684         hillas3->Draw();
    685     }
     757    ShowHide();
    686758}
    687759
     
    777849            }
    778850            return kTRUE;
     851
     852        case kCM_CHECKBUTTON:
     853            switch (mp1)
     854            {
     855            case kShowMuon:
     856            case kShowImgPar:
     857                ShowHide();
     858                return kTRUE;
     859            }
     860            return kTRUE;
    779861        }
    780862        break;
Note: See TracChangeset for help on using the changeset viewer.