Fork me on GitHub

Changeset 0a67548 in git for display/DelphesEventDisplay.h


Ignore:
Timestamp:
Nov 6, 2014, 10:58:31 AM (10 years ago)
Author:
Christophe Delaere <christophe.delaere@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
53b78e8
Parents:
6301e02
Message:

Use signal/slot to communicate with GUI elements

This removes the need to keep pointers to widgets in the class itself.
Next: do something similar to communicate the progress of the summary
plot initialization.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • display/DelphesEventDisplay.h

    r6301e02 r0a67548  
    3434#include "TGNumberEntry.h"
    3535#include "TGProgressBar.h"
     36#include <RQ_OBJECT.h>
    3637
    3738
     
    4647class DelphesEventDisplay
    4748{
     49    RQ_OBJECT("DelphesEventDisplay")
    4850  public:
    4951    DelphesEventDisplay();
    5052    DelphesEventDisplay(const char *configFile, const char *inputFile, Delphes3DGeometry& det3D);
    5153    ~DelphesEventDisplay();
     54    void EventChanged(Int_t); // *SIGNAL*
    5255
    5356  private:
     
    5962    // Configuration and global variables.
    6063    Int_t event_id_;
     64    Int_t event_id_tmp_;
    6165    ExRootTreeReader *treeReader_;
    6266    Double_t tkRadius_, totRadius_, tkHalfLength_, muHalfLength_, bz_;
     
    6973    DelphesPlotSummary *plotSummary_;
    7074    TGStatusBar* fStatusBar_;
    71     TGNumberEntry* numberEntry_; // event_id
    72     TGHProgressBar* progress_; // event_id
    7375   
    74 
    7576    // gui controls
    7677  public:
    7778     void Fwd() { 
    7879        if (event_id_ < treeReader_->GetEntries() - 2) {
    79            ++event_id_;
    80            numberEntry_->SetIntNumber(event_id_);
    81            progress_->SetPosition(event_id_);
    82            load_event();
     80           EventChanged(event_id_+1);
    8381        } else {
    8482           printf("Already at last event.\n");
     
    8886     void Bck() {
    8987        if (event_id_ > 0) {
    90            --event_id_;
    91            numberEntry_->SetIntNumber(event_id_);
    92            progress_->SetPosition(event_id_);
    93            load_event();
     88           EventChanged(event_id_-1);
    9489        } else {
    9590           printf("Already at first event.\n");
     
    9792     }
    9893
    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();
     94    void PreSetEv(char* ev) {
     95      event_id_tmp_ = Int_t(atoi(ev));
     96    }
     97
     98    void GoTo() {
     99      if (event_id_tmp_>=0 && event_id_tmp_ < treeReader_->GetEntries()-1) {
     100        EventChanged(event_id_tmp_);
    105101      } else {
    106102        printf("Error: no such event.\n");
Note: See TracChangeset for help on using the changeset viewer.