CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
FWPathsPopup Class Reference

#include <FWPathsPopup.h>

Inheritance diagram for FWPathsPopup:

Public Member Functions

void applyEditor ()
 
void cellClicked (Int_t iRow, Int_t iColumn, Int_t iButton, Int_t iKeyMod, Int_t iGlobalX, Int_t iGlobalY)
 
 FWPathsPopup (FWFFLooper *, FWGUIManager *)
 
virtual Bool_t HandleKey (Event_t *event)
 
bool & hasChanges ()
 
void postModule (edm::ModuleDescription const &)
 
void postProcessEvent (edm::Event const &, edm::EventSetup const &)
 
void preModule (edm::ModuleDescription const &)
 
void scheduleReloadEvent ()
 
void setup (const edm::ScheduleInfo *info)
 
void updateFilterString (const char *str)
 
void windowIsClosing ()
 

Private Member Functions

 ClassDef (FWPathsPopup, 0)
 

Private Attributes

TGTextButton * m_apply
 
FWGUIManagerm_guiManager
 
bool m_hasChanges
 
const edm::ScheduleInfom_info
 
FWFFLooperm_looper
 
TGLabel * m_moduleLabel
 
TGLabel * m_moduleName
 
FWPSetTableManagerm_psTable
 
TGTextEntry * m_search
 
FWTableWidgetm_tableWidget
 

Detailed Description

Definition at line 26 of file FWPathsPopup.h.

Constructor & Destructor Documentation

FWPathsPopup::FWPathsPopup ( FWFFLooper looper,
FWGUIManager guiManager 
)

Definition at line 37 of file FWPathsPopup.cc.

References FWDialogBuilder::addLabel(), FWDialogBuilder::addTable(), FWDialogBuilder::addTextButton(), FWDialogBuilder::addTextEntry(), FWTableWidget::body(), FWTableWidget::disableGrowInWidth(), idDealer::editor, FWDialogBuilder::expand(), FWDialogBuilder::floatLeft(), FWDialogBuilder::indent(), m_apply, FWPSetTableManager::m_editor, m_psTable, m_search, m_tableWidget, FWTableWidget::SetBackgroundColor(), FWPSetTableManager::setCellValueEditor(), FWTableWidget::SetHeaderBackgroundColor(), FWTableWidget::SetLineSeparatorColor(), and FWDialogBuilder::spaceDown().

38  : TGMainFrame(gClient->GetRoot(), 400, 600),
39  m_info(0),
40  m_looper(looper),
41  m_hasChanges(false),
42  m_moduleLabel(0),
43  m_moduleName(0),
44  m_apply(0),
46  m_guiManager(guiManager)
47 {
48  gVirtualX->SelectInput(GetId(), kKeyPressMask | kKeyReleaseMask | kExposureMask |
49  kPointerMotionMask | kStructureNotifyMask | kFocusChangeMask |
50  kEnterWindowMask | kLeaveWindowMask);
51  this->Connect("CloseWindow()","FWPathsPopup",this,"windowIsClosing()");
52 
53  FWDialogBuilder builder(this);
54  builder.indent(4)
55  .spaceDown(10)
56  .addLabel("Filter:").floatLeft(4).expand(false, false)
57  .addTextEntry("", &m_search).expand(true, false)
58  .spaceDown(10)
59  .addTable(m_psTable, &m_tableWidget).expand(true, true)
60  .addTextButton("Apply changes and reload", &m_apply);
61 
63  editor->SetBackgroundColor(gVirtualX->GetPixel(kYellow-7));
64  editor->SetFrameDrawn(false);
66  m_psTable->m_editor->Connect("ReturnPressed()", "FWPathsPopup", this, "applyEditor()");
67 
68  m_apply->Connect("Clicked()", "FWPathsPopup", this, "scheduleReloadEvent()");
69  m_apply->SetEnabled(false);
70  m_search->SetEnabled(true);
71  m_search->Connect("TextChanged(const char *)", "FWPathsPopup",
72  this, "updateFilterString(const char *)");
76  m_tableWidget->Connect("cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)",
77  "FWPathsPopup",this,
78  "cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)");
80 
81  SetWindowName("CMSSW Configuration Editor");
82  MapSubwindows();
83  editor->UnmapWindow();
84 
85  Layout();
86 }
void SetBackgroundColor(Pixel_t)
FWGUIManager * m_guiManager
Definition: FWPathsPopup.h:59
void SetHeaderBackgroundColor(Pixel_t)
TGTextEntry * m_search
Definition: FWPathsPopup.h:58
void SetLineSeparatorColor(Pixel_t)
void disableGrowInWidth()
TGLabel * m_moduleLabel
Definition: FWPathsPopup.h:52
TGLabel * m_moduleName
Definition: FWPathsPopup.h:53
FWTableWidget * m_tableWidget
Definition: FWPathsPopup.h:57
FWTabularWidget * body()
Definition: FWTableWidget.h:93
FWPSetCellEditor * m_editor
const edm::ScheduleInfo * m_info
Definition: FWPathsPopup.h:45
TGTextButton * m_apply
Definition: FWPathsPopup.h:55
tuple editor
Definition: idDealer.py:73
void setCellValueEditor(FWPSetCellEditor *editor)
bool m_hasChanges
Definition: FWPathsPopup.h:50
FWFFLooper * m_looper
Definition: FWPathsPopup.h:48
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:56

