001 #include "FMDataSelector.h"
002
003 #ifdef WIN32
004 #include <Riostream.h>
005 #else
006 #include <iostream.h>
007 #endif
008
009 using std::cout;
010 using std::endl;
011
012 #include "TGButtonGroup.h"
013
014 FMDataSelector::FMDataSelector(IDisplayFrame* parentFrame):
015 m_pParentFrame(parentFrame)
016 {
017 TGVerticalFrame* fToolFrame = parentFrame->modulesFrame();
018 m_pReader = parentFrame->ntupleReader();
019
020 TGButtonGroup *fDetButtonGroup = new TGButtonGroup(fToolFrame,"Data Display",kVerticalFrame);
021
022
023 int id = 0;
024 TGRadioButton* fDetRadioButton;
025 std::vector<std::string> vBranchesNames = m_pReader->getBranchesName();
026 std::vector<std::string>::const_iterator it = vBranchesNames.begin();
027 for(;it!=vBranchesNames.end();++it,++id) {
028 m_mapBranchesId[id] = *it;
029 fDetRadioButton = new TGRadioButton(fDetButtonGroup, new TGHotString(it->c_str()), id);
030 if(m_pReader->currentBranch()== (*it)) fDetRadioButton->SetState(kButtonDown);
031 }
032 m_previousId = 0;
033
034 fDetButtonGroup->Connect("Pressed(Int_t)", "FMDataSelector", this, "OnDataChange(Int_t)");
035 fToolFrame->AddFrame(fDetButtonGroup, new TGLayoutHints(kLHintsLeft | kLHintsTop |kLHintsExpandX,2,2,0,0));
036 }
037
038 FMDataSelector::~FMDataSelector(void)
039 {
040 }
041
042 void FMDataSelector::OnDataChange(Int_t id) {
043
044 if(id!=m_previousId) {
045 std::map<int,std::string>::const_iterator it = m_mapBranchesId.find(id);
046 if(it == m_mapBranchesId.end() ) {
047
048 m_previousId = id;
049 } else {
050
051 m_previousId = id;
052 m_pReader->selectBranch(it->second);
053 m_pReader->getEntry(m_pReader->currentEntry());
054 m_pParentFrame->onDataChangeDraw();
055 }
056 }
057 }
| Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems |
|
This page was automatically generated by the
LXR engine.
|
|