Fork me on GitHub

Changeset 6301e02 in git


Ignore:
Timestamp:
11/05/14 19:23:34 (6 years ago)
Author:
Christophe Delaere <christophe.delaere@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
0a67548
Parents:
2695ae1
Message:

Better GUI

Improved the event navigation widget + batch operations

Location:
display
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • display/DelphesBranchElement.cc

    r2695ae1 r6301e02  
    2525#include "TEveVector.h"
    2626#include <iostream>
    27 
    28 //TODO implement GetVectors()
    2927
    3028// special case for calo towers
  • display/DelphesEventDisplay.cc

    r2695ae1 r6301e02  
    4545#include "TRootBrowser.h"
    4646#include "TGButton.h"
     47#include "TGTextEntry.h"
     48#include "TGProgressBar.h"
     49#include "TGNumberEntry.h"
    4750#include "TRootEmbeddedCanvas.h"
    4851#include "TClonesArray.h"
     
    113116   // Create object of class ExRootTreeReader
    114117   fStatusBar_->SetText("Opening Delphes data file", 1);
     118   gSystem->ProcessEvents();
    115119   treeReader_ = new ExRootTreeReader(chain_);
    116120
     
    155159   //ready...
    156160   fStatusBar_->SetText("Ready.", 1);
    157    plotSummary_->FillSample(treeReader_, event_id_); //TODO later, control it via a GUI button.
     161   gSystem->ProcessEvents();
    158162   load_event();
    159163   gEve->Redraw3D(kTRUE);   
     
    243247   // message
    244248   fStatusBar_->SetText(Form("Loading event %d.", event_id_), 1);
     249   gSystem->ProcessEvents();
    245250
    246251   // clear the previous event
     
    268273   gEve->Redraw3D(kFALSE, kTRUE);
    269274   fStatusBar_->SetText(Form("Loaded event %d.", event_id_), 1);
     275   gSystem->ProcessEvents();
    270276}
    271277
     
    337343{
    338344   // Create minimal GUI for event navigation.
    339    // TODO: better GUI could be made based on the ch15 of the manual (Writing a GUI)
    340345
    341346   // add a tab on the left
    342347   TEveBrowser* browser = gEve->GetBrowser();
     348   browser->SetWindowName("Delphes Event Display");
    343349   browser->StartEmbedding(TRootBrowser::kLeft);
    344350
     
    349355
    350356   // build the navigation menu
    351    TGHorizontalFrame* hf = new TGHorizontalFrame(frmMain);
     357   TString icondir;
     358   if(gSystem->Getenv("ROOTSYS"))
     359     icondir = Form("%s/icons/", gSystem->Getenv("ROOTSYS"));
     360   if(!gSystem->OpenDirectory(icondir))
     361     icondir = Form("%s/icons/", (const char*)gSystem->GetFromPipe("root-config --etcdir") );
     362   TGGroupFrame* vf = new TGGroupFrame(frmMain,"Event navigation",kVerticalFrame | kFitWidth );
    352363   {
    353       TString icondir;
    354       if(gSystem->Getenv("ROOTSYS"))
    355         icondir = Form("%s/icons/", gSystem->Getenv("ROOTSYS"));
    356       if(!gSystem->OpenDirectory(icondir))
    357         icondir = Form("%s/icons/", (const char*)gSystem->GetFromPipe("root-config --etcdir") );
    358       TGPictureButton* b = 0;
    359 
    360       b = new TGPictureButton(hf, gClient->GetPicture(icondir+"GoBack.gif"));
    361       hf->AddFrame(b);
    362       b->Connect("Clicked()", "DelphesEventDisplay", this, "Bck()");
    363 
    364       b = new TGPictureButton(hf, gClient->GetPicture(icondir+"GoForward.gif"));
    365       hf->AddFrame(b);
    366       b->Connect("Clicked()", "DelphesEventDisplay", this, "Fwd()");
    367    }
    368    frmMain->AddFrame(hf);
     364     TGHorizontalFrame* hf = new TGHorizontalFrame(frmMain);
     365     {
     366        TGPictureButton* b = 0;
     367
     368        b = new TGPictureButton(hf, gClient->GetPicture(icondir+"GoBack.gif"));
     369        hf->AddFrame(b, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 10, 2, 10, 10));
     370        b->Connect("Clicked()", "DelphesEventDisplay", this, "Bck()");
     371
     372        numberEntry_ = new TGNumberEntry(hf,0,9,-1,TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, treeReader_->GetEntries());
     373        hf->AddFrame(numberEntry_, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY , 2, 0, 10, 10));
     374        numberEntry_->Connect("ValueSet(Long_t)", "DelphesEventDisplay", this, "GoTo(Long_t)");
     375       
     376        b = new TGPictureButton(hf, gClient->GetPicture(icondir+"GoForward.gif"));
     377        hf->AddFrame(b, new TGLayoutHints(kLHintsRight | kLHintsCenterY , 2, 10, 10, 10));
     378        b->Connect("Clicked()", "DelphesEventDisplay", this, "Fwd()");
     379 
     380     }
     381     vf->AddFrame(hf, new TGLayoutHints(kLHintsExpandX , 2, 2, 2, 2));
     382
     383     progress_ = new TGHProgressBar(frmMain, TGProgressBar::kFancy, 100);
     384     progress_->SetMax( treeReader_->GetEntries());
     385     progress_->ShowPosition(kTRUE, kFALSE, "Event %.0f");
     386     progress_->SetBarColor("green");
     387     vf->AddFrame(progress_, new TGLayoutHints(kLHintsExpandX, 10, 10, 5, 5));
     388   }
     389   frmMain->AddFrame(vf, new TGLayoutHints(kLHintsExpandX , 5, 5, 5, 5));
     390   vf = new TGGroupFrame(frmMain,"Batch operations",kVerticalFrame | kFitWidth );
     391   {
     392        TGTextButton *b = new TGTextButton(vf, "Initialize Summary Plots");
     393        vf->AddFrame(b, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY | kLHintsExpandX, 10, 10, 10, 10));
     394        b->Connect("Clicked()", "DelphesEventDisplay", this, "InitSummaryPlots()");
     395   }
     396   frmMain->AddFrame(vf, new TGLayoutHints(kLHintsExpandX , 5, 5, 5, 5));
     397
    369398   frmMain->MapSubwindows();
    370399   frmMain->Resize();
  • display/DelphesEventDisplay.h

    r2695ae1 r6301e02  
    3232#include "TClonesArray.h"
    3333#include "TGStatusBar.h"
     34#include "TGNumberEntry.h"
     35#include "TGProgressBar.h"
     36
     37
    3438
    3539/*
     
    6569    DelphesPlotSummary *plotSummary_;
    6670    TGStatusBar* fStatusBar_;
     71    TGNumberEntry* numberEntry_; // event_id
     72    TGHProgressBar* progress_; // event_id
     73   
    6774
    6875    // gui controls
    6976  public:
    7077     void Fwd() { 
    71         if (event_id_ < treeReader_->GetEntries() - 1) {
     78        if (event_id_ < treeReader_->GetEntries() - 2) {
    7279           ++event_id_;
     80           numberEntry_->SetIntNumber(event_id_);
     81           progress_->SetPosition(event_id_);
    7382           load_event();
    7483        } else {
     
    8089        if (event_id_ > 0) {
    8190           --event_id_;
     91           numberEntry_->SetIntNumber(event_id_);
     92           progress_->SetPosition(event_id_);
    8293           load_event();
    8394        } else {
     
    8596        }
    8697     }
     98
     99    void GoTo(Long_t ev) {
     100      Int_t event = Int_t(numberEntry_->GetNumber());
     101      if (event < treeReader_->GetEntries()-1) {
     102        event_id_ = event;
     103        progress_->SetPosition(event_id_);  //TODO we could provide a signal related to event_id changes
     104        load_event();
     105      } else {
     106        printf("Error: no such event.\n");
     107      }
     108    }
     109
     110    void InitSummaryPlots() {
     111      plotSummary_->FillSample(treeReader_, event_id_); // TODO we could add a signal to give the progress
     112      plotSummary_->FillEvent();
     113      plotSummary_->Draw();
     114    }
    87115};
    88116
  • display/DelphesPlotSummary.cc

    r2695ae1 r6301e02  
    88
    99DelphesPlotSummary::~DelphesPlotSummary() {}
    10 
    11 //TODO: sort the vectors before filling.
    1210
    1311void DelphesPlotSummary::Init(std::vector<DelphesBranchBase*>& elements) {
     
    9896}
    9997
    100 void DelphesPlotSummary::FillEvent() {
     98void DelphesPlotSummary::FillEvent() { //TODO make it faster... try to reuse objects and simply change the values
    10199  // clear previous markers
    102100  for(std::map< TString, std::vector<TMarker*> >::iterator mv = eventMarkers_.begin(); mv!=eventMarkers_.end();++mv) {
Note: See TracChangeset for help on using the changeset viewer.