Member Function Documentation

void FWPathsPopup::applyEditor ( )

Proxies the applyEditor() method in the model so that it can be connected to GUI, signals.

Definition at line 107 of file FWPathsPopup.cc.

References FWPSetTableManager::applyEditor(), m_apply, and m_psTable.

Referenced by cellClicked(), and scheduleReloadEvent().

108 {
109  bool applied = m_psTable->applyEditor();
110  if (applied)
111  m_apply->SetEnabled(true);
112 }
TGTextButton * m_apply
Definition: FWPathsPopup.h:55
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:56
void FWPathsPopup::cellClicked ( Int_t  iRow,
Int_t  iColumn,
Int_t  iButton,
Int_t  iKeyMod,
Int_t  iGlobalX,
Int_t  iGlobalY 
)

Handles clicking on the table cells.

Clicking on a cell in the first column opens / closes a given node. Clicking on a cell in the second column moves the editor to that cell.

Definition at line 121 of file FWPathsPopup.cc.

References applyEditor(), FWPSetTableManager::data(), FWPSetTableManager::PSetData::editable, m_psTable, FWPSetTableManager::rowToIndex(), FWPSetTableManager::selectedColumn(), FWPSetTableManager::selectedRow(), FWPSetTableManager::setExpanded(), and FWPSetTableManager::setSelection().

122 {
123  if (iButton != kButton1)
124  return;
125 
126 
127  if (iColumn == 0 || iColumn == 1)
128  {
129  // Save and close the previous editor, if required.
130  if (m_psTable->selectedColumn() == 1
131  && m_psTable->selectedRow() != -1)
132  {
133  int oldIndex = m_psTable->rowToIndex()[m_psTable->selectedRow()];
134  FWPSetTableManager::PSetData& oldData = m_psTable->data()[oldIndex];
135 
136  if (oldData.editable)
137  applyEditor();
138  }
139 
140  m_psTable->setSelection(iRow, iColumn, iKeyMod);
141 
142  if (iColumn == 0)
143  m_psTable->setExpanded(iRow);
144  }
145 }
std::vector< int > & rowToIndex()
void applyEditor()
std::vector< PSetData > & data()
void setSelection(int row, int column, int mask)
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:56
FWPathsPopup::ClassDef ( FWPathsPopup  ,
 
)
private
Bool_t FWPathsPopup::HandleKey ( Event_t *  event)
virtual

Handle pressing of esc.

Definition at line 91 of file FWPathsPopup.cc.

References FWPSetTableManager::cancelEditor(), m_psTable, and FWPSetTableManager::setSelection().

92 {
93  UInt_t keysym = event->fCode;
94 
95  if (keysym == (UInt_t) gVirtualX->KeysymToKeycode(kKey_Escape))
96  {
97  // called from FWPSetCellEditor
99  m_psTable->setSelection(-1, -1, 0);
100  }
101  return TGMainFrame::HandleKey(event);
102 }
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
unsigned int UInt_t
Definition: FUTypes.h:12
void setSelection(int row, int column, int mask)
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:56
bool& FWPathsPopup::hasChanges ( )
inline

Definition at line 35 of file FWPathsPopup.h.

References m_hasChanges.

Referenced by FWFFLooper::duringLoop().

35 { return m_hasChanges; }
bool m_hasChanges
Definition: FWPathsPopup.h:50
void FWPathsPopup::postModule ( edm::ModuleDescription const &  description)

Gets called by CMSSW as modules are about to be processed.

Definition at line 165 of file FWPathsPopup.cc.

References m_guiManager, edm::ModuleDescription::moduleName(), and FWGUIManager::updateStatus().

