Fork me on GitHub

Changeset fafc433 in git for display/DelphesEventDisplay.h


Ignore:
Timestamp:
Oct 16, 2014, 2:19:17 PM (10 years ago)
Author:
Christophe Delaere <christophe.delaere@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
30bb83a
Parents:
a3b2495
Message:

Working basic GUI

The functionality of Fwd and Bck buttons has been restored.
This brings us back to a fully working prototype ready for new features.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • display/DelphesEventDisplay.h

    ra3b2495 rfafc433  
    2121
    2222#include <vector>
     23#include <iostream>
    2324#include "external/ExRootAnalysis/ExRootTreeReader.h"
    2425#include "display/DelphesDisplay.h"
     
    4041    DelphesEventDisplay(const char *configFile, const char *inputFile, Delphes3DGeometry& det3D);
    4142    ~DelphesEventDisplay();
    42     Int_t event_id;
    43     ExRootTreeReader *gTreeReader;
    44     void load_event();
    4543
    4644  private:
    4745    void make_gui();
     46    void load_event();
    4847    void delphes_read();
    4948    void delphes_read_towers(TClonesArray* data, DelphesBranchBase* element);
     
    5453
    5554    // Configuration and global variables.
     55    Int_t event_id_;
     56    ExRootTreeReader *treeReader_;
    5657    Double_t tkRadius_, totRadius_, tkHalfLength_, bz_;
    5758    TChain* chain_;
    58     std::vector<DelphesBranchBase*> gElements;
    59     std::vector<TClonesArray*> gArrays;
    60     DelphesDisplay *gDelphesDisplay;
     59    std::vector<DelphesBranchBase*> elements_;
     60    std::vector<TClonesArray*> arrays_;
     61    DelphesDisplay *delphesDisplay_;
    6162
    62     // EvNavHandler class is needed to connect GUI signals.
    63     class EvNavHandler
    64     {     
    65       public:
    66      
    67          EvNavHandler(DelphesEventDisplay* display):display_(display) {}
     63    // gui controls
     64  public:
     65     void Fwd() { 
     66        if (event_id_ < treeReader_->GetEntries() - 1) {
     67           ++event_id_;
     68           load_event();
     69        } else {
     70           printf("Already at last event.\n");
     71        }
     72     }
    6873
    69          ~EvNavHandler() {}
    70 
    71          void Fwd() { 
    72             if (display_->event_id < display_->gTreeReader->GetEntries() - 1) {
    73                ++(display_->event_id);
    74                display_->load_event();
    75             } else {
    76                printf("Already at last event.\n");
    77             }
    78          }
    79 
    80          void Bck() {
    81             if (display_->event_id > 0) {
    82                --(display_->event_id);
    83                display_->load_event();
    84             } else {
    85                printf("Already at first event.\n");
    86             }
    87          }
    88        private:
    89          DelphesEventDisplay* display_;
    90     };
     74     void Bck() {
     75        if (event_id_ > 0) {
     76           --event_id_;
     77           load_event();
     78        } else {
     79           printf("Already at first event.\n");
     80        }
     81     }
    9182};
    9283
Note: See TracChangeset for help on using the changeset viewer.