Referenced by FWFFLooper::attachTo().

166 {
167  m_guiManager->updateStatus((description.moduleName() + " processed.").c_str());
168  gSystem->ProcessEvents();
169 }
FWGUIManager * m_guiManager
Definition: FWPathsPopup.h:59
void updateStatus(const char *status)
tuple description
Definition: idDealer.py:66
void FWPathsPopup::postProcessEvent ( edm::Event const &  event,
edm::EventSetup const &  eventSetup 
)

Definition at line 181 of file FWPathsPopup.cc.

References FWTableWidget::body(), FWPSetTableManager::PathUpdate::choiceMaker, FWTableManagerBase::dataChanged(), FWTabularWidget::DoRedraw(), alignCSCRings::e, edm::ProcessHistory::empty(), fwLog, i, edm::HandleBase::isValid(), fwlog::kInfo, m_guiManager, m_info, m_psTable, m_tableWidget, FWPSetTableManager::PathUpdate::passed, FWPSetTableManager::PathUpdate::pathName, pi, edm::Event::processHistory(), AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, edm::TriggerNames::triggerName(), edm::TriggerNames::triggerNames(), patRefSel_triggerSelection_cff::triggerResults, update, FWPSetTableManager::update(), FWPSetTableManager::updateSchedule(), and FWGUIManager::updateStatus().

Referenced by FWFFLooper::attachTo().

182 {
183  m_guiManager->updateStatus("Done processing.");
184  gSystem->ProcessEvents();
185 
186  // Get the last process name from the process history:
187  // this should be the one specified in the cfg file
188 
189  if (event.processHistory().empty()) {
190  fwLog(fwlog::kInfo) << "Path GUI:: no process history available.\n";
191  return;
192  }
193  edm::ProcessHistory::const_iterator pi = event.processHistory().end() - 1;
194  std::string processName = pi->processName();
195 
196  // It's called TriggerResults but actually contains info on all paths
197  edm::InputTag tag("TriggerResults", "", processName);
199  event.getByLabel(tag, triggerResults);
200 
201  std::vector<FWPSetTableManager::PathUpdate> pathUpdates;
202 
203  if (triggerResults.isValid())
204  {
205  edm::TriggerNames triggerNames = event.triggerNames(*triggerResults);
206 
207  for (size_t i = 0, e = triggerResults->size(); i != e; ++i)
208  {
210  update.pathName = triggerNames.triggerName(i);
211  update.passed = triggerResults->accept(i);
212  update.choiceMaker = triggerResults->index(i);
213  pathUpdates.push_back(update);
214  }
215  }
217  m_psTable->update(pathUpdates);
220 }
collection_type::const_iterator const_iterator
int i
Definition: DBlmapReader.cc:9
FWGUIManager * m_guiManager
Definition: FWPathsPopup.h:59
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes...
void updateStatus(const char *status)
Strings const & triggerNames() const
Definition: TriggerNames.cc:24
FWTableWidget * m_tableWidget
Definition: FWPathsPopup.h:57
FWTabularWidget * body()
Definition: FWTableWidget.h:93
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool isValid() const
Definition: HandleBase.h:76
const edm::ScheduleInfo * m_info
Definition: FWPathsPopup.h:45
void updateSchedule(const edm::ScheduleInfo *info)
#define fwLog(_level_)
Definition: fwLog.h:51
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:27
#define update(a, b)
void update(std::vector< PathUpdate > &pathUpdates)
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:56
double pi
void FWPathsPopup::preModule ( edm::ModuleDescription const &  description)

Gets called by CMSSW as we process modules.

Definition at line 173 of file FWPathsPopup.cc.

References m_guiManager, edm::ModuleDescription::moduleName(), and FWGUIManager::updateStatus().

Referenced by FWFFLooper::attachTo().

174 {
175  m_guiManager->updateStatus(("Processing " + description.moduleName() + "...").c_str());
176  gSystem->ProcessEvents();
177 }
FWGUIManager * m_guiManager
Definition: FWPathsPopup.h:59
void updateStatus(const char *status)
tuple description
Definition: idDealer.py:66
void FWPathsPopup::scheduleReloadEvent ( )

Modifies the module and asks the looper to reload the event.

  1. Read the configuration snippet from the GUI,
  2. Use the python interpreter to parse it and get the new parameter set.
  3. Notify the looper about the changes.

FIXME: implement 2 and 3.

Definition at line 234 of file FWPathsPopup.cc.

References applyEditor(), gather_cfg::cout, FWPSetTableManager::ModuleInfo::current_pset, data, FWPSetTableManager::ModuleInfo::dirty, FWPSetTableManager::entries(), FWPSetTableManager::ModuleInfo::entry, cppFunctionSkipper::exception, FWPSetTableManager::PSetData::label, m_apply, m_hasChanges, m_looper, m_psTable, FWPSetTableManager::modules(), edm::pythonToCppException(), FWFFLooper::requestChanges(), and cms::Exception::what().

235 {
236  applyEditor();
237  try
238  {
239  for (size_t mni = 0, mne = m_psTable->modules().size(); mni != mne; ++mni)
240  {
242  if (module.dirty == false)
243  continue;
245  m_looper->requestChanges(data.label, * module.current_pset);
246  }
247  m_hasChanges = true;
248  m_apply->SetEnabled(false);
249  gSystem->ExitLoop();
250  }
251  catch (boost::python::error_already_set)
252  {
253  edm::pythonToCppException("Configuration");
254  Py_Finalize();
255  }
256  catch (cms::Exception &exception)
257  {
258  std::cout << exception.what() << std::endl;
259  }
260  // Return control to the FWFFLooper so that it can decide what to do next.
261 }
virtual char const * what() const
Definition: Exception.cc:141
std::vector< ModuleInfo > & modules()
void pythonToCppException(const std::string &iType)
Definition: PythonWrapper.cc:6
void requestChanges(const std::string &, const edm::ParameterSet &)
Definition: FWFFLooper.cc:529
void applyEditor()
TGTextButton * m_apply
Definition: FWPathsPopup.h:55
bool m_hasChanges
Definition: FWPathsPopup.h:50
FWFFLooper * m_looper
Definition: FWPathsPopup.h:48
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
tuple cout
Definition: gather_cfg.py:121
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:56
Definition: vlib.h:209
std::vector< PSetData > & entries()
void FWPathsPopup::setup ( const edm::ScheduleInfo info)

Finish the setup of the GUI

Definition at line 157 of file FWPathsPopup.cc.

References info, and m_info.

Referenced by FWFFLooper::startingNewLoop().

158 {
159  assert(info);
160  m_info = info;
161 }
const edm::ScheduleInfo * m_info
Definition: FWPathsPopup.h:45
void FWPathsPopup::updateFilterString ( const char *  str)

Definition at line 148 of file FWPathsPopup.cc.

References FWPSetTableManager::applyEditor(), m_psTable, FWPSetTableManager::setSelection(), and FWPSetTableManager::updateFilter().

149 {
151  m_psTable->setSelection(-1, -1, 0);
152  m_psTable->updateFilter(str);
153 }
virtual void updateFilter(const char *filter)
void setSelection(int row, int column, int mask)
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:56
void FWPathsPopup::windowIsClosing ( )

Definition at line 31 of file FWPathsPopup.cc.

32 {
33  UnmapWindow();
34  DontCallClose();
35 }

Member Data Documentation

TGTextButton* FWPathsPopup::m_apply
private

Definition at line 55 of file FWPathsPopup.h.

Referenced by applyEditor(), FWPathsPopup(), and scheduleReloadEvent().

FWGUIManager* FWPathsPopup::m_guiManager
private

Definition at line 59 of file FWPathsPopup.h.

Referenced by postModule(), postProcessEvent(), and preModule().

bool FWPathsPopup::m_hasChanges
private

Definition at line 50 of file FWPathsPopup.h.

Referenced by hasChanges(), and scheduleReloadEvent().

const edm::ScheduleInfo* FWPathsPopup::m_info
private

Definition at line 45 of file FWPathsPopup.h.

Referenced by postProcessEvent(), and setup().

FWFFLooper* FWPathsPopup::m_looper
private

Definition at line 48 of file FWPathsPopup.h.

Referenced by scheduleReloadEvent().

TGLabel* FWPathsPopup::m_moduleLabel
private

Definition at line 52 of file FWPathsPopup.h.

TGLabel* FWPathsPopup::m_moduleName
private

Definition at line 53 of file FWPathsPopup.h.

FWPSetTableManager* FWPathsPopup::m_psTable
private
TGTextEntry* FWPathsPopup::m_search
private

Definition at line 58 of file FWPathsPopup.h.

Referenced by FWPathsPopup().

FWTableWidget* FWPathsPopup::m_tableWidget
private

Definition at line 57 of file FWPathsPopup.h.

Referenced by FWPathsPopup(), and postProcessEvent().